diff --git a/checkin_notes b/checkin_notes index 33ced07620..13bb1ea467 100755 --- a/checkin_notes +++ b/checkin_notes @@ -27686,3 +27686,22 @@ Charlie 26 April 2005 mac_saver_module.cpp mac_build/ HowToBuildBOINC_XCode.rtf + +Rom 26 April 2005 + - More code cleanup in the manager. + - Take care of a couple crashing conditions that occurred after the + migration to wxWidgets 2.6.0 + - Make the website buttons work again + - Layout() seems to work better than the call to Fit() to adjust the + various window locations. So switch all the calls from Fit() to + Layout() and see if this fixes the Mac scrollbar issue. + + clientgui/ + BOINCBaseView.cpp, .h + BOINCTaskCtrl.cpp, .h + Events.h + MainFrame.cpp + ViewProjects.cpp + ViewStatistics.cpp + ViewTransfers.cpp + ViewWork.cpp diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index 40e32c2b55..2a8684eab0 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -87,7 +87,9 @@ CBOINCBaseView::CBOINCBaseView( itemFlexGridSizer->Add(m_pTaskPane, 1, wxGROW|wxALL, 1); itemFlexGridSizer->Add(m_pListPane, 1, wxGROW|wxALL, 1); - SetSizerAndFit(itemFlexGridSizer); + SetSizer(itemFlexGridSizer); + + Layout(); } @@ -111,20 +113,6 @@ const char** CBOINCBaseView::GetViewIcon() { } -void CBOINCBaseView::EmptyTasks() { - unsigned int i; - unsigned int j; - for (i=0; im_Tasks.size(); j++) { - delete m_TaskGroups[i]->m_Tasks[j]; - } - m_TaskGroups[i]->m_Tasks.clear(); - delete m_TaskGroups[i]; - } - m_TaskGroups.clear(); -} - - bool CBOINCBaseView::FireOnSaveState(wxConfigBase* pConfig) { return OnSaveState(pConfig); } @@ -379,6 +367,20 @@ int CBOINCBaseView::UpdateCache( } +void CBOINCBaseView::EmptyTasks() { + unsigned int i; + unsigned int j; + for (i=0; im_Tasks.size(); j++) { + delete m_TaskGroups[i]->m_Tasks[j]; + } + m_TaskGroups[i]->m_Tasks.clear(); + delete m_TaskGroups[i]; + } + m_TaskGroups.clear(); +} + + void CBOINCBaseView::UpdateSelection() {} diff --git a/clientgui/BOINCBaseView.h b/clientgui/BOINCBaseView.h index 00258dd851..003f4124d2 100644 --- a/clientgui/BOINCBaseView.h +++ b/clientgui/BOINCBaseView.h @@ -36,8 +36,11 @@ class CTaskItem : wxObject { public: CTaskItem(); CTaskItem( wxString strName, wxString strDescription, wxInt32 iEventID ) : - m_strName(strName), m_strDescription(strDescription), m_iEventID(iEventID), m_pButton(NULL), - m_strWebSiteLink(wxT("")) {}; + m_strName(strName), m_strDescription(strDescription), m_strWebSiteLink(wxT("")), + m_iEventID(iEventID), m_pButton(NULL) {}; + CTaskItem( wxString strName, wxString strDescription, wxString strWebSiteLink, wxInt32 iEventID ) : + m_strName(strName), m_strDescription(strDescription), m_strWebSiteLink(strWebSiteLink), + m_iEventID(iEventID), m_pButton(NULL) {}; ~CTaskItem() {}; wxString m_strName; @@ -100,7 +103,6 @@ public: std::vector m_TaskGroups; protected: - virtual void EmptyTasks(); virtual bool OnSaveState( wxConfigBase* pConfig ); virtual bool OnRestoreState( wxConfigBase* pConfig ); @@ -124,6 +126,8 @@ protected: virtual int SyncronizeCache(); virtual int UpdateCache( long item, long column, wxString& strNewData ); + virtual void EmptyTasks(); + virtual void UpdateSelection(); bool _EnsureLastItemVisible(); diff --git a/clientgui/BOINCTaskCtrl.cpp b/clientgui/BOINCTaskCtrl.cpp index 4f81ea1197..d462bb2851 100644 --- a/clientgui/BOINCTaskCtrl.cpp +++ b/clientgui/BOINCTaskCtrl.cpp @@ -33,7 +33,7 @@ CBOINCTaskCtrl::CBOINCTaskCtrl() {} CBOINCTaskCtrl::CBOINCTaskCtrl(CBOINCBaseView* pView, wxWindowID iTaskWindowID, wxInt32 iTaskWindowFlags) : - wxPanel(pView, iTaskWindowID, wxDefaultPosition, wxSize(175, -1), iTaskWindowFlags) + wxPanel(pView, iTaskWindowID, wxDefaultPosition, wxSize(200, -1), iTaskWindowFlags) { m_pParent = pView; m_pBoxSizer = NULL; @@ -43,6 +43,98 @@ CBOINCTaskCtrl::CBOINCTaskCtrl(CBOINCBaseView* pView, wxWindowID iTaskWindowID, CBOINCTaskCtrl::~CBOINCTaskCtrl() {} +wxInt32 CBOINCTaskCtrl::DeleteTaskGroupAndTasks( CTaskItemGroup* pGroup ) { + unsigned int i; + CTaskItem* pItem = NULL; + + for (i=0; i < pGroup->m_Tasks.size(); i++) { + pItem = pGroup->m_Tasks[i]; + DeleteTask(pGroup, pItem); + } + if (pGroup->m_pStaticBoxSizer) { + m_pBoxSizer->Detach(pGroup->m_pStaticBoxSizer); + pGroup->m_pStaticBoxSizer->Detach(pGroup->m_pStaticBox); + + delete pGroup->m_pStaticBox; + delete pGroup->m_pStaticBoxSizer; + + pGroup->m_pStaticBox = NULL; + pGroup->m_pStaticBoxSizer = NULL; + } + + return 0; +} + + +wxInt32 CBOINCTaskCtrl::DisableTaskGroupTasks( CTaskItemGroup* pGroup ) { + unsigned int i; + CTaskItem* pItem = NULL; + + if (pGroup) { + for (i=0; i < pGroup->m_Tasks.size(); i++) { + pItem = pGroup->m_Tasks[i]; + DisableTask(pItem); + } + } + + return 0; +} + + +wxInt32 CBOINCTaskCtrl::EnableTaskGroupTasks( CTaskItemGroup* pGroup ) { + unsigned int i; + CTaskItem* pItem = NULL; + + if (pGroup) { + for (i=0; i < pGroup->m_Tasks.size(); i++) { + pItem = pGroup->m_Tasks[i]; + EnableTask(pItem); + } + } + + return 0; +} + + +wxInt32 CBOINCTaskCtrl::DeleteTask( CTaskItemGroup* pGroup, CTaskItem* pItem ) { + if (pItem->m_pButton) { + pGroup->m_pStaticBoxSizer->Detach(pItem->m_pButton); + delete pItem->m_pButton; + pItem->m_pButton = NULL; + } + return 0; +} + + +wxInt32 CBOINCTaskCtrl::DisableTask( CTaskItem* pItem ) { + if (pItem->m_pButton) { + pItem->m_pButton->Disable(); + } + return 0; +} + + +wxInt32 CBOINCTaskCtrl::EnableTask( CTaskItem* pItem ) { + if (pItem->m_pButton) { + pItem->m_pButton->Enable(); + } + return 0; +} + + +wxInt32 CBOINCTaskCtrl::UpdateTask( CTaskItem* pItem, wxString strName, wxString strDescription ) { + if (pItem->m_pButton) { + pItem->m_strName = strName; + pItem->m_strDescription = strDescription; + + pItem->m_pButton->SetLabel( strName ); +#if wxUSE_TOOLTIPS + pItem->m_pButton->SetToolTip( strDescription ); +#endif + } + return 0; +} + wxInt32 CBOINCTaskCtrl::UpdateControls() { unsigned int i; @@ -51,20 +143,22 @@ wxInt32 CBOINCTaskCtrl::UpdateControls() { CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL; - bCreateMainSizer = (!GetSizer()); - if (bCreateMainSizer) { + + bCreateMainSizer = !GetSizer(); + if (bCreateMainSizer) { + SetAutoLayout(TRUE); m_pBoxSizer = new wxBoxSizer(wxVERTICAL); m_pBoxSizer->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); } + // Create static boxes and sizers if they don't exist for (i=0; i < m_pParent->m_TaskGroups.size(); i++) { pGroup = m_pParent->m_TaskGroups[i]; - if (!pGroup->m_pStaticBox) { + if (!pGroup->m_pStaticBoxSizer) { pGroup->m_pStaticBox = new wxStaticBox(this, wxID_ANY, pGroup->m_strName); pGroup->m_pStaticBoxSizer = new wxStaticBoxSizer(pGroup->m_pStaticBox, wxVERTICAL); m_pBoxSizer->Add(pGroup->m_pStaticBoxSizer, 0, wxEXPAND|wxALL, 5); - m_pBoxSizer->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); } } @@ -84,12 +178,13 @@ wxInt32 CBOINCTaskCtrl::UpdateControls() { } } + if (bCreateMainSizer) { SetSizer(m_pBoxSizer); - } else { - Fit(); } + Layout(); + return 0; } diff --git a/clientgui/BOINCTaskCtrl.h b/clientgui/BOINCTaskCtrl.h index c51d18fe3c..a858714b57 100644 --- a/clientgui/BOINCTaskCtrl.h +++ b/clientgui/BOINCTaskCtrl.h @@ -25,6 +25,8 @@ #endif +class CTaskItem; +class CTaskItemGroup; class CBOINCBaseView; class CBOINCTaskCtrl : public wxPanel { @@ -36,6 +38,15 @@ public: ~CBOINCTaskCtrl(); + wxInt32 DeleteTaskGroupAndTasks( CTaskItemGroup* pGroup ); + wxInt32 DisableTaskGroupTasks( CTaskItemGroup* pGroup ); + wxInt32 EnableTaskGroupTasks( CTaskItemGroup* pGroup ); + + wxInt32 DeleteTask( CTaskItemGroup* pGroup, CTaskItem* pItem ); + wxInt32 DisableTask( CTaskItem* pItem ); + wxInt32 EnableTask( CTaskItem* pItem ); + wxInt32 UpdateTask( CTaskItem* pItem, wxString strName, wxString strDescription ); + wxInt32 UpdateControls(); virtual bool OnSaveState( wxConfigBase* pConfig ); diff --git a/clientgui/Events.h b/clientgui/Events.h index 234cea58e0..7d538fe44c 100644 --- a/clientgui/Events.h +++ b/clientgui/Events.h @@ -70,7 +70,7 @@ #define ID_TASK_PROJECT_DETACH 9006 #define ID_TASK_PROJECT_ATTACH 9007 #define ID_TASK_PROJECT_WEB_PROJDEF_MIN 9100 -#define ID_TASK_PROJECT_WEB_PROJDEF_MAX 9106 +#define ID_TASK_PROJECT_WEB_PROJDEF_MAX 9150 #define ID_TASK_WORK_SUSPEND 9200 #define ID_TASK_WORK_RESUME 9201 #define ID_TASK_WORK_SHOWGRAPHICS 9202 diff --git a/clientgui/MainFrame.cpp b/clientgui/MainFrame.cpp index 82f89622f7..4c008ecc6d 100644 --- a/clientgui/MainFrame.cpp +++ b/clientgui/MainFrame.cpp @@ -427,9 +427,8 @@ bool CMainFrame::CreateNotebook() { CreateNotebookPage(new CViewResources(m_pNotebook)); - // have the panel calculate everything after the pages are created so - // the mac can display the html control width correctly - pPanel->SetSizerAndFit(pPanelSizer); + pPanel->SetSizer(pPanelSizer); + pPanel->Layout(); wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateNotebook - Function End")); diff --git a/clientgui/ViewProjects.cpp b/clientgui/ViewProjects.cpp index 8f8640a855..b82bcd9bb6 100644 --- a/clientgui/ViewProjects.cpp +++ b/clientgui/ViewProjects.cpp @@ -42,13 +42,17 @@ #define COLUMN_RESOURCESHARE 5 #define COLUMN_STATUS 6 +// groups that contain buttons +#define GRP_TASKS 0 +#define GRP_WEBSITES 1 + // buttons in the "tasks" area -#define BTN_UPDATE 0 -#define BTN_SUSPEND 1 -#define BTN_NOWORK 2 -#define BTN_RESET 3 -#define BTN_DETACH 4 -#define BTN_ATTACH 5 +#define BTN_UPDATE 0 +#define BTN_SUSPEND 1 +#define BTN_NOWORK 2 +#define BTN_RESET 3 +#define BTN_DETACH 4 +#define BTN_ATTACH 5 CProject::CProject() { @@ -94,7 +98,6 @@ CViewProjects::CViewProjects() {} CViewProjects::CViewProjects(wxNotebook* pNotebook) : CBOINCBaseView(pNotebook, ID_TASK_PROJECTSVIEW, DEFAULT_TASK_FLAGS, ID_LIST_PROJECTSVIEW, DEFAULT_LIST_SINGLE_SEL_FLAGS) { - wxInt32 iCurrentEventID = 0; CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL; @@ -118,18 +121,14 @@ CViewProjects::CViewProjects(wxNotebook* pNotebook) : pItem = new CTaskItem( _("Suspend"), - _("Stop work for this project " - "(you can resume later)."), + _("Suspend work for this project."), ID_TASK_PROJECT_SUSPEND ); pGroup->m_Tasks.push_back( pItem ); pItem = new CTaskItem( - _("Don't Get New Work"), - _("Tell the project to not " - "fetch additional work for this " - "project. Any work already downloaded will " - "still be processed and returned."), + _("No new work"), + _("Don't fetch new work for this project."), ID_TASK_PROJECT_NONEWWORK ); pGroup->m_Tasks.push_back( pItem ); @@ -164,18 +163,6 @@ CViewProjects::CViewProjects(wxNotebook* pNotebook) : pGroup->m_Tasks.push_back( pItem ); - pGroup = new CTaskItemGroup( _("Web sites") ); - m_TaskGroups.push_back( pGroup ); - - for (iCurrentEventID = ID_TASK_PROJECT_WEB_PROJDEF_MIN; iCurrentEventID <= ID_TASK_PROJECT_WEB_PROJDEF_MAX; iCurrentEventID++) { - pItem = new CTaskItem( - wxT(""), - wxT(""), - iCurrentEventID - ); - pGroup->m_Tasks.push_back( pItem ); - } - // Create Task Pane Items m_pTaskPane->UpdateControls(); @@ -589,7 +576,7 @@ wxInt32 CViewProjects::UpdateCache(long item, long column, wxString& strNewData) void CViewProjects::UpdateSelection() { - unsigned int j; + unsigned int i; CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL; PROJECT* project = NULL; @@ -597,85 +584,92 @@ void CViewProjects::UpdateSelection() { wxASSERT(NULL != pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + wxASSERT(NULL != m_pTaskPane); // Update the tasks static box buttons + // pGroup = m_TaskGroups[0]; - if (m_pListPane->GetSelectedItemCount() == 0) { - pGroup->button(BTN_UPDATE)->Disable(); - pGroup->button(BTN_SUSPEND)->Disable(); - pGroup->button(BTN_NOWORK)->Disable(); - pGroup->button(BTN_RESET)->Disable(); - pGroup->button(BTN_DETACH)->Disable(); - pGroup->button(BTN_ATTACH)->Enable(); - } else { + if (m_pListPane->GetSelectedItemCount()) { project = pDoc->project(m_pListPane->GetFirstSelected()); - pGroup->button(BTN_UPDATE)->Enable(); - pGroup->button(BTN_SUSPEND)->Enable(); + m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_UPDATE]); + m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_SUSPEND]); if (project->suspended_via_gui) { - pGroup->button(BTN_SUSPEND)->SetLabel(_("Resume")); -#if wxUSE_TOOLTIPS - pGroup->button(BTN_SUSPEND)->SetToolTip(_("Resume work for this project")); -#endif + m_pTaskPane->UpdateTask( + pGroup->m_Tasks[BTN_SUSPEND], _("Resume"), _("Resume work for this project.") + ); } else { - pGroup->button(BTN_SUSPEND)->SetLabel(_("Suspend")); -#if wxUSE_TOOLTIPS - pGroup->button(BTN_SUSPEND)->SetToolTip(_("Suspend work for this project")); -#endif + m_pTaskPane->UpdateTask( + pGroup->m_Tasks[BTN_SUSPEND], _("Suspend"), _("Suspend work for this project.") + ); } - pGroup->button(BTN_NOWORK)->Enable(); + m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_NOWORK]); if (project->dont_request_more_work) { - pGroup->button(BTN_NOWORK)->SetLabel(_("Allow new work")); -#if wxUSE_TOOLTIPS - pGroup->button(BTN_NOWORK)->SetToolTip(_("Allow fetching new work for this project")); -#endif + m_pTaskPane->UpdateTask( + pGroup->m_Tasks[BTN_NOWORK], _("Allow new work"), _("Allow fetching new work for this project.") + ); } else { - pGroup->button(BTN_NOWORK)->SetLabel(_("No new work")); -#if wxUSE_TOOLTIPS - pGroup->button(BTN_NOWORK)->SetToolTip(_("Don't fetch new work for this project")); -#endif + m_pTaskPane->UpdateTask( + pGroup->m_Tasks[BTN_NOWORK], _("No new work"), _("Don't fetch new work for this project.") + ); } - pGroup->button(BTN_RESET)->Enable(); - pGroup->button(BTN_DETACH)->Enable(); - pGroup->button(BTN_ATTACH)->Enable(); + m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_RESET]); + m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_DETACH]); + m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_ATTACH]); + } else { + m_pTaskPane->DisableTaskGroupTasks(pGroup); + m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_ATTACH]); } // Update the websites list - pGroup = m_TaskGroups[1]; - pGroup->m_pStaticBox->Hide(); - for (j=0; j < pGroup->m_Tasks.size(); j++) { - pItem = pGroup->m_Tasks[j]; - pItem->m_pButton->Hide(); + // + if (m_TaskGroups.size() > 1) { + + // Delete task group, objects, and controls. + pGroup = m_TaskGroups[1]; + + m_pTaskPane->DeleteTaskGroupAndTasks(pGroup); + for (i=0; im_Tasks.size(); i++) { + delete pGroup->m_Tasks[i]; + } + pGroup->m_Tasks.clear(); + delete pGroup; + + pGroup = NULL; + + m_TaskGroups.erase( m_TaskGroups.begin() + 1 ); } + + // If something is selected create the tasks and controls if (m_pListPane->GetSelectedItemCount()) { project = pDoc->project(m_pListPane->GetFirstSelected()); - pGroup->m_pStaticBox->Show(); + // Create the web sites task group + pGroup = new CTaskItemGroup( _("Web sites") ); + m_TaskGroups.push_back( pGroup ); // Default project url - pItem = pGroup->m_Tasks[0]; - pItem->m_pButton->SetLabel(project->project_name.c_str()); -#if wxUSE_TOOLTIPS - pItem->m_pButton->SetToolTip(wxT("")); -#endif - pItem->m_pButton->Show(); - pItem->m_strWebSiteLink = project->master_url.c_str(); + pItem = new CTaskItem( + project->project_name.c_str(), + wxT(""), + project->master_url.c_str(), + ID_TASK_PROJECT_WEB_PROJDEF_MIN + ); + pGroup->m_Tasks.push_back(pItem); // Project defined urls - unsigned int number_of_gui_urls = project->gui_urls.size(); - unsigned int max_number_of_buttons = ID_TASK_PROJECT_WEB_PROJDEF_MAX-ID_TASK_PROJECT_WEB_PROJDEF_MIN; - int gui_url_index = 0; - for (j=1;j<=number_of_gui_urls && j<=max_number_of_buttons;j++) { - gui_url_index = j - 1; - pItem = pGroup->m_Tasks[j]; - pItem->m_pButton->SetLabel(project->gui_urls[gui_url_index].name.c_str()); -#if wxUSE_TOOLTIPS - pItem->m_pButton->SetToolTip(project->gui_urls[gui_url_index].description.c_str()); -#endif - pItem->m_pButton->Show(); - pItem->m_strWebSiteLink = project->gui_urls[gui_url_index].url.c_str(); + for (i=0;(igui_urls.size())&&(i<=ID_TASK_PROJECT_WEB_PROJDEF_MAX);i++) { + pItem = new CTaskItem( + project->gui_urls[i].name.c_str(), + project->gui_urls[i].description.c_str(), + project->gui_urls[i].url.c_str(), + ID_TASK_PROJECT_WEB_PROJDEF_MIN + 1 + i + ); + pGroup->m_Tasks.push_back(pItem); } } + + m_pTaskPane->UpdateControls(); } diff --git a/clientgui/ViewStatistics.cpp b/clientgui/ViewStatistics.cpp index 0f13b0d2fb..0df5602277 100644 --- a/clientgui/ViewStatistics.cpp +++ b/clientgui/ViewStatistics.cpp @@ -297,7 +297,7 @@ CViewStatistics::CViewStatistics(wxNotebook* pNotebook) : itemFlexGridSizer->Add(m_pTaskPane, 1, wxGROW|wxALL, 1); itemFlexGridSizer->Add(m_PaintStatistics, 1, wxGROW|wxALL, 1); - SetSizerAndFit(itemFlexGridSizer); + SetSizer(itemFlexGridSizer); pGroup = new CTaskItemGroup( _("Tasks") ); @@ -335,6 +335,8 @@ CViewStatistics::CViewStatistics(wxNotebook* pNotebook) : // Create Task Pane Items m_pTaskPane->UpdateControls(); + Layout(); + UpdateSelection(); } diff --git a/clientgui/ViewTransfers.cpp b/clientgui/ViewTransfers.cpp index e49cd26219..3ded69c0f6 100644 --- a/clientgui/ViewTransfers.cpp +++ b/clientgui/ViewTransfers.cpp @@ -354,12 +354,10 @@ wxInt32 CViewTransfers::UpdateCache(long item, long column, wxString& strNewData void CViewTransfers::UpdateSelection() { CTaskItemGroup* pGroup = m_TaskGroups[0]; - if (m_pListPane->GetSelectedItemCount() == 0) { - pGroup->button(BTN_RETRY)->Disable(); - pGroup->button(BTN_ABORT)->Disable(); + if (m_pListPane->GetSelectedItemCount()) { + m_pTaskPane->EnableTaskGroupTasks(pGroup); } else { - pGroup->button(BTN_RETRY)->Enable(); - pGroup->button(BTN_ABORT)->Enable(); + m_pTaskPane->DisableTaskGroupTasks(pGroup); } } diff --git a/clientgui/ViewWork.cpp b/clientgui/ViewWork.cpp index bcea87bb6e..7549682377 100644 --- a/clientgui/ViewWork.cpp +++ b/clientgui/ViewWork.cpp @@ -104,7 +104,7 @@ CViewWork::CViewWork(wxNotebook* pNotebook) : pItem = new CTaskItem( _("Suspend"), - _("Suspend work on the result."), + _("Suspend work for this result."), ID_TASK_WORK_SUSPEND ); pGroup->m_Tasks.push_back( pItem ); @@ -438,34 +438,34 @@ wxInt32 CViewWork::UpdateCache(long item, long column, wxString& strNewData) { void CViewWork::UpdateSelection() { - CTaskItemGroup* pGroup = m_TaskGroups[0]; + CTaskItemGroup* pGroup = NULL; + CMainDocument* pDoc = wxGetApp().GetDocument(); - if (m_pListPane->GetSelectedItemCount() == 0) { - pGroup->button(BTN_SUSPEND)->Disable(); - pGroup->button(BTN_GRAPHICS)->Disable(); - pGroup->button(BTN_ABORT)->Disable(); - } else { - CMainDocument* pDoc = wxGetApp().GetDocument(); + wxASSERT(NULL != pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + wxASSERT(NULL != m_pTaskPane); + + pGroup = m_TaskGroups[0]; + if (m_pListPane->GetSelectedItemCount()) { RESULT* result = pDoc->result(m_pListPane->GetFirstSelected()); - pGroup->button(BTN_SUSPEND)->Enable(); + m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_SUSPEND]); if (result->suspended_via_gui) { - pGroup->button(BTN_SUSPEND)->SetLabel(wxString("Resume")); -#if wxUSE_TOOLTIPS - pGroup->button(BTN_SUSPEND)->SetToolTip(wxString("Resume work for this result")); -#endif + m_pTaskPane->UpdateTask( + pGroup->m_Tasks[BTN_SUSPEND], _("Resume"), _("Resume work for this result.") + ); } else { - pGroup->button(BTN_SUSPEND)->SetLabel(wxString("Suspend")); -#if wxUSE_TOOLTIPS - pGroup->button(BTN_SUSPEND)->SetToolTip(wxString("Suspend work for this result")); -#endif + m_pTaskPane->UpdateTask( + pGroup->m_Tasks[BTN_SUSPEND], _("Suspend"), _("Suspend work for this result.") + ); } if (result->supports_graphics) { - pGroup->button(BTN_GRAPHICS)->Enable(); + m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_GRAPHICS]); } else { - pGroup->button(BTN_GRAPHICS)->Disable(); + m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_GRAPHICS]); } - pGroup->button(BTN_ABORT)->Enable(); - + m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_ABORT]); + } else { + m_pTaskPane->DisableTaskGroupTasks(pGroup); } }