mirror of https://github.com/BOINC/boinc.git
MGR: New Simple GUI optimization
svn path=/trunk/boinc/; revision=22961
This commit is contained in:
parent
a0cbc14c5d
commit
f736f5ce43
|
@ -288,12 +288,12 @@ Charlie 27 Jan 2011
|
|||
Events.h
|
||||
sg_BoincSimpleFrame.cpp, .h (new)
|
||||
sg_CustomControls.cpp, .h
|
||||
sg_TaskPanel.cpp, .h (new)
|
||||
sg_PanelBase.cpp, .h (new)
|
||||
sg_ProjectCommandPopup.cpp, .h (new)
|
||||
sg_ProjectPanel.cpp, .h (new)
|
||||
sg_ProjectWebSitesPopup.cpp, .h (new)
|
||||
sg_TaskCommandPopup.cpp, .h (new)
|
||||
sg_TaskPanel.cpp, .h (new)
|
||||
SkinManager.cpp
|
||||
mac/
|
||||
MacBitmapComboBox.cpp, .h (new)
|
||||
|
@ -373,3 +373,19 @@ David 28 Jan 2011
|
|||
util_basics.inc
|
||||
py/Boinc/
|
||||
setup_project.py
|
||||
|
||||
Charlie 29 Jan 2011
|
||||
- MGR: Code cleanup.
|
||||
|
||||
clientgui/
|
||||
sg_PanelBase.cpp, .h
|
||||
sg_ProjectPanel.cpp, .h
|
||||
sg_TaskPanel.cpp, .h
|
||||
|
||||
Charlie 30 Jan 2011
|
||||
- MGR: New Simple GUI optimization.
|
||||
|
||||
clientgui/
|
||||
sg_BoincSimpleFrame.cpp
|
||||
sg_PanelBase.cpp
|
||||
sg_TaskPanel.cpp, .h
|
||||
|
|
|
@ -582,7 +582,6 @@ CSimpleGUIPanel::CSimpleGUIPanel(wxWindow* parent) :
|
|||
m_oldWorkCount = 0;
|
||||
m_bNewNoticeAlert = false;
|
||||
m_bNoticesButtonIsRed = false;
|
||||
m_bisPaused = false;
|
||||
|
||||
checkForNewNoticesTimer = new wxTimer(this, ID_SIMPLEMESSAGECHECKTIMER);
|
||||
checkForNewNoticesTimer->Start(5000);
|
||||
|
@ -635,6 +634,7 @@ CSimpleGUIPanel::CSimpleGUIPanel(wxWindow* parent) :
|
|||
|
||||
mainSizer->Fit(GetParent());
|
||||
|
||||
m_bisPaused = false;
|
||||
m_PauseResumeButton->SetLabel(m_sPauseString);
|
||||
m_PauseResumeButton->SetToolTip(m_sPauseButtonToolTip);
|
||||
|
||||
|
@ -727,6 +727,7 @@ void CSimpleGUIPanel::OnFrameRender() {
|
|||
wxASSERT(pDoc);
|
||||
int workCount = pDoc->GetSimpleGUIWorkCount();
|
||||
CC_STATUS status;
|
||||
bool isPaused;
|
||||
|
||||
// OnFrameRender() may be called while SimpleGUI initialization is
|
||||
// in progress due to completion of a periodic get_messages RPC,
|
||||
|
@ -748,11 +749,13 @@ void CSimpleGUIPanel::OnFrameRender() {
|
|||
// Show resume or pause as appropriate
|
||||
pDoc->GetCoreClientStatus(status);
|
||||
|
||||
m_bisPaused = (RUN_MODE_NEVER == status.task_mode);
|
||||
m_PauseResumeButton->SetLabel(m_bisPaused ? m_sResumeString : m_sPauseString);
|
||||
m_PauseResumeButton->SetToolTip(m_bisPaused ? m_sResumeButtonToolTip : m_sPauseButtonToolTip);
|
||||
isPaused = (RUN_MODE_NEVER == status.task_mode);
|
||||
if (isPaused != m_bisPaused) {
|
||||
m_bisPaused = isPaused;
|
||||
m_PauseResumeButton->SetLabel(m_bisPaused ? m_sResumeString : m_sPauseString);
|
||||
m_PauseResumeButton->SetToolTip(m_bisPaused ? m_sResumeButtonToolTip : m_sPauseButtonToolTip);
|
||||
}
|
||||
m_PauseResumeButton->Enable();
|
||||
|
||||
UpdateProjectView();
|
||||
} else {
|
||||
m_PauseResumeButton->SetToolTip(wxEmptyString);
|
||||
|
@ -913,7 +916,15 @@ void CSimpleGUIPanel::OnPaint(wxPaintEvent& event) {
|
|||
|
||||
void CSimpleGUIPanel::OnEraseBackground(wxEraseEvent& event) {
|
||||
wxDC *dc = event.GetDC();
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// Avoid unnecessary drawing due to Mac progress indicator's animation
|
||||
wxRect clipRect;
|
||||
wxRect taskRect = m_taskPanel->GetRect();
|
||||
dc->GetClippingBox(&clipRect.x, &clipRect.y, &clipRect.width, &clipRect.height);
|
||||
if (clipRect.IsEmpty() || taskRect.Contains(clipRect)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
dc->DrawBitmap(m_bmpBg, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ void CSimplePanelBase::OnEraseBackground(wxEraseEvent& event) {
|
|||
if (!m_GotBGBitMap) {
|
||||
MakeBGBitMap();
|
||||
}
|
||||
|
||||
//return;
|
||||
dc->DrawBitmap(m_TaskPanelBGBitMap, 0, 0);
|
||||
wxPen oldPen= dc->GetPen();
|
||||
wxBrush oldBrush = dc->GetBrush();
|
||||
|
|
|
@ -183,6 +183,9 @@ BEGIN_EVENT_TABLE(CSimpleTaskPanel, CSimplePanelBase)
|
|||
// EVT_BUTTON(ID_TASKSCOMMANDBUTTON, CSimpleTaskPanel::OnTasksCommand)
|
||||
// EVT_LEFT_DOWN(CSimpleTaskPanel::OnTasksCommand)
|
||||
EVT_TIMER(ID_SIMPLE_PROGRESSPULSETIMER, CSimpleTaskPanel::OnPulseProgressIndicator)
|
||||
#ifdef __WXMAC__
|
||||
EVT_ERASE_BACKGROUND(CSimpleTaskPanel::OnEraseBackground)
|
||||
#endif
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#if TESTBIGICONPOPUP
|
||||
|
@ -210,6 +213,7 @@ CSimpleTaskPanel::CSimpleTaskPanel( wxWindow* parent ) :
|
|||
m_CurrentTaskSelection = -1;
|
||||
m_sNoProjectsString = _("You don't have any projects. Please Add a Project.");
|
||||
m_sNotAvailableString = _("Not available");
|
||||
m_progressBarRect = NULL;
|
||||
|
||||
SetFont(wxFont(SMALL_FONT,wxSWISS,wxNORMAL,wxNORMAL,false,wxT("Arial")));
|
||||
|
||||
|
@ -297,7 +301,8 @@ CSimpleTaskPanel::CSimpleTaskPanel( wxWindow* parent ) :
|
|||
|
||||
// TODO: Standard Mac progress indicator's animation uses lots of CPU
|
||||
// time, and also triggers unnecessary Erase events. Should we use a
|
||||
// non-standard progress indicator on Mac?
|
||||
// non-standard progress indicator on Mac? See also optimizations in
|
||||
// CSimpleGUIPanel::OnEraseBackground and CSimpleTaskPanel::OnEraseBackground.
|
||||
m_ProgressBar = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL );
|
||||
m_ProgressBar->SetValue( 50 );
|
||||
GetTextExtent(wxT("0"), &w, &h);
|
||||
|
@ -350,6 +355,10 @@ CSimpleTaskPanel::~CSimpleTaskPanel()
|
|||
|
||||
m_pulseTimer->Stop();
|
||||
delete m_pulseTimer;
|
||||
|
||||
if (m_progressBarRect) {
|
||||
delete m_progressBarRect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -893,3 +902,23 @@ void CSimpleTaskPanel::DisplayIdleState() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// Avoid unnecessary drawing due to Mac progress indicator's animation
|
||||
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);
|
||||
}
|
||||
dc->GetClippingBox(&clipRect.x, &clipRect.y, &clipRect.width, &clipRect.height);
|
||||
if (clipRect.IsEmpty() || m_progressBarRect->Contains(clipRect)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CSimplePanelBase::OnEraseBackground(event);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -51,7 +51,7 @@ class CSlideShowPanel : public wxPanel
|
|||
void OnSlideShowTimer(wxTimerEvent& WXUNUSED(event));
|
||||
void AdvanceSlideShow(bool changeSlide);
|
||||
void OnPaint(wxPaintEvent& WXUNUSED(event));
|
||||
|
||||
|
||||
private:
|
||||
wxTimer* m_ChangeSlideTimer;
|
||||
wxBitmap m_SlideBitmap;
|
||||
|
@ -105,6 +105,10 @@ class CSimpleTaskPanel : public CSimplePanelBase
|
|||
void OnPulseProgressIndicator(wxTimerEvent& event);
|
||||
|
||||
protected:
|
||||
#ifdef __WXMAC__
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
#endif
|
||||
wxRect* m_progressBarRect;
|
||||
CTransparentStaticText* m_myTasksLabel;
|
||||
CBOINCBitmapComboBox* m_TaskSelectionCtrl;
|
||||
CTransparentStaticText* m_TaskProjectLabel;
|
||||
|
|
Loading…
Reference in New Issue