From 286f96cc9a49528df9440dcfa8321eb9fd950796 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Fri, 12 Nov 2010 12:56:29 +0000 Subject: [PATCH] MGR: Save window dimensions and position on SIZE and MOVE events svn path=/trunk/boinc/; revision=22694 --- checkin_notes | 10 ++++++++++ clientgui/AdvancedFrame.cpp | 14 ++++++++++++++ clientgui/AdvancedFrame.h | 2 ++ clientgui/DlgEventLog.cpp | 16 +++++++++++++++- clientgui/DlgEventLog.h | 2 ++ clientgui/sg_DlgMessages.cpp | 16 ++++++++++++++++ clientgui/sg_DlgMessages.h | 2 ++ 7 files changed, 61 insertions(+), 1 deletion(-) diff --git a/checkin_notes b/checkin_notes index dc1e554049..5205bf783b 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8077,3 +8077,13 @@ Rom 11 Nov 2010 clientgui/gtk/ taskbarex.h + +Charlie 12 Nov 2010 + - MGR: Save window dimensions and position on SIZE and MOVE events + to make sure changes are recorded even if the window is minimized + (iconized) when exiting BOINC. + + clientgui/ + AdvancedFrame.cpp, .h + DlgEventLog.cpp, .h + sg_DlgMessages.cpp, .h diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index 6437b55d1a..5244cb8e82 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -193,6 +193,8 @@ BEGIN_EVENT_TABLE (CAdvancedFrame, CBOINCBaseFrame) EVT_TIMER(ID_REFRESHSTATETIMER, CAdvancedFrame::OnRefreshState) EVT_TIMER(ID_FRAMERENDERTIMER, CAdvancedFrame::OnFrameRender) EVT_NOTEBOOK_PAGE_CHANGED(ID_FRAMENOTEBOOK, CAdvancedFrame::OnNotebookSelectionChanged) + EVT_SIZE(CAdvancedFrame::OnSize) + EVT_MOVE(CAdvancedFrame::OnMove) END_EVENT_TABLE () @@ -1023,6 +1025,18 @@ void CAdvancedFrame::SaveWindowDimensions() { wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::SaveWindowDimensions - Function End")); } + + +void CAdvancedFrame::OnSize(wxSizeEvent& event) { + SaveWindowDimensions(); + event.Skip(); +} + + +void CAdvancedFrame::OnMove(wxMoveEvent& event) { + SaveWindowDimensions(); + event.Skip(); +} int CAdvancedFrame::_GetCurrentViewPage() { diff --git a/clientgui/AdvancedFrame.h b/clientgui/AdvancedFrame.h index 324775e4ba..3f9659daff 100644 --- a/clientgui/AdvancedFrame.h +++ b/clientgui/AdvancedFrame.h @@ -129,6 +129,8 @@ private: bool DeleteStatusbar(); void SaveWindowDimensions(); + void OnSize(wxSizeEvent& event); + void OnMove(wxMoveEvent& event); void UpdateActivityModeControls( CC_STATUS& status ); void UpdateGPUModeControls( CC_STATUS& status ); diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp index bc7953ddb1..c9552173f7 100644 --- a/clientgui/DlgEventLog.cpp +++ b/clientgui/DlgEventLog.cpp @@ -72,6 +72,8 @@ BEGIN_EVENT_TABLE( CDlgEventLog, wxDialog ) EVT_BUTTON(ID_COPYSELECTED, CDlgEventLog::OnMessagesCopySelected) EVT_BUTTON(ID_TASK_MESSAGES_FILTERBYPROJECT, CDlgEventLog::OnMessagesFilter) EVT_BUTTON(ID_SIMPLE_HELP, CDlgEventLog::OnButtonHelp) + EVT_SIZE(CDlgEventLog::OnSize) + EVT_MOVE(CDlgEventLog::OnMove) EVT_CLOSE(CDlgEventLog::OnClose) ////@end CDlgEventLog event table entries END_EVENT_TABLE() @@ -679,7 +681,19 @@ void CDlgEventLog::SetWindowDimensions() { pConfig->Write(wxT("Height"), GetSize().y); } } - + + +void CDlgEventLog::OnSize(wxSizeEvent& event) { + SetWindowDimensions(); + event.Skip(); +} + + +void CDlgEventLog::OnMove(wxMoveEvent& event) { + SetWindowDimensions(); + event.Skip(); +} + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COPYAll diff --git a/clientgui/DlgEventLog.h b/clientgui/DlgEventLog.h index a7b7efd68b..f823c1b44b 100644 --- a/clientgui/DlgEventLog.h +++ b/clientgui/DlgEventLog.h @@ -166,6 +166,8 @@ private: void GetWindowDimensions( wxPoint& position, wxSize& size ); void SetWindowDimensions(); + void OnSize(wxSizeEvent& event); + void OnMove(wxMoveEvent& event); void OnMouseUp(wxMouseEvent& event); diff --git a/clientgui/sg_DlgMessages.cpp b/clientgui/sg_DlgMessages.cpp index b7a915e146..c6b16d43a3 100644 --- a/clientgui/sg_DlgMessages.cpp +++ b/clientgui/sg_DlgMessages.cpp @@ -314,6 +314,8 @@ BEGIN_EVENT_TABLE( CDlgMessages, wxDialog ) EVT_HELP(wxID_ANY, CDlgMessages::OnHelp) EVT_SHOW( CDlgMessages::OnShow ) EVT_BUTTON( wxID_OK, CDlgMessages::OnOK ) + EVT_SIZE(CDlgMessages::OnSize) + EVT_MOVE(CDlgMessages::OnMove) ////@end CDlgMessages event table entries END_EVENT_TABLE() @@ -606,3 +608,17 @@ void CDlgMessages::RestoreWindowDimensions() { #endif // ! __WXMAC__ } +void CDlgMessages::OnSize(wxSizeEvent& event) { + if (IsShown()) { + SaveWindowDimensions(); + } + event.Skip(); +} + + +void CDlgMessages::OnMove(wxMoveEvent& event) { + if (IsShown()) { + SaveWindowDimensions(); + } + event.Skip(); +} diff --git a/clientgui/sg_DlgMessages.h b/clientgui/sg_DlgMessages.h index 191e262457..ec03cb69dd 100644 --- a/clientgui/sg_DlgMessages.h +++ b/clientgui/sg_DlgMessages.h @@ -150,6 +150,8 @@ private: void SaveWindowDimensions(); bool RestoreState(); void RestoreWindowDimensions(); + void OnSize(wxSizeEvent& event); + void OnMove(wxMoveEvent& event); ////@begin CDlgMessages member variables CPanelMessages* m_pBackgroundPanel;