mirror of https://github.com/BOINC/boinc.git
MGR: Fixes to new Simple GUI for Linux
svn path=/trunk/boinc/; revision=23531
This commit is contained in:
parent
b67f9b6e4f
commit
04291cef99
|
@ -2930,3 +2930,10 @@ David 11 May 2011
|
|||
|
||||
lib/
|
||||
filesys.cpp
|
||||
|
||||
Charlie 12 May 2011
|
||||
- MGR: Fixes to new Simple GUI for Linux.
|
||||
|
||||
clientgui/
|
||||
sg_BoincSimpleFrame.cpp
|
||||
sg_PanelBase.cpp, .h
|
||||
|
|
|
@ -882,8 +882,10 @@ void CSimpleGUIPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||
myDC.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
#ifdef __WXMAC__
|
||||
myDC.DrawRoundedRectangle(r.x, r.y, r.width, r.height, 12);
|
||||
#else
|
||||
#elif defined(__WXMSW__)
|
||||
myDC.DrawRectangle(r.x, r.y, r.width, r.height);
|
||||
#else
|
||||
myDC.DrawRoundedRectangle(r.x, r.y, r.width, r.height, 6);
|
||||
#endif
|
||||
// Restore Mode, Pen and Brush
|
||||
myDC.SetBackgroundMode(oldMode);
|
||||
|
@ -894,6 +896,8 @@ void CSimpleGUIPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||
}
|
||||
|
||||
|
||||
// We don't reliably get EraseBackground events under Linux,
|
||||
// so there is a workaround at CSimplePanelBase::MakeBGBitMap()
|
||||
void CSimpleGUIPanel::OnEraseBackground(wxEraseEvent& event) {
|
||||
wxDC *dc = event.GetDC();
|
||||
|
||||
|
|
|
@ -21,11 +21,7 @@
|
|||
IMPLEMENT_DYNAMIC_CLASS(CSimplePanelBase, wxPanel)
|
||||
|
||||
BEGIN_EVENT_TABLE(CSimplePanelBase, wxPanel)
|
||||
#if (defined(__WXMSW_) || defined(__WXMAC__))
|
||||
EVT_ERASE_BACKGROUND(CSimplePanelBase::OnEraseBackground)
|
||||
#else // Linux
|
||||
EVT_PAINT(CSimplePanelBase::OnPaint)
|
||||
#endif
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
@ -67,12 +63,19 @@ void CSimplePanelBase::MakeBGBitMap() {
|
|||
register unsigned char *bgImagePixels;
|
||||
register unsigned char *whitePixels;
|
||||
register int i, j, k;
|
||||
CSimpleGUIPanel* backgroundPanel = (CSimpleGUIPanel*)GetParent();
|
||||
wxPen bgPen(*wxWHITE, 1, wxTRANSPARENT);
|
||||
wxBrush bgBrush(*wxWHITE);
|
||||
|
||||
// Workaround for CSimpleGUIPanel not reliably getting
|
||||
// Paint or EraseBackground events under Linux
|
||||
#if (defined(__WXMSW_) || defined(__WXMAC__))
|
||||
backgroundPanel->SetBackgroundBitmap();
|
||||
#endif
|
||||
|
||||
GetPosition(&r.x, &r.y);
|
||||
GetSize(&r.width, &r.height);
|
||||
wxBitmap *bgBmp(((CSimpleGUIPanel*)GetParent())->GetBackgroundBitMap());
|
||||
wxBitmap *bgBmp(backgroundPanel->GetBackgroundBitMap());
|
||||
wxRect bgRect(0, 0, bgBmp->GetWidth(), bgBmp->GetHeight());
|
||||
if (bgRect.Contains(r)) {
|
||||
rawBmp = bgBmp->GetSubBitmap(r);
|
||||
|
@ -121,37 +124,8 @@ void CSimplePanelBase::MakeBGBitMap() {
|
|||
}
|
||||
|
||||
|
||||
#if (defined(__WXMSW_) || defined(__WXMAC__))
|
||||
|
||||
void CSimplePanelBase::OnEraseBackground(wxEraseEvent& event) {
|
||||
wxDC* dc = event.GetDC();
|
||||
|
||||
if (!m_GotBGBitMap) {
|
||||
MakeBGBitMap();
|
||||
}
|
||||
|
||||
dc->DrawBitmap(m_TaskPanelBGBitMap, 0, 0);
|
||||
wxPen oldPen= dc->GetPen();
|
||||
wxBrush oldBrush = dc->GetBrush();
|
||||
int oldMode = dc->GetBackgroundMode();
|
||||
wxCoord w, h;
|
||||
wxPen bgPen(*wxBLUE, 3);
|
||||
wxBrush bgBrush(*wxBLUE, wxTRANSPARENT);
|
||||
|
||||
dc->SetBackgroundMode(wxSOLID);
|
||||
dc->SetPen(bgPen);
|
||||
dc->SetBrush(bgBrush);
|
||||
dc->GetSize(&w, &h);
|
||||
dc->DrawRoundedRectangle(0, 0, w, h, 10.0);
|
||||
|
||||
// Restore Mode, Pen and Brush
|
||||
dc->SetBackgroundMode(oldMode);
|
||||
dc->SetPen(oldPen);
|
||||
dc->SetBrush(oldBrush);
|
||||
}
|
||||
|
||||
#else // Linux
|
||||
|
||||
// Linux does not reliably generate EraseBackground
|
||||
// events here, so use Paint events
|
||||
void CSimplePanelBase::OnPaint(wxPaintEvent& event) {
|
||||
wxPaintDC dc(this);
|
||||
|
||||
|
@ -181,8 +155,6 @@ void CSimplePanelBase::OnPaint(wxPaintEvent& event) {
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void CSimplePanelBase::UpdateStaticText(CTransparentStaticText **whichText, wxString s) {
|
||||
EllipseStringIfNeeded(s, *whichText);
|
||||
|
|
|
@ -82,11 +82,7 @@ class CSimplePanelBase : public wxPanel
|
|||
|
||||
protected:
|
||||
void MakeBGBitMap();
|
||||
#if (defined(__WXMSW_) || defined(__WXMAC__))
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
#else // Linux
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
#endif
|
||||
|
||||
wxBitmap m_TaskPanelBGBitMap;
|
||||
bool m_GotBGBitMap;
|
||||
|
|
Loading…
Reference in New Issue