mirror of https://github.com/BOINC/boinc.git
MGR: To minimize flicker, UpdateSelections() sets each button only once to its final desired state.
svn path=/trunk/boinc/; revision=15995
This commit is contained in:
parent
505e66938a
commit
6742a687e4
|
@ -7413,3 +7413,11 @@ Charlie 12 Sep 2008
|
|||
ViewProjects.cpp
|
||||
ViewTransfers.cpp
|
||||
ViewWork.cpp
|
||||
|
||||
Charlie 13 Sep 2008
|
||||
MGR: To minimize flicker, UpdateSelections() sets each button only
|
||||
once to its final desired state.
|
||||
|
||||
clientgui/
|
||||
ViewProjects.cpp
|
||||
ViewWork.cpp
|
||||
|
|
|
@ -636,28 +636,34 @@ void CViewProjects::UpdateSelection() {
|
|||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
int i, n, row;
|
||||
bool wasSuspended=false, wasNoNewWork=false;
|
||||
bool enableUpdate = false;
|
||||
bool enableSuspendResume = false;
|
||||
bool enableNoNewTasks = false;
|
||||
bool enableReset = false;
|
||||
bool enableDetach = false;
|
||||
bool enableProperties = false;
|
||||
|
||||
wxASSERT(pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
wxASSERT(m_pTaskPane);
|
||||
wxASSERT(m_pListPane);
|
||||
|
||||
|
||||
CBOINCBaseView::PreUpdateSelection();
|
||||
|
||||
|
||||
// Update the tasks static box buttons
|
||||
//
|
||||
pGroup = m_TaskGroups[0];
|
||||
|
||||
n = m_pListPane->GetSelectedItemCount();
|
||||
if (n > 0) {
|
||||
m_pTaskPane->EnableTaskGroupTasks(pGroup);
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_PROPERTIES]);
|
||||
enableUpdate = true;
|
||||
enableSuspendResume = true;
|
||||
enableNoNewTasks = true;
|
||||
enableReset = true;
|
||||
enableDetach = true;
|
||||
} else {
|
||||
m_pTaskPane->DisableTaskGroupTasks(pGroup);
|
||||
UpdateWebsiteSelection(GRP_WEBSITES, NULL);
|
||||
if(m_TaskGroups.size()>1) {
|
||||
if(m_TaskGroups.size() > 1) {
|
||||
m_pTaskPane->DisableTaskGroupTasks(m_TaskGroups[1]);
|
||||
}
|
||||
}
|
||||
|
@ -692,7 +698,7 @@ void CViewProjects::UpdateSelection() {
|
|||
if (wasSuspended != project->suspended_via_gui) {
|
||||
// Disable Suspend / Resume button if the multiple selection
|
||||
// has a mix of suspended and not suspended projects
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_SUSPEND]);
|
||||
enableSuspendResume = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -711,28 +717,36 @@ void CViewProjects::UpdateSelection() {
|
|||
if (wasNoNewWork != project->dont_request_more_work) {
|
||||
// Disable Allow New Work / No New Work button if the multiple
|
||||
// selection has a mix of Allow New Work and No New Work projects
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_NOWORK]);
|
||||
enableNoNewTasks = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (project->attached_via_acct_mgr) {
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_DETACH]);
|
||||
}
|
||||
|
||||
if (n == 1) {
|
||||
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_PROPERTIES]);
|
||||
|
||||
UpdateWebsiteSelection(GRP_WEBSITES, project);
|
||||
if(m_TaskGroups.size()>1) {
|
||||
m_pTaskPane->EnableTaskGroupTasks(m_TaskGroups[1]);
|
||||
}
|
||||
} else {
|
||||
UpdateWebsiteSelection(GRP_WEBSITES, NULL);
|
||||
if(m_TaskGroups.size()>1) {
|
||||
m_pTaskPane->DisableTaskGroupTasks(m_TaskGroups[1]);
|
||||
}
|
||||
enableDetach = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (n == 1) {
|
||||
enableProperties = true;
|
||||
|
||||
UpdateWebsiteSelection(GRP_WEBSITES, project);
|
||||
if(m_TaskGroups.size()>1) {
|
||||
m_pTaskPane->EnableTaskGroupTasks(m_TaskGroups[1]);
|
||||
}
|
||||
} else {
|
||||
UpdateWebsiteSelection(GRP_WEBSITES, NULL);
|
||||
if(m_TaskGroups.size()>1) {
|
||||
m_pTaskPane->DisableTaskGroupTasks(m_TaskGroups[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// To minimize flicker, set each button only once to the final desired state
|
||||
pGroup->m_Tasks[BTN_UPDATE]->m_pButton->Enable(enableUpdate);
|
||||
pGroup->m_Tasks[BTN_SUSPEND]->m_pButton->Enable(enableSuspendResume);
|
||||
pGroup->m_Tasks[BTN_NOWORK]->m_pButton->Enable(enableNoNewTasks);
|
||||
pGroup->m_Tasks[BTN_RESET]->m_pButton->Enable(enableReset);
|
||||
pGroup->m_Tasks[BTN_DETACH]->m_pButton->Enable(enableDetach);
|
||||
pGroup->m_Tasks[BTN_PROPERTIES]->m_pButton->Enable(enableProperties);
|
||||
|
||||
CBOINCBaseView::PostUpdateSelection();
|
||||
}
|
||||
|
|
|
@ -569,7 +569,11 @@ void CViewWork::UpdateSelection() {
|
|||
int i, n, row;
|
||||
bool wasSuspended=false, all_same_project=false;
|
||||
std::string first_project_url;
|
||||
|
||||
bool enableShowGraphics = false;
|
||||
bool enableSuspendResume = false;
|
||||
bool enableAbort = false;
|
||||
bool enableProperties = false;
|
||||
|
||||
wxASSERT(NULL != pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
wxASSERT(NULL != m_pTaskPane);
|
||||
|
@ -580,14 +584,14 @@ void CViewWork::UpdateSelection() {
|
|||
|
||||
n = m_pListPane->GetSelectedItemCount();
|
||||
if (n > 0) {
|
||||
m_pTaskPane->EnableTaskGroupTasks(pGroup);
|
||||
enableShowGraphics = true;
|
||||
enableSuspendResume = true;
|
||||
enableAbort = true;
|
||||
|
||||
pDoc->GetCoreClientStatus(status);
|
||||
if (status.task_suspend_reason & ~(SUSPEND_REASON_CPU_USAGE_LIMIT)) {
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_GRAPHICS]);
|
||||
enableShowGraphics = false;
|
||||
}
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_PROPERTIES]);
|
||||
} else {
|
||||
m_pTaskPane->DisableTaskGroupTasks(pGroup);
|
||||
}
|
||||
|
||||
row = -1;
|
||||
|
@ -617,7 +621,7 @@ void CViewWork::UpdateSelection() {
|
|||
if (wasSuspended != result->suspended_via_gui) {
|
||||
// Disable Suspend / Resume button if the multiple selection
|
||||
// has a mix of suspended and not suspended tasks
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_SUSPEND]);
|
||||
enableSuspendResume = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -625,12 +629,12 @@ void CViewWork::UpdateSelection() {
|
|||
if (((!result->supports_graphics) || pDoc->GetState()->executing_as_daemon)
|
||||
&& result->graphics_exec_path.empty()
|
||||
) {
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_GRAPHICS]);
|
||||
enableShowGraphics = false;
|
||||
}
|
||||
|
||||
if (result->suspended_via_gui || result->project_suspended_via_gui ||
|
||||
(result->scheduler_state != CPU_SCHED_SCHEDULED)) {
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_GRAPHICS]);
|
||||
enableShowGraphics = false;
|
||||
}
|
||||
|
||||
// Disable Abort button if any selected task already aborted
|
||||
|
@ -639,7 +643,7 @@ void CViewWork::UpdateSelection() {
|
|||
result->active_task_state == PROCESS_ABORTED ||
|
||||
result->state == RESULT_ABORTED
|
||||
) {
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_ABORT]);
|
||||
enableAbort = false;
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
|
@ -652,11 +656,17 @@ void CViewWork::UpdateSelection() {
|
|||
}
|
||||
|
||||
if (n == 1) {
|
||||
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_PROPERTIES]);
|
||||
enableProperties = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// To minimize flicker, set each button only once to the final desired state
|
||||
pGroup->m_Tasks[BTN_GRAPHICS]->m_pButton->Enable(enableShowGraphics);
|
||||
pGroup->m_Tasks[BTN_SUSPEND]->m_pButton->Enable(enableSuspendResume);
|
||||
pGroup->m_Tasks[BTN_ABORT]->m_pButton->Enable(enableAbort);
|
||||
pGroup->m_Tasks[BTN_PROPERTIES]->m_pButton->Enable(enableProperties);
|
||||
|
||||
if (all_same_project) {
|
||||
project = pDoc->state.lookup_project(result->project_url);
|
||||
UpdateWebsiteSelection(GRP_WEBSITES, project);
|
||||
|
|
Loading…
Reference in New Issue