diff --git a/SleepyHead.depend b/SleepyHead.depend index dbbd431b..781fe77f 100644 --- a/SleepyHead.depend +++ b/SleepyHead.depend @@ -7875,7 +7875,7 @@ -1306811240 /home/mark/projects/git/sleepyhead/version.h +1306815962 /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" -1306811240 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp +1306815066 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp "wx_pch.h" "version.h" @@ -7910,7 +7910,7 @@ "sleeplib/profiles.h" "sleeplib/machine_loader.h" -1306810919 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp +1306815882 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp diff --git a/SleepyHeadMain.cpp b/SleepyHeadMain.cpp index b599caea..6551cb23 100644 --- a/SleepyHeadMain.cpp +++ b/SleepyHeadMain.cpp @@ -330,15 +330,15 @@ Summary::Summary(wxWindow *win,Profile *_profile) AddData(waketime=new UsageHistoryData(profile,UHD_Waketime)); AddData(bedtime=new UsageHistoryData(profile,UHD_Bedtime)); - AHI=new gGraphWindow(ScrolledWindow,-1,wxT("AHI"),wxPoint(0,0), wxSize(400,200), wxNO_BORDER); - AHI->SetMargins(10,15,60,80); + 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 gXAxis(NULL,wxBLACK)); //AHI->AddLayer(new gLineChart(ahidata,wxRED)); fgSizer->Add(AHI,1,wxEXPAND); - PRESSURE=new gGraphWindow(ScrolledWindow,-1,wxT("Pressure"),wxPoint(0,0), wxSize(400,200), wxNO_BORDER); - PRESSURE->SetMargins(10,15,60,80); + PRESSURE=new gGraphWindow(ScrolledWindow,-1,wxT("Pressure"),wxPoint(0,0), wxSize(400,160), wxNO_BORDER); + PRESSURE->SetMargins(10,15,65,80); //PRESSURE->AddLayer(new gBarChart(pressure,wxBLUE)); PRESSURE->AddLayer(new gLineChart(pressure,wxDARK_GREEN,6192)); PRESSURE->AddLayer(new gLineChart(pressure_eap,wxRED,6192,false,true)); @@ -347,16 +347,16 @@ Summary::Summary(wxWindow *win,Profile *_profile) fgSizer->Add(PRESSURE,1,wxEXPAND); - LEAK=new gGraphWindow(ScrolledWindow,-1,wxT("Mask Leak"),wxPoint(0,0), wxSize(400,200), wxNO_BORDER); - LEAK->SetMargins(10,15,60,80); + LEAK=new gGraphWindow(ScrolledWindow,-1,wxT("Mask Leak"),wxPoint(0,0), wxSize(400,160), wxNO_BORDER); + 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)); fgSizer->Add(LEAK,1,wxEXPAND); - USAGE=new gGraphWindow(ScrolledWindow,-1,wxT("Usage (Hours)"),wxPoint(0,0), wxSize(400,200), wxNO_BORDER); - USAGE->SetMargins(10,15,60,80); + 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)); @@ -491,19 +491,19 @@ Daily::Daily(wxWindow *win,Profile *p) AddData(tap_iap=new TAPData(CPAP_IAP)); AddData(tap=new TAPData(CPAP_Pressure)); - TAP=new gGraphWindow(ScrolledWindow,-1,wxT("Time@Pressure"),wxPoint(0,0), wxSize(600,50), wxNO_BORDER); + TAP=new gGraphWindow(ScrolledWindow,-1,wxT("Time@Pressure"),wxPoint(0,0), wxSize(600,60), wxNO_BORDER); TAP->SetMargins(20,15,5,50); TAP->AddLayer(new gCandleStick(tap)); - TAP_IAP=new gGraphWindow(ScrolledWindow,-1,wxT("Time@IPAP"),wxPoint(0,0), wxSize(600,50), wxNO_BORDER); + TAP_IAP=new gGraphWindow(ScrolledWindow,-1,wxT("Time@IPAP"),wxPoint(0,0), wxSize(600,60), wxNO_BORDER); TAP_IAP->SetMargins(20,15,5,50); TAP_IAP->AddLayer(new gCandleStick(tap_iap)); - TAP_EAP=new gGraphWindow(ScrolledWindow,-1,wxT("Time@EPAP"),wxPoint(0,0), wxSize(600,50), wxNO_BORDER); + TAP_EAP=new gGraphWindow(ScrolledWindow,-1,wxT("Time@EPAP"),wxPoint(0,0), wxSize(600,60), wxNO_BORDER); TAP_EAP->SetMargins(20,15,5,50); TAP_EAP->AddLayer(new gCandleStick(tap_eap)); - G_AHI=new gGraphWindow(ScrolledWindow,-1,wxT("Event Breakdown"),wxPoint(0,0), wxSize(600,50), wxNO_BORDER); + G_AHI=new gGraphWindow(ScrolledWindow,-1,wxT("Event Breakdown"),wxPoint(0,0), wxSize(600,60), wxNO_BORDER); G_AHI->SetMargins(20,15,5,50); AddData(g_ahi=new AHIData()); gCandleStick *l=new gCandleStick(g_ahi); @@ -562,7 +562,7 @@ Daily::Daily(wxWindow *win,Profile *p) FRW->AddLayer(new gLineOverlayBar(flags[1],wxPURPLE,wxT("CA"))); FRW->AddLayer(new gXAxis(NULL,wxBLACK)); - SF=new gGraphWindow(ScrolledWindow,-1,wxT("Event Flags"),wxPoint(0,0), wxSize(600,150), wxNO_BORDER); + SF=new gGraphWindow(ScrolledWindow,-1,wxT("Event Flags"),wxPoint(0,0), wxSize(600,180), wxNO_BORDER); // SF->SetMargins(10,15,20,80); SF->LinkZoom(FRW); diff --git a/graphs/graph.cpp b/graphs/graph.cpp index 948bf8a3..b866d5d3 100644 --- a/graphs/graph.cpp +++ b/graphs/graph.cpp @@ -123,6 +123,28 @@ BEGIN_EVENT_TABLE(gGraphWindow, wxWindow) END_EVENT_TABLE() +gGraphWindow::gGraphWindow(wxWindow *parent, wxWindowID id,const wxString & title,const wxPoint &pos,const wxSize &size,long flags) +: wxWindow( parent, id, pos, size, flags, title ) +{ + m_scrX = m_scrY = 64; + m_title=title; + m_mouseRDown=m_mouseLDown=false; + SetBackgroundColour( *wxWHITE ); + m_bgColour = *wxWHITE; + m_fgColour = *wxBLACK; + SetMargins(10, 15, 46, 80); + m_block_move=false; + m_block_zoom=false; + + +} +gGraphWindow::~gGraphWindow() +{ + for (auto l=layers.begin();l!=layers.end();l++) delete (*l); + layers.clear(); +} + + void gGraphWindow::AddLayer(gLayer *l) { if (l) { l->NotifyGraphWindow(this); @@ -337,26 +359,6 @@ void gGraphWindow::OnMouseLeftRelease(wxMouseEvent &event) } -gGraphWindow::gGraphWindow(wxWindow *parent, wxWindowID id,const wxString & title,const wxPoint &pos,const wxSize &size,long flags) -: wxWindow( parent, id, pos, size, flags, title ) -{ - m_scrX = m_scrY = 64; - m_title=title; - m_mouseRDown=m_mouseLDown=false; - SetBackgroundColour( *wxWHITE ); - m_bgColour = *wxWHITE; - m_fgColour = *wxBLACK; - SetMargins(10, 15, 32, 80); - m_block_move=false; - m_block_zoom=false; - - -} -gGraphWindow::~gGraphWindow() -{ - for (auto l=layers.begin();l!=layers.end();l++) delete (*l); - layers.clear(); -} void gGraphWindow::Update() { Refresh(); @@ -706,12 +708,12 @@ void gXAxis::Plot(wxDC & dc, gGraphWindow & w) } else { // Day ticks.. show_time=false; st=st2; - min_tick=1; + min_tick=1.0; double mtiks=(x+20.0)/width; double mt=mtiks*xx; min_tick=mt; - if (min_tick<1) min_tick=1; - if (min_tick>10) min_tick=10; + //if (min_tick<1.0) min_tick=1.0; + //if (min_tick>10) min_tick=10; } // dc.SetPen(*wxBLACK_PEN); @@ -733,13 +735,13 @@ void gXAxis::Plot(wxDC & dc, gGraphWindow & w) while (stIsReady()) return; + + double xx=w.max_x-w.min_x; + if (xx<=0) return; //if (!data->NP()) return; int scrx = w.GetScrX(); @@ -1382,16 +1383,11 @@ void gFlagsLine::Plot(wxDC & dc, gGraphWindow & w) int width=scrx-(w.GetLeftMargin()+w.GetRightMargin()); int height=scry-(w.GetTopMargin()+w.GetBottomMargin()); - - double xx=w.max_x-w.min_x; - if (xx<=0) return; - static wxColor col1=wxColor(0xff,0xf0,0xd0,0x7f); static wxColor col2=wxColor(0xe0,0xff,0xd0,0x7f); static wxBrush linebr1(col1, wxSOLID); static wxBrush linebr2(col2, wxSOLID); - static wxPen pen2(wxDARK_GREY, 1, wxDOT); static wxPen pen3(*wxGREEN, 2, wxSOLID); @@ -1405,15 +1401,15 @@ void gFlagsLine::Plot(wxDC & dc, gGraphWindow & w) 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); + wxPen sfp1(*color[0], 1, wxSOLID); wxBrush brush(*color[0],wxSOLID); //FDIAGONAL_HATCH); - double line_h=((height)/total_lines); + double line_h=(height+1)/double(total_lines); int r=int(height) % total_lines; - double line_top=1+(start_py+(line_num*line_h)-r/2.0); + double line_top=start_py+round(line_num*line_h)-1; //double line_bottom=line_top+line_h; dc.SetPen(*wxBLACK); @@ -1422,7 +1418,7 @@ void gFlagsLine::Plot(wxDC & dc, gGraphWindow & w) } else { dc.SetBrush(linebr2); } - dc.DrawRectangle(start_px,line_top,width+1,line_h+1); + dc.DrawRectangle(start_px,line_top,width+1,round(line_h+1)); int x,y; dc.GetTextExtent(label,&x,&y); dc.DrawText(label,start_px-x-6,line_top+(line_h/2)-(y/2)); @@ -1792,7 +1788,7 @@ HistoryData::HistoryData(Profile * _profile) AddSegment(max_points); if (profile->LastDay().IsValid()) { real_min_x=profile->FirstDay().GetMJD(); - real_max_x=profile->LastDay().GetMJD()+1; + real_max_x=profile->LastDay().GetMJD()+0.5; } } HistoryData::~HistoryData() @@ -1802,7 +1798,7 @@ void HistoryData::ResetDateRange() { if (profile->LastDay().IsValid()) { real_min_x=profile->FirstDay().GetMJD(); - real_max_x=profile->LastDay().GetMJD()+1; + real_max_x=profile->LastDay().GetMJD()+0.5; } Reload(NULL); } @@ -1874,7 +1870,7 @@ double HistoryData::GetAverage() } void HistoryData::SetDateRange(wxDateTime start,wxDateTime end) { - double x1=start.GetMJD()-1;//+1; + double x1=start.GetMJD()-0.5; double x2=end.GetMJD(); if (x1 < real_min_x) x1=real_min_x; if (x2 > (real_max_x)) x2=(real_max_x); diff --git a/version.h b/version.h index 489395b5..b16fcab6 100644 --- a/version.h +++ b/version.h @@ -16,14 +16,14 @@ namespace AutoVersion{ //Standard Version Type static const long MAJOR = 0; static const long MINOR = 7; - static const long BUILD = 2441; - static const long REVISION = 8013; + static const long BUILD = 2474; + static const long REVISION = 8196; //Miscellaneous Version Types - static const long BUILDS_COUNT = 7433; - #define RC_FILEVERSION 0,7,2441,8013 - #define RC_FILEVERSION_STRING "0, 7, 2441, 8013\0" - static const char FULLVERSION_STRING[] = "0.7.2441.8013"; + 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"; //These values are to keep track of your versioning state, don't modify them. static const long BUILD_HISTORY = 62;