1
0
Fork 0

some minor improvements for copy file offset and table scrolling

This commit is contained in:
torusrxxx 2020-08-03 23:27:18 +08:00 committed by Duncan Ogilvie
parent d0eaef34e3
commit c2c0f75434
2 changed files with 2 additions and 24 deletions

View File

@ -5,7 +5,6 @@
#include "CachedFontMetrics.h"
#include "Bridge.h"
#include "DisassemblyPopup.h"
#include <windows.h>
#include "MethodInvoker.h"
int AbstractTableView::mMouseWheelScrollDelta = 0;
@ -67,28 +66,7 @@ AbstractTableView::AbstractTableView(QWidget* parent)
horizontalScrollBar()->setRange(0, 0);
horizontalScrollBar()->setPageStep(650);
if(mMouseWheelScrollDelta == 0)
{
//Initialize scroll delta from registry. Windows-specific
HKEY hDesktop;
if(RegOpenKeyExW(HKEY_CURRENT_USER, L"Control Panel\\Desktop\\", 0, STANDARD_RIGHTS_READ | KEY_QUERY_VALUE, &hDesktop) != ERROR_SUCCESS)
mMouseWheelScrollDelta = 4; // Failed to open the registry. Use a default value;
else
{
wchar_t Data[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
DWORD regType = 0;
DWORD cbData = sizeof(Data) - sizeof(wchar_t);
if(RegQueryValueExW(hDesktop, L"WheelScrollLines", nullptr, &regType, (LPBYTE)&Data, &cbData) == ERROR_SUCCESS)
{
if(regType == REG_SZ) // Don't process other types of data
mMouseWheelScrollDelta = _wtoi(Data);
if(mMouseWheelScrollDelta == 0)
mMouseWheelScrollDelta = 4; // Malformed registry value. Use a default value.
}
else
mMouseWheelScrollDelta = 4; // Failed to query the registry. Use a default value;
RegCloseKey(hDesktop);
}
}
mMouseWheelScrollDelta = QApplication::wheelScrollLines();
setMouseTracking(true);
// Slots

View File

@ -809,7 +809,7 @@ void TraceBrowser::setupRightClickContextMenu()
copyMenu->addAction(makeAction(DIcon("copy_selection_no_bytes.png"), tr("Selection to File (No Bytes)"), SLOT(copySelectionToFileNoBytesSlot())));
copyMenu->addAction(makeShortcutAction(DIcon("copy_address.png"), tr("Address"), SLOT(copyCipSlot()), "ActionCopyAddress"));
copyMenu->addAction(makeShortcutAction(DIcon("copy_address.png"), tr("&RVA"), SLOT(copyRvaSlot()), "ActionCopyRva"), isDebugging);
copyMenu->addAction(makeAction(DIcon("fileoffset.png"), tr("&File Offset"), SLOT(copyFileOffsetSlot())), isDebugging);
copyMenu->addAction(makeShortcutAction(DIcon("fileoffset.png"), tr("&File Offset"), SLOT(copyFileOffsetSlot()), "ActionCopyFileOffset"), isDebugging);
copyMenu->addAction(makeAction(DIcon("copy_disassembly.png"), tr("Disassembly"), SLOT(copyDisassemblySlot())));
copyMenu->addAction(makeAction(DIcon("copy_address.png"), tr("Index"), SLOT(copyIndexSlot())));