mirror of https://github.com/BOINC/boinc.git
MGR: In Simple View, sort Project & Task Selection Controls case-insensitive, fix bugs in MacBitmapComboBox.cpp
svn path=/trunk/boinc/; revision=24647
This commit is contained in:
parent
7aa51c84c3
commit
28c52cfd9d
|
@ -8648,3 +8648,15 @@ Charlie 23 Nov 2011
|
|||
|
||||
clientgui/
|
||||
sg_TaskPanel.cpp,.h
|
||||
|
||||
Charlie 23 Nov 2011
|
||||
- MGR: In Simple View, sort Project Selection Control; make sorting of
|
||||
Project and Task Selection controls case-insensitive, fix bugs in
|
||||
MacBitmapComboBox.cpp.
|
||||
|
||||
clientgui/
|
||||
mac/
|
||||
MacBitmapComboBox.cpp
|
||||
MacBitmapComboBox.cpp
|
||||
sg_ProjectPanel.cpp
|
||||
sg_TaskPanel.cpp
|
||||
|
|
|
@ -179,7 +179,9 @@ int CBOINCBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap) {
|
|||
m_BitmapCache.push_back(bitmap);
|
||||
}
|
||||
|
||||
return m_ChoiceControl->Append(item);
|
||||
int n = m_ChoiceControl->Append(item);
|
||||
SetItemBitmap(n, bitmap);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,6 +204,7 @@ int CBOINCBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap, u
|
|||
delete bm;
|
||||
}
|
||||
int n = m_ChoiceControl->Insert(item, pos);
|
||||
SetItemBitmap(n, bitmap);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@ -215,6 +218,7 @@ int CBOINCBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap, u
|
|||
}
|
||||
|
||||
int n = m_ChoiceControl->Insert(item, pos, clientData);
|
||||
SetItemBitmap(n, bitmap);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#define TESTBIGICONPOPUP 0
|
||||
|
||||
#define SORTPROJECTLIST 1
|
||||
|
||||
#include "stdwx.h"
|
||||
#include "Events.h"
|
||||
#include "app_ipc.h"
|
||||
|
@ -389,36 +391,58 @@ void CSimpleProjectPanel::UpdateProjectList() {
|
|||
ProjectSelectionData* selData;
|
||||
PROJECT* project;
|
||||
char* ctrl_url;
|
||||
int i, j;
|
||||
int i, j, oldProjectSelection, newProjectSelection;
|
||||
|
||||
if ( pDoc->IsConnected() ) {
|
||||
int projCnt = pDoc->GetSimpleProjectCount();
|
||||
int ctrlCount = m_ProjectSelectionCtrl->GetCount();
|
||||
|
||||
// If a new project has been added, figure out which one and then add it;
|
||||
while ( projCnt > ctrlCount ) {
|
||||
for(i=0; i<projCnt; i++) {
|
||||
project = pDoc->state.projects[i];
|
||||
bool found = false;
|
||||
for(j=0; j<ctrlCount; j++) {
|
||||
ctrl_url = ((ProjectSelectionData*)m_ProjectSelectionCtrl->GetClientData(j))->project_url;
|
||||
if (!strcmp(project->master_url, ctrl_url)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !found ) {
|
||||
selData = new ProjectSelectionData;
|
||||
strncpy(selData->project_url, project->master_url, sizeof(selData->project_url));
|
||||
selData->project_files_downloaded_time = 0.0;
|
||||
wxBitmap* projectBM = GetProjectSpecificBitmap(selData->project_url);
|
||||
wxString projname(project->project_name.c_str(), wxConvUTF8);
|
||||
m_ProjectSelectionCtrl->Append(projname, *projectBM, (void*)selData);
|
||||
ctrlCount = m_ProjectSelectionCtrl->GetCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
oldProjectSelection = m_ProjectSelectionCtrl->GetSelection();
|
||||
|
||||
// If a new project has been added, figure out which one
|
||||
for(i=0; i<projCnt; i++) {
|
||||
project = pDoc->state.projects[i];
|
||||
bool found = false;
|
||||
for(j=0; j<ctrlCount; j++) {
|
||||
ctrl_url = ((ProjectSelectionData*)m_ProjectSelectionCtrl->GetClientData(j))->project_url;
|
||||
if (!strcmp(project->master_url, ctrl_url)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if it isn't currently in the list then we have a new one! lets add it
|
||||
if ( !found ) {
|
||||
wxString projname(project->project_name.c_str(), wxConvUTF8);
|
||||
#if SORTPROJECTLIST
|
||||
int alphaOrder;
|
||||
for(j = 0; j < ctrlCount; ++j) {
|
||||
alphaOrder = (m_ProjectSelectionCtrl->GetString(j)).CmpNoCase(projname);
|
||||
if (alphaOrder > 0) {
|
||||
break; // Insert the new item here (sorted by item label)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
selData = new ProjectSelectionData;
|
||||
strncpy(selData->project_url, project->master_url, sizeof(selData->project_url));
|
||||
selData->project_files_downloaded_time = project->project_files_downloaded_time;
|
||||
wxBitmap* projectBM = GetProjectSpecificBitmap(selData->project_url);
|
||||
#if SORTPROJECTLIST
|
||||
if (j < ctrlCount) {
|
||||
m_ProjectSelectionCtrl->Insert(projname, *projectBM, j, (void*)selData);
|
||||
if (j <= oldProjectSelection) {
|
||||
++oldProjectSelection;
|
||||
m_ProjectSelectionCtrl->SetSelection(oldProjectSelection);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
m_ProjectSelectionCtrl->Append(projname, *projectBM, (void*)selData);
|
||||
}
|
||||
ctrlCount = m_ProjectSelectionCtrl->GetCount();
|
||||
}
|
||||
}
|
||||
|
||||
newProjectSelection = oldProjectSelection;
|
||||
if ( projCnt < ctrlCount ) {
|
||||
project = NULL;
|
||||
// Check items in descending order so deletion won't change indexes of items yet to be checked
|
||||
|
@ -431,9 +455,22 @@ void CSimpleProjectPanel::UpdateProjectList() {
|
|||
// Indicate to Delete() we have cleaned up the Selection Data
|
||||
m_ProjectSelectionCtrl->SetClientData(j, NULL);
|
||||
m_ProjectSelectionCtrl->Delete(j);
|
||||
if (j == oldProjectSelection) {
|
||||
int newCount = m_ProjectSelectionCtrl->GetCount();
|
||||
if (newProjectSelection < newCount) {
|
||||
// Select the next item if one exists
|
||||
m_ProjectSelectionCtrl->SetSelection(newProjectSelection);
|
||||
} else if (newCount > 0) {
|
||||
// Select the previous item if one exists
|
||||
newProjectSelection = newCount-1;
|
||||
m_ProjectSelectionCtrl->SetSelection(newProjectSelection);
|
||||
} else {
|
||||
newProjectSelection = -1;
|
||||
m_ProjectSelectionCtrl->SetSelection(wxNOT_FOUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check to see if we need to reload the project icon
|
||||
|
|
|
@ -725,7 +725,7 @@ void CSimpleTaskPanel::FindSlideShowFiles(TaskSelectionData *selData) {
|
|||
|
||||
void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleTaskPanel::UpdateTaskSelectionList - Function Begin"));
|
||||
int i, j, count, newColor, alphaOrder;;
|
||||
int i, j, count, newColor;
|
||||
TaskSelectionData *selData;
|
||||
RESULT* result;
|
||||
RESULT* ctrlResult;
|
||||
|
@ -779,8 +779,9 @@ void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
|
|||
|
||||
// if it isn't currently in the list then we have a new one! lets add it
|
||||
if (!found) {
|
||||
int alphaOrder;
|
||||
for(j = 0; j < count; ++j) {
|
||||
alphaOrder = (m_TaskSelectionCtrl->GetString(j)).Cmp(resname);
|
||||
alphaOrder = (m_TaskSelectionCtrl->GetString(j)).CmpNoCase(resname);
|
||||
#if SORTTASKLIST
|
||||
if (alphaOrder > 0) {
|
||||
break; // Insert the new item here (sorted by item label)
|
||||
|
@ -860,6 +861,7 @@ void CSimpleTaskPanel::UpdateTaskSelectionList(bool reskin) {
|
|||
needRefresh = true;
|
||||
} else if (j < m_CurrentTaskSelection) {
|
||||
--m_CurrentTaskSelection;
|
||||
m_TaskSelectionCtrl->SetSelection(m_CurrentTaskSelection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue