From 596f7343cb87cfc655355111ffd53efe952de1da Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Mon, 30 Oct 2006 04:07:41 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11396 --- checkin_notes | 9 +++++++++ clientgui/AdvancedFrame.cpp | 20 -------------------- clientgui/AdvancedFrame.h | 4 ---- clientgui/BOINCBaseFrame.cpp | 20 ++++++++++++++++++++ clientgui/BOINCBaseFrame.h | 5 +++++ clientgui/BOINCGUIApp.cpp | 7 ++++++- clientgui/BOINCGUIApp.h | 1 + clientgui/sg_BoincSimpleGUI.cpp | 30 +++++++++++++++++++++++++----- 8 files changed, 66 insertions(+), 30 deletions(-) diff --git a/checkin_notes b/checkin_notes index 469eac7cff..2a18da2017 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11757,3 +11757,12 @@ Rom 29 Oct 2006 sg_ProjectsComponent.cpp, .h sg_StatImageLoader.cpp, .h SkinManager.cpp + +Charlie 29 Oct 2006 + - Mac: fix some Mac-specific Simple GUI bugs. + + clientgui/ + AdvancedFrame.cpp, h + BOINCBaseFrame.cpp, .h + BOINCGUIApp.cpp, .h + sg_BoincSimpleGUI.cpp diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index 33b9165bd9..fb368c7996 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -1927,24 +1927,4 @@ void CAdvancedFrame::UpdateNetworkModeControls( CC_STATUS& status ) { } -#ifdef __WXMAC__ - -bool CAdvancedFrame::Show(bool show) { - ProcessSerialNumber psn; - - GetCurrentProcess(&psn); - if (show) { - SetFrontProcess(&psn); // Shows process if hidden - } else { - GetWindowDimensions(); - if (IsProcessVisible(&psn)) - ShowHideProcess(&psn, false); - } - - return wxFrame::Show(show); -} - -#endif // __WXMAC__ - - const char *BOINC_RCSID_d881a56dc5 = "$Id$"; diff --git a/clientgui/AdvancedFrame.h b/clientgui/AdvancedFrame.h index e2cd3772b2..ef0def7724 100644 --- a/clientgui/AdvancedFrame.h +++ b/clientgui/AdvancedFrame.h @@ -100,10 +100,6 @@ public: // relevent code in OnPageChanged function // and the base/statistics view. -#ifdef __WXMAC__ - bool Show( bool show = true ); -#endif - wxTimer* m_pRefreshStateTimer; wxTimer* m_pFrameRenderTimer; wxTimer* m_pFrameListPanelRenderTimer; diff --git a/clientgui/BOINCBaseFrame.cpp b/clientgui/BOINCBaseFrame.cpp index c770488afa..959d1fcfda 100644 --- a/clientgui/BOINCBaseFrame.cpp +++ b/clientgui/BOINCBaseFrame.cpp @@ -554,6 +554,26 @@ bool CBOINCBaseFrame::RestoreState() { } +#ifdef __WXMAC__ +bool CBOINCBaseFrame::Show(bool show) { + ProcessSerialNumber psn; + + GetCurrentProcess(&psn); + if (show) { + SetFrontProcess(&psn); // Shows process if hidden + } else { +// GetWindowDimensions(); + if (wxGetApp().GetCurrentGUISelection() == m_windowType) + if (IsProcessVisible(&psn)) + ShowHideProcess(&psn, false); + } + + return wxFrame::Show(show); +} + +#endif // __WXMAC__ + + void CFrameAlertEvent::ProcessResponse(const int response) const { CMainDocument* pDoc = wxGetApp().GetDocument(); diff --git a/clientgui/BOINCBaseFrame.h b/clientgui/BOINCBaseFrame.h index 5d9272b666..0788f93fa1 100644 --- a/clientgui/BOINCBaseFrame.h +++ b/clientgui/BOINCBaseFrame.h @@ -82,6 +82,11 @@ public: void ExecuteBrowserLink( const wxString& strLink ); +#ifdef __WXMAC__ + bool Show( bool show = true ); + int m_windowType; // BOINC_SIMPLEGUI or BOINC_ADVANCEDGUI +#endif + protected: CBOINCDialUpManager* m_pDialupManager; diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index fc9533b47b..6405a43175 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -942,6 +942,11 @@ bool CBOINCGUIApp::SetActiveGUI(int iGUISelection, bool bShowWindow) { if (pNewFrame) { SetTopWindow(pNewFrame); +#ifdef __WXMAC__ + // So closing old view doesn't hide application + pNewFrame->m_windowType = iGUISelection; + m_iGUISelected = iGUISelection; +#endif // Delete the old one if it exists if (m_pFrame) m_pFrame->Destroy(); @@ -949,7 +954,7 @@ bool CBOINCGUIApp::SetActiveGUI(int iGUISelection, bool bShowWindow) { m_pFrame = pNewFrame; } } -#else +#else // ifndef SIMPLEGUI if (!m_pFrame) { // Initialize the advanced gui window iGUISelection = BOINC_ADVANCEDGUI; diff --git a/clientgui/BOINCGUIApp.h b/clientgui/BOINCGUIApp.h index 2794c6592d..dc7b98dc55 100644 --- a/clientgui/BOINCGUIApp.h +++ b/clientgui/BOINCGUIApp.h @@ -113,6 +113,7 @@ public: #endif #ifdef __WXMAC__ CMacSystemMenu* GetMacSystemMenu() { return m_pMacSystemMenu; } + int GetCurrentGUISelection() { return m_iGUISelected; } #endif wxArrayString& GetSupportedLanguages() { return m_astrLanguages; } diff --git a/clientgui/sg_BoincSimpleGUI.cpp b/clientgui/sg_BoincSimpleGUI.cpp index c370d50790..6b5a91903d 100644 --- a/clientgui/sg_BoincSimpleGUI.cpp +++ b/clientgui/sg_BoincSimpleGUI.cpp @@ -136,6 +136,30 @@ bool CSimpleFrame::RestoreState() { int x = pConfig->Read(wxT("X_Position"), ((wxPoint) wxDefaultPosition).x); int y = pConfig->Read(wxT("Y_Position"), ((wxPoint) wxDefaultPosition).y); + // Read the size of the BSG + int width, height; + GetSize(&width, &height); + +#ifdef __WXMAC__ + + // If the user has changed the arrangement of multiple + // displays, make sure the window title bar is still on-screen. + Rect titleRect = {y, x, y+22, x+width }; + InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible + RgnHandle displayRgn = NewRgn(); + CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays + Rect menuRect = ((**GetMainDevice())).gdRect; + menuRect.bottom = GetMBarHeight() + menuRect.top; + RgnHandle menuRgn = NewRgn(); + RectRgn(menuRgn, &menuRect); // Region hidden by menu bar + DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar retion + if (!RectInRgn(&titleRect, displayRgn)) + x = y = 30; + DisposeRgn(menuRgn); + DisposeRgn(displayRgn); + +#else + // If either co-ordinate is less then 0 then set it equal to 0 to ensure // it displays on the screen. if ( x < 0 ) x = 0; @@ -145,16 +169,12 @@ bool CSimpleFrame::RestoreState() { int maxX = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ); int maxY = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ); - // Read the size of the BSG - int width, height; - GetSize(&width, &height); - // Max sure that it doesn't go off to the right or bottom if ( x + width > maxX ) x=maxX-width; if ( y + height > maxY ) y=maxY-height; +#endif Move(x,y); - return true; }