diff --git a/checkin_notes b/checkin_notes index 229eaaf722..e5965b03f1 100755 --- a/checkin_notes +++ b/checkin_notes @@ -367,3 +367,11 @@ David 9 Jan 2007 client/ app_control.C + +Charlie 9 Jan 2007 + - MGR: Updates to disk usage pie charts from Frank Weiler. + + clientgui/ + ViewResources.cp + common/ + wxPieCtrl.cpp,h diff --git a/clientgui/ViewResources.cpp b/clientgui/ViewResources.cpp index fcf430487d..0114b3b4f4 100644 --- a/clientgui/ViewResources.cpp +++ b/clientgui/ViewResources.cpp @@ -37,8 +37,6 @@ WX_DEFINE_OBJARRAY(wxArrayColour); IMPLEMENT_DYNAMIC_CLASS(CViewResources, CBOINCBaseView) BEGIN_EVENT_TABLE (CViewResources, CBOINCBaseView) - EVT_LIST_ITEM_SELECTED(ID_LIST_RESOURCEUTILIZATIONVIEW, CViewResources::OnListSelected) - EVT_LIST_ITEM_DESELECTED(ID_LIST_RESOURCEUTILIZATIONVIEW, CViewResources::OnListDeselected) END_EVENT_TABLE () @@ -91,14 +89,10 @@ CViewResources::CViewResources(wxNotebook* pNotebook) : // setup the legend m_pieCtrlTotal->GetLegend()->SetTransparent(true); m_pieCtrlTotal->GetLegend()->SetHorBorder(10); -#ifndef __WXMAC__ - m_pieCtrlTotal->GetLegend()->SetWindowStyle(wxSTATIC_BORDER); -#endif m_pieCtrlTotal->GetLegend()->SetLabelFont(*wxSWISS_FONT); m_pieCtrlTotal->GetLegend()->SetLabelColour(wxColour(0,0,127)); m_pieCtrlTotal->GetLegend()->SetLabelColour(wxColour(0,0,127)); - //TODO: respect title localization - m_pieCtrlTotal->GetLegend()->SetTitle(wxT("total disk usage")); + m_pieCtrlTotal->GetLegend()->SetLabel(_("total disk usage")); //set the angle above PI/2 to prevent tilt m_pieCtrlTotal->SetAngle(4); //disable 3D drawing @@ -112,14 +106,10 @@ CViewResources::CViewResources(wxNotebook* pNotebook) : //setup the legend m_pieCtrlBOINC->GetLegend()->SetTransparent(true); m_pieCtrlBOINC->GetLegend()->SetHorBorder(10); -#ifndef __WXMAC__ - m_pieCtrlBOINC->GetLegend()->SetWindowStyle(wxSTATIC_BORDER); -#endif - m_pieCtrlTotal->GetLegend()->SetLabelFont(*wxSWISS_FONT); m_pieCtrlBOINC->GetLegend()->SetLabelFont(*wxSWISS_FONT); m_pieCtrlBOINC->GetLegend()->SetLabelColour(wxColour(0,0,127)); m_pieCtrlBOINC->GetLegend()->SetLabelColour(wxColour(0,0,127)); - m_pieCtrlBOINC->GetLegend()->SetTitle(wxT("disk usage by BOINC projects ")); + m_pieCtrlBOINC->GetLegend()->SetLabel(_("disk usage by BOINC projects")); m_pieCtrlBOINC->SetAngle(4); m_pieCtrlBOINC->SetPaint3D(false); m_pieCtrlBOINC->SetDrawCircle(true); @@ -158,7 +148,7 @@ const char** CViewResources::GetViewIcon() { } void CViewResources::UpdateSelection() { - //TODO: is this needed ? no list ctrl at this view + //TODO: is this needed ? no task buttons CBOINCBaseView::PreUpdateSelection(); CBOINCBaseView::PostUpdateSelection(); } diff --git a/clientgui/common/wxPieCtrl.cpp b/clientgui/common/wxPieCtrl.cpp index d7cecc6e65..36d6119ec8 100644 --- a/clientgui/common/wxPieCtrl.cpp +++ b/clientgui/common/wxPieCtrl.cpp @@ -31,9 +31,15 @@ wxPieCtrlLegend::wxPieCtrlLegend(wxPieCtrl * parent, wxString title, m_TitleColour = wxColour(0,0,127); m_LabelColour = *wxBLACK; m_BackColour = wxColour(255,255,0); -#ifdef __WXMAC__ - m_TitleFont = *wxNORMAL_FONT; // Prevent wxDebug assert -#endif + m_TitleFont = *wxSWISS_FONT; + m_TitleFont.SetWeight(wxBOLD); + //remember the title, because Getlabel() doesn't seem to work under X + m_szTitle = title; +} + +void wxPieCtrlLegend::SetLabel(const wxString& label) { + wxWindow::SetLabel(label); + m_szTitle = label; } void wxPieCtrlLegend::SetTransparent(bool value) @@ -109,13 +115,13 @@ void wxPieCtrlLegend::OnPaint(wxPaintEvent & /*event*/) //draw legend title mdc.SetFont(m_TitleFont); mdc.SetTextForeground(m_TitleColour); - mdc.GetTextExtent(this->GetTitle(),&titlew,&titleh); - mdc.DrawText(this->GetTitle(),m_HorBorder+2,m_VerBorder+2); + mdc.GetTextExtent(m_szTitle,&titlew,&titleh); + mdc.DrawText(m_szTitle,m_HorBorder+2,m_VerBorder+2); dy += (titleh+5); //draw legend items mdc.SetFont(m_LabelFont); mdc.SetTextForeground(m_LabelColour); - int maxwidth(titlew); + int maxwidth(titlew + 2*m_HorBorder + 15); for(i = 0; i < parent->m_Series.Count(); i++) { mdc.GetTextExtent(parent->m_Series[i].GetLabel(), &tw, &th); @@ -128,10 +134,9 @@ void wxPieCtrlLegend::OnPaint(wxPaintEvent & /*event*/) dy += m_VerBorder; if(w != maxwidth || h != dy) SetSize(maxwidth, dy); -#ifdef __WXMAC__ - // SetWindowStyle borders distort the pie circle on Mac so we draw our own - int x, y; - wxPen savedPen = mdc.GetPen(); + // SetWindowStyle borders distort the pie circle on Mac so we draw our own + int x, y; + wxPen savedPen = mdc.GetPen(); GetSize(&x,&y); x--; @@ -143,7 +148,7 @@ void wxPieCtrlLegend::OnPaint(wxPaintEvent & /*event*/) mdc.DrawLine(0,y,x,y); // bottom mdc.DrawLine(x,0,x,y); // right mdc.SetPen(savedPen); -#endif + pdc.Blit(0,0,w,h,&mdc,0,0); } @@ -207,10 +212,10 @@ void wxPieCtrl::RecreateCanvas() { int x = GetSize().GetWidth(); int y = GetSize().GetHeight(); -#ifdef __WXMAC__ +//#ifdef __WXMAC__ if ((x < 1) || (y < 1)) return; -#endif +//#endif m_CanvasBitmap.Create(x, y); m_CanvasDC.SelectObject(m_CanvasBitmap); } diff --git a/clientgui/common/wxPieCtrl.h b/clientgui/common/wxPieCtrl.h index 1480391c64..c5b8c75fb8 100644 --- a/clientgui/common/wxPieCtrl.h +++ b/clientgui/common/wxPieCtrl.h @@ -24,7 +24,7 @@ WX_DECLARE_OBJARRAY(double, wxArrayDouble); // ======================================================================== // wxPiePart // ------------------------------------------------------------------------ -/// This class is used for storing data in wxPieCtrl. +/// This class is used for storing data in wxPieCtrl. class wxPiePart { double m_Value; @@ -41,7 +41,7 @@ public: */ wxPiePart(double value, wxColour colour, wxString label = wxEmptyString); /// Copy constructor - wxPiePart(const wxPiePart & part); + wxPiePart(const wxPiePart & part); /// Returns the colour of sector wxColour GetColour() {return m_Colour;} /// Sets the colour of sector @@ -71,13 +71,14 @@ class wxPieCtrlLegend : public wxWindow wxFont m_LabelFont; bool m_IsTransparent; wxColour m_TitleColour; - wxColour m_LabelColour; - wxColour m_BackColour; + wxColour m_LabelColour; + wxColour m_BackColour; wxBitmap m_Background; wxMemoryDC m_BackgroundDC; unsigned int m_HorBorder; - unsigned int m_VerBorder; - + unsigned int m_VerBorder; + wxString m_szTitle; + protected: void RecreateBackground(wxMemoryDC & parentdc); public: @@ -89,13 +90,13 @@ public: \param sz Legend window size \param style Window style */ - wxPieCtrlLegend(wxPieCtrl * parent, wxString title = wxEmptyString, + wxPieCtrlLegend(wxPieCtrl * parent, wxString title = wxEmptyString, wxPoint pos = wxPoint(10,10), wxSize sz = wxDefaultSize, long style = 0); /// Returns transparency flag of legend window bool IsTransparent() {return m_IsTransparent;} /// Sets transparency flag of legend window - void SetTransparent(bool value); + void SetTransparent(bool value); /// Returns the font used for displaying the labels of sectors wxFont GetLabelFont() {return m_LabelFont;} /// Sets the font used for displaying the labels of sectors @@ -117,6 +118,8 @@ public: /// Sets the colour used for displaying legend window background void SetBackColour(wxColour colour); + void SetLabel(const wxString& label); + DECLARE_EVENT_TABLE() void OnPaint(wxPaintEvent & event); void OnEraseBackground(wxEraseEvent & event); @@ -131,14 +134,14 @@ class wxPieCtrl : public wxWindow double m_Angle; double m_RotationAngle; int m_Height; - wxArrayDouble m_Values; + wxArrayDouble m_Values; wxBitmap m_Background; wxBitmap m_CanvasBitmap; wxMemoryDC m_CanvasDC; wxColour m_BackColour; wxPieCtrlLegend * m_Legend; - bool m_ShowEdges; - void GetPartAngles(wxArrayDouble & angles); + bool m_ShowEdges; + void GetPartAngles(wxArrayDouble & angles); #if defined(__WXMSW__) || defined(__WXMAC__) void DrawParts(wxMemoryDC & dc, int cx, int cy, int w, int h); #endif @@ -197,7 +200,7 @@ public: DECLARE_EVENT_TABLE() void OnPaint(wxPaintEvent & event); void OnEraseBackground(wxEraseEvent & event); - void OnSize(wxSizeEvent & event); + void OnSize(wxSizeEvent & event); }; // ======================================================================== // wxProgressPie @@ -218,7 +221,7 @@ public: \param value Initial value of progress pie \param pos Window position \param sz Window size - \param style Window style + \param style Window style */ wxProgressPie(wxWindow * parent, wxWindowID id = wxID_ANY, double maxvalue = 100, double value = 50, wxPoint pos = wxDefaultPosition, wxSize sz = wxDefaultSize, long style = 0); @@ -237,7 +240,7 @@ public: /// Returns the colour of sector that indicates the progress (filled) wxColour GetFilledColour(); /// Returns the colour of sector that indicates the rest (unfilled) - wxColour GetUnfilledColour(); + wxColour GetUnfilledColour(); }; #endif