MGR: Bug fix: if currently selected task in Simple View deleted, change selection

svn path=/trunk/boinc/; revision=24463
This commit is contained in:
Charlie Fenton 2011-10-22 11:12:30 +00:00
parent e5153566d4
commit 3373bc801a
2 changed files with 25 additions and 3 deletions

View File

@ -7672,3 +7672,10 @@ Charlie 21 Oct 2011
clientgui/
sg_TaskPanel.cpp
Charlie 21 Oct 2011
- MGR: Bug fix: when the task currently selected in Simple View
is deleted, change selection to a different task.
clientgui/
sg_TaskPanel.cpp

View File

@ -82,7 +82,7 @@ void CSlideShowPanel::AdvanceSlideShow(bool changeSlide) {
TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData();
if (selData == NULL) return;
int numSlides = selData->slideShowFileNames.size();
int numSlides = (int)selData->slideShowFileNames.size();
if (numSlides <= 0) {
if (m_bCurrentSlideIsDefault) return;
@ -691,6 +691,7 @@ void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
RESULT* ctrlResult;
PROJECT* project;
std::vector<bool>is_alive;
bool needRefresh = false;
CMainDocument* pDoc = wxGetApp().GetDocument();
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
@ -729,7 +730,7 @@ void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
}
}
// if it isn't currently one of the tabs then we have a new one! lets add it
// if it isn't currently in the list then we have a new one! lets add it
if (!found) {
#if SELECTBYRESULTNAME
wxString resname(result->name, wxConvUTF8);
@ -761,7 +762,18 @@ void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
delete selData;
m_TaskSelectionCtrl->Delete(j);
if (j == m_CurrentTaskSelection) {
int newCount = m_TaskSelectionCtrl->GetCount();
if (m_CurrentTaskSelection < newCount) {
// Select the next item if one exists
m_TaskSelectionCtrl->SetSelection(m_CurrentTaskSelection);
} else if (newCount > 0) {
// Select the previous item if one exists
m_TaskSelectionCtrl->SetSelection(newCount-1);
} else {
m_TaskSelectionCtrl->SetSelection(wxNOT_FOUND);
}
m_bStableTaskInfoChanged = true;
needRefresh = true;
}
}
}
@ -802,9 +814,12 @@ void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
break;
}
selData->dotColor = newColor;
m_TaskSelectionCtrl->Refresh();
needRefresh = true;
}
}
if (needRefresh) {
m_TaskSelectionCtrl->Refresh();
}
}