Merge pull request #1627 from shygoo/fix-regtabs

[Debugger] Make register tabs stable
This commit is contained in:
zilmar 2019-06-15 20:50:11 +09:30 committed by GitHub
commit eace1a7ba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 11 deletions

View File

@ -78,7 +78,7 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
m_StepOverButton.Attach(GetDlgItem(IDC_STEPOVER_BTN)); m_StepOverButton.Attach(GetDlgItem(IDC_STEPOVER_BTN));
m_SkipButton.Attach(GetDlgItem(IDC_SKIP_BTN)); m_SkipButton.Attach(GetDlgItem(IDC_SKIP_BTN));
m_GoButton.Attach(GetDlgItem(IDC_GO_BTN)); m_GoButton.Attach(GetDlgItem(IDC_GO_BTN));
m_RegisterTabs.Attach(GetDlgItem(IDC_REG_TABS)); m_RegisterTabs.Attach(GetDlgItem(IDC_REG_TABS), m_Debugger);
m_Scrollbar.Attach(GetDlgItem(IDC_SCRL_BAR)); m_Scrollbar.Attach(GetDlgItem(IDC_SCRL_BAR));
m_BackButton.Attach(GetDlgItem(IDC_BACK_BTN)); m_BackButton.Attach(GetDlgItem(IDC_BACK_BTN));
m_ForwardButton.Attach(GetDlgItem(IDC_FORWARD_BTN)); m_ForwardButton.Attach(GetDlgItem(IDC_FORWARD_BTN));
@ -88,8 +88,6 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
DlgSavePos_Init(DebuggerUI_CommandsPos); DlgSavePos_Init(DebuggerUI_CommandsPos);
DlgToolTip_Init(); DlgToolTip_Init();
m_RegisterTabs.SetDebugger(m_Debugger);
// Setup address input // Setup address input
m_AddressEdit.SetDisplayType(CEditNumber32::DisplayHex); m_AddressEdit.SetDisplayType(CEditNumber32::DisplayHex);
m_AddressEdit.SetLimitText(8); m_AddressEdit.SetLimitText(8);

View File

@ -26,8 +26,9 @@ CRegisterTabs::~CRegisterTabs()
{ {
} }
void CRegisterTabs::Attach(HWND hWndNew) void CRegisterTabs::Attach(HWND hWndNew, CDebuggerUI* debugger)
{ {
m_Debugger = debugger;
CTabCtrl::Attach(hWndNew); CTabCtrl::Attach(hWndNew);
m_GPRTab = AddTab("GPR", IDD_Debugger_RegGPR, TabProcGPR); m_GPRTab = AddTab("GPR", IDD_Debugger_RegGPR, TabProcGPR);
@ -562,6 +563,11 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L
// right click labels // right click labels
if (msg == WM_CONTEXTMENU) if (msg == WM_CONTEXTMENU)
{ {
if (m_Debugger == NULL)
{
return FALSE;
}
HWND hWnd = (HWND)wParam; HWND hWnd = (HWND)wParam;
WORD ctrlId = (WORD) ::GetWindowLong(hWnd, GWL_ID); WORD ctrlId = (WORD) ::GetWindowLong(hWnd, GWL_ID);
@ -594,6 +600,11 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L
// click labels // click labels
if (msg == WM_COMMAND && HIWORD(wParam) == STN_CLICKED || HIWORD(wParam) == STN_DBLCLK) if (msg == WM_COMMAND && HIWORD(wParam) == STN_CLICKED || HIWORD(wParam) == STN_DBLCLK)
{ {
if (m_Debugger == NULL)
{
return FALSE;
}
HWND hWnd = (HWND)lParam; HWND hWnd = (HWND)lParam;
WORD ctrlId = LOWORD(wParam); WORD ctrlId = LOWORD(wParam);
@ -626,6 +637,11 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L
// color labels // color labels
if (msg == WM_CTLCOLORSTATIC) if (msg == WM_CTLCOLORSTATIC)
{ {
if (m_Debugger == NULL)
{
return FALSE;
}
HWND hWnd = (HWND)lParam; HWND hWnd = (HWND)lParam;
WORD ctrlId = (WORD) ::GetWindowLong(hWnd, GWL_ID); WORD ctrlId = (WORD) ::GetWindowLong(hWnd, GWL_ID);
@ -772,11 +788,6 @@ void CRegisterTabs::SetColorsEnabled(bool bColorsEnabled)
m_bColorsEnabled = bColorsEnabled; m_bColorsEnabled = bColorsEnabled;
} }
void CRegisterTabs::SetDebugger(CDebuggerUI* debugger)
{
m_Debugger = debugger;
}
void CRegisterTabs::InitRegisterEdit(CWindow& tab, CEditNumber32& edit, WORD ctrlId) void CRegisterTabs::InitRegisterEdit(CWindow& tab, CEditNumber32& edit, WORD ctrlId)
{ {
edit.Attach(tab.GetDlgItem(ctrlId)); edit.Attach(tab.GetDlgItem(ctrlId));

View File

@ -45,7 +45,7 @@ public:
CRegisterTabs(void); CRegisterTabs(void);
~CRegisterTabs(); ~CRegisterTabs();
void Attach(HWND hWndNew); void Attach(HWND hWndNew, CDebuggerUI* debugger);
HWND Detach(); HWND Detach();
CWindow AddTab(char* caption, int dialogId, DLGPROC dlgProc); CWindow AddTab(char* caption, int dialogId, DLGPROC dlgProc);
@ -54,7 +54,6 @@ public:
void RedrawCurrentTab(); void RedrawCurrentTab();
void RefreshEdits(); void RefreshEdits();
void SetColorsEnabled(bool bColorsEnabled); void SetColorsEnabled(bool bColorsEnabled);
void SetDebugger(CDebuggerUI* debugger);
private: private:
CRegisterTabs(const CRegisterTabs&); // Disable copy constructor CRegisterTabs(const CRegisterTabs&); // Disable copy constructor