-edit register by double clicking

-copy register with ctrl+c
This commit is contained in:
Kingcom 2013-06-27 11:50:59 +02:00
parent c81ca1874d
commit 76f135e077
6 changed files with 56 additions and 24 deletions

View File

@ -58,7 +58,7 @@ public:
virtual const char *GetRegName(int cat, int index) {return 0;}
virtual void PrintRegValue(int cat, int index, char *out)
{
sprintf(out,"%08x",GetGPR32Value(index));
sprintf(out,"%08X",GetGPR32Value(index));
}
virtual u32 GetRegValue(int cat, int index) {return 0;}
virtual void SetRegValue(int cat, int index, u32 value) {}

View File

@ -67,7 +67,7 @@ public:
{
switch (cat)
{
case 0: sprintf(out, "%08x", cpu->r[index]); break;
case 0: sprintf(out, "%08X", cpu->r[index]); break;
case 1: sprintf(out, "%f", cpu->f[index]); break;
case 2: sprintf(out, "N/A"); break;
}

View File

@ -87,13 +87,13 @@ LRESULT CALLBACK CtrlDisAsmView::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
return FALSE;
case WM_KEYDOWN:
ccp->onKeyDown(wParam,lParam);
break;
return 0;
case WM_SYSKEYDOWN:
ccp->onKeyDown(wParam,lParam);
return 0; // return a value so that windows doesn't execute the standard syskey action
case WM_KEYUP:
ccp->onKeyUp(wParam,lParam);
break;
return 0;
case WM_LBUTTONDOWN: lmbDown=true; ccp->onMouseDown(wParam,lParam,1); break;
case WM_RBUTTONDOWN: rmbDown=true; ccp->onMouseDown(wParam,lParam,2); break;
case WM_MOUSEMOVE: ccp->onMouseMove(wParam,lParam,(lmbDown?1:0) | (rmbDown?2:0)); break;
@ -113,20 +113,16 @@ LRESULT CALLBACK CtrlDisAsmView::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
{
switch (wParam)
{
case VK_LEFT:
case VK_RIGHT:
case VK_UP:
case VK_DOWN:
case VK_F9:
case VK_F10:
case VK_F11:
case VK_TAB:
return DLGC_WANTMESSAGE;
default:
return 0;
return DLGC_WANTCHARS|DLGC_WANTARROWS;
}
}
break;
return DLGC_WANTCHARS|DLGC_WANTARROWS;
default:
break;
}

View File

@ -34,7 +34,7 @@ void CtrlRegisterList::init()
wc.hIcon = 0;
wc.lpszMenuName = 0;
wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
wc.style = 0;
wc.style = CS_DBLCLKS;
wc.cbClsExtra = 0;
wc.cbWndExtra = sizeof( CtrlRegisterList * );
wc.hIconSm = 0;
@ -83,12 +83,16 @@ LRESULT CALLBACK CtrlRegisterList::wndProc(HWND hwnd, UINT msg, WPARAM wParam, L
return FALSE;
case WM_KEYDOWN:
ccp->onKeyDown(wParam,lParam);
break;
return 0;
case WM_KEYUP:
if (wParam == VK_CONTROL) ccp->ctrlDown = false;
return 0;
case WM_LBUTTONDOWN: SetFocus(hwnd); lmbDown=true; ccp->onMouseDown(wParam,lParam,1); break;
case WM_RBUTTONDOWN: rmbDown=true; ccp->onMouseDown(wParam,lParam,2); break;
case WM_MOUSEMOVE: ccp->onMouseMove(wParam,lParam,(lmbDown?1:0) | (rmbDown?2:0)); break;
case WM_LBUTTONUP: lmbDown=false; ccp->onMouseUp(wParam,lParam,1); break;
case WM_RBUTTONUP: rmbDown=false; ccp->onMouseUp(wParam,lParam,2); break;
case WM_LBUTTONDBLCLK: ccp->editRegisterValue(); break;
case WM_SETFOCUS:
SetFocus(hwnd);
ccp->hasFocus=true;
@ -98,6 +102,8 @@ LRESULT CALLBACK CtrlRegisterList::wndProc(HWND hwnd, UINT msg, WPARAM wParam, L
ccp->hasFocus=false;
ccp->redraw();
break;
case WM_GETDLGCODE: // want chars so that we can return 0 on key press and supress the beeping sound
return DLGC_WANTARROWS|DLGC_WANTCHARS;
default:
break;
}
@ -297,6 +303,12 @@ void CtrlRegisterList::onKeyDown(WPARAM wParam, LPARAM lParam)
GetClientRect(this->wnd, &rect);
int page=(rect.bottom/rowHeight)/2-1;
if (ctrlDown && tolower(wParam) == 'c')
{
copyRegisterValue();
return;
}
switch (wParam & 0xFFFF)
{
case VK_DOWN:
@ -311,6 +323,9 @@ void CtrlRegisterList::onKeyDown(WPARAM wParam, LPARAM lParam)
case VK_PRIOR:
selection-=4;
break;
case VK_CONTROL:
ctrlDown = true;
break;
default:
return;
}
@ -324,6 +339,33 @@ void CtrlRegisterList::redraw()
UpdateWindow(wnd);
}
void CtrlRegisterList::copyRegisterValue()
{
int cat = category;
int reg = selection;
if (selection >= cpu->GetNumRegsInCategory(cat))
return;
u32 val = cpu->GetRegValue(cat,reg);
char temp[24];
sprintf(temp,"%08X",val);
W32Util::CopyTextToClipboard(wnd,temp);
}
void CtrlRegisterList::editRegisterValue()
{
int cat = category;
int reg = selection;
if (selection >= cpu->GetNumRegsInCategory(cat))
return;
u32 val = cpu->GetRegValue(cat,reg);
if (InputBox_GetHex(GetModuleHandle(NULL),wnd,"Set new value",val,val))
{
cpu->SetRegValue(cat,reg,val);
redraw();
}
}
void CtrlRegisterList::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
{
@ -387,20 +429,10 @@ void CtrlRegisterList::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
disasmWindow[i]->Goto(val);
break;
case ID_REGLIST_COPYVALUE:
{
char temp[24];
sprintf(temp,"%08x",val);
W32Util::CopyTextToClipboard(wnd,temp);
}
copyRegisterValue();
break;
case ID_REGLIST_CHANGE:
{
if (InputBox_GetHex(GetModuleHandle(NULL),wnd,"Set new value",val,val))
{
cpu->SetRegValue(cat,reg,val);
redraw();
}
}
editRegisterValue();
break;
}
return;

View File

@ -43,7 +43,10 @@ class CtrlRegisterList
u32 lastPC;
u32 *lastCat0Values;
bool *changedCat0Regs;
bool ctrlDown;
void copyRegisterValue();
void editRegisterValue();
public:
CtrlRegisterList(HWND _wnd);
~CtrlRegisterList();

View File

@ -389,6 +389,7 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
case WM_USER+3: // run to wparam
{
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
ptr->setDontRedraw(true);
SetDebugMode(false);
CBreakPoints::AddBreakPoint(wParam,true);
_dbg_update_();