* Debugger: newly created Bookmarks inherit existing symbolic name by default

* Debugger, Tracer: right-clicking on an address or a symbolic name works even when there's selection
This commit is contained in:
ansstuff 2013-09-20 20:30:08 +00:00
parent 8f9e2be234
commit 9af83bb79c
3 changed files with 44 additions and 7 deletions

View File

@ -1380,7 +1380,7 @@ void LoadGameDebuggerData(HWND hwndDlg = hDebug)
int Debugger_CheckClickingOnAnAddressOrSymbolicName(unsigned int lineNumber, bool onlyCheckWhenNothingSelected) int Debugger_CheckClickingOnAnAddressOrSymbolicName(unsigned int lineNumber, bool onlyCheckWhenNothingSelected)
{ {
// debug_str contains the text in the disassembly window // debug_str contains the text in the disassembly window
int sel_start, sel_end; int sel_start = 0, sel_end = 0;
SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end); SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
if (onlyCheckWhenNothingSelected) if (onlyCheckWhenNothingSelected)
if (sel_end > sel_start) if (sel_end > sel_start)
@ -1511,8 +1511,14 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w
} }
case WM_RBUTTONUP: case WM_RBUTTONUP:
{ {
// if nothing is selected, try bringing Symbolic Debug Naming dialog // save current selection
int offset = Debugger_CheckClickingOnAnAddressOrSymbolicName(GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight, true); int sel_start = 0, sel_end = 0;
SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
// simulate a click
CallWindowProc(IDC_DEBUGGER_DISASSEMBLY_oldWndProc, hwndDlg, WM_LBUTTONDOWN, wParam, lParam);
CallWindowProc(IDC_DEBUGGER_DISASSEMBLY_oldWndProc, hwndDlg, WM_LBUTTONUP, wParam, lParam);
// try bringing Symbolic Debug Naming dialog
int offset = Debugger_CheckClickingOnAnAddressOrSymbolicName(GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight, false);
if (offset != EOF) if (offset != EOF)
{ {
if (DoSymbolicDebugNaming(offset, hDebug)) if (DoSymbolicDebugNaming(offset, hDebug))
@ -1524,7 +1530,16 @@ BOOL CALLBACK IDC_DEBUGGER_DISASSEMBLY_WndProc(HWND hwndDlg, UINT uMsg, WPARAM w
CheckDlgButton(hDebug, IDC_DEBUGGER_ENABLE_SYMBOLIC, BST_CHECKED); CheckDlgButton(hDebug, IDC_DEBUGGER_ENABLE_SYMBOLIC, BST_CHECKED);
} }
UpdateDebugger(false); UpdateDebugger(false);
} else
{
// then restore old selection
SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)sel_start, (LPARAM)sel_end);
} }
return 0;
} else
{
// then restore old selection
SendDlgItemMessage(hDebug, IDC_DEBUGGER_DISASSEMBLY, EM_SETSEL, (WPARAM)sel_start, (LPARAM)sel_end);
} }
break; break;
} }

View File

@ -660,7 +660,14 @@ void AddDebuggerBookmark2(HWND hwnd, unsigned int addr)
{ {
int index = bookmarks_addr.size(); int index = bookmarks_addr.size();
bookmarks_addr.push_back(addr); bookmarks_addr.push_back(addr);
bookmarks_name.push_back(""); // try to find Symbolic name for this address
Name* node = findNode(getNamesPointerForAddress(addr), addr);
if (node && node->name)
bookmarks_name.push_back(node->name);
else
bookmarks_name.push_back("");
// add new item to ListBox
char buffer[256]; char buffer[256];
sprintf(buffer, "%04X %s", bookmarks_addr[index], bookmarks_name[index].c_str()); sprintf(buffer, "%04X %s", bookmarks_addr[index], bookmarks_name[index].c_str());
SendDlgItemMessage(hwnd, LIST_DEBUGGER_BOOKMARKS, LB_ADDSTRING, 0, (LPARAM)buffer); SendDlgItemMessage(hwnd, LIST_DEBUGGER_BOOKMARKS, LB_ADDSTRING, 0, (LPARAM)buffer);
@ -676,7 +683,7 @@ void AddDebuggerBookmark2(HWND hwnd, unsigned int addr)
**/ **/
void AddDebuggerBookmark(HWND hwnd) void AddDebuggerBookmark(HWND hwnd)
{ {
unsigned int n; int n;
char buffer[5] = {0}; char buffer[5] = {0};
GetDlgItemText(hwnd, IDC_DEBUGGER_BOOKMARK, buffer, 5); GetDlgItemText(hwnd, IDC_DEBUGGER_BOOKMARK, buffer, 5);

View File

@ -220,8 +220,14 @@ BOOL CALLBACK IDC_TRACER_LOG_WndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
} }
case WM_RBUTTONUP: case WM_RBUTTONUP:
{ {
// if nothing is selected, try bringing Symbolic Debug Naming dialog // save current selection
int offset = Tracer_CheckClickingOnAnAddressOrSymbolicName(tracesi.nPos + (GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight), true); int sel_start, sel_end;
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
// simulate a click
CallWindowProc(IDC_TRACER_LOG_oldWndProc, hwndDlg, WM_LBUTTONDOWN, wParam, lParam);
CallWindowProc(IDC_TRACER_LOG_oldWndProc, hwndDlg, WM_LBUTTONUP, wParam, lParam);
// try bringing Symbolic Debug Naming dialog
int offset = Tracer_CheckClickingOnAnAddressOrSymbolicName(tracesi.nPos + (GET_Y_LPARAM(lParam) / debugSystem->fixedFontHeight), false);
if (offset != EOF) if (offset != EOF)
{ {
if (DoSymbolicDebugNaming(offset, hTracer)) if (DoSymbolicDebugNaming(offset, hTracer))
@ -230,7 +236,16 @@ BOOL CALLBACK IDC_TRACER_LOG_WndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
UpdateDebugger(false); UpdateDebugger(false);
if (hMemView) if (hMemView)
UpdateCaption(); UpdateCaption();
} else
{
// then restore old selection
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_SETSEL, (WPARAM)sel_start, (LPARAM)sel_end);
} }
return 0;
} else
{
// then restore old selection
SendDlgItemMessage(hTracer, IDC_TRACER_LOG, EM_SETSEL, (WPARAM)sel_start, (LPARAM)sel_end);
} }
break; break;
} }