From e48a3e625c9155392a2311aa232ada41c51d67e5 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Wed, 25 Oct 2006 20:48:23 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11355 --- checkin_notes | 9 +++++ clientgui/sg_BoincSimpleGUI.cpp | 65 +++++++++++++++++++++------------ clientgui/sg_BoincSimpleGUI.h | 4 -- 3 files changed, 50 insertions(+), 28 deletions(-) diff --git a/checkin_notes b/checkin_notes index 64a835511b..3bbc8ff327 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11487,3 +11487,12 @@ David 25 Oct 2006 cs_files.C file_xfer.h log_flags.C,h + +Rom 25 Oct 2006 + - MGR: Fix crashing bug where the simple GUI is the initial state and + the skin just finished loading. After a new skin is loaded the + ReloadSkin event is fired so each frame needs to make sure it + doesn't try to deref it's own null pointers. + + clientgui/ + sg_BoincSimpleGUI.cpp, .h diff --git a/clientgui/sg_BoincSimpleGUI.cpp b/clientgui/sg_BoincSimpleGUI.cpp index ce9d421c9e..352a4791c5 100644 --- a/clientgui/sg_BoincSimpleGUI.cpp +++ b/clientgui/sg_BoincSimpleGUI.cpp @@ -54,13 +54,11 @@ IMPLEMENT_DYNAMIC_CLASS(CSimpleFrame, CBOINCBaseFrame) BEGIN_EVENT_TABLE(CSimpleFrame, CBOINCBaseFrame) - EVT_BUTTON(-1,CSimpleFrame::OnBtnClick) EVT_SIZE(CSimpleFrame::OnSize) EVT_ERASE_BACKGROUND(CSimpleFrame::OnEraseBackground) EVT_FRAME_CONNECT(CSimpleFrame::OnConnect) EVT_FRAME_RELOADSKIN(CSimpleFrame::OnReloadSkin) EVT_TIMER(ID_SIMPLEFRAMERENDERTIMER, CSimpleFrame::OnFrameRender) - EVT_FLATNOTEBOOK_PAGE_CHANGED(-1, CSimpleFrame::OnPageChanged) END_EVENT_TABLE() @@ -75,25 +73,30 @@ CSimpleFrame::CSimpleFrame(wxString title, wxIcon* icon) : wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE) { wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Overloaded Constructor Function Begin")); - RestoreState(); - // Initialize Application - SetIcon(*icon); - + wrkUnitNB = NULL; + clientState = NULL; + projComponent = NULL; + projectViewInitialized = false; emptyViewInitialized = false; notebookViewInitialized = false; dlgOpen = false; + RestoreState(); + + // Initialize Application + SetIcon(*icon); + //set polling timer for interface m_pFrameRenderTimer = new wxTimer(this, ID_SIMPLEFRAMERENDERTIMER); wxASSERT(m_pFrameRenderTimer); m_pFrameRenderTimer->Start(1000); // Send event every 1 second - InitEmptyView(); wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Overloaded Constructor Function End")); - } +} + CSimpleFrame::~CSimpleFrame() { @@ -110,6 +113,7 @@ CSimpleFrame::~CSimpleFrame() wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Destructor Function End")); } + bool CSimpleFrame::RestoreState() { CBOINCBaseFrame::RestoreState(); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); @@ -154,6 +158,7 @@ bool CSimpleFrame::RestoreState() { return true; } + bool CSimpleFrame::SaveState() { CBOINCBaseFrame::SaveState(); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); @@ -242,10 +247,12 @@ void CSimpleFrame::OnConnect(CFrameEvent& WXUNUSED(event)) { wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnConnect - Function End")); } + void CSimpleFrame::OnReloadSkin(CFrameEvent& WXUNUSED(event)) { ReskinAppGUI(); } + void CSimpleFrame::OnProjectsAttachToProject() { wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnProjectsAttachToProject - Function Begin")); @@ -278,9 +285,8 @@ void CSimpleFrame::OnProjectsAttachToProject() { wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnProjectsAttachToProject - Function End")); } + void CSimpleFrame::OnFrameRender(wxTimerEvent& WXUNUSED(event)) { - - CMainDocument* pDoc = wxGetApp().GetDocument(); if (!projectViewInitialized) { @@ -324,10 +330,12 @@ void CSimpleFrame::OnFrameRender(wxTimerEvent& WXUNUSED(event)) { } } + void CSimpleFrame::UpdateEmptyView() { clientState->DisplayState(); } + void CSimpleFrame::DestroyEmptyView() { delete clientState; emptyViewInitialized = false; @@ -353,16 +361,22 @@ void CSimpleFrame::InitEmptyView() emptyViewInitialized = true; } + + void CSimpleFrame::UpdateProjectView() { //update Project Component projComponent->UpdateInterface(); } + + void CSimpleFrame::DestroyNotebook() { mainSizer->Detach(wrkUnitNB); delete wrkUnitNB; notebookViewInitialized = false; } + + void CSimpleFrame::InitProjectView() { // Do not update screen at this point @@ -372,6 +386,7 @@ void CSimpleFrame::InitProjectView() projectViewInitialized = true; } + void CSimpleFrame::InitNotebook() { wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::InitNotebook - Function Start")); @@ -387,9 +402,11 @@ void CSimpleFrame::InitNotebook() notebookViewInitialized = true; wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::InitNotebook - Function End")); } -/// + + void CSimpleFrame::ReskinAppGUI(){ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::ReskinAppGUI - Function Start")); + CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); wxASSERT(pSkinSimple); @@ -397,24 +414,22 @@ void CSimpleFrame::ReskinAppGUI(){ //bg color SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); - if(notebookViewInitialized){ - wrkUnitNB->ReskinAppGUI(); + + if(notebookViewInitialized){ + if (wrkUnitNB) wrkUnitNB->ReskinAppGUI(); } else { - clientState->ReskinInterface(); + if (clientState) clientState->ReskinInterface(); } - //reskin component - projComponent->ReskinInterface(); - Refresh(); + + //reskin component + if (projComponent) projComponent->ReskinInterface(); + + Refresh(); + wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::ReskinAppGUI - Function End")); } -void CSimpleFrame::OnBtnClick(wxCommandEvent& WXUNUSED(event)){ //init function -} -//end function -void CSimpleFrame::OnPageChanged(wxFlatNotebookEvent& WXUNUSED(event)) -{ -// btnCollapse->Refresh(); -} + void CSimpleFrame::OnEraseBackground(wxEraseEvent& event){ CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); @@ -425,6 +440,8 @@ void CSimpleFrame::OnEraseBackground(wxEraseEvent& event){ if(m_wxWin==this){event.Skip(true);DrawBackImg(event,this,pSkinSimple->GetBackgroundImage()->GetBitmap(),0);return;} event.Skip(true); } + + void CSimpleFrame::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz){ event.Skip(false); diff --git a/clientgui/sg_BoincSimpleGUI.h b/clientgui/sg_BoincSimpleGUI.h index 7cf1e4c6b0..d77ba4b25c 100644 --- a/clientgui/sg_BoincSimpleGUI.h +++ b/clientgui/sg_BoincSimpleGUI.h @@ -27,12 +27,10 @@ class CViewTabPage; class StatImageLoader; -class SkinClass; class ImageLoader; class CProjectsComponent; class ClientStateIndicator; class WorkunitNotebook; -class wxFlatNotebookEvent; // Define a new frame class CSimpleFrame : public CBOINCBaseFrame @@ -95,11 +93,9 @@ public: protected: void OnEraseBackground(wxEraseEvent& event); - void OnBtnClick(wxCommandEvent& event); void OnConnect(CFrameEvent& event ); void OnReloadSkin( CFrameEvent& event ); void OnFrameRender(wxTimerEvent& event ); - void OnPageChanged(wxFlatNotebookEvent& event); void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz);