Moved FooBar (the green range thingy) to it's own gLayer

This commit is contained in:
Mark Watkins 2011-05-31 14:50:06 +10:00
parent 6b5ef70df9
commit 9b05b5d512
5 changed files with 85 additions and 56 deletions

View File

@ -7871,11 +7871,11 @@
<map>
"tinyxml/tinyxml.h"
1306804928 /home/mark/projects/git/sleepyhead/graphs/graph.h
1306817262 /home/mark/projects/git/sleepyhead/graphs/graph.h
<sleeplib/machine.h>
<list>
1306815962 /home/mark/projects/git/sleepyhead/version.h
1306817290 /home/mark/projects/git/sleepyhead/version.h
1306724655 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h
"machine.h"
@ -7892,7 +7892,7 @@
"preferences.h"
"tinyxml/tinyxml.h"
1306815066 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
1306816925 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
"wx_pch.h"
"version.h"
<wx/app.h>
@ -7910,7 +7910,7 @@
"sleeplib/profiles.h"
"sleeplib/machine_loader.h"
1306815882 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp
1306817190 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp
<wx/settings.h>
<wx/dcbuffer.h>
<wx/log.h>

View File

@ -333,6 +333,7 @@ Summary::Summary(wxWindow *win,Profile *_profile)
AHI=new gGraphWindow(ScrolledWindow,-1,wxT("AHI"),wxPoint(0,0), wxSize(400,160), wxNO_BORDER);
AHI->SetMargins(10,15,65,80);
AHI->AddLayer(new gBarChart(ahidata,wxRED));
AHI->AddLayer(new gFooBar());
// AHI->AddLayer(new gXAxis(NULL,wxBLACK));
//AHI->AddLayer(new gLineChart(ahidata,wxRED));
fgSizer->Add(AHI,1,wxEXPAND);
@ -343,7 +344,7 @@ Summary::Summary(wxWindow *win,Profile *_profile)
PRESSURE->AddLayer(new gLineChart(pressure,wxDARK_GREEN,6192));
PRESSURE->AddLayer(new gLineChart(pressure_eap,wxRED,6192,false,true));
PRESSURE->AddLayer(new gLineChart(pressure_iap,wxBLUE,6192,false,true));
PRESSURE->AddLayer(new gXAxis(NULL,wxBLACK));
PRESSURE->AddLayer(new gXAxis(wxBLACK));
fgSizer->Add(PRESSURE,1,wxEXPAND);
@ -351,14 +352,15 @@ Summary::Summary(wxWindow *win,Profile *_profile)
LEAK->SetMargins(10,15,65,80);
//LEAK->AddLayer(new gBarChart(leak,wxYELLOW));
LEAK->AddLayer(new gLineChart(leak,wxPURPLE,6192));
LEAK->AddLayer(new gXAxis(NULL,wxBLACK));
LEAK->AddLayer(new gXAxis(wxBLACK));
fgSizer->Add(LEAK,1,wxEXPAND);
USAGE=new gGraphWindow(ScrolledWindow,-1,wxT("Usage (Hours)"),wxPoint(0,0), wxSize(400,160), wxNO_BORDER);
USAGE->SetMargins(10,15,65,80);
USAGE->AddLayer(new gBarChart(usage,wxGREEN));
//USAGE->AddLayer(new gXAxis(NULL,wxBLACK));
USAGE->AddLayer(new gFooBar());
//USAGE->AddLayer(new gXAxis(wxBLACK));
//USAGE->AddLayer(new gLineChart(usage,wxGREEN));
fgSizer->Add(USAGE,1,wxEXPAND);
@ -525,7 +527,7 @@ Daily::Daily(wxWindow *win,Profile *p)
AddData(leakdata=new PressureData(CPAP_Leak,0));
LEAK=new gGraphWindow(ScrolledWindow,-1,wxT("Mask Leaks"),wxPoint(0,0), wxSize(600,130), wxNO_BORDER);
LEAK->AddLayer(new gLineChart(leakdata,wxPURPLE,4096,false));
LEAK->AddLayer(new gXAxis(NULL,wxBLACK));
LEAK->AddLayer(new gXAxis(wxBLACK));
AddData(pressure_iap=new PressureData(CPAP_IAP));
AddData(pressure_eap=new PressureData(CPAP_EAP));
@ -534,7 +536,7 @@ Daily::Daily(wxWindow *win,Profile *p)
PRD->AddLayer(new gLineChart(prd,wxDARK_GREEN,4096,false));
PRD->AddLayer(new gLineChart(pressure_iap,wxBLUE,4096,false,true));
PRD->AddLayer(new gLineChart(pressure_eap,wxRED,4096,false,true));
PRD->AddLayer(new gXAxis(NULL,wxBLACK));
PRD->AddLayer(new gXAxis(wxBLACK));
AddData(frw=new FlowData());
FRW=new gGraphWindow(ScrolledWindow,-1,wxT("Flow Rate"),wxPoint(0,0), wxSize(600,150), wxNO_BORDER);
@ -560,7 +562,7 @@ Daily::Daily(wxWindow *win,Profile *p)
FRW->AddLayer(new gLineOverlayBar(flags[3],wxBLUE,wxT("H")));
FRW->AddLayer(new gLineOverlayBar(flags[2],wxAQUA,wxT("OA")));
FRW->AddLayer(new gLineOverlayBar(flags[1],wxPURPLE,wxT("CA")));
FRW->AddLayer(new gXAxis(NULL,wxBLACK));
FRW->AddLayer(new gXAxis(wxBLACK));
SF=new gGraphWindow(ScrolledWindow,-1,wxT("Event Flags"),wxPoint(0,0), wxSize(600,180), wxNO_BORDER);
// SF->SetMargins(10,15,20,80);
@ -583,8 +585,8 @@ Daily::Daily(wxWindow *win,Profile *p)
SF->AddLayer(new gFlagsLine(flags[2],wxAQUA,wxT("OA"),2,sfc));
SF->AddLayer(new gFlagsLine(flags[1],wxPURPLE,wxT("CA"),1,sfc));
SF->AddLayer(new gFlagsLine(flags[0],wxGREEN2,wxT("CSR"),0,sfc));
SF->AddLayer(new gXAxis(NULL,wxBLACK));
SF->AddLayer(new gXAxis(wxBLACK));
SF->AddLayer(new gFooBar());
fgSizer->Add(SF,1,wxEXPAND);
fgSizer->Add(G_AHI,1,wxEXPAND);

