MGR: don't show "indeterminate" progress bar in Simple View

svn path=/trunk/boinc/; revision=24742
This commit is contained in:
Charlie Fenton 2011-12-06 11:46:57 +00:00
parent 18ec343ca1
commit 7bb64d8247
6 changed files with 57 additions and 51 deletions

View File

@ -8849,7 +8849,17 @@ David 6 Dec 2011
cpu_sched.cpp
Charlie 6 Dec 2011
- MGR: eliminate "ghost" Notices window when running on Windows OS.
- MGR: eliminate "ghost" Notices window in Simple View when running
on Windows OS.
- MGR: don't show "indeterminate" progress bar in Simple View.
clientgui/
sg_DlgMessages.cpp
Charlie 6 Dec 2011
- MGR: don't show "indeterminate" progress bar in Simple View.
clientgui/
Events.h
sg_PanelBase.cpp,.h
sg_TaskPanel.cpp,.h

View File

@ -151,18 +151,17 @@
#define ID_SIMPLEMESSAGECHECKTIMER 6401
#define ID_SIMPLE_HELP 6402
#define ID_SIMPLE_MESSAGESVIEW 6403
#define ID_SIMPLE_PROGRESSPULSETIMER 6404
#define ID_SGTASKSELECTOR 6405
#define ID_TASKSCOMMANDBUTTON 6406
#define ID_ADDROJECTBUTTON 6407
#define ID_SGPROJECTSELECTOR 6408
#define ID_PROJECTWEBSITESBUTTON 6409
#define ID_PROJECTCOMMANDBUTTON 6410
#define ID_SGNOTICESBUTTON 6411
#define ID_SGSUSPENDRESUMEBUTTON 6412
#define ID_SGOPTIONS 6413
#define ID_SGSKINSELECTOR 6414
#define ID_SGPROJECTDESCRIPTION 6415
#define ID_SGTASKSELECTOR 6404
#define ID_TASKSCOMMANDBUTTON 6405
#define ID_ADDROJECTBUTTON 6406
#define ID_SGPROJECTSELECTOR 6407
#define ID_PROJECTWEBSITESBUTTON 6408
#define ID_PROJECTCOMMANDBUTTON 6409
#define ID_SGNOTICESBUTTON 6410
#define ID_SGSUSPENDRESUMEBUTTON 6411
#define ID_SGOPTIONS 6412
#define ID_SGSKINSELECTOR 6413
#define ID_SGPROJECTDESCRIPTION 6414
#define ID_SGDEFAULTSKINSELECTOR 6500
#define ID_SGFIRSTSKINSELECTOR 6501
// 6501-6599 Reserved for Skin Selection

View File

