diff --git a/checkin_notes b/checkin_notes index 2a71719899..202f351d43 100755 --- a/checkin_notes +++ b/checkin_notes @@ -10255,3 +10255,23 @@ Walt 14 Sept 2006 lib/ procinfo_unix.C + +Kevin 14 Sept 2006 + - BSG + - Changed skin file so that most images are obtained from the skin class + + clientgui/ + sg_BoincSimpleGUI.cpp/h + sg_ClientStateIndicator.cpp/h + sg_DlgMessages.cpp/h + sg_DlgPreferences.cpp/h + sg_ImageButton.cpp/h + sg_ImageLoader.cpp/h + sg_ProgressBar.cpp/h + sg_ProjectsComponent.cpp/h + sg_SkinClass.cpp/h + sg_StatImageLoader.cpp/h + sg_ViewTabPage.cpp/h + clientgui/common + wxFlatNotebook.cpp/h + \ No newline at end of file diff --git a/clientgui/common/wxFlatNotebook.cpp b/clientgui/common/wxFlatNotebook.cpp index b5cb51c787..6c6ce991af 100644 --- a/clientgui/common/wxFlatNotebook.cpp +++ b/clientgui/common/wxFlatNotebook.cpp @@ -650,10 +650,7 @@ void wxPageContainerBase::LoadBgImage() { //app skin class appSkin = SkinClass::Instance(); - wxString dirPref = appSkin->GetSkinsFolder()+_T("/")+appSkin->GetSkinName()+_T("/"); - - g_tabAreaBg = new wxImage(dirPref + appSkin->GetTabAreaBg(), wxBITMAP_TYPE_PNG); - m_tabAreaBG = wxBitmap(g_tabAreaBg); + m_tabAreaBG = appSkin->GetTabAreaBg(); } int wxPageContainerBase::GetButtonAreaWidth(void) @@ -737,9 +734,9 @@ void wxPageContainerBase::OnPaint(wxPaintEvent &event) if(!m_useBg){ dc.DrawRectangle(0, 0, size.x, size.y); // draws background around the tabs }else{ - if(m_tabAreaBG.Ok()) + if(m_tabAreaBG->Ok()) { - dc.DrawBitmap(m_tabAreaBG, 0, 0); + dc.DrawBitmap(*m_tabAreaBG, 0, 0); } } /////////////////////////////////////////////////////////////////////////////// diff --git a/clientgui/common/wxFlatNotebook.h b/clientgui/common/wxFlatNotebook.h index 73d41e23a5..10d7f1e797 100644 --- a/clientgui/common/wxFlatNotebook.h +++ b/clientgui/common/wxFlatNotebook.h @@ -514,9 +514,7 @@ protected: //Skin Class SkinClass *appSkin; - //tabs background - wxImage *g_tabAreaBg; - wxBitmap m_tabAreaBG; + wxBitmap* m_tabAreaBG; public: /// Parametrized constructor diff --git a/clientgui/sg_BoincSimpleGUI.cpp b/clientgui/sg_BoincSimpleGUI.cpp index cb71f26343..73c99680a7 100644 --- a/clientgui/sg_BoincSimpleGUI.cpp +++ b/clientgui/sg_BoincSimpleGUI.cpp @@ -107,9 +107,8 @@ CSimpleFrame::~CSimpleFrame() m_pFrameRenderTimer->Stop(); delete m_pFrameRenderTimer; } - wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Destructor Function End")); - CBOINCBaseFrame::SaveState(); + wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Destructor Function End")); } bool CSimpleFrame::RestoreState() { @@ -135,7 +134,7 @@ bool CSimpleFrame::RestoreState() { } bool CSimpleFrame::SaveState() { - CBOINCBaseFrame::RestoreState(); + CBOINCBaseFrame::SaveState(); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); wxString strBaseConfigLocation = wxString(wxT("/")); @@ -473,18 +472,9 @@ void CSimpleFrame::InitNotebook() } void CSimpleFrame::LoadSkinImages(){ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::LoadSkinImages - Function Start")); - wxString dirPref = appSkin->GetSkinsFolder()+_T("/")+appSkin->GetSkinName()+_T("/"); - - fileImgBuf[0].LoadFile(dirPref + appSkin->GetAppBg(),wxBITMAP_TYPE_PNG); - // work unit icons - g_icoWorkWU = new wxImage(dirPref + appSkin->GetIcnWorkingWkUnit(), wxBITMAP_TYPE_PNG); - ////////////////////////////// - frameBg=&fileImgBuf[0]; - /// work unit tabs icons - wxBitmap const workWUico = wxBitmap(g_icoWorkWU); - // push them in image list + frameBg=appSkin->GetAppBg(); wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::LoadSkinImages - Time to push")); - m_ImageList.push_back(workWUico); + m_ImageList.push_back(*(appSkin->GetIcnWorkingWkUnit())); wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::LoadSkinImages - Function End")); } /// @@ -525,10 +515,10 @@ void CSimpleFrame::OnPageChanged(wxFlatNotebookEvent& WXUNUSED(event)) } void CSimpleFrame::OnEraseBackground(wxEraseEvent& event){ wxObject *m_wxWin = event.GetEventObject(); - if(m_wxWin==this){event.Skip(true);DrawBackImg(event,this,*frameBg,0);return;} + if(m_wxWin==this){event.Skip(true);DrawBackImg(event,this,frameBg,0);return;} event.Skip(true); } -void CSimpleFrame::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz){ +void CSimpleFrame::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz){ event.Skip(false); wxDC *dc; @@ -537,19 +527,19 @@ void CSimpleFrame::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitM dc->Clear(); switch (opz) { case 0:{ - dc->DrawBitmap(bitMap, 0, 0); + dc->DrawBitmap(*bitMap, 0, 0); break;} case 1:{ wxRect rec=win->GetClientRect(); - rec.SetLeft((rec.GetWidth()-bitMap.GetWidth()) / 2); - rec.SetTop ((rec.GetHeight()-bitMap.GetHeight()) / 2); - dc->DrawBitmap(bitMap,rec.GetLeft(),rec.GetTop(),0); + rec.SetLeft((rec.GetWidth()-bitMap->GetWidth()) / 2); + rec.SetTop ((rec.GetHeight()-bitMap->GetHeight()) / 2); + dc->DrawBitmap(*bitMap,rec.GetLeft(),rec.GetTop(),0); break;} case 2:{ wxRect rec=win->GetClientRect(); - for(int y=0;y < rec.GetHeight();y+=bitMap.GetHeight()){ - for(int x=0;x < rec.GetWidth();x+=bitMap.GetWidth()){ - dc->DrawBitmap(bitMap,x,y,0); + for(int y=0;y < rec.GetHeight();y+=bitMap->GetHeight()){ + for(int x=0;x < rec.GetWidth();x+=bitMap->GetWidth()){ + dc->DrawBitmap(*bitMap,x,y,0); } } break;} diff --git a/clientgui/sg_BoincSimpleGUI.h b/clientgui/sg_BoincSimpleGUI.h index 52c58010d7..81e35e2f0d 100644 --- a/clientgui/sg_BoincSimpleGUI.h +++ b/clientgui/sg_BoincSimpleGUI.h @@ -46,17 +46,12 @@ public: ~CSimpleFrame(); - // Images - wxImage *g_icoWorkWU; // // Flat Neotebook std::vector m_windows; // vector of all window tabs created for notebook wxFlatNotebookImageList m_ImageList; wxFlatNotebook *wrkUnitNB; wxBitmap const workWUico; - ////// Skin variables ////// - //XML doc - wxXmlDocument *skinXML; //Skin Class SkinClass *appSkin; wxString skinName; @@ -95,7 +90,6 @@ public: wxBitmap *bm39cImg0; wxBitmap *btmpIcnSleeping; - wxBitmap fileImgBuf[1]; #if 0 wxAnimationPlayer& GetPlayer() { return m_player; } @@ -112,7 +106,7 @@ protected: void OnConnect(CFrameEvent& event ); void OnFrameRender(wxTimerEvent& event ); void OnPageChanged(wxFlatNotebookEvent& event); - void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz); + void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz); private: bool SaveState(); diff --git a/clientgui/sg_ClientStateIndicator.cpp b/clientgui/sg_ClientStateIndicator.cpp index 143a2f830d..429bc6ff61 100644 --- a/clientgui/sg_ClientStateIndicator.cpp +++ b/clientgui/sg_ClientStateIndicator.cpp @@ -64,22 +64,17 @@ ClientStateIndicator::~ClientStateIndicator() delete m_connRenderTimer; } } + } void ClientStateIndicator::LoadSkinImages() { //app skin class appSkin = SkinClass::Instance(); - wxString dirPref = appSkin->GetSkinsFolder()+_T("/")+appSkin->GetSkinName()+_T("/"); - // comp bg - g_compBg = new wxImage(dirPref + appSkin->GetWorkunitBg(), wxBITMAP_TYPE_PNG); - m_compBG = wxBitmap(g_compBg); - //state ind bg - g_stateIndBg = new wxImage(dirPref + appSkin->GetStateIndBg(), wxBITMAP_TYPE_PNG); - m_stateIndBG = wxBitmap(g_stateIndBg); - // indicators - g_connInd = new wxImage(dirPref + appSkin->GetConnInd(), wxBITMAP_TYPE_PNG); - g_errorInd = new wxImage(dirPref + appSkin->GetErrorInd(), wxBITMAP_TYPE_PNG); + btmpCompBg = appSkin->GetWorkunitBg(); + btmpStateIndBg = appSkin->GetStateIndBg(); + btmpConnInd = appSkin->GetConnInd(); + btmpErrorInd = appSkin->GetErrorInd(); } @@ -98,12 +93,12 @@ void ClientStateIndicator::SetActionState(const char* message) clientState = CLIENT_STATE_ACTION; i_indBg = new ImageLoader(this); i_indBg->Move(wxPoint(42,74)); - i_indBg->LoadImage(g_stateIndBg); + i_indBg->LoadImage(*btmpStateIndBg); for(int x = 0; x < numOfIndic; x++){ ImageLoader *i_connInd = new ImageLoader(this); i_connInd->Move(wxPoint(rightPosition +(connIndicatorWidth+10) * x,84)); - i_connInd->LoadImage(g_connInd); + i_connInd->LoadImage(*btmpConnInd); if(x !=0){ i_connInd->Show(false); } @@ -128,13 +123,13 @@ void ClientStateIndicator::SetPausedState(const char* message) clientState = CLIENT_STATE_PAUSED; i_indBg = new ImageLoader(this); i_indBg->Move(wxPoint(42,74)); - i_indBg->LoadImage(g_stateIndBg); + i_indBg->LoadImage(*btmpStateIndBg); for(int x = 0; x < numOfIndic; x++){ ImageLoader *i_connInd = new ImageLoader(this); i_connInd->Move(wxPoint(rightPosition +(connIndicatorWidth+10) * x,84)); - i_connInd->LoadImage(g_connInd); + i_connInd->LoadImage(*btmpConnInd); m_connIndV.push_back(i_connInd); } } @@ -152,11 +147,11 @@ void ClientStateIndicator::SetNoActionState(const char* message) clientState = CLIENT_STATE_ERROR; i_indBg = new ImageLoader(this); i_indBg->Move(wxPoint(42,74)); - i_indBg->LoadImage(g_stateIndBg); + i_indBg->LoadImage(*btmpStateIndBg); i_errorInd = new ImageLoader(this); i_errorInd->Move(wxPoint(rightPosition+24,84)); - i_errorInd->LoadImage(g_errorInd); + i_errorInd->LoadImage(*btmpErrorInd); i_errorInd->Refresh(); } Thaw(); @@ -222,9 +217,9 @@ void ClientStateIndicator::OnEraseBackground(wxEraseEvent& event){ dc=event.GetDC(); dc->SetBackground(wxBrush(this->GetBackgroundColour(),wxSOLID)); dc->Clear(); - if(m_compBG.Ok()) + if(btmpCompBg->Ok()) { - dc->DrawBitmap(m_compBG, 0, 0); + dc->DrawBitmap(*btmpCompBg, 0, 0); } } @@ -268,7 +263,6 @@ void ClientStateIndicator::DisplayState() { SetActionState(_T("Downloading work from the server.")); } else if ( Suspended() ) { CC_STATUS status; - bool result = false; pDoc->GetCoreClientStatus(status); if ( status.task_suspend_reason & SUSPEND_REASON_BATTERIES ) { SetActionState(_T("Processing Suspended: Running On Batteries.")); diff --git a/clientgui/sg_ClientStateIndicator.h b/clientgui/sg_ClientStateIndicator.h index c5d368c4b0..943e73b0a5 100644 --- a/clientgui/sg_ClientStateIndicator.h +++ b/clientgui/sg_ClientStateIndicator.h @@ -63,12 +63,10 @@ private: void SetPausedState(const char* message); bool DownloadingResults(); bool Suspended(); - wxImage *g_stateIndBg; - wxImage *g_compBg; - wxImage *g_connInd; - wxImage *g_errorInd; - wxBitmap m_stateIndBG; - wxBitmap m_compBG; + wxBitmap* btmpConnInd; + wxBitmap* btmpErrorInd; + wxBitmap* btmpStateIndBg; + wxBitmap* btmpCompBg; time_t error_time; void OnEraseBackground(wxEraseEvent& event); diff --git a/clientgui/sg_DlgMessages.cpp b/clientgui/sg_DlgMessages.cpp index ddd7a1c1cf..e5158136c4 100644 --- a/clientgui/sg_DlgMessages.cpp +++ b/clientgui/sg_DlgMessages.cpp @@ -103,8 +103,8 @@ void CDlgMessages::CreateDialog() SetBackgroundColour(appSkin->GetAppBgCol()); wxToolTip *ttClose = new wxToolTip(wxT("Close message window")); - btnClose=new wxBitmapButton(this,ID_CLOSEBUTTON,btmpClose,wxPoint(472,398),wxSize(57,16),wxNO_BORDER); - btnClose->SetBitmapSelected(btmpCloseClick); + btnClose=new wxBitmapButton(this,ID_CLOSEBUTTON,*btmpClose,wxPoint(472,398),wxSize(57,16),wxNO_BORDER); + btnClose->SetBitmapSelected(*btmpCloseClick); btnClose->SetToolTip(ttClose); Refresh(); @@ -112,39 +112,31 @@ void CDlgMessages::CreateDialog() void CDlgMessages::LoadSkinImages(){ //get skin class appSkin = SkinClass::Instance(); - - fileImgBuf[0].LoadFile(m_SkinDirPrefix + appSkin->GetDlgMessBg(),wxBITMAP_TYPE_PNG); - - // close - g_close = new wxImage(m_SkinDirPrefix + appSkin->GetBtnClose(), wxBITMAP_TYPE_PNG); - g_closeClick = new wxImage(m_SkinDirPrefix + appSkin->GetBtnCloseClick(), wxBITMAP_TYPE_PNG); - - windowBg=&fileImgBuf[0]; - - btmpClose= wxBitmap(g_close); - btmpCloseClick= wxBitmap(g_closeClick); + btmpWindowBg=appSkin->GetDlgMessBg(); + btmpClose= appSkin->GetBtnClose(); + btmpCloseClick= appSkin->GetBtnCloseClick(); } -void CDlgMessages::VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz){ +void CDlgMessages::VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz){ event.Skip(false);wxDC *dc; dc=event.GetDC(); dc->SetBackground(wxBrush(win->GetBackgroundColour(),wxSOLID)); dc->Clear(); switch (opz) { case 0:{ - dc->DrawBitmap(bitMap, 0, 0); + dc->DrawBitmap(*bitMap, 0, 0); break;} case 1:{ wxRect rec=win->GetClientRect(); - rec.SetLeft((rec.GetWidth()-bitMap.GetWidth()) / 2); - rec.SetTop ((rec.GetHeight()-bitMap.GetHeight()) / 2); - dc->DrawBitmap(bitMap,rec.GetLeft(),rec.GetTop(),0); + rec.SetLeft((rec.GetWidth()-bitMap->GetWidth()) / 2); + rec.SetTop ((rec.GetHeight()-bitMap->GetHeight()) / 2); + dc->DrawBitmap(*bitMap,rec.GetLeft(),rec.GetTop(),0); break;} case 2:{ wxRect rec=win->GetClientRect(); - for(int y=0;y < rec.GetHeight();y+=bitMap.GetHeight()){ - for(int x=0;x < rec.GetWidth();x+=bitMap.GetWidth()){ - dc->DrawBitmap(bitMap,x,y,0); + for(int y=0;y < rec.GetHeight();y+=bitMap->GetHeight()){ + for(int x=0;x < rec.GetWidth();x+=bitMap->GetWidth()){ + dc->DrawBitmap(*bitMap,x,y,0); } } break;} @@ -152,12 +144,11 @@ void CDlgMessages::VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & b } void CDlgMessages::OnEraseBackground(wxEraseEvent& event){ wxObject *m_wxWin = event.GetEventObject(); - if(m_wxWin==this){event.Skip(true);VwXDrawBackImg(event,this,*windowBg,0);VwXEvOnEraseBackground(event) ;return;} + if(m_wxWin==this){event.Skip(true);VwXDrawBackImg(event,this,btmpWindowBg,0);VwXEvOnEraseBackground(event) ;return;} event.Skip(true); } void CDlgMessages::OnBtnClick(wxCommandEvent& event){ //init function - wxObject *m_wxDlgBtnObj = event.GetEventObject(); int btnID = event.GetId(); if(btnID==ID_CLOSEBUTTON){ //wxMessageBox("OnBtnClick - btnClose"); diff --git a/clientgui/sg_DlgMessages.h b/clientgui/sg_DlgMessages.h index 02ce838985..8ad6e12f87 100644 --- a/clientgui/sg_DlgMessages.h +++ b/clientgui/sg_DlgMessages.h @@ -37,15 +37,11 @@ public: //Skin Class SkinClass *appSkin; //btns - wxImage *g_close; - wxImage *g_closeClick; - wxBitmap btmpClose; - wxBitmap btmpCloseClick; + wxBitmap* btmpClose; + wxBitmap* btmpCloseClick; + wxBitmap* btmpWindowBg; wxBitmapButton *btnClose; - //window bg - wxBitmap *windowBg; - wxBitmap fileImgBuf[1]; - // + // Pointer control virtual ~CDlgMessages(); void initBefore(); @@ -81,7 +77,7 @@ protected: void OnEraseBackground(wxEraseEvent& event); void OnBtnClick(wxCommandEvent& event); void VwXEvOnEraseBackground(wxEraseEvent& event); - void VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz); + void VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz); // virtual void OnListRender( wxTimerEvent& event ); virtual wxInt32 GetDocCount(); diff --git a/clientgui/sg_DlgPreferences.cpp b/clientgui/sg_DlgPreferences.cpp index 8ac5767821..1d2bd15e71 100644 --- a/clientgui/sg_DlgPreferences.cpp +++ b/clientgui/sg_DlgPreferences.cpp @@ -71,7 +71,6 @@ CDlgPreferences::CDlgPreferences(wxWindow* parent, wxString dirPref,wxWindowID i } CDlgPreferences::~CDlgPreferences() { - } @@ -94,8 +93,8 @@ void CDlgPreferences::CreateDialog() cmbSkinPicker->SetValue(m_SkinName); wxToolTip *ttSaveSkin = new wxToolTip(wxT("Change skin")); - btnSaveSkin=new wxBitmapButton(this,ID_SAVESKINBUTTON,btmpSave,wxPoint(187,82),wxSize(57,16),wxNO_BORDER); - btnSaveSkin->SetBitmapSelected(btmpSaveClick); + btnSaveSkin=new wxBitmapButton(this,ID_SAVESKINBUTTON,*btmpSave,wxPoint(187,82),wxSize(57,16),wxNO_BORDER); + btnSaveSkin->SetBitmapSelected(*btmpSaveClick); btnSaveSkin->SetToolTip(ttSaveSkin); lnMyTop = new CStaticLine(this,wxPoint(16,113),wxSize(378,1)); @@ -149,18 +148,18 @@ void CDlgPreferences::CreateDialog() cmbDWACIdleFor->SetValue(userValIdleFor); // Btn Save and Cancel wxToolTip *ttSave = new wxToolTip(wxT("Save preferences locally and close window")); - btnSave=new wxBitmapButton(this,ID_SAVEBUTTON,btmpSave,wxPoint(120,340),wxSize(57,16),wxNO_BORDER); - btnSave->SetBitmapSelected(btmpSaveClick); + btnSave=new wxBitmapButton(this,ID_SAVEBUTTON,*btmpSave,wxPoint(120,340),wxSize(57,16),wxNO_BORDER); + btnSave->SetBitmapSelected(*btmpSaveClick); btnSave->SetToolTip(ttSave); wxToolTip *ttCancel = new wxToolTip(wxT("Cancel changes and close window")); - btnCancel=new wxBitmapButton(this,ID_CANCELBUTTON,btmpCancel,wxPoint(187,340),wxSize(57,16),wxNO_BORDER); - btnCancel->SetBitmapSelected(btmpCancelClick); + btnCancel=new wxBitmapButton(this,ID_CANCELBUTTON,*btmpCancel,wxPoint(187,340),wxSize(57,16),wxNO_BORDER); + btnCancel->SetBitmapSelected(*btmpCancelClick); btnCancel->SetToolTip(ttCancel); wxToolTip *ttClear = new wxToolTip(wxT("Clear local preferences and use preferences from the web")); - btnClear=new wxBitmapButton(this,ID_CLEARBUTTON,btmpClear,wxPoint(254,340),wxSize(57,16),wxNO_BORDER); - btnClear->SetBitmapSelected(btmpClearClick); + btnClear=new wxBitmapButton(this,ID_CLEARBUTTON,*btmpClear,wxPoint(254,340),wxSize(57,16),wxNO_BORDER); + btnClear->SetBitmapSelected(*btmpClearClick); btnClear->SetToolTip(ttClear); // @@ -169,48 +168,34 @@ void CDlgPreferences::CreateDialog() Refresh(); } void CDlgPreferences::LoadSkinImages(){ - - fileImgBuf[0].LoadFile(m_SkinDirPrefix + appSkin->GetDlgPrefBg(),wxBITMAP_TYPE_PNG); - - // save - g_save = new wxImage(m_SkinDirPrefix + appSkin->GetBtnSave(), wxBITMAP_TYPE_PNG); - g_saveClick = new wxImage(m_SkinDirPrefix + appSkin->GetBtnSaveClick(), wxBITMAP_TYPE_PNG); - // cancel - g_cancel = new wxImage(m_SkinDirPrefix + appSkin->GetBtnCancel(), wxBITMAP_TYPE_PNG); - g_cancelClick = new wxImage(m_SkinDirPrefix + appSkin->GetBtnCancelClick(), wxBITMAP_TYPE_PNG); - - // clear - g_clear = new wxImage(m_SkinDirPrefix + appSkin->GetBtnClear(), wxBITMAP_TYPE_PNG); - g_clearClick = new wxImage(m_SkinDirPrefix + appSkin->GetBtnClearClick(), wxBITMAP_TYPE_PNG); - - dlgBack=&fileImgBuf[0]; - btmpSave= wxBitmap(g_save); - btmpSaveClick= wxBitmap(g_saveClick); - btmpCancel= wxBitmap(g_cancel); - btmpClearClick= wxBitmap(g_saveClick); - btmpClear= wxBitmap(g_clear); - btmpClearClick= wxBitmap(g_clearClick); + btmpDlgBg=appSkin->GetDlgPrefBg(); + btmpSave= appSkin->GetBtnSave(); + btmpSaveClick= appSkin->GetBtnSaveClick(); + btmpCancel= appSkin->GetBtnCancel(); + btmpCancelClick= appSkin->GetBtnCancelClick(); + btmpClear= appSkin->GetBtnClear(); + btmpClearClick= appSkin->GetBtnClearClick(); } -void CDlgPreferences::VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz){ +void CDlgPreferences::VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz){ event.Skip(false);wxDC *dc; dc=event.GetDC(); dc->SetBackground(wxBrush(win->GetBackgroundColour(),wxSOLID)); dc->Clear(); switch (opz) { case 0:{ - dc->DrawBitmap(bitMap, 0, 0); + dc->DrawBitmap(*bitMap, 0, 0); break;} case 1:{ wxRect rec=win->GetClientRect(); - rec.SetLeft((rec.GetWidth()-bitMap.GetWidth()) / 2); - rec.SetTop ((rec.GetHeight()-bitMap.GetHeight()) / 2); - dc->DrawBitmap(bitMap,rec.GetLeft(),rec.GetTop(),0); + rec.SetLeft((rec.GetWidth()-bitMap->GetWidth()) / 2); + rec.SetTop ((rec.GetHeight()-bitMap->GetHeight()) / 2); + dc->DrawBitmap(*bitMap,rec.GetLeft(),rec.GetTop(),0); break;} case 2:{ wxRect rec=win->GetClientRect(); - for(int y=0;y < rec.GetHeight();y+=bitMap.GetHeight()){ - for(int x=0;x < rec.GetWidth();x+=bitMap.GetWidth()){ - dc->DrawBitmap(bitMap,x,y,0); + for(int y=0;y < rec.GetHeight();y+=bitMap->GetHeight()){ + for(int x=0;x < rec.GetWidth();x+=bitMap->GetWidth()){ + dc->DrawBitmap(*bitMap,x,y,0); } } break;} @@ -218,12 +203,11 @@ void CDlgPreferences::VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap } void CDlgPreferences::OnEraseBackground(wxEraseEvent& event){ wxObject *m_wxWin = event.GetEventObject(); - if(m_wxWin==this){event.Skip(true);VwXDrawBackImg(event,this,*dlgBack,0);VwXEvOnEraseBackground(event) ;return;} + if(m_wxWin==this){event.Skip(true);VwXDrawBackImg(event,this,btmpDlgBg,0);VwXEvOnEraseBackground(event) ;return;} event.Skip(true); } void CDlgPreferences::OnBtnClick(wxCommandEvent& event){ //init function - wxObject *m_wxDlgBtnObj = event.GetEventObject(); int btnID = event.GetId(); if(btnID==ID_SAVEBUTTON){ WriteSettings(); @@ -244,7 +228,6 @@ void CDlgPreferences::OnBtnClick(wxCommandEvent& event){ //init function } //end function void CDlgPreferences::OnCmbSelected(wxCommandEvent& event){ //init function - wxObject *m_wxDlgCmbObj = event.GetEventObject(); int cmbID = event.GetId(); if(cmbID==ID_SKINPICKERCMBBOX){ m_SkinName = event.GetString(); diff --git a/clientgui/sg_DlgPreferences.h b/clientgui/sg_DlgPreferences.h index bcb6b68523..601ae429a4 100644 --- a/clientgui/sg_DlgPreferences.h +++ b/clientgui/sg_DlgPreferences.h @@ -49,18 +49,14 @@ public: //Skin Class SkinClass *appSkin; //btns - wxImage *g_save; - wxImage *g_saveClick; - wxImage *g_cancel; - wxImage *g_cancelClick; - wxImage *g_clear; - wxImage *g_clearClick; - wxBitmap btmpSave; - wxBitmap btmpSaveClick; - wxBitmap btmpCancel; - wxBitmap btmpCancelClick; - wxBitmap btmpClear; - wxBitmap btmpClearClick; + wxBitmap* btmpSave; + wxBitmap* btmpSaveClick; + wxBitmap* btmpCancel; + wxBitmap* btmpCancelClick; + wxBitmap* btmpClear; + wxBitmap* btmpClearClick; + wxBitmap* btmpDlgBg; + wxBitmapButton *btnSave; wxBitmapButton *btnSaveSkin; wxBitmapButton *btnCancel; @@ -89,8 +85,6 @@ public: wxComboBox *cmbSkinPicker; //wxTextCtrl *tx30c; - wxBitmap *dlgBack; - wxBitmap fileImgBuf[1]; virtual ~CDlgPreferences(); void initBefore(); void WriteSettings(); @@ -116,7 +110,7 @@ protected: void OnBtnClick(wxCommandEvent& event); void OnCmbSelected(wxCommandEvent& event); void VwXEvOnEraseBackground(wxEraseEvent& event); - void VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz); + void VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz); private: CStaticLine *lnMyTop; diff --git a/clientgui/sg_ImageButton.cpp b/clientgui/sg_ImageButton.cpp index 3fd9b265f9..310676c8df 100644 --- a/clientgui/sg_ImageButton.cpp +++ b/clientgui/sg_ImageButton.cpp @@ -50,7 +50,7 @@ void CImageButton::OnPaint(wxPaintEvent& WXUNUSED(event)) } void CImageButton::SetImage(wxBitmap bg) { - btnBG = wxBitmap(bg); + btnBG = bg; } void CImageButton::OnEraseBackground(wxEraseEvent& event){ diff --git a/clientgui/sg_ImageLoader.cpp b/clientgui/sg_ImageLoader.cpp index f007fac93f..80be6eaa6c 100644 --- a/clientgui/sg_ImageLoader.cpp +++ b/clientgui/sg_ImageLoader.cpp @@ -31,19 +31,11 @@ END_EVENT_TABLE() ImageLoader::ImageLoader(wxWindow* parent) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER) { } -void ImageLoader::LoadImage(const wxImage& image) +void ImageLoader::LoadImage(wxBitmap image) { - Bitmap = wxBitmap();//delete existing bitmap since we are loading newone - int width = image.GetWidth(); int height = image.GetHeight(); - //double X_Ratio = (double) MaxWidth / (double) width; - //double Y_Ratio = (double) MaxHeight / (double) height; - //double Ratio = X_Ratio < Y_Ratio ? X_Ratio : Y_Ratio; - //wxImage Image = image.Scale((int)(Ratio * width), (int)(Ratio * height)); - Bitmap = wxBitmap(image); - //width = imageGetWidth(); - //height = image.GetHeight(); + Bitmap = image; SetSize(width, height); } diff --git a/clientgui/sg_ImageLoader.h b/clientgui/sg_ImageLoader.h index 4076f745fd..a5efb9e8d2 100644 --- a/clientgui/sg_ImageLoader.h +++ b/clientgui/sg_ImageLoader.h @@ -29,7 +29,7 @@ class ImageLoader : public wxWindow public: /// Constructors ImageLoader(wxWindow* parent); - void LoadImage(const wxImage& image); + void LoadImage(wxBitmap image); void OnPaint(wxPaintEvent& event); private: //static const int MaxWidth = 320; diff --git a/clientgui/sg_ProgressBar.cpp b/clientgui/sg_ProgressBar.cpp index fc3a09a291..519c06c8d4 100644 --- a/clientgui/sg_ProgressBar.cpp +++ b/clientgui/sg_ProgressBar.cpp @@ -45,12 +45,10 @@ void CProgressBar::LoadSkinImages() { //app skin class appSkin = SkinClass::Instance(); - wxString dirPref = appSkin->GetSkinsFolder()+_T("/")+appSkin->GetSkinName()+_T("/"); //bg - g_gaugeBg = new wxImage(dirPref + appSkin->GetGaugeBg(), wxBITMAP_TYPE_PNG); - m_gaugeBG = wxBitmap(g_gaugeBg); + m_gaugeBG = appSkin->GetGaugeBg(); // indicator - g_gaugeInd = new wxImage(dirPref + appSkin->GetGaugeProgressInd(), wxBITMAP_TYPE_PNG); + g_gaugeInd = appSkin->GetGaugeProgressInd(); } void CProgressBar::SetValue(double progress) @@ -64,7 +62,7 @@ void CProgressBar::SetValue(double progress) for(int indIndex = 0; indIndex < numOfProgressInd; indIndex++){ ImageLoader *i_ind = new ImageLoader(this); i_ind->Move(wxPoint(rightPosition +((indicatorWidth)*indIndex),topPosition)); - i_ind->LoadImage(g_gaugeInd); + i_ind->LoadImage(*g_gaugeInd); m_progInd.push_back(i_ind); } } @@ -80,7 +78,7 @@ void CProgressBar::UpdateValue(double progress) for(int indIndex = numOfProgressInd; indIndex < currProg; indIndex++){ wxWindow *w_ind=new wxWindow(this,-1,wxPoint(rightPosition +((indicatorWidth)*indIndex),topPosition),wxSize(indicatorWidth,indicatorHeight)); ImageLoader *i_ind = new ImageLoader(w_ind); - i_ind->LoadImage(g_gaugeInd); + i_ind->LoadImage(*g_gaugeInd); numOfProgressInd = progress /(100/numOfIndic); } } @@ -112,9 +110,9 @@ void CProgressBar::OnEraseBackground(wxEraseEvent& event){ dc=event.GetDC(); dc->SetBackground(wxBrush(this->GetBackgroundColour(),wxSOLID)); dc->Clear(); - if(m_gaugeBG.Ok()) + if(m_gaugeBG->Ok()) { - dc->DrawBitmap(m_gaugeBG, 0, 0); + dc->DrawBitmap(*m_gaugeBG, 0, 0); } } diff --git a/clientgui/sg_ProgressBar.h b/clientgui/sg_ProgressBar.h index d8b6251a43..b9976ad6c5 100644 --- a/clientgui/sg_ProgressBar.h +++ b/clientgui/sg_ProgressBar.h @@ -47,9 +47,8 @@ public: void ClearIndicators(); private: - wxImage *g_gaugeBg; - wxImage *g_gaugeInd; - wxBitmap m_gaugeBG; + wxBitmap* g_gaugeInd; + wxBitmap* m_gaugeBG; double m_progress; void OnEraseBackground(wxEraseEvent& event); diff --git a/clientgui/sg_ProjectsComponent.cpp b/clientgui/sg_ProjectsComponent.cpp index a55feae617..e26fa4831d 100644 --- a/clientgui/sg_ProjectsComponent.cpp +++ b/clientgui/sg_ProjectsComponent.cpp @@ -48,7 +48,8 @@ END_EVENT_TABLE() size_t CProjectsComponent::lastMessageId = 0; -CProjectsComponent::CProjectsComponent() {} +CProjectsComponent::CProjectsComponent() { +} CProjectsComponent::CProjectsComponent(CSimpleFrame* parent,wxPoint coord) : @@ -79,61 +80,27 @@ void CProjectsComponent::LoadSkinImages(){ //app skin class appSkin = SkinClass::Instance(); - wxString dirPref = appSkin->GetSkinsFolder()+_T("/")+appSkin->GetSkinName()+_T("/"); - // - //component bg - fileImgBuf[0].LoadFile(dirPref + appSkin->GetProjCompBg(),wxBITMAP_TYPE_PNG); - // default stat icon - g_statIcnDefault = new wxImage(dirPref + appSkin->GetDefaultStatIcn(), wxBITMAP_TYPE_PNG); - // arrows - g_arwLeft = new wxImage(dirPref + appSkin->GetBtnLeftArr(), wxBITMAP_TYPE_PNG); - g_arwRight = new wxImage(dirPref + appSkin->GetBtnRightArr(), wxBITMAP_TYPE_PNG); - g_arwLeftClick = new wxImage(dirPref + appSkin->GetBtnLeftArrClick(), wxBITMAP_TYPE_PNG); - g_arwRightClick = new wxImage(dirPref + appSkin->GetBtnRightArrClick(), wxBITMAP_TYPE_PNG); - // add proj - g_addProj = new wxImage(dirPref + appSkin->GetBtnAddProj(), wxBITMAP_TYPE_PNG); - g_addProjClick = new wxImage(dirPref + appSkin->GetBtnAddProjClick(), wxBITMAP_TYPE_PNG); - // messages - g_messages = new wxImage(dirPref + appSkin->GetBtnMessages(), wxBITMAP_TYPE_PNG); - g_messagesClick = new wxImage(dirPref + appSkin->GetBtnMessages(), wxBITMAP_TYPE_PNG); - // error messages - g_alertMessages = new wxImage(dirPref + appSkin->GetBtnAlertMessages(), wxBITMAP_TYPE_PNG); - g_alertMessagesClick = new wxImage(dirPref + appSkin->GetBtnAlertMessages(), wxBITMAP_TYPE_PNG); - // pause - g_pause = new wxImage(dirPref + appSkin->GetBtnPause(), wxBITMAP_TYPE_PNG); - g_pauseClick = new wxImage(dirPref + appSkin->GetBtnPause(), wxBITMAP_TYPE_PNG); - // resume - g_resume = new wxImage(dirPref + appSkin->GetBtnResume(), wxBITMAP_TYPE_PNG); - g_resumeClick = new wxImage(dirPref + appSkin->GetBtnResume(), wxBITMAP_TYPE_PNG); - // resume - g_pref = new wxImage(dirPref + appSkin->GetBtnPrefer(), wxBITMAP_TYPE_PNG); - g_prefClick = new wxImage(dirPref + appSkin->GetBtnPrefer(), wxBITMAP_TYPE_PNG); - // resume - g_advView = new wxImage(dirPref + appSkin->GetBtnAdvView(), wxBITMAP_TYPE_PNG); - g_advViewClick = new wxImage(dirPref + appSkin->GetBtnAdvView(), wxBITMAP_TYPE_PNG); - //spacer - g_spacer = new wxImage(dirPref + appSkin->GetSpacerImage(), wxBITMAP_TYPE_PNG); - - - btmpComponentBg=&fileImgBuf[0]; - btmpArwL= wxBitmap(g_arwLeft); - btmpArwR= wxBitmap(g_arwRight); - btmpArwLC= wxBitmap(g_arwLeftClick); - btmpArwRC= wxBitmap(g_arwRightClick); - btmpAddProj= wxBitmap(g_addProj); - btmpAddProjC= wxBitmap(g_addProjClick); - btmpMessages= wxBitmap(g_messages); - btmpMessagesC= wxBitmap(g_messagesClick); - btmpAlertMessages= wxBitmap(g_alertMessages); - btmpAlertMessagesC= wxBitmap(g_alertMessagesClick); - btmpPause= wxBitmap(g_pause); - btmpPauseC= wxBitmap(g_pauseClick); - btmpResume= wxBitmap(g_resume); - btmpResumeC= wxBitmap(g_resumeClick); - btmpPref= wxBitmap(g_pref); - btmpPrefC= wxBitmap(g_prefClick); - btmpAdvView= wxBitmap(g_advView); - btmpAdvViewC= wxBitmap(g_advViewClick); + btmpComponentBg=appSkin->GetProjCompBg(); + btmpStatIcnDefault = appSkin->GetDefaultStatIcn(); + btmpArwL= appSkin->GetBtnLeftArr(); + btmpArwR= appSkin->GetBtnRightArr(); + btmpArwLC= appSkin->GetBtnLeftArrClick(); + btmpArwRC= appSkin->GetBtnRightArrClick(); + btmpAddProj= appSkin->GetBtnAddProj(); + btmpAddProjC= appSkin->GetBtnAddProjClick(); + btmpMessages= appSkin->GetBtnMessages(); + btmpMessagesC= appSkin->GetBtnMessages(); + btmpAlertMessages= appSkin->GetBtnAlertMessages(); + btmpAlertMessagesC= appSkin->GetBtnAlertMessages(); + btmpPause= appSkin->GetBtnPause(); + btmpPauseC= appSkin->GetBtnPause(); + btmpResume= appSkin->GetBtnResume(); + btmpResumeC= appSkin->GetBtnResume(); + btmpPref= appSkin->GetBtnPrefer(); + btmpPrefC= appSkin->GetBtnPrefer(); + btmpAdvView= appSkin->GetBtnAdvView(); + btmpAdvViewC= appSkin->GetBtnAdvView(); + btmpSpacer = appSkin->GetSpacerImage(); } @@ -144,8 +111,8 @@ void CProjectsComponent::CreateComponent() //Static content in my Projects section // add project button wxToolTip *ttAddProject = new wxToolTip(wxT("Add Project")); - btnAddProj=new wxBitmapButton(this,-1,btmpAddProj,wxPoint(235,7),wxSize(81,18),wxNO_BORDER); - btnAddProj->SetBitmapSelected(btmpAddProjC); + btnAddProj=new wxBitmapButton(this,-1,*btmpAddProj,wxPoint(235,7),wxSize(81,18),wxNO_BORDER); + btnAddProj->SetBitmapSelected(*btmpAddProjC); btnAddProj->SetToolTip(ttAddProject); /// Line lnMyProjTop = new CStaticLine(this,wxPoint(29,29),wxSize(292,1)); @@ -172,7 +139,7 @@ void CProjectsComponent::CreateComponent() // resolve the proj image url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory); dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName; - i_statW->LoadImage(dirProjectGraphic, g_statIcnDefault); + i_statW->LoadImage(dirProjectGraphic, btmpStatIcnDefault); i_statW->SetToolTip(statToolTip); // push icon in the vector @@ -183,11 +150,11 @@ void CProjectsComponent::CreateComponent() } //// Arrow Btns - btnArwLeft=new wxBitmapButton(this,-1,btmpArwL,wxPoint(29,47),wxSize(20,20),wxNO_BORDER); - btnArwLeft->SetBitmapSelected(btmpArwLC); + btnArwLeft=new wxBitmapButton(this,-1,*btmpArwL,wxPoint(29,47),wxSize(20,20),wxNO_BORDER); + btnArwLeft->SetBitmapSelected(*btmpArwLC); btnArwLeft->Show(false);//on creation this one is always false - btnArwRight=new wxBitmapButton(this,-1,btmpArwR,wxPoint(301,47),wxSize(20,20),wxNO_BORDER); - btnArwRight->SetBitmapSelected(btmpArwRC); + btnArwRight=new wxBitmapButton(this,-1,*btmpArwR,wxPoint(301,47),wxSize(20,20),wxNO_BORDER); + btnArwRight->SetBitmapSelected(*btmpArwRC); if(m_projCnt > m_maxNumOfIcons){//right shows up only if there is more than max num of icons btnArwRight->Show(true); }else{ @@ -196,46 +163,46 @@ void CProjectsComponent::CreateComponent() // //// Messages Play Pause Btns wxToolTip *ttMessages = new wxToolTip(wxT("Messages")); - btnMessages=new wxBitmapButton(this,-1,btmpMessages,wxPoint(11,86),wxSize(70,20),wxNO_BORDER); - btnMessages->SetBitmapSelected(btmpMessagesC); + btnMessages=new wxBitmapButton(this,-1,*btmpMessages,wxPoint(11,86),wxSize(70,20),wxNO_BORDER); + btnMessages->SetBitmapSelected(*btmpMessagesC); btnMessages->SetToolTip(ttMessages); wxToolTip *ttAlertMessages = new wxToolTip(wxT("Messages")); - btnAlertMessages=new wxBitmapButton(this,-1,btmpAlertMessages,wxPoint(11,86),wxSize(70,20),wxNO_BORDER); - btnAlertMessages->SetBitmapSelected(btmpAlertMessagesC); + btnAlertMessages=new wxBitmapButton(this,-1,*btmpAlertMessages,wxPoint(11,86),wxSize(70,20),wxNO_BORDER); + btnAlertMessages->SetBitmapSelected(*btmpAlertMessagesC); btnAlertMessages->SetToolTip(ttAlertMessages); btnAlertMessages->Show(false); //spacer wxWindow *w_sp1 = new wxWindow(this,-1,wxPoint(83,91),wxSize(2,11)); i_spacer = new ImageLoader(w_sp1); - i_spacer->LoadImage(g_spacer); + i_spacer->LoadImage(*btmpSpacer); // pause btn wxToolTip *ttPause = new wxToolTip(wxT("Pause all processing")); - btnPause=new wxBitmapButton(this,-1,btmpPause,wxPoint(85,86),wxSize(59,20),wxNO_BORDER); - btnPause->SetBitmapSelected(btmpPauseC); + btnPause=new wxBitmapButton(this,-1,*btmpPause,wxPoint(85,86),wxSize(59,20),wxNO_BORDER); + btnPause->SetBitmapSelected(*btmpPauseC); btnPause->SetToolTip(ttPause); // resume btn wxToolTip *ttResume = new wxToolTip(wxT("Resume all Processing")); - btnResume=new wxBitmapButton(this,-1,btmpResume,wxPoint(85,86),wxSize(59,20),wxNO_BORDER); - btnResume->SetBitmapSelected(btmpResumeC); + btnResume=new wxBitmapButton(this,-1,*btmpResume,wxPoint(85,86),wxSize(59,20),wxNO_BORDER); + btnResume->SetBitmapSelected(*btmpResumeC); btnResume->SetToolTip(ttResume); btnResume->Show(false); //spacer wxWindow *w_sp2 = new wxWindow(this,-1,wxPoint(144,91),wxSize(2,11)); i_spacer = new ImageLoader(w_sp2); - i_spacer->LoadImage(g_spacer); + i_spacer->LoadImage(*btmpSpacer); // Pref Btn wxToolTip *ttPreferences = new wxToolTip(wxT("Preferences")); - btnPreferences=new wxBitmapButton(this,-1,btmpPref,wxPoint(149,86),wxSize(81,20),wxNO_BORDER); - btnPreferences->SetBitmapSelected(btmpPrefC); + btnPreferences=new wxBitmapButton(this,-1,*btmpPref,wxPoint(149,86),wxSize(81,20),wxNO_BORDER); + btnPreferences->SetBitmapSelected(*btmpPrefC); btnPreferences->SetToolTip(ttPreferences); //spacer wxWindow *w_sp3 = new wxWindow(this,-1,wxPoint(230,91),wxSize(2,11)); i_spacer = new ImageLoader(w_sp3); - i_spacer->LoadImage(g_spacer); + i_spacer->LoadImage(*btmpSpacer); // Advanced View wxToolTip *ttAdvView = new wxToolTip(wxT("Advanced View")); - btnAdvancedView=new wxBitmapButton(this,-1,btmpAdvView,wxPoint(233,86),wxSize(101,20),wxNO_BORDER); - btnAdvancedView->SetBitmapSelected(btmpAdvViewC); + btnAdvancedView=new wxBitmapButton(this,-1,*btmpAdvView,wxPoint(233,86),wxSize(101,20),wxNO_BORDER); + btnAdvancedView->SetBitmapSelected(*btmpAdvViewC); btnAdvancedView->SetToolTip(ttAdvView); /// Line lnMyProjBtm = new CStaticLine(this,wxPoint(29,83),wxSize(292,1)); @@ -283,7 +250,7 @@ void CProjectsComponent::RemoveProject(std::string prjUrl) // resolve the proj image url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory); dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName; - i_statW->LoadImage(dirProjectGraphic, g_statIcnDefault); + i_statW->LoadImage(dirProjectGraphic, btmpStatIcnDefault); i_statW->SetToolTip(statToolTip); // push icon in the vector @@ -311,7 +278,7 @@ void CProjectsComponent::RemoveProject(std::string prjUrl) // resolve the proj image url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory); dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName; - i_statW->LoadImage(dirProjectGraphic, g_statIcnDefault); + i_statW->LoadImage(dirProjectGraphic, btmpStatIcnDefault); i_statW->SetToolTip(statToolTip); // push icon in the vector @@ -380,7 +347,7 @@ void CProjectsComponent::UpdateInterface() // resolve the proj image url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory); dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName; - i_statW->LoadImage(dirProjectGraphic, g_statIcnDefault); + i_statW->LoadImage(dirProjectGraphic, btmpStatIcnDefault); i_statW->SetToolTip(statToolTip); // push icon in the vector @@ -409,40 +376,40 @@ void CProjectsComponent::ReskinInterface() SetBackgroundColour(appSkin->GetAppBgCol()); //right button btnArwRight->SetBackgroundColour(appSkin->GetAppBgCol()); - btnArwRight->SetBitmapLabel(btmpArwR); - btnArwRight->SetBitmapSelected(btmpArwRC); + btnArwRight->SetBitmapLabel(*btmpArwR); + btnArwRight->SetBitmapSelected(*btmpArwRC); //left button btnArwLeft->SetBackgroundColour(appSkin->GetAppBgCol()); - btnArwLeft->SetBitmapLabel(btmpArwL); - btnArwLeft->SetBitmapSelected(btmpArwLC); + btnArwLeft->SetBitmapLabel(*btmpArwL); + btnArwLeft->SetBitmapSelected(*btmpArwLC); // add project btn btnAddProj->SetBackgroundColour(appSkin->GetAppBgCol()); - btnAddProj->SetBitmapLabel(btmpAddProj); - btnAddProj->SetBitmapSelected(btmpAddProjC); + btnAddProj->SetBitmapLabel(*btmpAddProj); + btnAddProj->SetBitmapSelected(*btmpAddProjC); // messages btn btnMessages->SetBackgroundColour(appSkin->GetAppBgCol()); - btnMessages->SetBitmapLabel(btmpMessages); - btnMessages->SetBitmapSelected(btmpMessagesC); + btnMessages->SetBitmapLabel(*btmpMessages); + btnMessages->SetBitmapSelected(*btmpMessagesC); // alert messages btn btnAlertMessages->SetBackgroundColour(appSkin->GetAppBgCol()); - btnAlertMessages->SetBitmapLabel(btmpAlertMessages); - btnAlertMessages->SetBitmapSelected(btmpAlertMessagesC); + btnAlertMessages->SetBitmapLabel(*btmpAlertMessages); + btnAlertMessages->SetBitmapSelected(*btmpAlertMessagesC); // pause btn btnPause->SetBackgroundColour(appSkin->GetAppBgCol()); - btnPause->SetBitmapLabel(btmpPause); - btnPause->SetBitmapSelected(btmpPauseC); + btnPause->SetBitmapLabel(*btmpPause); + btnPause->SetBitmapSelected(*btmpPauseC); // resume btn btnResume->SetBackgroundColour(appSkin->GetAppBgCol()); - btnResume->SetBitmapLabel(btmpResume); - btnResume->SetBitmapSelected(btmpResumeC); + btnResume->SetBitmapLabel(*btmpResume); + btnResume->SetBitmapSelected(*btmpResumeC); // preferences btn btnPreferences->SetBackgroundColour(appSkin->GetAppBgCol()); - btnPreferences->SetBitmapLabel(btmpPref); - btnPreferences->SetBitmapSelected(btmpPrefC); + btnPreferences->SetBitmapLabel(*btmpPref); + btnPreferences->SetBitmapSelected(*btmpPrefC); // advance view btn btnAdvancedView->SetBackgroundColour(appSkin->GetAppBgCol()); - btnAdvancedView->SetBitmapLabel(btmpAdvView); - btnAdvancedView->SetBitmapSelected(btmpAdvViewC); + btnAdvancedView->SetBitmapLabel(*btmpAdvView); + btnAdvancedView->SetBitmapSelected(*btmpAdvViewC); //set line colors lnMyProjTop->SetLineColor(appSkin->GetStaticLineCol()); lnMyProjBtm->SetLineColor(appSkin->GetStaticLineCol()); @@ -484,7 +451,7 @@ void CProjectsComponent::OnBtnClick(wxCommandEvent& event){ //init function // resolve the proj image url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory); dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName; - i_statW->LoadImage(dirProjectGraphic, g_statIcnDefault); + i_statW->LoadImage(dirProjectGraphic, btmpStatIcnDefault); i_statW->SetToolTip(statToolTip); @@ -529,7 +496,7 @@ void CProjectsComponent::OnBtnClick(wxCommandEvent& event){ //init function // resolve the proj image url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory); dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName; - i_statW->LoadImage(dirProjectGraphic, g_statIcnDefault); + i_statW->LoadImage(dirProjectGraphic, btmpStatIcnDefault); i_statW->SetToolTip(statToolTip); // push icon in the vector @@ -593,10 +560,10 @@ void CProjectsComponent::OnBtnClick(wxCommandEvent& event){ //init function } void CProjectsComponent::OnEraseBackground(wxEraseEvent& event){ wxObject *m_wxWin = event.GetEventObject(); - if(m_wxWin==this){event.Skip(true);DrawBackImg(event,this,*btmpComponentBg,0);return;} + if(m_wxWin==this){event.Skip(true);DrawBackImg(event,this,btmpComponentBg,0);return;} event.Skip(true); } -void CProjectsComponent::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz){ +void CProjectsComponent::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz){ event.Skip(false); wxDC *dc; @@ -605,19 +572,19 @@ void CProjectsComponent::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap dc->Clear(); switch (opz) { case 0:{ - dc->DrawBitmap(bitMap, 0, 0); + dc->DrawBitmap(*bitMap, 0, 0); break;} case 1:{ wxRect rec=win->GetClientRect(); - rec.SetLeft((rec.GetWidth()-bitMap.GetWidth()) / 2); - rec.SetTop ((rec.GetHeight()-bitMap.GetHeight()) / 2); - dc->DrawBitmap(bitMap,rec.GetLeft(),rec.GetTop(),0); + rec.SetLeft((rec.GetWidth()-bitMap->GetWidth()) / 2); + rec.SetTop ((rec.GetHeight()-bitMap->GetHeight()) / 2); + dc->DrawBitmap(*bitMap,rec.GetLeft(),rec.GetTop(),0); break;} case 2:{ wxRect rec=win->GetClientRect(); - for(int y=0;y < rec.GetHeight();y+=bitMap.GetHeight()){ - for(int x=0;x < rec.GetWidth();x+=bitMap.GetWidth()){ - dc->DrawBitmap(bitMap,x,y,0); + for(int y=0;y < rec.GetHeight();y+=bitMap->GetHeight()){ + for(int x=0;x < rec.GetWidth();x+=bitMap->GetWidth()){ + dc->DrawBitmap(*bitMap,x,y,0); } } break;} diff --git a/clientgui/sg_ProjectsComponent.h b/clientgui/sg_ProjectsComponent.h index 2292f44ce7..f307dda60c 100644 --- a/clientgui/sg_ProjectsComponent.h +++ b/clientgui/sg_ProjectsComponent.h @@ -54,49 +54,33 @@ public: wxString toolTipTxt; wxString userCredit; // default icon - wxImage *g_statIcnDefault; // spacer - wxImage *g_spacer; ImageLoader *i_spacer; // btns // arrows - wxImage *g_arwLeft; - wxImage *g_arwRight; - wxImage *g_arwLeftClick; - wxImage *g_arwRightClick; - wxImage *g_addProj; - wxImage *g_addProjClick; - wxImage *g_messages; - wxImage *g_messagesClick; - wxImage *g_alertMessages; - wxImage *g_alertMessagesClick; - wxImage *g_pause; - wxImage *g_pauseClick; - wxImage *g_resume; - wxImage *g_resumeClick; - wxImage *g_pref; - wxImage *g_prefClick; - wxImage *g_advView; - wxImage *g_advViewClick; - wxBitmap btmpArwL; - wxBitmap btmpArwR; - wxBitmap btmpArwLC; - wxBitmap btmpArwRC; - wxBitmap btmpAddProj; - wxBitmap btmpAddProjC; - wxBitmap btmpMessages; - wxBitmap btmpMessagesC; - wxBitmap btmpAlertMessages; - wxBitmap btmpAlertMessagesC; - wxBitmap btmpPause; - wxBitmap btmpPauseC; - wxBitmap btmpResume; - wxBitmap btmpResumeC; - wxBitmap btmpPref; - wxBitmap btmpPrefC; - wxBitmap btmpAdvView; - wxBitmap btmpAdvViewC; - wxBitmapButton *btnArwLeft; + wxBitmap* btmpSpacer; + wxBitmap* btmpStatIcnDefault; + wxBitmap* btmpArwL; + wxBitmap* btmpArwR; + wxBitmap* btmpArwLC; + wxBitmap* btmpArwRC; + wxBitmap* btmpAddProj; + wxBitmap* btmpAddProjC; + wxBitmap* btmpMessages; + wxBitmap* btmpMessagesC; + wxBitmap* btmpAlertMessages; + wxBitmap* btmpAlertMessagesC; + wxBitmap* btmpPause; + wxBitmap* btmpPauseC; + wxBitmap* btmpResume; + wxBitmap* btmpResumeC; + wxBitmap* btmpPref; + wxBitmap* btmpPrefC; + wxBitmap* btmpAdvView; + wxBitmap* btmpAdvViewC; + wxBitmap* btmpComponentBg; + + wxBitmapButton *btnArwLeft; wxBitmapButton *btnArwRight; wxBitmapButton *btnAddProj; wxBitmapButton *btnMessages; @@ -105,9 +89,6 @@ public: wxBitmapButton *btnResume; wxBitmapButton *btnPreferences; wxBitmapButton *btnAdvancedView; - // bg - wxBitmap *btmpComponentBg; - wxBitmap fileImgBuf[1]; CProjectsComponent(); CProjectsComponent(CSimpleFrame* parent,wxPoint coord); @@ -130,7 +111,7 @@ protected: int m_rightIndex; void OnEraseBackground(wxEraseEvent& event); - void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz); + void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz); private: wxTimer* checkForMessagesTimer; diff --git a/clientgui/sg_SkinClass.cpp b/clientgui/sg_SkinClass.cpp index 6ca9278843..e1fa4758d5 100644 --- a/clientgui/sg_SkinClass.cpp +++ b/clientgui/sg_SkinClass.cpp @@ -60,18 +60,26 @@ bool SkinClass::CheckSkin() return false;//skin xml file is not available } - wxString dirPref = compute_skin_dir()+_T("/"); - if ( skinImageNames.size() != 35 ) { return false; } + return LoadImages();; +} + +bool SkinClass::LoadImages() { + wxString dirPref = compute_skin_dir()+_T("/"); for( wxStringHashMap::iterator x = skinImageNames.begin(); x != skinImageNames.end();x++){ wxString imgLoc = x->second; - wxBitmap skinImage = wxBitmap(dirPref + imgLoc,wxBITMAP_TYPE_ANY); - if(!skinImage.Ok()){ + wxBitmap* skinImage = new wxBitmap(dirPref + imgLoc,wxBITMAP_TYPE_ANY); + if(!skinImage->Ok()){ return false; } else { + wxBitmapHashMap::iterator y = skinImages.find(x->first); + if ( y != skinImages.end() ) { + delete y->second; + skinImages.erase(y); + } skinImages[x->first] = skinImage; } } @@ -215,6 +223,7 @@ bool SkinClass::change_skin(const wxString& new_skin_name) { } else { m_skinName = old_skin_name; LoadSkinXML(); + LoadImages(); return false; } } @@ -226,6 +235,7 @@ bool SkinClass::init_skin(const wxString& skin_name) { } else { m_skinName = wxString("default"); LoadSkinXML(); + LoadImages(); return false; } } diff --git a/clientgui/sg_SkinClass.h b/clientgui/sg_SkinClass.h index 79d09ff8f0..1772d5f7ae 100644 --- a/clientgui/sg_SkinClass.h +++ b/clientgui/sg_SkinClass.h @@ -34,45 +34,45 @@ public: bool init_skin(const wxString& skin_name); // Getters - wxString GetAppBg() { return skinImageNames[wxString(_T("background"))]; } + wxBitmap* GetAppBg() { return skinImages[wxString(_T("background"))]; } wxColour GetAppBgCol() { return GetColorFromStr(m_appBgCol); } - wxString GetProjCompBg() { return skinImageNames[wxString(_T("project_component_background"))]; } - wxString GetSpacerImage() { return skinImageNames[wxString(_T("spacer_image"))]; } - wxString GetWorkunitBg() { return skinImageNames[wxString(_T("workunit_background"))]; } - wxString GetBtnPrefer() { return skinImageNames[wxString(_T("preferences_button"))]; } - wxString GetBtnAddProj() { return skinImageNames[wxString(_T("add_project_button"))]; } - wxString GetBtnAddProjClick() { return skinImageNames[wxString(_T("add_project_clicked_button"))]; } - wxString GetBtnAdvView() { return skinImageNames[wxString(_T("advanced_view_button"))]; } - wxString GetBtnResume() { return skinImageNames[wxString(_T("resume_button"))]; } - wxString GetBtnPause() { return skinImageNames[wxString(_T("pause_button"))]; } - wxString GetBtnMessages() { return skinImageNames[wxString(_T("messages_button"))]; } - wxString GetBtnAlertMessages() { return skinImageNames[wxString(_T("alert_messages_button"))]; } - wxString GetBtnSave() { return skinImageNames[wxString(_T("save_button"))]; } - wxString GetBtnSaveClick() { return skinImageNames[wxString(_T("save_clicked_button"))]; } - wxString GetBtnCancel() { return skinImageNames[wxString(_T("cancel_button"))]; } - wxString GetBtnCancelClick() { return skinImageNames[wxString(_T("cancel_clicked_button"))]; } - wxString GetBtnClear() { return skinImageNames[wxString(_T("clear_button"))]; } - wxString GetBtnClearClick() { return skinImageNames[wxString(_T("clear_clicked_button"))]; } - wxString GetBtnClose() { return skinImageNames[wxString(_T("close_button"))]; } - wxString GetBtnCloseClick() { return skinImageNames[wxString(_T("close_clicked_button"))]; } - wxString GetBtnLeftArr() { return skinImageNames[wxString(_T("left_arrow_button"))]; } - wxString GetBtnRightArr() { return skinImageNames[wxString(_T("right_arrow_button"))]; } - wxString GetBtnLeftArrClick() { return skinImageNames[wxString(_T("left_arrow_clicked_button"))]; } - wxString GetBtnRightArrClick() { return skinImageNames[wxString(_T("right_arrow_clicked_button"))]; } + wxBitmap* GetProjCompBg() { return skinImages[wxString(_T("project_component_background"))]; } + wxBitmap* GetSpacerImage() { return skinImages[wxString(_T("spacer_image"))]; } + wxBitmap* GetWorkunitBg() { return skinImages[wxString(_T("workunit_background"))]; } + wxBitmap* GetBtnPrefer() { return skinImages[wxString(_T("preferences_button"))]; } + wxBitmap* GetBtnAddProj() { return skinImages[wxString(_T("add_project_button"))]; } + wxBitmap* GetBtnAddProjClick() { return skinImages[wxString(_T("add_project_clicked_button"))]; } + wxBitmap* GetBtnAdvView() { return skinImages[wxString(_T("advanced_view_button"))]; } + wxBitmap* GetBtnResume() { return skinImages[wxString(_T("resume_button"))]; } + wxBitmap* GetBtnPause() { return skinImages[wxString(_T("pause_button"))]; } + wxBitmap* GetBtnMessages() { return skinImages[wxString(_T("messages_button"))]; } + wxBitmap* GetBtnAlertMessages() { return skinImages[wxString(_T("alert_messages_button"))]; } + wxBitmap* GetBtnSave() { return skinImages[wxString(_T("save_button"))]; } + wxBitmap* GetBtnSaveClick() { return skinImages[wxString(_T("save_clicked_button"))]; } + wxBitmap* GetBtnCancel() { return skinImages[wxString(_T("cancel_button"))]; } + wxBitmap* GetBtnCancelClick() { return skinImages[wxString(_T("cancel_clicked_button"))]; } + wxBitmap* GetBtnClear() { return skinImages[wxString(_T("clear_button"))]; } + wxBitmap* GetBtnClearClick() { return skinImages[wxString(_T("clear_clicked_button"))]; } + wxBitmap* GetBtnClose() { return skinImages[wxString(_T("close_button"))]; } + wxBitmap* GetBtnCloseClick() { return skinImages[wxString(_T("close_clicked_button"))]; } + wxBitmap* GetBtnLeftArr() { return skinImages[wxString(_T("left_arrow_button"))]; } + wxBitmap* GetBtnRightArr() { return skinImages[wxString(_T("right_arrow_button"))]; } + wxBitmap* GetBtnLeftArrClick() { return skinImages[wxString(_T("left_arrow_clicked_button"))]; } + wxBitmap* GetBtnRightArrClick() { return skinImages[wxString(_T("right_arrow_clicked_button"))]; } - wxString GetDlgPrefBg() { return skinImageNames[wxString(_T("preferences_dialogue"))]; } - wxString GetDlgMessBg() { return skinImageNames[wxString(_T("messages_dialogue"))]; } + wxBitmap* GetDlgPrefBg() { return skinImages[wxString(_T("preferences_dialogue"))]; } + wxBitmap* GetDlgMessBg() { return skinImages[wxString(_T("messages_dialogue"))]; } wxColour GetStaticLineCol() { return GetColorFromStr(m_staticLineCol); } - wxString GetGaugeBg() { return skinImageNames[wxString(_T("gauge_background"))]; } - wxString GetGaugeProgressInd() { return skinImageNames[wxString(_T("gauge_progress"))]; } + wxBitmap* GetGaugeBg() { return skinImages[wxString(_T("gauge_background"))]; } + wxBitmap* GetGaugeProgressInd() { return skinImages[wxString(_T("gauge_progress"))]; } - wxString GetStateIndBg() { return skinImageNames[wxString(_T("state_indicator_background"))]; } - wxString GetConnInd() { return skinImageNames[wxString(_T("connecting_indicator"))]; } - wxString GetErrorInd() { return skinImageNames[wxString(_T("error_indicator"))]; } + wxBitmap* GetStateIndBg() { return skinImages[wxString(_T("state_indicator_background"))]; } + wxBitmap* GetConnInd() { return skinImages[wxString(_T("connecting_indicator"))]; } + wxBitmap* GetErrorInd() { return skinImages[wxString(_T("error_indicator"))]; } - wxString GetTabAreaBg() { return skinImageNames[wxString(_T("tab_area_background"))]; } + wxBitmap* GetTabAreaBg() { return skinImages[wxString(_T("tab_area_background"))]; } wxColour GetTabFromColAc() { return GetColorFromStr(m_tabFromColAc); } wxColour GetTabToColAc() { return GetColorFromStr(m_tabToColAc); } wxColour GetTabBrdColAc() { return GetColorFromStr(m_tabBrdColAc); } @@ -80,9 +80,9 @@ public: wxColour GetTabToColIn() { return GetColorFromStr(m_tabToColIn); } wxColour GetTabBrdColIn() { return GetColorFromStr(m_tabBrdColIn); } - wxString GetIcnWorkingWkUnit() { return skinImageNames[wxString(_T("workingWkUnit"))]; } - wxString GetDefaultStatIcn() { return skinImageNames[wxString(_T("defaultStatIcon"))]; } - wxString GetAnimationBg() { return skinImageNames[wxString(_T("animation_background"))]; } + wxBitmap* GetIcnWorkingWkUnit() { return skinImages[wxString(_T("workingWkUnit"))]; } + wxBitmap* GetDefaultStatIcn() { return skinImages[wxString(_T("defaultStatIcon"))]; } + wxBitmap* GetAnimationBg() { return skinImages[wxString(_T("animation_background"))]; } wxString GetAnimationFile() const { return m_animFile; } wxString GetSkinName() const { return m_skinName; } @@ -118,6 +118,7 @@ private: bool CheckSkin(); int LoadSkinXML(); + bool LoadImages(); // Bg wxString m_appBgCol; @@ -139,7 +140,7 @@ private: WX_DECLARE_STRING_HASH_MAP( wxString, wxStringHashMap ); wxStringHashMap skinImageNames; - WX_DECLARE_STRING_HASH_MAP( wxBitmap, wxBitmapHashMap ); + WX_DECLARE_STRING_HASH_MAP( wxBitmap*, wxBitmapHashMap ); wxBitmapHashMap skinImages; wxFlatNotebookImageList m_ImageList; diff --git a/clientgui/sg_StatImageLoader.cpp b/clientgui/sg_StatImageLoader.cpp index d63bc3fbd7..958f94d57b 100644 --- a/clientgui/sg_StatImageLoader.cpp +++ b/clientgui/sg_StatImageLoader.cpp @@ -31,7 +31,7 @@ StatImageLoader::StatImageLoader(wxWindow* parent, std::string url) : wxWindow(p void StatImageLoader::PopUpMenu(wxMouseEvent& WXUNUSED(event)) { // pop up menu - bool menuPoped = PopupMenu(statPopUpMenu); + PopupMenu(statPopUpMenu); } void StatImageLoader::RebuildMenu() { @@ -81,7 +81,6 @@ void StatImageLoader::OnMenuLinkClicked(wxCommandEvent& event) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(pDoc); - wxObject *m_wxBtnObj = event.GetEventObject(); int menuIDevt = event.GetId(); if(menuIDevt == WEBSITE_URL_MENU_ID_REMOVE_PROJECT){ @@ -142,29 +141,28 @@ void StatImageLoader::OnProjectDetach() { } } -void StatImageLoader::LoadStatIcon(const wxImage& image) { - Bitmap = wxBitmap();//delete existing bitmap since we are loading new one +void StatImageLoader::LoadStatIcon(wxBitmap& image) { int width = image.GetWidth(); int height = image.GetHeight(); - Bitmap = wxBitmap(image); + Bitmap = image; SetSize(width, height); } -void StatImageLoader::LoadImage(std::string project_icon, const wxImage& defaultImage) +void StatImageLoader::LoadImage(std::string project_icon, wxBitmap* defaultImage) { char defaultIcnPath[256]; bool defaultUsed = true; if(boinc_resolve_filename(project_icon.c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0){ - wxImage* g_statIcn = new wxImage(); - if ( g_statIcn->LoadFile(defaultIcnPath, wxBITMAP_TYPE_PNG) ) { - LoadStatIcon(g_statIcn); + wxBitmap* btmpStatIcn = new wxBitmap(); + if ( btmpStatIcn->LoadFile(defaultIcnPath, wxBITMAP_TYPE_ANY) ) { + LoadStatIcon(*btmpStatIcn); defaultUsed = false; } else { - LoadStatIcon(defaultImage); + LoadStatIcon(*defaultImage); } }else{ - LoadStatIcon(defaultImage); + LoadStatIcon(*defaultImage); } if ( defaultUsed ) { @@ -180,9 +178,9 @@ void StatImageLoader::CheckForProjectIconDownloaded(wxTimerEvent& WXUNUSED(event bool success = false; // Check project icon downloaded if(boinc_resolve_filename(projectIcon.c_str(), defaultIcnPath, sizeof(defaultIcnPath)) == 0){ - wxImage* g_statIcn = new wxImage(); - if ( g_statIcn->LoadFile(defaultIcnPath, wxBITMAP_TYPE_PNG) ) { - LoadStatIcon(g_statIcn); + wxBitmap* btmpStatIcn = new wxBitmap(); + if ( btmpStatIcn->LoadFile(defaultIcnPath, wxBITMAP_TYPE_ANY) ) { + LoadStatIcon(*btmpStatIcn); success = true; Refresh(); Update(); diff --git a/clientgui/sg_StatImageLoader.h b/clientgui/sg_StatImageLoader.h index 783473b06e..3de519fdb7 100644 --- a/clientgui/sg_StatImageLoader.h +++ b/clientgui/sg_StatImageLoader.h @@ -17,7 +17,7 @@ public: std::string m_prjUrl; /// Constructors StatImageLoader(wxWindow* parent, std::string url); - void LoadImage(std::string project_icon, const wxImage& defaultImage); + void LoadImage(std::string project_icon, wxBitmap* defaultImage); void CreateMenu(); void OnMenuLinkClicked(wxCommandEvent& event); void OnProjectDetach(); @@ -32,7 +32,7 @@ private: int numReloadTries; size_t urlCount; wxTimer* attemptToReloadTimer; - void LoadStatIcon(const wxImage& image); + void LoadStatIcon(wxBitmap& image); void CheckForProjectIconDownloaded(wxTimerEvent& WXUNUSED(event)); DECLARE_EVENT_TABLE() }; diff --git a/clientgui/sg_ViewTabPage.cpp b/clientgui/sg_ViewTabPage.cpp index 0945b29e6a..7e7d25ae7a 100644 --- a/clientgui/sg_ViewTabPage.cpp +++ b/clientgui/sg_ViewTabPage.cpp @@ -61,18 +61,14 @@ CViewTabPage::CViewTabPage(wxFlatNotebook* parent,RESULT* result,std::string nam } -CViewTabPage::~CViewTabPage() {} +CViewTabPage::~CViewTabPage() { +} void CViewTabPage::LoadSkinImages(){ //app skin class appSkin = SkinClass::Instance(); dirPref = appSkin->GetSkinsFolder()+_T("/")+appSkin->GetSkinName()+_T("/"); - //anim bg - g_projBg = new wxImage(dirPref + appSkin->GetAnimationBg(), wxBITMAP_TYPE_PNG); - ////////////////////////////// - //component bg - fileImgBuf[0].LoadFile(dirPref + appSkin->GetWorkunitBg(),wxBITMAP_TYPE_PNG); - btmpComponentBg=&fileImgBuf[0]; + btmpComponentBg=appSkin->GetWorkunitBg(); } void CViewTabPage::CreatePage() @@ -91,7 +87,7 @@ void CViewTabPage::CreatePage() //Line Proj Name lnProjName = new CStaticLine(this,wxPoint(20,36),wxSize(316,1)); lnProjName->SetLineColor(appSkin->GetStaticLineCol()); - // + //TODO - is this line below needed? wxStaticLine spacerLine = new wxStaticLine(this,-1,wxPoint(20,36),wxSize(305,1)); //My Progress @@ -111,9 +107,7 @@ void CViewTabPage::CreatePage() m_hasGraphic = true; } // project image behind graphic <><><> - wxString dirPref = appSkin->GetSkinsFolder()+_T("/")+appSkin->GetSkinName()+_T("/"); - wxImage g_projBg = new wxImage(dirPref + appSkin->GetAnimationBg(), wxBITMAP_TYPE_PNG); - btnAminBg = new CImageButton(this,wxBitmap(g_projBg),wxPoint(28,154),wxSize(294,146),m_hasGraphic); + btnAminBg = new CImageButton(this,*(appSkin->GetAnimationBg()),wxPoint(28,154),wxSize(294,146),m_hasGraphic); //// Animation Window wAnimWk1=new wxWindow(this,-1,wxPoint(98,156),wxSize(148,142),wxNO_BORDER); @@ -171,7 +165,7 @@ void CViewTabPage::ReskinInterface() //Load new skin images LoadSkinImages(); //animation bg - btnAminBg->SetImage(wxBitmap(g_projBg)); + btnAminBg->SetImage(*(appSkin->GetAnimationBg())); //line lnProjName->SetLineColor(appSkin->GetStaticLineCol()); // gauge @@ -327,10 +321,10 @@ void CViewTabPage::DrawText() } void CViewTabPage::OnEraseBackground(wxEraseEvent& event){ wxObject *m_wxWin = event.GetEventObject(); - if(m_wxWin==this){event.Skip(true);DrawBackImg(event,this,*btmpComponentBg,0);return;} + if(m_wxWin==this){event.Skip(true);DrawBackImg(event,this,btmpComponentBg,0);return;} event.Skip(true); } -void CViewTabPage::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz){ +void CViewTabPage::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz){ event.Skip(false); wxDC *dc; @@ -339,19 +333,19 @@ void CViewTabPage::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitM dc->Clear(); switch (opz) { case 0:{ - dc->DrawBitmap(bitMap, 0, 0); + dc->DrawBitmap(*bitMap, 0, 0); break;} case 1:{ wxRect rec=win->GetClientRect(); - rec.SetLeft((rec.GetWidth()-bitMap.GetWidth()) / 2); - rec.SetTop ((rec.GetHeight()-bitMap.GetHeight()) / 2); - dc->DrawBitmap(bitMap,rec.GetLeft(),rec.GetTop(),0); + rec.SetLeft((rec.GetWidth()-bitMap->GetWidth()) / 2); + rec.SetTop ((rec.GetHeight()-bitMap->GetHeight()) / 2); + dc->DrawBitmap(*bitMap,rec.GetLeft(),rec.GetTop(),0); break;} case 2:{ wxRect rec=win->GetClientRect(); - for(int y=0;y < rec.GetHeight();y+=bitMap.GetHeight()){ - for(int x=0;x < rec.GetWidth();x+=bitMap.GetWidth()){ - dc->DrawBitmap(bitMap,x,y,0); + for(int y=0;y < rec.GetHeight();y+=bitMap->GetHeight()){ + for(int x=0;x < rec.GetWidth();x+=bitMap->GetWidth()){ + dc->DrawBitmap(*bitMap,x,y,0); } } break;} diff --git a/clientgui/sg_ViewTabPage.h b/clientgui/sg_ViewTabPage.h index b5c1d1457b..a689108869 100644 --- a/clientgui/sg_ViewTabPage.h +++ b/clientgui/sg_ViewTabPage.h @@ -56,10 +56,8 @@ public: // btns //////////// //////////////////// // animation - wxBitmap *btmpBgAnim; - wxBitmap fileImgBuf[1]; - wxImage *g_projBg; - wxWindow *wAnimWk1; + wxBitmap* btmpBgAnim; + wxWindow* wAnimWk1; CImageButton * btnAminBg; //line CStaticLine *lnProjName; @@ -77,7 +75,7 @@ public: wxString percStr; wxFloat64 percNum; // bg - wxBitmap *btmpComponentBg; + wxBitmap* btmpComponentBg; RESULT* resultWU; CViewTabPage(); @@ -119,7 +117,7 @@ protected: void SGUITimeFormat( float fBuffer, wxString& strBuffer) const; void OnEraseBackground(wxEraseEvent& event); - void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz); + void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap* bitMap,int opz); MyCanvas* m_canvas; wxGIFAnimationCtrl* m_animationCtrl;