From 0dbc713d1987b0ae171ca0e337faee326bec37cc Mon Sep 17 00:00:00 2001 From: Milos Travar Date: Thu, 20 Jul 2006 17:57:23 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=10695 --- clientgui/sg_BoincSimpleGUI.cpp | 2 +- clientgui/sg_BoincSimpleGUI.h | 2 ++ clientgui/sg_DlgPreferences.h | 5 ++-- clientgui/sg_StatImageLoader.cpp | 51 ++++++++++++++++++++++++++++++-- clientgui/sg_StatImageLoader.h | 4 ++- clientgui/sg_ViewTabPage.cpp | 6 ++-- 6 files changed, 60 insertions(+), 10 deletions(-) diff --git a/clientgui/sg_BoincSimpleGUI.cpp b/clientgui/sg_BoincSimpleGUI.cpp index 69ce6678d5..e05188c571 100644 --- a/clientgui/sg_BoincSimpleGUI.cpp +++ b/clientgui/sg_BoincSimpleGUI.cpp @@ -341,7 +341,7 @@ void CSimpleFrame::InitSimpleClient() // Project button wxWindow *w_statW = new wxWindow(this,-1,wxPoint(60 + 52*j,460),wxSize(52,52)); wxToolTip *statToolTip = new wxToolTip(toolTipTxt); - StatImageLoader *i_statW = new StatImageLoader(w_statW,project->master_url); + StatImageLoader *i_statW = new StatImageLoader(w_statW,project->master_url,j); // resolve the proj image url_to_project_dir((char*)project->master_url.c_str() ,urlDirectory); dirProjectGraphic = (std::string)urlDirectory + "/" + projectIconName; diff --git a/clientgui/sg_BoincSimpleGUI.h b/clientgui/sg_BoincSimpleGUI.h index 1cf67f7571..f065c72e85 100644 --- a/clientgui/sg_BoincSimpleGUI.h +++ b/clientgui/sg_BoincSimpleGUI.h @@ -22,6 +22,8 @@ #define _SIMPLEFRAME_H_ class CViewTabPage; +class ImageLoader; + // Define a new frame class CSimpleFrame : public CBOINCBaseFrame diff --git a/clientgui/sg_DlgPreferences.h b/clientgui/sg_DlgPreferences.h index 5389db3078..5ae20a10a1 100644 --- a/clientgui/sg_DlgPreferences.h +++ b/clientgui/sg_DlgPreferences.h @@ -1,3 +1,5 @@ +#ifndef _DLG_PREFERENCES_H_ +#define _DLG_PREFERENCES_H_ #include "sg_SkinClass.h" @@ -62,6 +64,5 @@ protected: //[win]end your code }; -// end CDlgPreferences -//#endif +#endif // end CDlgPreferences diff --git a/clientgui/sg_StatImageLoader.cpp b/clientgui/sg_StatImageLoader.cpp index 32d07f66d3..7c6677992c 100644 --- a/clientgui/sg_StatImageLoader.cpp +++ b/clientgui/sg_StatImageLoader.cpp @@ -3,6 +3,8 @@ #include "BOINCGUIApp.h" #include "sg_StatImageLoader.h" #include "BOINCBaseFrame.h" +//#include "sg_BoincSimpleGUI.h" + enum{ WEBSITE_URL_MENU_ID = 34500, @@ -17,11 +19,11 @@ BEGIN_EVENT_TABLE(StatImageLoader, wxWindow) EVT_MENU(WEBSITE_URL_MENU_ID_REMOVE_PROJECT,StatImageLoader::OnMenuLinkClicked) END_EVENT_TABLE() -StatImageLoader::StatImageLoader(wxWindow* parent, std::string url) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER) +StatImageLoader::StatImageLoader(wxWindow* parent, std::string url,int index) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER) { m_parent = parent; - appSkin = SkinClass::Instance(); m_prjUrl = url; + m_ProjIconIndex = index; CreateMenu(); } @@ -36,6 +38,8 @@ void StatImageLoader::CreateMenu() CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(pDoc); + appSkin = SkinClass::Instance(); + PROJECT* project = pDoc->state.lookup_project(m_prjUrl); int urlCount = project->gui_urls.size(); @@ -80,7 +84,8 @@ void StatImageLoader::OnMenuLinkClicked(wxCommandEvent& event) int menuIDevt = event.GetId(); if(menuIDevt == WEBSITE_URL_MENU_ID_REMOVE_PROJECT){ - //call detach project function + //call detach project function + OnProjectDetach(); }else{ int menuId = menuIDevt - WEBSITE_URL_MENU_ID; PROJECT* project = pDoc->state.lookup_project(m_prjUrl); @@ -94,6 +99,46 @@ void StatImageLoader::OnMenuLinkClicked(wxCommandEvent& event) } } +void StatImageLoader::OnProjectDetach() { + wxLogTrace(wxT("Function Start/End"), wxT("StatImageLoader::OnProjectDetach - Function Begin")); + + wxInt32 iAnswer = 0; + std::string strProjectName; + wxString strMessage = wxEmptyString; + CMainDocument* pDoc = wxGetApp().GetDocument(); + + //CSimpleFrame* pFrame = wxDynamicCast(GetParent()->GetParent(), CSimpleFrame); + + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + // wxASSERT(pFrame); + + if (!pDoc->IsUserAuthorized()) + return; + + PROJECT* project = pDoc->project(m_ProjIconIndex); + project->get_name(strProjectName); + + strMessage.Printf( + _("Are you sure you want to detach from project '%s'?"), + strProjectName.c_str() + ); + + iAnswer = ::wxMessageBox( + strMessage, + _("Detach from Project"), + wxYES_NO | wxICON_QUESTION, + this + ); + + if (wxYES == iAnswer) { + pDoc->ProjectDetach(m_ProjIconIndex); + } + //pFrame->FireRefreshView(); + + wxLogTrace(wxT("Function Start/End"), wxT("StatImageLoader::OnProjectDetach - Function End")); +} + void StatImageLoader::LoadImage(const wxImage& image) { diff --git a/clientgui/sg_StatImageLoader.h b/clientgui/sg_StatImageLoader.h index 19c0dc5770..267e867f19 100644 --- a/clientgui/sg_StatImageLoader.h +++ b/clientgui/sg_StatImageLoader.h @@ -18,14 +18,16 @@ public: SkinClass *appSkin; std::string m_prjUrl; /// Constructors - StatImageLoader(wxWindow* parent, std::string url); + StatImageLoader(wxWindow* parent, std::string url,int index); void LoadImage(const wxImage& image); void CreateMenu(); void OnMenuLinkClicked(wxCommandEvent& event); + void OnProjectDetach(); void PopUpMenu(wxMouseEvent& event); void OnPaint(wxPaintEvent& event); private: //private memb + int m_ProjIconIndex; wxWindow *m_parent; wxBitmap Bitmap; DECLARE_EVENT_TABLE() diff --git a/clientgui/sg_ViewTabPage.cpp b/clientgui/sg_ViewTabPage.cpp index 39634516f6..c3a3161e69 100644 --- a/clientgui/sg_ViewTabPage.cpp +++ b/clientgui/sg_ViewTabPage.cpp @@ -342,13 +342,13 @@ void CViewTabPage::OnWorkShowGraphics() { if (wxYES == iAnswer) { int x = 3; - /*pDoc->WorkShowGraphics( - m_pListPane->GetFirstSelected(), + pDoc->WorkShowGraphics( + m_tabIndex, MODE_WINDOW, wxGetApp().m_strDefaultWindowStation, wxGetApp().m_strDefaultDesktop, wxGetApp().m_strDefaultDisplay - );*/ + ); } //pFrame->FireRefreshView();