@ -161,10 +161,12 @@ void CSimplePanelBase::OnPaint(wxPaintEvent& /*event*/) {
#ifdef __WXMAC__
// Mac progress bar can be hard to see on a colored
// background, so put it on a white background
wxRect progressRect = GetProgressRect();
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRoundedRectangle(progressRect.x, progressRect.y, progressRect.width, progressRect.height, 2);
wxRect* progressRect = GetProgressRect();
if (progressRect) {
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRoundedRectangle(progressRect->x, progressRect->y, progressRect->width, progressRect->height, 2);
}
#endif
// Restore Mode, Pen and Brush

View File

@ -69,7 +69,7 @@ class CSimplePanelBase : public wxPanel
~CSimplePanelBase();
void ReskinInterface();
virtual wxRect GetProgressRect() { return wxRect(0, 0, 0, 0); }
virtual wxRect* GetProgressRect() { return NULL; }
wxBitmap GetBackgroundBmp();
void UpdateStaticText(CTransparentStaticText **whichText, wxString s);
void EllipseStringIfNeeded(wxString& s, wxWindow *win);

View File

@ -424,7 +424,6 @@ IMPLEMENT_DYNAMIC_CLASS(CSimpleTaskPanel, CSimplePanelBase)
BEGIN_EVENT_TABLE(CSimpleTaskPanel, CSimplePanelBase)
EVT_BOINCBITMAPCOMBOBOX(ID_SGTASKSELECTOR, CSimpleTaskPanel::OnTaskSelection)
EVT_TIMER(ID_SIMPLE_PROGRESSPULSETIMER, CSimpleTaskPanel::OnPulseProgressIndicator)
#ifdef __WXMAC__
EVT_ERASE_BACKGROUND(CSimpleTaskPanel::OnEraseBackground)
#endif
@ -440,7 +439,6 @@ CSimpleTaskPanel::CSimpleTaskPanel( wxWindow* parent ) :
int w, h;
wxString str = wxEmptyString;
m_pulseTimer = new wxTimer(this, ID_SIMPLE_PROGRESSPULSETIMER);
m_oldWorkCount = -1;
error_time = 0;
m_GotBGBitMap = false; // Can't be made until parent has been laid out.
@ -576,10 +574,7 @@ CSimpleTaskPanel::~CSimpleTaskPanel()
m_TaskSelectionCtrl->SetClientData(j, NULL);
}
m_TaskSelectionCtrl->Clear();
m_pulseTimer->Stop();
delete m_pulseTimer;
if (m_progressBarRect) {
delete m_progressBarRect;
}
@ -625,13 +620,12 @@ void CSimpleTaskPanel::UpdatePanel(bool delayShow) {
m_SlideShowArea->Hide();
m_ElapsedTimeValue->Hide();
m_TimeRemainingValue->Hide();
m_ProgressValueText->Hide();
m_TaskCommandsButton->Hide();
if (m_iPctDoneX10 >= 0) {
m_iPctDoneX10 = -1;
m_ProgressBar->Pulse();
m_pulseTimer->Start(100);
m_ProgressBar->Hide();
}
m_ProgressValueText->Hide();
m_TaskCommandsButton->Hide();
this->Layout();
#ifdef __WXMAC__
@ -656,6 +650,7 @@ void CSimpleTaskPanel::UpdatePanel(bool delayShow) {
m_SlideShowArea->Show();
m_ElapsedTimeValue->Show();
m_TimeRemainingValue->Show();
m_ProgressBar->Show();
m_ProgressValueText->Show();
m_TaskCommandsButton->Show();
this->Layout();
@ -703,11 +698,8 @@ void CSimpleTaskPanel::UpdatePanel(bool delayShow) {
UpdateStaticText(&m_TimeRemainingValue, GetTimeRemainingString(result->estimated_cpu_time_remaining));
int pctDoneX10 = result->fraction_done * 1000.0;
if (m_iPctDoneX10 != pctDoneX10) {
if (m_iPctDoneX10 < 0) {
m_pulseTimer->Stop();
}
int pctDone = pctDoneX10 / 10;
if (pctDone != (m_iPctDoneX10 / 10)) {
if (m_iPctDoneX10 != (pctDone * 10)) {
m_ProgressBar->SetValue(pctDone);
}
s.Printf(_("%.3f%%"), result->fraction_done*100);
@ -724,8 +716,7 @@ void CSimpleTaskPanel::UpdatePanel(bool delayShow) {
UpdateStaticText(&m_TimeRemainingValue, GetTimeRemainingString(-1.0));
if (m_iPctDoneX10 >= 0) {
m_iPctDoneX10 = -1;
m_ProgressBar->Pulse();
m_pulseTimer->Start(100);
m_ProgressBar->Hide();
}
UpdateStaticText(&m_ProgressValueText, wxEmptyString);
UpdateStaticText(&m_StatusValueText, GetStatusString(NULL));
@ -740,6 +731,15 @@ void CSimpleTaskPanel::UpdatePanel(bool delayShow) {
}
wxRect* CSimpleTaskPanel::GetProgressRect() {
if (m_ProgressBar->IsShown()) {
return &m_ProgressRect;
} else {
return NULL;
}
}
void CSimpleTaskPanel::ReskinInterface() {
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleTaskPanel::ReskinInterface - Function Begin"));
CSimplePanelBase::ReskinInterface();
@ -749,11 +749,6 @@ void CSimpleTaskPanel::ReskinInterface() {
}
void CSimpleTaskPanel::OnPulseProgressIndicator(wxTimerEvent& /*event*/) {
m_ProgressBar->Pulse();
}
TaskSelectionData* CSimpleTaskPanel::GetTaskSelectionData() {
int count = m_TaskSelectionCtrl->GetCount();
if (count <= 0) {
@ -1246,16 +1241,18 @@ void CSimpleTaskPanel::DisplayIdleState() {
void CSimpleTaskPanel::OnEraseBackground(wxEraseEvent& event) {
wxRect clipRect;
wxDC *dc = event.GetDC();
if (m_progressBarRect == NULL) {
m_progressBarRect = new wxRect(m_ProgressBar->GetRect());
m_progressBarRect->Inflate(1, 0);
if (m_ProgressBar->IsShown()) {
if (m_progressBarRect == NULL) {
m_progressBarRect = new wxRect(m_ProgressBar->GetRect());
m_progressBarRect->Inflate(1, 0);
}
dc->GetClippingBox(&clipRect.x, &clipRect.y, &clipRect.width, &clipRect.height);
if (clipRect.IsEmpty() || m_progressBarRect->Contains(clipRect)) {
return;
}
}
dc->GetClippingBox(&clipRect.x, &clipRect.y, &clipRect.width, &clipRect.height);
if (clipRect.IsEmpty() || m_progressBarRect->Contains(clipRect)) {
return;
}
CSimplePanelBase::OnEraseBackground(event);
}
#endif

View File

@ -124,7 +124,7 @@ class CSimpleTaskPanel : public CSimplePanelBase
TaskSelectionData* GetTaskSelectionData();
wxString GetSelectedTaskString() { return m_TaskSelectionCtrl->GetValue(); }
void UpdatePanel(bool delayShow=false);
wxRect GetProgressRect() { return m_ProgressRect; }
wxRect* GetProgressRect();
void ReskinInterface();
private:
@ -141,7 +141,6 @@ class CSimpleTaskPanel : public CSimplePanelBase
bool Suspended();
bool ProjectUpdateScheduled();
void DisplayIdleState();
void OnPulseProgressIndicator(wxTimerEvent& event);
protected:
#ifdef __WXMAC__
@ -166,7 +165,6 @@ class CSimpleTaskPanel : public CSimplePanelBase
int m_oldWorkCount;
int m_iPctDoneX10;
time_t error_time;
wxTimer* m_pulseTimer;
bool m_bStableTaskInfoChanged;
int m_CurrentTaskSelection;
wxString m_sNotAvailableString;