[Debugger] Do not update register if have not finished attaching

This commit is contained in:
zilmar 2018-03-02 17:34:27 +11:00
parent be9b0e6bc5
commit cfbd181ff9
2 changed files with 29 additions and 33 deletions

View File

@ -16,7 +16,8 @@
bool CRegisterTabs::m_bColorsEnabled = false; bool CRegisterTabs::m_bColorsEnabled = false;
CRegisterTabs::CRegisterTabs() CRegisterTabs::CRegisterTabs() :
m_attached(false)
{ {
} }
@ -76,10 +77,12 @@ void CRegisterTabs::Attach(HWND hWndNew)
SetColorsEnabled(false); SetColorsEnabled(false);
RefreshEdits(); RefreshEdits();
RedrawCurrentTab(); RedrawCurrentTab();
m_attached = true;
} }
HWND CRegisterTabs::Detach(void) HWND CRegisterTabs::Detach(void)
{ {
m_attached = false;
m_GPRTab = NULL; m_GPRTab = NULL;
m_FPRTab = NULL; m_FPRTab = NULL;
m_COP0Tab = NULL; m_COP0Tab = NULL;
@ -447,23 +450,21 @@ void CRegisterTabs::RegisterChanged(HWND hDlg, TAB_ID srcTabId, WPARAM wParam)
} }
} }
INT_PTR CALLBACK CRegisterTabs::TabProcDefault(HWND hDlg, UINT msg, WPARAM wParam, LPARAM /*lParam*/) INT_PTR CALLBACK CRegisterTabs::TabProcDefault(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
if (msg == WM_INITDIALOG) if (msg == WM_INITDIALOG)
{ {
SetProp(hDlg, "attached", (HANDLE)lParam);
return TRUE; return TRUE;
} }
if (msg != WM_COMMAND) if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS)
{ {
return FALSE; bool * attached = (bool *)GetProp(hDlg, "attached");
} if (attached != NULL && *attached)
WORD notification = HIWORD(wParam);
if (notification == EN_KILLFOCUS)
{ {
RegisterChanged(hDlg, TabDefault, wParam); RegisterChanged(hDlg, TabDefault, wParam);
} }
}
return FALSE; return FALSE;
} }
@ -472,6 +473,7 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L
{ {
if (msg == WM_INITDIALOG) if (msg == WM_INITDIALOG)
{ {
SetProp(hDlg, "attached", (HANDLE)lParam);
return TRUE; return TRUE;
} }
@ -533,39 +535,32 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L
return (LRESULT)GetStockObject(DC_BRUSH); return (LRESULT)GetStockObject(DC_BRUSH);
} }
if (msg != WM_COMMAND) if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS)
{ {
return FALSE; bool * attached = (bool *)GetProp(hDlg, "attached");
} if (attached != NULL && *attached)
WORD notification = HIWORD(wParam);
if (notification == EN_KILLFOCUS)
{ {
RegisterChanged(hDlg, TabGPR, wParam); RegisterChanged(hDlg, TabGPR, wParam);
} }
}
return FALSE; return FALSE;
} }
INT_PTR CALLBACK CRegisterTabs::TabProcFPR(HWND hDlg, UINT msg, WPARAM wParam, LPARAM /*lParam*/) INT_PTR CALLBACK CRegisterTabs::TabProcFPR(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
if (msg == WM_INITDIALOG) if (msg == WM_INITDIALOG)
{ {
SetProp(hDlg, "attached", (HANDLE)lParam);
return TRUE; return TRUE;
} }
if (msg != WM_COMMAND) if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS)
{ {
return FALSE; bool * attached = (bool *)GetProp(hDlg, "attached");
} if (attached != NULL && *attached)
WORD notification = HIWORD(wParam);
if (notification == EN_KILLFOCUS)
{ {
RegisterChanged(hDlg, TabFPR, wParam); RegisterChanged(hDlg, TabFPR, wParam);
} }
}
return FALSE; return FALSE;
} }
@ -584,7 +579,7 @@ CWindow CRegisterTabs::AddTab(char* caption, int dialogId, DLGPROC dlgProc)
AddItem(caption); AddItem(caption);
CWindow parentWin = GetParent(); CWindow parentWin = GetParent();
CWindow tabWin = ::CreateDialog(NULL, MAKEINTRESOURCE(dialogId), parentWin, dlgProc); CWindow tabWin = ::CreateDialogParam(NULL, MAKEINTRESOURCE(dialogId), parentWin, dlgProc, (LPARAM)&m_attached);
CRect pageRect = GetPageRect(); CRect pageRect = GetPageRect();

View File

@ -242,6 +242,7 @@ private:
static bool m_bColorsEnabled; static bool m_bColorsEnabled;
vector<CWindow> m_TabWindows; vector<CWindow> m_TabWindows;
bool m_attached;
CWindow m_GPRTab; CWindow m_GPRTab;
CEditReg64 m_GPREdits[sizeof(GPREditIds) / sizeof(GPREditIds[0])]; CEditReg64 m_GPREdits[sizeof(GPREditIds) / sizeof(GPREditIds[0])];