diff --git a/checkin_notes b/checkin_notes index 58c539a122..6fd5eb00d5 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/clientgui/Events.h b/clientgui/Events.h index 6dcb3c74da..47a9997005 100644 --- a/clientgui/Events.h +++ b/clientgui/Events.h @@ -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 diff --git a/clientgui/sg_PanelBase.cpp b/clientgui/sg_PanelBase.cpp index a9aff19a83..be2ef20a72 100755 --- a/clientgui/sg_PanelBase.cpp +++ b/clientgui/sg_PanelBase.cpp @@ -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 diff --git a/clientgui/sg_PanelBase.h b/clientgui/sg_PanelBase.h index 4a7756c938..dd53c98a23 100755 --- a/clientgui/sg_PanelBase.h +++ b/clientgui/sg_PanelBase.h @@ -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); diff --git a/clientgui/sg_TaskPanel.cpp b/clientgui/sg_TaskPanel.cpp index da0be6d1f4..da8331ca59 100755 --- a/clientgui/sg_TaskPanel.cpp +++ b/clientgui/sg_TaskPanel.cpp @@ -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 diff --git a/clientgui/sg_TaskPanel.h b/clientgui/sg_TaskPanel.h index 9e2d587c2e..eb12b3b367 100755 --- a/clientgui/sg_TaskPanel.h +++ b/clientgui/sg_TaskPanel.h @@ -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;