diff --git a/checkin_notes b/checkin_notes index 804b0b27b3..ebf65e04c1 100755 --- a/checkin_notes +++ b/checkin_notes @@ -3828,6 +3828,10 @@ Charlie 14 Apr 2006 CMainFrame::OnShow() into new method CMainFrame::GetWindowDimensions(). Call GetWindowDimensions() from CMainFrame::OnShow() and also from Mac-only method CMainFrame::Show(). + - Mac: Fix compile errors due to xpm files. + - Save main window dimensions on Hide so SaveState can write them even + if the window is hidden before application exit. clientgui/ + BOINCGUIApp.cpp MainFrame.cpp, .h diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index 99050f731d..da66eb7e9c 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -38,13 +38,10 @@ #ifdef __APPLE__ #include "res/boinc_mac.xpm" #include "res/gridrepublic_mac.xpm" -#endif - +#else #include "res/boinc.xpm" -#include "res/boincsm.xpm" #include "res/gridrepublic16.xpm" #include "res/gridrepublic32.xpm" -#include "res/gridrepublicamwizard.xpm" #include "res/cpdnbbc16.xpm" #include "res/cpdnbbc32.xpm" #include "res/cpdnbbcapwizard.xpm" @@ -52,6 +49,9 @@ #include "res/seed32.xpm" #include "res/seedamwizard.xpm" #include "res/seedapwizard.xpm" +#endif +#include "res/boincsm.xpm" +#include "res/gridrepublicamwizard.xpm" ////@end XPM images diff --git a/clientgui/MainFrame.cpp b/clientgui/MainFrame.cpp index b5d119dadc..e16999bde9 100644 --- a/clientgui/MainFrame.cpp +++ b/clientgui/MainFrame.cpp @@ -205,6 +205,11 @@ CMainFrame::CMainFrame(wxString title, wxIcon* icon) : m_iReminderFrequency = 0; m_iDisplayExitWarning = 1; + m_Top = 30; + m_Left = 30; + m_Width = 800; + m_Height = 600; + m_strNetworkDialupConnectionName = wxEmptyString; @@ -726,15 +731,21 @@ bool CMainFrame::SaveState() { #if defined(__WXMSW__) || defined(__WXMAC__) pConfig->Write(wxT("WindowMaximized"), IsMaximized()); #endif + if (!IsIconized() && !IsMaximized()) { - pConfig->Write(wxT("Width"), GetSize().GetWidth()); - pConfig->Write(wxT("Height"), GetSize().GetHeight()); -#ifdef __WXMAC__ - pConfig->Write(wxT("XPos"),GetPosition().x); - pConfig->Write(wxT("YPos"), GetPosition().y); -#endif + m_Width = GetSize().GetWidth(); + m_Height = GetSize().GetHeight(); + m_Left = GetPosition().x; + m_Top = GetPosition().y; } + pConfig->Write(wxT("Width"), m_Width); + pConfig->Write(wxT("Height"), m_Height); +#ifdef __WXMAC__ + pConfig->Write(wxT("XPos"), m_Left); + pConfig->Write(wxT("YPos"), m_Top); +#endif + // // Save Page(s) State @@ -1502,14 +1513,28 @@ void CMainFrame::OnShow(wxShowEvent& event) { wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnShow - Function Begin")); if (event.GetShow()) + SetWindowDimensions(); + else GetWindowDimensions(); event.Skip(); wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnShow - Function End")); } - + void CMainFrame::GetWindowDimensions() { + if (!IsIconized() && !IsMaximized()) { +#ifdef __WXMAC__ + m_Top = GetPosition().y; + m_Left = GetPosition().x; +#endif + m_Width = GetSize().GetWidth(); + m_Height = GetSize().GetHeight(); + } +} + + +void CMainFrame::SetWindowDimensions() { static bool bFirstTime = true; if (bFirstTime) { @@ -2155,10 +2180,12 @@ bool CMainFrame::Show(bool show) { GetCurrentProcess(&psn); if (show) { SetFrontProcess(&psn); // Shows process if hidden + SetWindowDimensions(); + } else { GetWindowDimensions(); - } else if (IsProcessVisible(&psn)) ShowHideProcess(&psn, false); + } return wxFrame::Show(show); } diff --git a/clientgui/MainFrame.h b/clientgui/MainFrame.h index 08093bd5df..70a916d54b 100644 --- a/clientgui/MainFrame.h +++ b/clientgui/MainFrame.h @@ -88,6 +88,7 @@ public: void OnClose( wxCloseEvent& event ); void OnShow( wxShowEvent& event ); + void SetWindowDimensions(); void GetWindowDimensions(); void OnRefreshState( wxTimerEvent& event ); @@ -158,6 +159,11 @@ private: wxArrayString m_aSelectedComputerMRU; + long m_Top; + long m_Left; + long m_Height; + long m_Width; + bool CreateMenu(); bool DeleteMenu();