Mgr: fix a bug deleting entries from Task Selection control introduced on 9 November

svn path=/trunk/boinc/; revision=24577
This commit is contained in:
Charlie Fenton 2011-11-11 11:40:57 +00:00
parent 248c9e8bc7
commit 46157c721d
2 changed files with 29 additions and 18 deletions

View File

@ -8374,3 +8374,12 @@ Charlie 9 Nov 2011
cs_cmdline.cpp cs_cmdline.cpp
clientgui/ clientgui/
BOINCGUIApp.cpp BOINCGUIApp.cpp
Charlie 11 Nov 2011
- Mgr: fix a bug deleting entries from Task Selection control which I
introduced on 9 November. Deleting an entry cvan create a gap in
the alphabetically sorted sequence, so we can't use my earlier
shortcut in checking for existing entries.
clientgui/
sg_TaskPanel.cpp

View File

@ -736,26 +736,28 @@ void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
is_alive.at(j) = true; is_alive.at(j) = true;
break; // skip out of this loop break; // skip out of this loop
} }
alphaOrder = (m_TaskSelectionCtrl->GetString(j)).Cmp(resname);
#if SORTTASKLIST
if (alphaOrder > 0) {
break; // Insert the new item here (sorted by item label)
}
#endif
// wxComboBox and wxBitmapComboBox have bugs on Windows when multiple
// entries have identical text, so add enough spaces to make each
// entry's text unique.
if (alphaOrder == 0) {
resname.Append((const wxChar *)wxT(" "));
#if !SORTTASKLIST
j = -1; // If not sorted, check new name from start for duplicate
#endif
continue;
}
} }
// if it isn't currently in the list 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 (!found) {
for(j = 0; j < count; ++j) {
alphaOrder = (m_TaskSelectionCtrl->GetString(j)).Cmp(resname);
#if SORTTASKLIST
if (alphaOrder > 0) {
break; // Insert the new item here (sorted by item label)
}
#endif
// wxComboBox and wxBitmapComboBox have bugs on Windows when multiple
// entries have identical text, so add enough spaces to make each
// entry's text unique.
if (alphaOrder == 0) {
resname.Append((const wxChar *)wxT(" "));
#if !SORTTASKLIST
j = -1; // If not sorted, check new name from start for duplicate
#endif
}
}
selData = new TaskSelectionData; selData = new TaskSelectionData;
selData->result = result; selData->result = result;
strncpy(selData->result_name, result->name, sizeof(selData->result_name)); strncpy(selData->result_name, result->name, sizeof(selData->result_name));
@ -785,8 +787,8 @@ void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
is_alive.push_back(true); is_alive.push_back(true);
} }
++count; ++count;
} } // End if (!found)
} } // End for (i) loop
// Check items in descending order so deletion won't change indexes of items yet to be checked // Check items in descending order so deletion won't change indexes of items yet to be checked
for(j = count-1; j >=0; --j) { for(j = count-1; j >=0; --j) {