View File

@ -25,12 +25,13 @@ wxColor zwxLIGHT_YELLOW(228,228,168,255);
wxColor *wxLIGHT_YELLOW=&zwxLIGHT_YELLOW;
wxColor zwxDARK_GREEN=wxColor(20,128,20,255);
wxColor *wxDARK_GREEN=&zwxDARK_GREEN;
wxColor zwxDARK_GREY(0xA0,0xA0,0xA0,0xA0);
wxColor *wxDARK_GREY=&zwxDARK_GREY;
const wxColor *gradient_start_color=wxWHITE, *gradient_end_color=wxLIGHT_YELLOW;
wxDirection gradient_direction=wxEAST;
const wxColor *selection_color=wxBLUE; //GREEN2;
wxColor wxDARK_GREY(0xA0,0xA0,0xA0,0xA0);
gGraphData::gGraphData(int mp,gDataType t)
:vc(0),type(t),max_points(mp)
@ -638,8 +639,8 @@ void gGraphWindow::DataChanged(gLayer *layer)
}
gXAxis::gXAxis(gPointData *d,const wxColor * col)
:gLayer(d)
gXAxis::gXAxis(const wxColor * col)
:gLayer(NULL)
{
if (col) {
color.clear();
@ -780,8 +781,8 @@ void gXAxis::Plot(wxDC & dc, gGraphWindow & w)
}
gYAxis::gYAxis(gPointData *d,const wxColor * col)
:gLayer(d)
gYAxis::gYAxis(const wxColor * col)
:gLayer(NULL)
{
if (col) {
color.clear();
@ -870,6 +871,46 @@ void gYAxis::Plot(wxDC & dc,gGraphWindow &w)
dc.DrawRotatedText(w.Title(), start_px-8-labelW - y, start_py+((height + x)>>1), 90);
}
gFooBar::gFooBar(const wxColor * col,const wxColor * col2)
:gLayer(NULL)
{
if (col && col2) {
color.clear();
color.push_back(col);
color.push_back(col2);
}
}
gFooBar::~gFooBar()
{
}
void gFooBar::Plot(wxDC & dc, gGraphWindow & w)
{
if (!m_visible) return;
double xx=w.max_x-w.min_x;
if (xx==0) return;
int scrx = w.GetScrX();
int scry = w.GetScrY();
int start_px=w.GetLeftMargin();
int start_py=w.GetTopMargin();
int width=scrx-(w.GetLeftMargin()+w.GetRightMargin());
int height=scry-(w.GetTopMargin()+w.GetBottomMargin());
wxPen pen2(*color[0], 1, wxDOT);
wxPen pen3(*color[1], 2, wxSOLID);
dc.SetPen( pen2 );
dc.DrawLine(start_px, start_py+height+10, start_px+width, start_py+height+10);
double rmx=w.rmax_x-w.rmin_x;
double px=((1/rmx)*(w.min_x-w.rmin_x))*width;
double py=((1/rmx)*(w.max_x-w.rmin_x))*width;
dc.SetPen(pen3);
dc.DrawLine(start_px+px, start_py+height+10, start_px+py, start_py+height+10);
dc.DrawLine(start_px+px, start_py+height+8, start_px+px, start_py+height+12);
dc.DrawLine(start_px+py, start_py+height+8, start_px+py, start_py+height+12);
}
gCandleStick::gCandleStick(gPointData *d,wxOrientation o)
:gLayer(d)
@ -965,8 +1006,8 @@ gBarChart::gBarChart(gPointData *d,const wxColor *col,wxOrientation o)
color.clear();
color.push_back(col);
}
Xaxis=new gXAxis(NULL,wxBLACK);
Yaxis=new gYAxis(NULL,wxBLACK);
Xaxis=new gXAxis(wxBLACK);
Yaxis=new gYAxis(wxBLACK);
}
gBarChart::~gBarChart()
{
@ -1055,7 +1096,7 @@ void gBarChart::Plot(wxDC & dc, gGraphWindow & w)
if (m_direction==wxVERTICAL) {
dc.DrawRotatedText(str,start_px-textX-8,j,0);
} else {
dc.DrawRotatedText(str,j,start_py+height+4+textX,90);
dc.DrawRotatedText(str,j,start_py+height+16+textX,90);
}
} else draw_xticks_instead=true;
@ -1074,13 +1115,15 @@ gLineChart::gLineChart(gPointData *d,const wxColor * col,int dlsize,bool a,bool
m_drawlist=new wxPoint [dlsize];
color.clear();
color.push_back(col);
Yaxis=new gYAxis(NULL,wxBLACK);
foobar=new gFooBar();
Yaxis=new gYAxis(wxBLACK);
Yaxis->SetShowMajorLines(true);
Yaxis->SetShowMinorLines(true);
}
gLineChart::~gLineChart()
{
delete Yaxis;
delete foobar;
delete [] m_drawlist;
}
@ -1127,18 +1170,7 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w)
dc.DrawLine(start_px+width+1,start_py,start_px+width+1,start_py+height+1);
// Funky Bar.. move this to it's own layer.
wxPen pen2(wxDARK_GREY, 1, wxDOT);
wxPen pen3(*wxGREEN, 2, wxSOLID);
dc.SetPen( pen2 );
dc.DrawLine(start_px,start_py+height+10,start_px+width,start_py+height+10);
double rmx=w.rmax_x-w.rmin_x;
px=((1/rmx)*(w.min_x-w.rmin_x))*width;
py=((1/rmx)*(w.max_x-w.rmin_x))*width;
dc.SetPen(pen3);
dc.DrawLine(start_px+px,start_py+height+10,start_px+py,start_py+height+10);
dc.DrawLine(start_px+px,start_py+height+8,start_px+px,start_py+height+12);
dc.DrawLine(start_px+py,start_py+height+8,start_px+py,start_py+height+12);
foobar->Plot(dc,w);
if (!m_hide_axes) {
Yaxis->Plot(dc,w);
@ -1388,20 +1420,6 @@ void gFlagsLine::Plot(wxDC & dc, gGraphWindow & w)
static wxBrush linebr1(col1, wxSOLID);
static wxBrush linebr2(col2, wxSOLID);
static wxPen pen2(wxDARK_GREY, 1, wxDOT);
static wxPen pen3(*wxGREEN, 2, wxSOLID);
dc.SetPen( pen2 );
dc.DrawLine(start_px,start_py+height+10,start_px+width,start_py+height+10);
double rmx=w.rmax_x-w.rmin_x;
double px=((1/rmx)*(w.min_x-w.rmin_x))*width;
double py=((1/rmx)*(w.max_x-w.rmin_x))*width;
dc.SetPen(pen3);
dc.DrawLine(start_px+px,start_py+height+10,start_px+py,start_py+height+10);
dc.DrawLine(start_px+px,start_py+height+8,start_px+px,start_py+height+12);
dc.DrawLine(start_px+py,start_py+height+8,start_px+py,start_py+height+12);
wxPen sfp1(*color[0], 1, wxSOLID);
wxBrush brush(*color[0],wxSOLID); //FDIAGONAL_HATCH);

View File

@ -19,6 +19,7 @@ extern wxColor *wxPURPLE;
extern wxColor *wxGREEN2;
extern wxColor *wxLIGHT_YELLOW;
extern wxColor *wxDARK_GREEN;
extern wxColor *wxDARK_GREY;
#define MIN(a,b) (a<b) ? a : b;
#define MAX(a,b) (a<b) ? b : a;
@ -312,7 +313,7 @@ class gCandleStick:public gLayer
class gXAxis:public gLayer
{
public:
gXAxis(gPointData *d=NULL,const wxColor * col=wxBLACK);
gXAxis(const wxColor * col=wxBLACK);
virtual ~gXAxis();
virtual void Plot(wxDC & dc, gGraphWindow & w);
protected:
@ -321,7 +322,7 @@ class gXAxis:public gLayer
class gYAxis:public gLayer
{
public:
gYAxis(gPointData *d=NULL,const wxColor * col=wxBLACK);
gYAxis(const wxColor * col=wxBLACK);
virtual ~gYAxis();
virtual void Plot(wxDC & dc, gGraphWindow & w);
void SetShowMinorLines(bool b) { m_show_minor_lines=b; };
@ -335,6 +336,14 @@ class gYAxis:public gLayer
bool m_show_minor_lines;
// virtual const wxString & Format(double v) { static wxString t; t=wxString::Format(wxT("%.1f"),v); return t; };
};
class gFooBar:public gLayer
{
public:
gFooBar(const wxColor * col=wxDARK_GREY,const wxColor * col2=wxGREEN);
virtual ~gFooBar();
virtual void Plot(wxDC & dc, gGraphWindow & w);
protected:
};
class gLineChart:public gLayer
@ -353,6 +362,7 @@ class gLineChart:public gLayer
bool m_hide_axes;
wxPoint screen[4096]; // max screen pixel width for accelerated plot usage only.
gYAxis * Yaxis;
gFooBar *foobar;
};
@ -395,7 +405,6 @@ class gBarChart:public gLayer
protected:
//virtual void DrawYTicks(wxDC & dc,gGraphWindow &w);
wxOrientation m_direction;
// d.Set(i+2400000.5+.000001); // JDN vs MJD vs Rounding errors

View File

@ -16,14 +16,14 @@ namespace AutoVersion{
//Standard Version Type
static const long MAJOR = 0;
static const long MINOR = 7;
static const long BUILD = 2474;
static const long REVISION = 8196;
static const long BUILD = 2493;
static const long REVISION = 8280;
//Miscellaneous Version Types
static const long BUILDS_COUNT = 7532;
#define RC_FILEVERSION 0,7,2474,8196
#define RC_FILEVERSION_STRING "0, 7, 2474, 8196\0"
static const char FULLVERSION_STRING[] = "0.7.2474.8196";
static const long BUILDS_COUNT = 7563;
#define RC_FILEVERSION 0,7,2493,8280
#define RC_FILEVERSION_STRING "0, 7, 2493, 8280\0"
static const char FULLVERSION_STRING[] = "0.7.2493.8280";
//These values are to keep track of your versioning state, don't modify them.
static const long BUILD_HISTORY = 62;