2005-04-04 06:02:36 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
|
|
|
//
|
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
2005-04-04 06:50:42 +00:00
|
|
|
#pragma implementation "ViewStatistics.h"
|
2005-04-04 06:02:36 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "MainDocument.h"
|
2006-06-24 05:00:57 +00:00
|
|
|
#include "AdvancedFrame.h"
|
2005-04-04 06:02:36 +00:00
|
|
|
#include "BOINCTaskCtrl.h"
|
|
|
|
#include "BOINCListCtrl.h"
|
|
|
|
#include "ViewStatistics.h"
|
|
|
|
#include "Events.h"
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
|
2006-02-16 18:01:46 +00:00
|
|
|
#include "res/stats.xpm"
|
|
|
|
|
|
|
|
|
2005-04-04 06:02:36 +00:00
|
|
|
BEGIN_EVENT_TABLE (CPaintStatistics, wxPanel)
|
|
|
|
EVT_PAINT(CPaintStatistics::OnPaint)
|
2005-11-14 22:06:17 +00:00
|
|
|
EVT_SIZE(CPaintStatistics::OnSize)
|
2005-04-04 06:02:36 +00:00
|
|
|
END_EVENT_TABLE ()
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CPaintStatistics::CPaintStatistics() {
|
2005-11-28 06:28:55 +00:00
|
|
|
m_SelectedStatistic=0;
|
|
|
|
heading=_("User Total");
|
|
|
|
m_ModeViewStatistic=0;
|
|
|
|
m_NextProjectStatistic=0;
|
2006-01-20 22:57:32 +00:00
|
|
|
m_GraphLineWidth=2;
|
|
|
|
m_GraphPointWidth=4;
|
|
|
|
m_brushAxisColour=wxColour (192 , 224 , 255);
|
|
|
|
m_ligthbrushAxisColour=wxColour (220 , 240 , 255);
|
|
|
|
m_penAxisColour=wxColour (64 , 128 , 192);
|
|
|
|
m_font_stdandart=*wxSWISS_FONT;
|
|
|
|
m_font_bold=*wxSWISS_FONT;
|
2005-04-04 06:02:36 +00:00
|
|
|
}
|
|
|
|
|
2005-11-25 06:03:35 +00:00
|
|
|
CPaintStatistics::CPaintStatistics(
|
2005-11-28 06:28:55 +00:00
|
|
|
wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
|
|
|
const wxSize& size, long style, const wxString& name
|
|
|
|
): wxPanel(parent, id, pos, size, style, name)
|
|
|
|
{
|
|
|
|
m_SelectedStatistic=0;
|
|
|
|
heading=_("User Total");
|
|
|
|
m_ModeViewStatistic=0;
|
|
|
|
m_NextProjectStatistic=0;
|
2006-01-20 22:57:32 +00:00
|
|
|
m_GraphLineWidth=2;
|
|
|
|
m_GraphPointWidth=4;
|
|
|
|
m_brushAxisColour=wxColour (192 , 224 , 255);
|
|
|
|
m_ligthbrushAxisColour=wxColour (220 , 240 , 255);
|
|
|
|
m_penAxisColour=wxColour (64 , 128 , 192);
|
|
|
|
m_font_stdandart=*wxSWISS_FONT;
|
|
|
|
m_font_bold=*wxSWISS_FONT;
|
2005-04-04 06:02:36 +00:00
|
|
|
}
|
2006-01-20 22:57:32 +00:00
|
|
|
static void getTypePoint(wxInt32 &typePoint, wxInt32 number) {
|
|
|
|
typePoint=number/10;
|
|
|
|
}
|
|
|
|
static void getDrawColour(wxColour &grafColour, wxInt32 number) {
|
|
|
|
switch (number %10){
|
2005-12-08 19:21:56 +00:00
|
|
|
case 0: grafColour=wxColour(255,0,0); //Red
|
|
|
|
break;
|
|
|
|
case 1: grafColour=wxColour(0,160,0); //Green
|
|
|
|
break;
|
|
|
|
case 2: grafColour=wxColour(0,0,255); //Blue
|
|
|
|
break;
|
|
|
|
case 3: grafColour=wxColour(0,0,0); //Black
|
|
|
|
break;
|
|
|
|
case 4: grafColour=wxColour(255,0,255); //Fluchsia
|
|
|
|
break;
|
|
|
|
case 5: grafColour=wxColour(255,128,0); //
|
|
|
|
break;
|
|
|
|
case 6: grafColour=wxColour(192,192,0); //Olive+
|
|
|
|
break;
|
|
|
|
case 7: grafColour=wxColour(0,192,192); //Teal+
|
|
|
|
break;
|
|
|
|
case 8: grafColour=wxColour(160,160,160); //Gray
|
|
|
|
break;
|
|
|
|
case 9: grafColour=wxColour(160,0,0);
|
|
|
|
break;
|
|
|
|
default:grafColour=wxColour(255,255,255); //White
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-01-20 22:57:32 +00:00
|
|
|
//----Draw "Point"
|
|
|
|
static void myDrawPoint(wxPaintDC &dc,wxCoord X, wxCoord Y, wxColour grafColour,wxInt32 numberTypePoint, wxInt32 PointWidth) {
|
|
|
|
dc.SetPen(wxPen(grafColour , 1 , wxSOLID));
|
|
|
|
switch (numberTypePoint %4){
|
|
|
|
case 1: {wxPoint* points = new wxPoint[3];
|
|
|
|
points[0] = wxPoint(X, Y-1-(PointWidth/2));
|
|
|
|
points[1] = wxPoint(X+(PointWidth/2), Y+(PointWidth/2));
|
|
|
|
points[2] = wxPoint(X-(PointWidth/2), Y+(PointWidth/2));
|
|
|
|
dc.DrawPolygon(3, points);
|
|
|
|
delete[] points;
|
|
|
|
break;}
|
|
|
|
case 2: {wxPoint* points = new wxPoint[3];
|
|
|
|
points[0] = wxPoint(X, Y+1+(PointWidth/2));
|
|
|
|
points[1] = wxPoint(X+(PointWidth/2), Y-(PointWidth/2));
|
|
|
|
points[2] = wxPoint(X-(PointWidth/2), Y-(PointWidth/2));
|
|
|
|
dc.DrawPolygon(3, points);
|
|
|
|
delete[] points;
|
|
|
|
break;}
|
|
|
|
case 3: dc.DrawRectangle(X-(PointWidth/2),Y-(PointWidth/2),PointWidth+1,PointWidth+1);
|
|
|
|
break;
|
|
|
|
default:dc.DrawCircle(X,Y,PointWidth/2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-12-08 19:21:56 +00:00
|
|
|
|
|
|
|
//----Find minimum/maximum value----
|
|
|
|
static void MinMaxDayCredit(std::vector<PROJECT*>::const_iterator &i, double &min_credit, double &max_credit, double &min_day, double &max_day, const wxInt32 m_SelectedStatistic) {
|
|
|
|
for (std::vector<DAILY_STATS>::const_iterator j=(*i)->statistics.begin(); j!=(*i)->statistics.end();++j) {
|
|
|
|
if (j->day<min_day) min_day=j->day;
|
|
|
|
if (j->day>max_day) max_day=j->day;
|
|
|
|
|
|
|
|
switch (m_SelectedStatistic){
|
|
|
|
case 0: if (j->user_total_credit>max_credit) max_credit=j->user_total_credit;
|
|
|
|
if (j->user_total_credit<min_credit) min_credit=j->user_total_credit;
|
|
|
|
break;
|
|
|
|
case 1: if (j->user_expavg_credit>max_credit) max_credit=j->user_expavg_credit;
|
|
|
|
if (j->user_expavg_credit<min_credit) min_credit=j->user_expavg_credit;
|
|
|
|
break;
|
|
|
|
case 2: if (j->host_total_credit>max_credit) max_credit=j->host_total_credit;
|
|
|
|
if (j->host_total_credit<min_credit) min_credit=j->host_total_credit;
|
|
|
|
break;
|
|
|
|
case 3: if (j->host_expavg_credit>max_credit) max_credit=j->host_expavg_credit;
|
|
|
|
if (j->host_expavg_credit<min_credit) min_credit=j->host_expavg_credit;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-01-20 22:57:32 +00:00
|
|
|
}
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
static void CheckMinMaxD(double &min_val, double &max_val) {
|
|
|
|
if (min_val<0) min_val=0;
|
|
|
|
if (max_val<0) max_val=0;
|
|
|
|
if (min_val>max_val) min_val=max_val;
|
|
|
|
if (max_val==min_val) max_val+=1;
|
|
|
|
}
|
|
|
|
static void CheckMinMaxC(wxCoord &min_val, wxCoord &max_val) {
|
|
|
|
if (min_val<0) min_val=0;
|
|
|
|
if (max_val<0) max_val=0;
|
|
|
|
if (min_val>max_val) min_val=max_val;
|
|
|
|
if (max_val==min_val) max_val+=1;
|
2005-12-08 19:21:56 +00:00
|
|
|
}
|
2006-01-20 22:57:32 +00:00
|
|
|
|
|
|
|
//----Draw Main Head----
|
|
|
|
void CPaintStatistics::DrawMainHead(wxPaintDC &dc, const wxString head_name, wxCoord &x_start, wxCoord &x_end, wxCoord &y_start, wxCoord &y_end){
|
|
|
|
wxCoord w_temp, h_temp, des_temp, lead_temp;
|
|
|
|
dc.GetTextExtent(head_name, &w_temp, &h_temp, &des_temp, &lead_temp);
|
|
|
|
dc.DrawText (head_name, x_start+((x_end-x_start-w_temp)/2), y_start+1);
|
|
|
|
y_start+=(h_temp+2);
|
|
|
|
};
|
|
|
|
|
|
|
|
//----Draw Legend----
|
|
|
|
void CPaintStatistics::DrawLegend(wxPaintDC &dc, PROJECTS * &proj, CMainDocument* &pDoc, wxInt32 SelProj, bool bColour, wxCoord &x_start, wxCoord &x_end, wxCoord &y_start, wxCoord &y_end){
|
|
|
|
dc.SetFont(m_font_bold);
|
2006-03-23 01:17:07 +00:00
|
|
|
wxString head_name=wxT("");
|
2006-01-20 22:57:32 +00:00
|
|
|
wxCoord project_name_max_width=0;
|
|
|
|
double radius1=1;
|
|
|
|
wxInt32 count=-1;
|
|
|
|
for (std::vector<PROJECT*>::const_iterator i=proj->projects.begin();i!=proj->projects.end(); ++i) {
|
|
|
|
++count;
|
|
|
|
|
|
|
|
PROJECT* statistic = wxGetApp().GetDocument()->statistic(count);
|
|
|
|
PROJECT* state_project = NULL;
|
|
|
|
wxString head_name;
|
|
|
|
std::string project_name;
|
|
|
|
if (statistic) {
|
|
|
|
state_project = pDoc->state.lookup_project(statistic->master_url);
|
|
|
|
if (state_project) {
|
2006-03-23 01:17:07 +00:00
|
|
|
state_project->get_name(project_name);
|
|
|
|
head_name = wxString(project_name.c_str(), wxConvUTF8);
|
2006-01-20 22:57:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
wxCoord w_temp, h_temp, des_temp, lead_temp;
|
|
|
|
dc.GetTextExtent(head_name, &w_temp, &h_temp, &des_temp, &lead_temp);
|
|
|
|
if (project_name_max_width<w_temp) project_name_max_width=w_temp;
|
|
|
|
radius1=(double)(h_temp/2.0);
|
|
|
|
}
|
|
|
|
project_name_max_width+=8+4+m_GraphPointWidth; ///+5 - Point
|
|
|
|
|
|
|
|
dc.SetBrush(wxBrush(m_ligthbrushAxisColour , wxSOLID));
|
|
|
|
dc.SetPen(wxPen(m_penAxisColour , 1 , wxSOLID));
|
|
|
|
dc.DrawRoundedRectangle(x_end-project_name_max_width+2,y_start+2,project_name_max_width-4,y_end-y_start-4,radius1);
|
|
|
|
|
|
|
|
x_end-=project_name_max_width;
|
|
|
|
///---
|
|
|
|
count=-1;
|
|
|
|
for (std::vector<PROJECT*>::const_iterator i=proj->projects.begin();i!=proj->projects.end(); ++i) {
|
|
|
|
++count;
|
|
|
|
///Draw project name
|
2006-08-22 17:59:18 +00:00
|
|
|
PROJECT* state_project = pDoc->state.lookup_project((*i)->master_url);
|
|
|
|
if (state_project) {
|
|
|
|
head_name = wxString(state_project->project_name.c_str(), wxConvUTF8);
|
2006-01-20 22:57:32 +00:00
|
|
|
}
|
2006-08-22 17:59:18 +00:00
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
wxCoord w_temp, h_temp, des_temp, lead_temp;
|
|
|
|
dc.GetTextExtent(head_name, &w_temp, &h_temp, &des_temp, &lead_temp);
|
|
|
|
if (SelProj==count){
|
|
|
|
dc.SetBrush(wxBrush(m_brushAxisColour , wxSOLID));
|
|
|
|
dc.SetPen(wxPen(m_penAxisColour , 1 , wxSOLID));
|
|
|
|
dc.DrawRectangle(x_end+1,y_start+1+wxCoord(((double)(count)+0.5)*1.1*(double)(h_temp)),project_name_max_width-2,h_temp+2);
|
|
|
|
}
|
|
|
|
|
2006-08-21 16:38:16 +00:00
|
|
|
// wxColour tempColour1=wxColour(0,0,0);
|
2006-01-20 22:57:32 +00:00
|
|
|
wxColour grafColour=wxColour(0,0,0);
|
|
|
|
wxInt32 typePoint=0;
|
2006-08-21 16:38:16 +00:00
|
|
|
// tempColour1=GetForegroundColour();
|
2006-01-20 22:57:32 +00:00
|
|
|
if (bColour){
|
|
|
|
getTypePoint(typePoint,count);
|
|
|
|
getDrawColour(grafColour,count);
|
|
|
|
}
|
|
|
|
dc.SetTextForeground (grafColour);
|
|
|
|
dc.SetBrush(wxBrush(m_ligthbrushAxisColour , wxSOLID));
|
|
|
|
myDrawPoint(dc, x_end+4+1+m_GraphPointWidth/2, y_start+2+wxCoord(((double)(count)+1)*1.1*(double)(h_temp)), grafColour, typePoint ,m_GraphPointWidth);
|
|
|
|
dc.DrawText (head_name, x_end+4+4+m_GraphPointWidth, y_start+2+wxCoord(((double)(count)+0.5)*1.1*(double)(h_temp)));
|
2006-08-21 16:38:16 +00:00
|
|
|
dc.SetTextForeground (*wxBLACK);
|
2006-01-20 22:57:32 +00:00
|
|
|
}
|
|
|
|
dc.SetFont(m_font_stdandart);
|
|
|
|
};
|
|
|
|
|
2005-12-08 19:21:56 +00:00
|
|
|
//----Draw graph----
|
2006-01-20 22:57:32 +00:00
|
|
|
void CPaintStatistics::DrawGraph(wxPaintDC &dc, std::vector<PROJECT*>::const_iterator &i, const wxCoord x_start, const wxCoord x_end, const wxCoord y_start, const wxCoord y_end, const wxColour grafColour, const wxInt32 typePoint, const wxInt32 m_SelectedStatistic, const double max_val_y, const double min_val_y, const double max_val_x, const double min_val_x) {
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-08-21 16:38:16 +00:00
|
|
|
dc.SetClippingRegion(x_start-4, y_start-4, x_end-x_start+8, y_end-y_start+8);
|
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
const double yscale=(y_end-y_start)/(max_val_y-min_val_y);
|
|
|
|
const double xscale=(x_end-x_start)/(max_val_x-min_val_x);
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
dc.SetPen(wxPen(grafColour , m_GraphLineWidth , wxSOLID));
|
2005-11-28 06:28:55 +00:00
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
wxCoord last_x=x_start, last_y=0, xpos=x_start, ypos=0;
|
2005-12-08 19:21:56 +00:00
|
|
|
|
|
|
|
for (std::vector<DAILY_STATS>::const_iterator j=(*i)->statistics.begin(); j!=(*i)->statistics.end(); ++j) {
|
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
xpos=(wxCoord)(x_start + (xscale * (j->day-min_val_x)));
|
2005-12-08 19:21:56 +00:00
|
|
|
|
|
|
|
switch (m_SelectedStatistic){
|
2006-01-20 22:57:32 +00:00
|
|
|
case 0: ypos=(wxCoord)(y_end - (yscale * (double)(j->user_total_credit-min_val_y)));
|
2005-12-08 19:21:56 +00:00
|
|
|
break;
|
2006-01-20 22:57:32 +00:00
|
|
|
case 1: ypos=(wxCoord)(y_end - (yscale * (double)(j->user_expavg_credit-min_val_y)));
|
2005-12-08 19:21:56 +00:00
|
|
|
break;
|
2006-01-20 22:57:32 +00:00
|
|
|
case 2: ypos=(wxCoord)(y_end - (yscale * (double)(j->host_total_credit-min_val_y)));
|
2005-12-08 19:21:56 +00:00
|
|
|
break;
|
2006-01-20 22:57:32 +00:00
|
|
|
case 3: ypos=(wxCoord)(y_end - (yscale * (double)(j->host_expavg_credit-min_val_y)));
|
2005-12-08 19:21:56 +00:00
|
|
|
break;
|
2006-01-20 22:57:32 +00:00
|
|
|
default:ypos=(wxCoord)(y_end - (yscale * (double)(j->user_total_credit-min_val_y)));
|
2005-12-08 19:21:56 +00:00
|
|
|
break;
|
2005-11-28 06:28:55 +00:00
|
|
|
}
|
2005-12-08 19:21:56 +00:00
|
|
|
if (last_y!=0) {
|
2006-01-20 22:57:32 +00:00
|
|
|
dc.SetPen(wxPen(grafColour , m_GraphLineWidth , wxSOLID));
|
|
|
|
dc.DrawLine(last_x,last_y,xpos,ypos);
|
|
|
|
myDrawPoint(dc, last_x, last_y, grafColour, typePoint ,m_GraphPointWidth);
|
2005-12-08 19:21:56 +00:00
|
|
|
}
|
|
|
|
last_x=xpos;
|
|
|
|
last_y=ypos;
|
|
|
|
}
|
2006-01-20 22:57:32 +00:00
|
|
|
if (last_y!=0) myDrawPoint(dc, last_x, last_y, grafColour, typePoint ,m_GraphPointWidth);
|
2006-08-21 16:38:16 +00:00
|
|
|
|
|
|
|
dc.DestroyClippingRegion();
|
2005-12-08 19:21:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----Draw background, axis(lines), text(01-Jan-1980)----
|
2006-01-20 22:57:32 +00:00
|
|
|
void CPaintStatistics::DrawAxis(wxPaintDC &dc, const double max_val_y, const double min_val_y, const double max_val_x, const double min_val_x, wxCoord &x_start, wxCoord &x_end, wxCoord &y_start, wxCoord &y_end) {
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-08-21 16:38:16 +00:00
|
|
|
dc.SetClippingRegion(x_start, y_start, x_end-x_start, y_end-y_start);
|
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
dc.SetBrush(wxBrush(m_brushAxisColour , wxSOLID));
|
|
|
|
dc.SetPen(wxPen(m_penAxisColour , 1 , wxSOLID));
|
2005-12-08 19:21:56 +00:00
|
|
|
|
|
|
|
wxCoord w_temp, h_temp, des_temp, lead_temp;
|
|
|
|
|
2006-03-23 01:17:07 +00:00
|
|
|
dc.GetTextExtent(wxString::Format(wxT(" %.1f"), max_val_y), &w_temp, &h_temp, &des_temp, &lead_temp);
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
x_start+=(w_temp+2);
|
|
|
|
y_end-=(h_temp+2);
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-03-23 01:17:07 +00:00
|
|
|
dc.GetTextExtent(wxT(" "), &w_temp, &h_temp, &des_temp, &lead_temp);
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
x_end-=w_temp;
|
2005-12-08 19:21:56 +00:00
|
|
|
double radius1=(double)(h_temp/2.0);
|
2006-01-20 22:57:32 +00:00
|
|
|
double d_y=(double)(h_temp/2.0);
|
2005-12-08 19:21:56 +00:00
|
|
|
|
|
|
|
wxDateTime dtTemp1;
|
|
|
|
wxString strBuffer1;
|
|
|
|
dtTemp1.Set((time_t)max_val_x);
|
2006-03-23 01:17:07 +00:00
|
|
|
strBuffer1=dtTemp1.Format(wxT("%d.%b.%y"));
|
2005-12-08 19:21:56 +00:00
|
|
|
dc.GetTextExtent(strBuffer1, &w_temp, &h_temp, &des_temp, &lead_temp);
|
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
double d_x=(double)(w_temp/2.0);
|
2005-12-08 19:21:56 +00:00
|
|
|
|
|
|
|
// Draw background graph
|
2006-01-20 22:57:32 +00:00
|
|
|
dc.DrawRoundedRectangle(x_start,y_start,x_end-x_start,y_end-y_start,radius1);
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
x_start+=(wxCoord)(d_x);
|
|
|
|
x_end-=(wxCoord)(d_x);
|
|
|
|
y_start+=(wxCoord)(d_y);
|
|
|
|
y_end-=(wxCoord)(d_y);
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
if (x_end<x_start) x_start=x_end=(x_end+x_start)/2;
|
|
|
|
if (y_end<y_start) y_start=y_end=(y_end+y_start)/2;
|
2005-11-28 06:28:55 +00:00
|
|
|
|
2006-08-21 16:38:16 +00:00
|
|
|
const double yscale=(y_end-y_start)/(max_val_y-min_val_y);
|
|
|
|
const double xscale=(x_end-x_start)/(max_val_x-min_val_x);
|
|
|
|
|
2005-12-08 19:21:56 +00:00
|
|
|
//Draw val and lines
|
|
|
|
dc.SetPen(wxPen(wxColour (64 , 128 , 192) , 1 , wxDOT));
|
2006-08-21 16:38:16 +00:00
|
|
|
|
2005-12-08 19:21:56 +00:00
|
|
|
wxInt32 d_oy_count=1;
|
2006-08-21 16:38:16 +00:00
|
|
|
d_oy_count=(wxInt32)ceil((y_end-y_start)/(2.0*h_temp));
|
|
|
|
|
|
|
|
// if (d_oy_count>9) d_oy_count=9;
|
|
|
|
// if (d_oy_count<1) d_oy_count=1;
|
|
|
|
|
|
|
|
double d_oy_val=fabs((max_val_y-min_val_y)/d_oy_count);
|
2006-08-22 19:59:48 +00:00
|
|
|
double d2=pow((double)10.0 , floor(log10(d_oy_val)));
|
2006-08-21 16:38:16 +00:00
|
|
|
|
|
|
|
if (d2>=d_oy_val){
|
|
|
|
d_oy_val=1*d2;
|
|
|
|
} else if (2*d2>=d_oy_val){
|
|
|
|
d_oy_val=2*d2;
|
|
|
|
} else if (5*d2>=d_oy_val){
|
|
|
|
d_oy_val=5*d2;
|
|
|
|
} else {
|
|
|
|
d_oy_val=10*d2;
|
|
|
|
}
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-08-21 16:38:16 +00:00
|
|
|
double y_start_val=ceil(min_val_y/d_oy_val)*d_oy_val;
|
2005-11-28 06:28:55 +00:00
|
|
|
|
2005-12-08 19:21:56 +00:00
|
|
|
for (double ny=0; ny<=d_oy_count;++ny){
|
2006-08-21 16:38:16 +00:00
|
|
|
dc.GetTextExtent(wxString::Format(wxT("%.1f"), y_start_val+ny*d_oy_val), &w_temp, &h_temp, &des_temp, &lead_temp);
|
|
|
|
if ((y_end - yscale * (y_start_val + ny * d_oy_val - min_val_y))>=(y_start-1)){
|
|
|
|
dc.DrawText(wxString::Format(wxT("%.1f"), y_start_val+ny*d_oy_val),(wxCoord)(x_start-w_temp-2-d_x),(wxCoord)(y_end - yscale * (y_start_val + ny * d_oy_val - min_val_y) - h_temp/2.0));
|
|
|
|
dc.DrawLine((wxCoord)(x_start-d_x+1),(wxCoord)(y_end - yscale * (y_start_val + ny * d_oy_val - min_val_y)),(wxCoord)(x_end+d_x),(wxCoord)(y_end - yscale * (y_start_val + ny * d_oy_val - min_val_y)));
|
|
|
|
}
|
2005-12-08 19:21:56 +00:00
|
|
|
}
|
2005-11-28 06:28:55 +00:00
|
|
|
|
2005-12-08 19:21:56 +00:00
|
|
|
//Draw day numbers and lines marking the days
|
|
|
|
dtTemp1.Set((time_t)max_val_x);
|
2006-03-23 01:17:07 +00:00
|
|
|
strBuffer1=dtTemp1.Format(wxT("%d.%b.%y"));
|
2005-12-08 19:21:56 +00:00
|
|
|
dc.GetTextExtent(strBuffer1, &w_temp, &h_temp, &des_temp, &lead_temp);
|
|
|
|
|
|
|
|
wxInt32 d_ox_count=1;
|
2006-01-20 22:57:32 +00:00
|
|
|
d_ox_count=(wxInt32)((x_end-x_start)/(1.2*w_temp));
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-08-21 16:38:16 +00:00
|
|
|
double d_ox_val=ceil(((double)(max_val_x-min_val_x)/d_ox_count)/86400.0)*86400.0;
|
|
|
|
d_ox_count=(wxInt32)ceil((max_val_x-min_val_x)/d_ox_val);
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2006-08-21 16:38:16 +00:00
|
|
|
double x_start_val=ceil(min_val_x/86400.0)*86400.0;
|
|
|
|
|
2005-12-08 19:21:56 +00:00
|
|
|
for (double nx=0; nx<=d_ox_count;++nx){
|
2006-08-21 16:38:16 +00:00
|
|
|
dtTemp1.Set((time_t)(x_start_val+nx*d_ox_val));
|
2006-03-23 01:17:07 +00:00
|
|
|
strBuffer1=dtTemp1.Format(wxT("%d.%b.%y"));
|
2005-12-08 19:21:56 +00:00
|
|
|
dc.GetTextExtent(strBuffer1, &w_temp, &h_temp, &des_temp, &lead_temp);
|
2006-08-21 16:38:16 +00:00
|
|
|
if ((x_start + xscale * (x_start_val + nx * d_ox_val - min_val_x))<=(x_end+1)){
|
|
|
|
dc.DrawText(strBuffer1, (wxCoord)(x_start-w_temp/2.0 + (xscale * (x_start_val + nx * d_ox_val - min_val_x))), (wxCoord)(y_end+d_y));
|
|
|
|
dc.DrawLine((wxCoord)(x_start + xscale * (x_start_val + nx * d_ox_val - min_val_x)),(wxCoord)(y_start-d_y+1), (wxCoord)(x_start + xscale * (x_start_val + nx * d_ox_val - min_val_x)),(wxCoord)(y_end+d_y));
|
|
|
|
}
|
2005-11-28 06:28:55 +00:00
|
|
|
}
|
2006-08-21 16:38:16 +00:00
|
|
|
dc.DestroyClippingRegion();
|
2005-12-08 19:21:56 +00:00
|
|
|
}
|
2005-11-28 06:28:55 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CPaintStatistics::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
2005-12-08 19:21:56 +00:00
|
|
|
//Init global
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-12-08 19:21:56 +00:00
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-11-28 06:28:55 +00:00
|
|
|
PROJECTS *proj=&(pDoc->statistics_status);
|
|
|
|
wxASSERT(proj);
|
2005-12-08 19:21:56 +00:00
|
|
|
//Init drawing
|
2005-11-28 06:28:55 +00:00
|
|
|
wxPaintDC dc (this);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2006-02-07 01:08:02 +00:00
|
|
|
wxCoord width = 0, height = 0;
|
2005-12-08 19:21:56 +00:00
|
|
|
wxCoord rectangle_x_start=0, rectangle_y_start=0;
|
|
|
|
wxCoord rectangle_x_end=0, rectangle_y_end=0;
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-11-28 06:28:55 +00:00
|
|
|
GetClientSize(&width, &height);
|
|
|
|
|
|
|
|
dc.SetBackground(*wxWHITE_BRUSH);
|
2006-08-21 16:38:16 +00:00
|
|
|
|
|
|
|
// dc.SetTextForeground (GetForegroundColour ());
|
|
|
|
dc.SetTextForeground (*wxBLACK);
|
2005-11-28 06:28:55 +00:00
|
|
|
dc.SetTextBackground (GetBackgroundColour ());
|
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
m_font_stdandart=dc.GetFont();
|
|
|
|
m_font_bold=dc.GetFont();
|
2005-11-28 06:28:55 +00:00
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
m_font_stdandart.SetWeight(wxNORMAL);
|
|
|
|
m_font_bold.SetWeight(wxBOLD);
|
|
|
|
|
|
|
|
dc.SetFont(m_font_stdandart);
|
|
|
|
|
|
|
|
// dc.SetFont(*wxSWISS_FONT);
|
2005-11-28 06:28:55 +00:00
|
|
|
|
2005-12-08 19:21:56 +00:00
|
|
|
//Start drawing
|
2005-11-28 06:28:55 +00:00
|
|
|
dc.BeginDrawing();
|
2006-01-20 22:57:32 +00:00
|
|
|
dc.Clear();
|
2005-12-08 19:21:56 +00:00
|
|
|
//Number of Projects
|
|
|
|
wxInt32 nb_proj=0;
|
|
|
|
for (std::vector<PROJECT*>::const_iterator i=proj->projects.begin(); i!=proj->projects.end(); ++i) {
|
|
|
|
++nb_proj;
|
|
|
|
}
|
|
|
|
if (nb_proj==0) {
|
|
|
|
dc.EndDrawing();
|
|
|
|
return;
|
|
|
|
}
|
2006-01-20 22:57:32 +00:00
|
|
|
// Check m_NextProjectStatistic
|
|
|
|
if (m_NextProjectStatistic<0) m_NextProjectStatistic=nb_proj-1;
|
|
|
|
if ((m_NextProjectStatistic<0)||(m_NextProjectStatistic>=nb_proj)) m_NextProjectStatistic=0;
|
|
|
|
// Initial coord
|
|
|
|
rectangle_x_start=0;
|
|
|
|
rectangle_x_end=width;
|
|
|
|
rectangle_y_start=0;
|
|
|
|
rectangle_y_end=height;
|
2005-12-08 19:21:56 +00:00
|
|
|
|
2005-11-28 06:28:55 +00:00
|
|
|
switch (m_ModeViewStatistic){
|
|
|
|
case 0:{
|
2006-01-20 22:57:32 +00:00
|
|
|
///Draw heading
|
|
|
|
CheckMinMaxC(rectangle_x_start, rectangle_x_end);
|
|
|
|
CheckMinMaxC(rectangle_y_start, rectangle_y_end);
|
|
|
|
DrawMainHead(dc, heading, rectangle_x_start, rectangle_x_end, rectangle_y_start, rectangle_y_end);
|
2005-12-08 19:21:56 +00:00
|
|
|
//How many rows/colums?
|
2005-11-28 06:28:55 +00:00
|
|
|
wxInt32 nb_proj_row=0, nb_proj_col=0;
|
|
|
|
if (nb_proj<4) {
|
|
|
|
nb_proj_col=1;
|
|
|
|
nb_proj_row=nb_proj;
|
|
|
|
} else {
|
|
|
|
nb_proj_col=2;
|
|
|
|
nb_proj_row=(wxInt32)ceil(static_cast<double>(nb_proj/static_cast<double>(nb_proj_col)));
|
|
|
|
}
|
|
|
|
|
|
|
|
wxInt32 col=1, row=1; //Used to identify the actual row/col
|
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
const double x_fac=(rectangle_x_end-rectangle_x_start)/nb_proj_col;
|
|
|
|
const double y_fac=(rectangle_y_end-rectangle_y_start)/nb_proj_row;
|
2005-11-28 06:28:55 +00:00
|
|
|
|
|
|
|
wxInt32 count=-1;
|
|
|
|
|
|
|
|
for (std::vector<PROJECT*>::const_iterator i=proj->projects.begin();i!=proj->projects.end(); ++i) {
|
|
|
|
++count;
|
2005-12-08 19:21:56 +00:00
|
|
|
//Find minimum/maximum value
|
2005-11-28 06:28:55 +00:00
|
|
|
double min_val_y=10e32, max_val_y=0;
|
2005-12-08 19:21:56 +00:00
|
|
|
double min_val_x=10e32, max_val_x=0;
|
|
|
|
MinMaxDayCredit(i, min_val_y,max_val_y,min_val_x, max_val_x, m_SelectedStatistic);
|
2006-01-20 22:57:32 +00:00
|
|
|
CheckMinMaxD(min_val_x, max_val_x);
|
|
|
|
CheckMinMaxD(min_val_y, max_val_y);
|
2006-08-21 16:38:16 +00:00
|
|
|
min_val_x=floor(min_val_x/86400.0)*86400.0;
|
|
|
|
max_val_x=ceil(max_val_x/86400.0)*86400.0;
|
2005-12-08 19:21:56 +00:00
|
|
|
//Where do we draw in?
|
2005-11-28 06:28:55 +00:00
|
|
|
wxCoord x_start=0, y_start=0, x_end=0, y_end=0;
|
2006-01-20 22:57:32 +00:00
|
|
|
x_start=(wxCoord)(rectangle_x_start+x_fac*(double)(col-1));
|
|
|
|
x_end=(wxCoord)(rectangle_x_start+x_fac*((double)col));
|
|
|
|
y_start=(wxCoord)(rectangle_y_start+y_fac*(double)(row-1));
|
|
|
|
y_end=(wxCoord)(rectangle_y_start+y_fac*(double)row);
|
2005-12-08 19:21:56 +00:00
|
|
|
///Draw scale Draw Project name
|
2005-11-28 06:28:55 +00:00
|
|
|
PROJECT* statistic = wxGetApp().GetDocument()->statistic(count);
|
|
|
|
PROJECT* state_project = NULL;
|
|
|
|
wxString head_name;
|
|
|
|
std::string project_name;
|
|
|
|
if (statistic) {
|
|
|
|
state_project = pDoc->state.lookup_project(statistic->master_url);
|
|
|
|
if (state_project) {
|
2006-03-23 01:17:07 +00:00
|
|
|
state_project->get_name(project_name);
|
|
|
|
head_name = wxString(project_name.c_str(), wxConvUTF8);
|
2005-11-28 06:28:55 +00:00
|
|
|
}
|
|
|
|
}
|
2006-01-20 22:57:32 +00:00
|
|
|
///Draw heading
|
|
|
|
CheckMinMaxC(x_start, x_end);
|
|
|
|
CheckMinMaxC(y_start, y_end);
|
|
|
|
DrawMainHead(dc, head_name, x_start, x_end, y_start, y_end);
|
|
|
|
///Draw axis
|
|
|
|
CheckMinMaxC(x_start, x_end);
|
|
|
|
CheckMinMaxC(y_start, y_end);
|
|
|
|
DrawAxis(dc, max_val_y, min_val_y,max_val_x, min_val_x, x_start, x_end, y_start, y_end);
|
2005-12-08 19:21:56 +00:00
|
|
|
///Draw graph
|
2005-11-28 06:28:55 +00:00
|
|
|
wxColour grafColour=wxColour(0,0,0);
|
2006-01-20 22:57:32 +00:00
|
|
|
getDrawColour(grafColour,m_SelectedStatistic);
|
|
|
|
CheckMinMaxC(x_start, x_end);
|
|
|
|
CheckMinMaxC(y_start, y_end);
|
|
|
|
DrawGraph(dc, i, x_start, x_end, y_start, y_end, grafColour, 0, m_SelectedStatistic, max_val_y, min_val_y, max_val_x, min_val_x);
|
|
|
|
//Change row/col
|
2005-11-28 06:28:55 +00:00
|
|
|
if (col==nb_proj_col) {
|
|
|
|
col=1;
|
|
|
|
++row;
|
|
|
|
} else {
|
|
|
|
++col;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:{
|
2006-01-20 22:57:32 +00:00
|
|
|
///Draw Legend
|
|
|
|
CheckMinMaxC(rectangle_x_start, rectangle_x_end);
|
|
|
|
CheckMinMaxC(rectangle_y_start, rectangle_y_end);
|
|
|
|
DrawLegend(dc, proj, pDoc, m_NextProjectStatistic, false, rectangle_x_start, rectangle_x_end, rectangle_y_start, rectangle_y_end);
|
|
|
|
///Draw heading
|
|
|
|
CheckMinMaxC(rectangle_x_start, rectangle_x_end);
|
|
|
|
CheckMinMaxC(rectangle_y_start, rectangle_y_end);
|
|
|
|
DrawMainHead(dc, heading, rectangle_x_start, rectangle_x_end, rectangle_y_start, rectangle_y_end);
|
|
|
|
//Draw project
|
2005-11-28 06:28:55 +00:00
|
|
|
wxInt32 count=-1;
|
|
|
|
for (std::vector<PROJECT*>::const_iterator i=proj->projects.begin();i!=proj->projects.end(); ++i) {
|
|
|
|
++count;
|
|
|
|
if (count!=m_NextProjectStatistic) continue;
|
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
///Find minimum/maximum value
|
2005-11-28 06:28:55 +00:00
|
|
|
double min_val_y=10e32, max_val_y=0;
|
2005-12-08 19:21:56 +00:00
|
|
|
double min_val_x=10e32, max_val_x=0;
|
|
|
|
|
|
|
|
MinMaxDayCredit(i, min_val_y,max_val_y,min_val_x, max_val_x, m_SelectedStatistic);
|
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
CheckMinMaxD(min_val_x, max_val_x);
|
|
|
|
CheckMinMaxD(min_val_y, max_val_y);
|
2006-08-21 16:38:16 +00:00
|
|
|
min_val_x=floor(min_val_x/86400.0)*86400.0;
|
|
|
|
max_val_x=ceil(max_val_x/86400.0)*86400.0;
|
2006-01-20 22:57:32 +00:00
|
|
|
///Draw axis + Draw Project name
|
2005-11-28 06:28:55 +00:00
|
|
|
PROJECT* statistic = wxGetApp().GetDocument()->statistic(count);
|
|
|
|
PROJECT* state_project = NULL;
|
|
|
|
wxString head_name;
|
|
|
|
std::string project_name;
|
|
|
|
if (statistic) {
|
|
|
|
state_project = pDoc->state.lookup_project(statistic->master_url);
|
|
|
|
if (state_project) {
|
2006-03-23 01:17:07 +00:00
|
|
|
state_project->get_name(project_name);
|
|
|
|
head_name = wxString(project_name.c_str(), wxConvUTF8);
|
2005-11-28 06:28:55 +00:00
|
|
|
}
|
|
|
|
}
|
2006-01-20 22:57:32 +00:00
|
|
|
///Draw heading
|
|
|
|
CheckMinMaxC(rectangle_x_start, rectangle_x_end);
|
|
|
|
CheckMinMaxC(rectangle_y_start, rectangle_y_end);
|
|
|
|
DrawMainHead(dc, head_name, rectangle_x_start, rectangle_x_end, rectangle_y_start, rectangle_y_end);
|
|
|
|
///Draw axis
|
|
|
|
CheckMinMaxC(rectangle_x_start, rectangle_x_end);
|
|
|
|
CheckMinMaxC(rectangle_y_start, rectangle_y_end);
|
|
|
|
DrawAxis(dc, max_val_y, min_val_y,max_val_x, min_val_x, rectangle_x_start, rectangle_x_end, rectangle_y_start, rectangle_y_end);
|
2005-12-08 19:21:56 +00:00
|
|
|
///Draw graph
|
2005-11-28 06:28:55 +00:00
|
|
|
wxColour grafColour=wxColour(0,0,0);
|
2006-01-20 22:57:32 +00:00
|
|
|
getDrawColour(grafColour,m_SelectedStatistic);
|
|
|
|
CheckMinMaxC(rectangle_x_start, rectangle_x_end);
|
|
|
|
CheckMinMaxC(rectangle_y_start, rectangle_y_end);
|
|
|
|
DrawGraph(dc, i, rectangle_x_start, rectangle_x_end, rectangle_y_start, rectangle_y_end, grafColour, 0, m_SelectedStatistic, max_val_y, min_val_y, max_val_x, min_val_x);
|
2005-11-28 06:28:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:{
|
2006-01-20 22:57:32 +00:00
|
|
|
///Draw Legend
|
|
|
|
CheckMinMaxC(rectangle_x_start, rectangle_x_end);
|
|
|
|
CheckMinMaxC(rectangle_y_start, rectangle_y_end);
|
|
|
|
DrawLegend(dc, proj, pDoc, -1, true, rectangle_x_start, rectangle_x_end, rectangle_y_start, rectangle_y_end);
|
|
|
|
///Draw heading
|
|
|
|
CheckMinMaxC(rectangle_x_start, rectangle_x_end);
|
|
|
|
CheckMinMaxC(rectangle_y_start, rectangle_y_end);
|
|
|
|
DrawMainHead(dc, heading, rectangle_x_start, rectangle_x_end, rectangle_y_start, rectangle_y_end);
|
2005-12-08 19:21:56 +00:00
|
|
|
//Find minimum/maximum value
|
|
|
|
double min_val_y=10e32, max_val_y=0;
|
|
|
|
double min_val_x=10e32, max_val_x=0;
|
|
|
|
|
|
|
|
wxInt32 count=-1;
|
|
|
|
for (std::vector<PROJECT*>::const_iterator i=proj->projects.begin();i!=proj->projects.end(); ++i) {
|
|
|
|
++count;
|
|
|
|
MinMaxDayCredit(i, min_val_y,max_val_y,min_val_x, max_val_x, m_SelectedStatistic);
|
|
|
|
}
|
2006-01-20 22:57:32 +00:00
|
|
|
CheckMinMaxD(min_val_x, max_val_x);
|
|
|
|
CheckMinMaxD(min_val_y, max_val_y);
|
2006-08-21 16:38:16 +00:00
|
|
|
min_val_x=floor(min_val_x/86400.0)*86400.0;
|
|
|
|
max_val_x=ceil(max_val_x/86400.0)*86400.0;
|
2005-12-08 19:21:56 +00:00
|
|
|
///Draw axis
|
2006-01-20 22:57:32 +00:00
|
|
|
CheckMinMaxC(rectangle_x_start, rectangle_x_end);
|
|
|
|
CheckMinMaxC(rectangle_y_start, rectangle_y_end);
|
|
|
|
DrawAxis(dc, max_val_y, min_val_y,max_val_x, min_val_x, rectangle_x_start, rectangle_x_end, rectangle_y_start, rectangle_y_end);
|
2005-12-08 19:21:56 +00:00
|
|
|
|
|
|
|
count=-1;
|
|
|
|
for (std::vector<PROJECT*>::const_iterator i=proj->projects.begin();i!=proj->projects.end(); ++i) {
|
|
|
|
++count;
|
|
|
|
///Draw graph
|
|
|
|
wxColour grafColour=wxColour(0,0,0);
|
2006-01-20 22:57:32 +00:00
|
|
|
wxInt32 typePoint=0;
|
|
|
|
getTypePoint(typePoint,count);
|
|
|
|
getDrawColour(grafColour,count);
|
|
|
|
CheckMinMaxC(rectangle_x_start, rectangle_x_end);
|
|
|
|
CheckMinMaxC(rectangle_y_start, rectangle_y_end);
|
|
|
|
DrawGraph(dc, i, rectangle_x_start, rectangle_x_end, rectangle_y_start, rectangle_y_end, grafColour, typePoint, m_SelectedStatistic, max_val_y, min_val_y, max_val_x, min_val_x);
|
2005-12-08 19:21:56 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-11-28 06:28:55 +00:00
|
|
|
default:{
|
|
|
|
m_ModeViewStatistic=0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dc.EndDrawing();
|
2005-04-04 06:02:36 +00:00
|
|
|
}
|
|
|
|
|
2005-11-14 22:06:17 +00:00
|
|
|
void CPaintStatistics::OnSize(wxSizeEvent& event) {
|
|
|
|
Refresh(TRUE, NULL);
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2005-04-04 06:02:36 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CViewStatistics, CBOINCBaseView)
|
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
BEGIN_EVENT_TABLE (CViewStatistics, CBOINCBaseView)
|
|
|
|
EVT_BUTTON(ID_TASK_STATISTICS_USERTOTAL, CViewStatistics::OnStatisticsUserTotal)
|
|
|
|
EVT_BUTTON(ID_TASK_STATISTICS_USERAVERAGE, CViewStatistics::OnStatisticsUserAverage)
|
|
|
|
EVT_BUTTON(ID_TASK_STATISTICS_HOSTTOTAL, CViewStatistics::OnStatisticsHostTotal)
|
|
|
|
EVT_BUTTON(ID_TASK_STATISTICS_HOSTAVERAGE, CViewStatistics::OnStatisticsHostAverage)
|
2006-01-20 22:57:32 +00:00
|
|
|
EVT_BUTTON(ID_TASK_STATISTICS_MODEVIEW0, CViewStatistics::OnStatisticsModeView0)
|
|
|
|
EVT_BUTTON(ID_TASK_STATISTICS_MODEVIEW1, CViewStatistics::OnStatisticsModeView1)
|
|
|
|
EVT_BUTTON(ID_TASK_STATISTICS_MODEVIEW2, CViewStatistics::OnStatisticsModeView2)
|
2005-11-28 06:28:55 +00:00
|
|
|
EVT_BUTTON(ID_TASK_STATISTICS_NEXTPROJECT, CViewStatistics::OnStatisticsNextProject)
|
2006-01-20 22:57:32 +00:00
|
|
|
EVT_BUTTON(ID_TASK_STATISTICS_PREVPROJECT, CViewStatistics::OnStatisticsPrevProject)
|
2005-04-21 23:14:10 +00:00
|
|
|
EVT_LIST_ITEM_SELECTED(ID_LIST_STATISTICSVIEW, CViewStatistics::OnListSelected)
|
|
|
|
EVT_LIST_ITEM_DESELECTED(ID_LIST_STATISTICSVIEW, CViewStatistics::OnListDeselected)
|
2005-04-21 06:04:26 +00:00
|
|
|
END_EVENT_TABLE ()
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-09-02 18:40:06 +00:00
|
|
|
CViewStatistics::CViewStatistics()
|
|
|
|
{}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
CViewStatistics::CViewStatistics(wxNotebook* pNotebook) :
|
2005-09-06 06:18:36 +00:00
|
|
|
CBOINCBaseView(pNotebook)
|
2005-04-21 06:04:26 +00:00
|
|
|
{
|
2005-11-28 06:28:55 +00:00
|
|
|
CTaskItemGroup* pGroup = NULL;
|
|
|
|
CTaskItem* pItem = NULL;
|
2005-04-04 06:02:36 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Setup View
|
|
|
|
//
|
|
|
|
wxFlexGridSizer* itemFlexGridSizer = new wxFlexGridSizer(2, 0, 0);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(itemFlexGridSizer);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
|
|
|
itemFlexGridSizer->AddGrowableRow(0);
|
|
|
|
itemFlexGridSizer->AddGrowableCol(1);
|
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
m_pTaskPane = new CBOINCTaskCtrl(this, ID_TASK_STATISTICSVIEW, DEFAULT_TASK_FLAGS);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-11-28 06:28:55 +00:00
|
|
|
m_PaintStatistics = new CPaintStatistics(this, ID_LIST_STATISTICSVIEW, wxDefaultPosition, wxSize(-1, -1), 0);
|
|
|
|
wxASSERT(m_PaintStatistics);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
|
|
|
itemFlexGridSizer->Add(m_pTaskPane, 1, wxGROW|wxALL, 1);
|
|
|
|
itemFlexGridSizer->Add(m_PaintStatistics, 1, wxGROW|wxALL, 1);
|
|
|
|
|
2005-04-27 06:32:40 +00:00
|
|
|
SetSizer(itemFlexGridSizer);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-07-22 22:57:38 +00:00
|
|
|
Layout();
|
|
|
|
|
2006-02-08 06:56:34 +00:00
|
|
|
pGroup = new CTaskItemGroup( _("Commands") );
|
2005-11-28 06:28:55 +00:00
|
|
|
m_TaskGroups.push_back( pGroup );
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2005-11-28 06:28:55 +00:00
|
|
|
pItem = new CTaskItem(
|
2005-04-21 06:04:26 +00:00
|
|
|
_("Show user total"),
|
2006-09-09 17:22:14 +00:00
|
|
|
_("Show total credit for user"),
|
2005-04-21 06:04:26 +00:00
|
|
|
ID_TASK_STATISTICS_USERTOTAL
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
2005-11-28 06:28:55 +00:00
|
|
|
pItem = new CTaskItem(
|
2005-04-21 06:04:26 +00:00
|
|
|
_("Show user average"),
|
2006-09-09 17:22:14 +00:00
|
|
|
_("Show average credit for user"),
|
2005-04-21 06:04:26 +00:00
|
|
|
ID_TASK_STATISTICS_USERAVERAGE
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
2005-11-28 06:28:55 +00:00
|
|
|
pItem = new CTaskItem(
|
2005-04-21 06:04:26 +00:00
|
|
|
_("Show host total"),
|
2006-09-09 17:22:14 +00:00
|
|
|
_("Show total credit for host"),
|
2005-04-21 06:04:26 +00:00
|
|
|
ID_TASK_STATISTICS_HOSTTOTAL
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
2005-11-28 06:28:55 +00:00
|
|
|
pItem = new CTaskItem(
|
2005-04-21 06:04:26 +00:00
|
|
|
_("Show host average"),
|
2006-09-09 17:22:14 +00:00
|
|
|
_("Show average credit for host"),
|
2005-04-21 06:04:26 +00:00
|
|
|
ID_TASK_STATISTICS_HOSTAVERAGE
|
|
|
|
);
|
2006-01-20 22:57:32 +00:00
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
|
|
|
pGroup = new CTaskItemGroup( _("Project") );
|
|
|
|
m_TaskGroups.push_back( pGroup );
|
|
|
|
|
|
|
|
pItem = new CTaskItem(
|
2006-03-09 10:21:07 +00:00
|
|
|
_("< &Previous project"),
|
2006-09-09 17:22:14 +00:00
|
|
|
_("Show chart for previous project"),
|
2006-01-20 22:57:32 +00:00
|
|
|
ID_TASK_STATISTICS_PREVPROJECT
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
pItem = new CTaskItem(
|
2006-03-09 10:21:07 +00:00
|
|
|
_("&Next project >"),
|
2006-09-09 17:22:14 +00:00
|
|
|
_("Show chart for next project"),
|
2006-01-20 22:57:32 +00:00
|
|
|
ID_TASK_STATISTICS_NEXTPROJECT
|
|
|
|
);
|
2005-04-21 06:04:26 +00:00
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
2005-12-08 19:21:56 +00:00
|
|
|
pGroup = new CTaskItemGroup( _("Mode view") );
|
|
|
|
m_TaskGroups.push_back( pGroup );
|
2005-11-28 06:28:55 +00:00
|
|
|
pItem = new CTaskItem(
|
2005-12-08 19:21:56 +00:00
|
|
|
_("All projects"),
|
2006-09-09 17:22:14 +00:00
|
|
|
_("Show all projects, one chart per project"),
|
2006-01-20 22:57:32 +00:00
|
|
|
ID_TASK_STATISTICS_MODEVIEW0
|
2005-11-28 06:28:55 +00:00
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
|
|
|
pItem = new CTaskItem(
|
2006-01-20 22:57:32 +00:00
|
|
|
_("One project"),
|
2006-09-09 17:22:14 +00:00
|
|
|
_("Show one chart with selected project"),
|
2006-01-20 22:57:32 +00:00
|
|
|
ID_TASK_STATISTICS_MODEVIEW1
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
|
|
|
pItem = new CTaskItem(
|
|
|
|
_("All projects(sum)"),
|
2006-09-09 17:22:14 +00:00
|
|
|
_("Show one chart with all projects"),
|
2006-01-20 22:57:32 +00:00
|
|
|
ID_TASK_STATISTICS_MODEVIEW2
|
2005-11-28 06:28:55 +00:00
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
2005-04-21 06:04:26 +00:00
|
|
|
// Create Task Pane Items
|
2005-04-21 23:14:10 +00:00
|
|
|
m_pTaskPane->UpdateControls();
|
2005-04-22 01:46:32 +00:00
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
m_pTaskPane->DisableTaskGroupTasks(m_TaskGroups[1]); /// "project" button
|
|
|
|
|
2005-04-22 01:46:32 +00:00
|
|
|
UpdateSelection();
|
2005-04-21 06:04:26 +00:00
|
|
|
}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
CViewStatistics::~CViewStatistics() {
|
|
|
|
EmptyTasks();
|
|
|
|
}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-09-02 21:03:36 +00:00
|
|
|
wxString& CViewStatistics::GetViewName() {
|
2005-09-02 20:56:08 +00:00
|
|
|
static wxString strViewName(_("Statistics"));
|
|
|
|
return strViewName;
|
2005-04-21 06:04:26 +00:00
|
|
|
}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2006-02-16 18:01:46 +00:00
|
|
|
const char** CViewStatistics::GetViewIcon() {
|
|
|
|
return stats_xpm;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewStatistics::OnStatisticsUserTotal( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsUserTotal - Function Begin"));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
pFrame->UpdateStatusText(_("Updating charts..."));
|
2005-11-28 06:28:55 +00:00
|
|
|
m_PaintStatistics->heading=_("User Total");
|
|
|
|
m_PaintStatistics->m_SelectedStatistic=0;
|
2005-04-21 06:04:26 +00:00
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
2005-05-05 06:07:14 +00:00
|
|
|
pFrame->FireRefreshView();
|
2005-04-21 23:14:10 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsUserTotal - Function End"));
|
|
|
|
}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewStatistics::OnStatisticsUserAverage( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsUserAverage - Function Begin"));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
pFrame->UpdateStatusText(_("Updating charts..."));
|
2005-11-28 06:28:55 +00:00
|
|
|
m_PaintStatistics->heading=_("User Average");
|
|
|
|
m_PaintStatistics->m_SelectedStatistic=1;
|
2005-04-21 06:04:26 +00:00
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
2005-05-05 06:07:14 +00:00
|
|
|
pFrame->FireRefreshView();
|
2005-04-21 23:14:10 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsUserAverage - Function End"));
|
2005-04-04 06:02:36 +00:00
|
|
|
}
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewStatistics::OnStatisticsHostTotal( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsHostTotal - Function Begin"));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
pFrame->UpdateStatusText(_("Updating charts..."));
|
2005-11-28 06:28:55 +00:00
|
|
|
m_PaintStatistics->heading=_("Host Total");
|
|
|
|
m_PaintStatistics->m_SelectedStatistic=2;
|
2005-04-21 06:04:26 +00:00
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
2005-05-05 06:07:14 +00:00
|
|
|
pFrame->FireRefreshView();
|
2005-04-21 23:14:10 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsHostTotal - Function End"));
|
2005-04-07 07:04:50 +00:00
|
|
|
}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewStatistics::OnStatisticsHostAverage( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsHostAverage - Function Begin"));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
pFrame->UpdateStatusText(_("Updating charts..."));
|
2005-11-28 06:28:55 +00:00
|
|
|
m_PaintStatistics->heading=_("Host Average");
|
|
|
|
m_PaintStatistics->m_SelectedStatistic=3;
|
2005-04-21 06:04:26 +00:00
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
2005-05-05 06:07:14 +00:00
|
|
|
pFrame->FireRefreshView();
|
2005-04-21 23:14:10 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsHostAverage - Function End"));
|
2005-04-04 06:02:36 +00:00
|
|
|
}
|
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
void CViewStatistics::OnStatisticsModeView0( wxCommandEvent& WXUNUSED(event) ) {
|
2005-11-28 06:28:55 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsModeView - Function Begin"));
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2005-11-28 06:28:55 +00:00
|
|
|
|
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2005-11-28 06:28:55 +00:00
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Updating charts..."));
|
2006-01-20 22:57:32 +00:00
|
|
|
m_PaintStatistics->m_ModeViewStatistic=0;
|
|
|
|
m_pTaskPane->EnableTaskGroupTasks(m_TaskGroups[0]);
|
|
|
|
m_pTaskPane->DisableTaskGroupTasks(m_TaskGroups[1]);
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsModeView - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CViewStatistics::OnStatisticsModeView1( wxCommandEvent& WXUNUSED(event) ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsModeView - Function Begin"));
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2006-01-20 22:57:32 +00:00
|
|
|
|
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2006-01-20 22:57:32 +00:00
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Updating charts..."));
|
|
|
|
m_PaintStatistics->m_ModeViewStatistic=1;
|
|
|
|
m_pTaskPane->EnableTaskGroupTasks(m_TaskGroups[0]);
|
|
|
|
m_pTaskPane->EnableTaskGroupTasks(m_TaskGroups[1]);
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsModeView - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CViewStatistics::OnStatisticsModeView2( wxCommandEvent& WXUNUSED(event) ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsModeView - Function Begin"));
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2006-01-20 22:57:32 +00:00
|
|
|
|
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2006-01-20 22:57:32 +00:00
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Updating charts..."));
|
|
|
|
m_PaintStatistics->m_ModeViewStatistic=2;
|
|
|
|
m_pTaskPane->EnableTaskGroupTasks(m_TaskGroups[0]);
|
|
|
|
m_pTaskPane->DisableTaskGroupTasks(m_TaskGroups[1]);
|
2005-11-28 06:28:55 +00:00
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsModeView - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CViewStatistics::OnStatisticsNextProject( wxCommandEvent& WXUNUSED(event) ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsNextProject - Function Begin"));
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2005-11-28 06:28:55 +00:00
|
|
|
|
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2005-11-28 06:28:55 +00:00
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Updating charts..."));
|
|
|
|
m_PaintStatistics->m_NextProjectStatistic++;
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsNextProject - Function End"));
|
|
|
|
}
|
|
|
|
|
2006-01-20 22:57:32 +00:00
|
|
|
void CViewStatistics::OnStatisticsPrevProject( wxCommandEvent& WXUNUSED(event) ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsPrevProject - Function Begin"));
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2006-01-20 22:57:32 +00:00
|
|
|
|
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2006-01-20 22:57:32 +00:00
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Updating charts..."));
|
|
|
|
m_PaintStatistics->m_NextProjectStatistic--;
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsPrevProject - Function End"));
|
|
|
|
}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
bool CViewStatistics::OnSaveState(wxConfigBase* pConfig) {
|
|
|
|
bool bReturnValue = true;
|
2005-04-08 06:24:58 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pConfig);
|
|
|
|
wxASSERT(m_pTaskPane);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
if (!m_pTaskPane->OnSaveState(pConfig)) {
|
|
|
|
bReturnValue = false;
|
|
|
|
}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
return bReturnValue;
|
|
|
|
}
|
2005-04-08 06:24:58 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
bool CViewStatistics::OnRestoreState(wxConfigBase* pConfig) {
|
|
|
|
wxASSERT(pConfig);
|
|
|
|
wxASSERT(m_pTaskPane);
|
2005-04-08 06:24:58 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
if (!m_pTaskPane->OnRestoreState(pConfig)) {
|
|
|
|
return false;
|
|
|
|
}
|
2005-04-08 06:24:58 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
return true;
|
2005-04-04 06:02:36 +00:00
|
|
|
}
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewStatistics::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
|
2006-04-17 20:26:59 +00:00
|
|
|
if (wxGetApp().GetDocument()->GetStatisticsCount()) {
|
2005-11-28 06:28:55 +00:00
|
|
|
m_PaintStatistics->Refresh();
|
|
|
|
}
|
2005-04-21 06:04:26 +00:00
|
|
|
}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
void CViewStatistics::UpdateSelection() {
|
2006-01-09 14:03:13 +00:00
|
|
|
CBOINCBaseView::PreUpdateSelection();
|
|
|
|
CBOINCBaseView::PostUpdateSelection();
|
2005-04-21 06:04:26 +00:00
|
|
|
}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
const char *BOINC_RCSID_7aadb93333 = "$Id$";
|