diff --git a/Source/Project64/UserInterface/Debugger/DebugDialog.h b/Source/Project64/UserInterface/Debugger/DebugDialog.h index 11734c2a0..7d05a567c 100644 --- a/Source/Project64/UserInterface/Debugger/DebugDialog.h +++ b/Source/Project64/UserInterface/Debugger/DebugDialog.h @@ -22,6 +22,32 @@ protected: SetEvent(m_CreatedEvent); } + void LoadWindowPos(UISettingID TopSetting, UISettingID LeftSetting) + { + CRect m_DefaultWindowRect; + GetWindowRect(&m_DefaultWindowRect); + + //We find the middle position of the screen, we use this if theres no setting + uint32_t X = GetX(m_DefaultWindowRect); + uint32_t Y = GetY(m_DefaultWindowRect); + + //Load the value from settings, if none is available, default to above + UISettingsLoadDword(TopSetting, Y); + UISettingsLoadDword(LeftSetting, X); + + SetPos(X, Y); + } + + void SaveWindowPos(UISettingID TopSetting, UISettingID LeftSetting) + { + RECT WinRect; + GetWindowRect(&WinRect); + + //Load the value from settings, if none is available, default to above + UISettingsSaveDword(TopSetting, WinRect.top); + UISettingsSaveDword(LeftSetting, WinRect.left); + } + public: CDebugDialog(CDebuggerUI * debugger) : m_Debugger(debugger), diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp index 2b2647574..a71f9b599 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp @@ -87,18 +87,6 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA DlgResize_Init(false, true); DlgToolTip_Init(); - GetWindowRect(&m_DefaultWindowRect); - - //We find the middle position of the screen, we use this if theres no setting - int32_t X = GetX(m_DefaultWindowRect); - int32_t Y = GetY(m_DefaultWindowRect); - - //Load the value from settings, if none is available, default to above - UISettingsLoadDword(Commands_Top, (uint32_t &)Y); - UISettingsLoadDword(Commands_Left, (uint32_t &)X); - - SetPos(X, Y); - int32_t Width = UISettingsLoadDword(Commands_Width); int32_t Height = UISettingsLoadDword(Commands_Height); @@ -180,11 +168,17 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA DWORD dwThreadID = ::GetCurrentThreadId(); hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, dwThreadID); - WindowCreated(); + LoadWindowPos(Commands_Top, Commands_Left); + WindowCreated(); m_Attached = true; return TRUE; } +void CDebugCommandsView::OnExitSizeMove(void) +{ + SaveWindowPos(Commands_Top, Commands_Left); +} + LRESULT CDebugCommandsView::OnDestroy(void) { m_Attached = false; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.h b/Source/Project64/UserInterface/Debugger/Debugger-Commands.h index 6b66fe6df..8fe59e7e5 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.h @@ -249,8 +249,6 @@ private: CAddSymbolDlg m_AddSymbolDlg; uint32_t m_StartAddress; - CRect m_DefaultWindowRect; - CEditNumber32 m_PCEdit; bool m_bIgnorePCChange; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.cpp b/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.cpp index 3c51984de..3533358b1 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-DMALogView.cpp @@ -146,19 +146,6 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM { DlgResize_Init(false, true); - CRect m_DefaultWindowRect; - GetWindowRect(&m_DefaultWindowRect); - - //We find the middle position of the screen, we use this if theres no setting - int32_t X = GetX(m_DefaultWindowRect); - int32_t Y = GetY(m_DefaultWindowRect); - - //Load the value from settings, if none is available, default to above - UISettingsLoadDword(DMALogView_Top, (uint32_t &)Y); - UISettingsLoadDword(DMALogView_Left, (uint32_t &)X); - - SetPos(X, Y); - int32_t Width = UISettingsLoadDword(DMALogView_Width); int32_t Height = UISettingsLoadDword(DMALogView_Height); @@ -196,6 +183,7 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM RefreshList(); + LoadWindowPos(DMALogView_Width, DMALogView_Height); WindowCreated(); m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp index 335a46e2e..5e6939f65 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.cpp @@ -40,19 +40,6 @@ void CDebugMemorySearch::AddAlignmentOptions(CComboBox & ctrl) LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - CRect m_DefaultWindowRect; - GetWindowRect(&m_DefaultWindowRect); - - //We find the middle position of the screen, we use this if theres no setting - int32_t X = GetX(m_DefaultWindowRect); - int32_t Y = GetY(m_DefaultWindowRect); - - //Load the value from settings, if none is available, default to above - UISettingsLoadDword(MemorySearch_Top, (uint32_t &)Y); - UISettingsLoadDword(MemorySearch_Left, (uint32_t &)X); - - SetPos(X, Y); - m_PAddrStart.Attach(GetDlgItem(IDC_PADDR_START)); m_PAddrStart.SetDisplayType(CEditNumber32::DisplayHex); m_SearchLen.Attach(GetDlgItem(IDC_ADDR_END)); @@ -84,10 +71,16 @@ LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA BOOL bHandled; OnClicked(0, IDC_BTN_RDRAM, NULL, bHandled); OnClicked(0, IDC_RADIO_VALUE, NULL, bHandled); - WindowCreated(); + LoadWindowPos(MemorySearch_Top, MemorySearch_Left); + WindowCreated(); return TRUE; } +void CDebugMemorySearch::OnExitSizeMove(void) +{ + SaveWindowPos(MemorySearch_Top, MemorySearch_Left); +} + LRESULT CDebugMemorySearch::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/) { switch (wID) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.h b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.h index 234625708..e6211b4c0 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-MemorySearch.h @@ -54,12 +54,14 @@ private: COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked) NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_RCLICK, OnResultRClick) NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_DBLCLK, OnResultDblClick) - END_MSG_MAP() + MSG_WM_EXITSIZEMOVE(OnExitSizeMove) + END_MSG_MAP() - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled); - LRESULT OnResultRClick(LPNMHDR lpnmh); - LRESULT OnResultDblClick(LPNMHDR lpnmh); + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); + LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled); + LRESULT OnResultRClick(LPNMHDR lpnmh); + LRESULT OnResultDblClick(LPNMHDR lpnmh); + void OnExitSizeMove(void); void EnableUnknownOptions(bool Enable); void EnableValueOptions(bool Enable); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp index 4fd6c74b1..240ac0fe5 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp @@ -31,19 +31,6 @@ LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l { DlgResize_Init(false, true); - CRect m_DefaultWindowRect; - GetWindowRect(&m_DefaultWindowRect); - - //We find the middle position of the screen, we use this if theres no setting - int32_t X = GetX(m_DefaultWindowRect); - int32_t Y = GetY(m_DefaultWindowRect); - - //Load the value from settings, if none is available, default to above - UISettingsLoadDword(Scripts_Top, (uint32_t &)Y); - UISettingsLoadDword(Scripts_Left, (uint32_t &)X); - - SetPos(X, Y); - int32_t Width = UISettingsLoadDword(Scripts_Width); int32_t Height = UISettingsLoadDword(Scripts_Height); @@ -74,7 +61,8 @@ LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l RefreshList(); - WindowCreated(); + LoadWindowPos(Scripts_Top, Scripts_Left); + WindowCreated(); return 0; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-StackTrace.cpp b/Source/Project64/UserInterface/Debugger/Debugger-StackTrace.cpp index 72f1a4f47..d5c3979e9 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-StackTrace.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-StackTrace.cpp @@ -50,19 +50,6 @@ LRESULT CDebugStackTrace::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM { DlgResize_Init(); - CRect m_DefaultWindowRect; - GetWindowRect(&m_DefaultWindowRect); - - //We find the middle position of the screen, we use this if theres no setting - int32_t X = GetX(m_DefaultWindowRect); - int32_t Y = GetY(m_DefaultWindowRect); - - //Load the value from settings, if none is available, default to above - UISettingsLoadDword(StackTrace_Top, (uint32_t &)Y); - UISettingsLoadDword(StackTrace_Left, (uint32_t &)X); - - SetPos(X, Y); - int32_t Width = UISettingsLoadDword(StackTrace_Width); int32_t Height = UISettingsLoadDword(StackTrace_Height); @@ -80,6 +67,7 @@ LRESULT CDebugStackTrace::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM m_List.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT); + LoadWindowPos(StackTrace_Top, StackTrace_Left); WindowCreated(); return TRUE; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp b/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp index 5d1cbc0cc..ca45ca101 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp @@ -26,19 +26,6 @@ LRESULT CDebugStackView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM / { DlgResize_Init(false, true); - CRect m_DefaultWindowRect; - GetWindowRect(&m_DefaultWindowRect); - - //We find the middle position of the screen, we use this if theres no setting - int32_t X = GetX(m_DefaultWindowRect); - int32_t Y = GetY(m_DefaultWindowRect); - - //Load the value from settings, if none is available, default to above - UISettingsLoadDword(StackView_Top, (uint32_t &)Y); - UISettingsLoadDword(StackView_Left, (uint32_t &)X); - - SetPos(X, Y); - int32_t Width = UISettingsLoadDword(StackView_Width); int32_t Height = UISettingsLoadDword(StackView_Height); @@ -60,7 +47,8 @@ LRESULT CDebugStackView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM / m_SPStatic.Attach(GetDlgItem(IDC_SP_STATIC)); - WindowCreated(); + LoadWindowPos(StackView_Top, StackView_Left); + WindowCreated(); return 0; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp index 3582e83c6..0d5a9066f 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp @@ -26,19 +26,6 @@ LRESULT CDebugSymbols::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l { DlgResize_Init(false, true); - CRect m_DefaultWindowRect; - GetWindowRect(&m_DefaultWindowRect); - - //We find the middle position of the screen, we use this if theres no setting - int32_t X = GetX(m_DefaultWindowRect); - int32_t Y = GetY(m_DefaultWindowRect); - - //Load the value from settings, if none is available, default to above - UISettingsLoadDword(Symbols_Top, (uint32_t &)Y); - UISettingsLoadDword(Symbols_Left, (uint32_t &)X); - - SetPos(X, Y); - int32_t Width = UISettingsLoadDword(Symbols_Width); int32_t Height = UISettingsLoadDword(Symbols_Height); @@ -63,7 +50,8 @@ LRESULT CDebugSymbols::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL); - WindowCreated(); + LoadWindowPos(Symbols_Top, Symbols_Left); + WindowCreated(); return 0; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-TLB.cpp b/Source/Project64/UserInterface/Debugger/Debugger-TLB.cpp index 1f838d209..33f623675 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-TLB.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-TLB.cpp @@ -23,19 +23,6 @@ CDebugTlb::~CDebugTlb() LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - CRect m_DefaultWindowRect; - GetWindowRect(&m_DefaultWindowRect); - - //We find the middle position of the screen, we use this if theres no setting - int32_t X = GetX(m_DefaultWindowRect); - int32_t Y = GetY(m_DefaultWindowRect); - - //Load the value from settings, if none is available, default to above - UISettingsLoadDword(TLB_Top, (uint32_t &)Y); - UISettingsLoadDword(TLB_Left, (uint32_t &)X); - - SetPos(X, Y); - LV_COLUMN col; col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; @@ -89,14 +76,16 @@ LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPara RefreshTLBWindow(); SendMessage(GetDlgItem(IDC_TLB_ENTRIES), BM_SETCHECK, BST_CHECKED, 0); - // if (Settings().Load(TLBWindowLeft) <= 0) - // { - // SetWindowPos(NULL,Settings().Load(TLBWindowLeft),Settings().Load(TLBWindowTop),0,0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW); - // } - WindowCreated(); + LoadWindowPos(TLB_Top, TLB_Left); + WindowCreated(); return TRUE; } +void CDebugTlb::OnExitSizeMove(void) +{ + SaveWindowPos(TLB_Top, TLB_Left); +} + LRESULT CDebugTlb::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/) { switch (wID) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-TLB.h b/Source/Project64/UserInterface/Debugger/Debugger-TLB.h index f4bea61a9..fcf8607f1 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-TLB.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-TLB.h @@ -16,10 +16,12 @@ class CDebugTlb : BEGIN_MSG_MAP_EX(CDebugTlb) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked) - END_MSG_MAP() + MSG_WM_EXITSIZEMOVE(OnExitSizeMove) + END_MSG_MAP() - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled); + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); + LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled); + void OnExitSizeMove(void); public: enum { IDD = IDD_Debugger_TLB }; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp b/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp index 8fc67f013..fc1a3ecf5 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.cpp @@ -38,19 +38,6 @@ CDebugMemoryView::~CDebugMemoryView() LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - CRect m_DefaultWindowRect; - GetWindowRect(&m_DefaultWindowRect); - - //We find the middle position of the screen, we use this if theres no setting - int32_t X = GetX(m_DefaultWindowRect); - int32_t Y = GetY(m_DefaultWindowRect); - - //Load the value from settings, if none is available, default to above - UISettingsLoadDword(ViewMemory_Top, (uint32_t &)Y); - UISettingsLoadDword(ViewMemory_Left, (uint32_t &)X); - - SetPos(X, Y); - m_SymbolColorStride = 0; m_SymbolColorPhase = 0; m_DataStartLoc = (DWORD)-1; @@ -140,7 +127,8 @@ LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM DWORD dwThreadID = ::GetCurrentThreadId(); hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, dwThreadID); - WindowCreated(); + LoadWindowPos(ViewMemory_Top, ViewMemory_Left); + WindowCreated(); m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL); @@ -160,6 +148,11 @@ DWORD WINAPI CDebugMemoryView::AutoRefreshProc(void* _self) } } +void CDebugMemoryView::OnExitSizeMove() +{ + SaveWindowPos(ViewMemory_Top, ViewMemory_Left); +} + void CDebugMemoryView::InterceptMouseWheel(WPARAM wParam, LPARAM /*lParam*/) { uint32_t newAddress = m_DataStartLoc - ((short)HIWORD(wParam) / WHEEL_DELTA) * 16; @@ -199,7 +192,10 @@ LRESULT CDebugMemoryView::OnDestroy(void) delete m_MemoryList; m_MemoryList = NULL; } - UnhookWindowsHookEx(hWinMessageHook); + m_MemAddr.Detach(); + m_SymInfo.Detach(); + m_DMAInfo.Detach(); + UnhookWindowsHookEx(hWinMessageHook); return 0; } diff --git a/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.h b/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.h index 6fc21cb37..a6caad5ca 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-ViewMemory.h @@ -32,6 +32,7 @@ private: NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_RIGHTCLICK, OnMemoryRightClicked) NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_HOTITEMCHANGED, OnHotItemChanged) MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) + MSG_WM_EXITSIZEMOVE(OnExitSizeMove) MSG_WM_DESTROY(OnDestroy) MSG_WM_VSCROLL(OnVScroll) END_MSG_MAP() @@ -40,6 +41,7 @@ private: LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled); void OnAddrChanged(UINT Code, int id, HWND ctl); void OnVScroll(int request, short Pos, HWND ctrl); + void OnExitSizeMove(void); LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnMemoryModified(LPNMHDR lpNMHDR); LRESULT OnMemoryRightClicked(LPNMHDR lpNMHDR);