diff --git a/SleepyHead.depend b/SleepyHead.depend index b979d9f3..295e9c31 100644 --- a/SleepyHead.depend +++ b/SleepyHead.depend @@ -7869,11 +7869,11 @@ "tinyxml/tinyxml.h" -1306647783 /home/mark/projects/git/sleepyhead/graphs/graph.h +1306652249 /home/mark/projects/git/sleepyhead/graphs/graph.h -1306649352 /home/mark/projects/git/sleepyhead/version.h +1306652337 /home/mark/projects/git/sleepyhead/version.h 1306549105 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h "machine.h" @@ -7890,7 +7890,7 @@ "preferences.h" "tinyxml/tinyxml.h" -1306649351 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp +1306650852 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp "wx_pch.h" "version.h" @@ -7905,7 +7905,7 @@ "SleepyHeadMain.h" "sleeplib/profiles.h" -1306648364 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp +1306652144 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp @@ -7951,7 +7951,7 @@ "machine_loader.h" "tinyxml/tinyxml.h" -1306645407 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.cpp +1306650068 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.cpp diff --git a/SleepyHeadMain.cpp b/SleepyHeadMain.cpp index eb5547ad..e124695f 100644 --- a/SleepyHeadMain.cpp +++ b/SleepyHeadMain.cpp @@ -263,14 +263,13 @@ void SleepyHeadFrame::OnImportSD(wxCommandEvent &event) int idx=main_auinotebook->GetPageIndex(daily); if (idx!=wxNOT_FOUND) { daily->RefreshData(m); + daily->Refresh(); } idx=main_auinotebook->GetPageIndex(summary); if (idx!=wxNOT_FOUND) { summary->RefreshData(m); + summary->Refresh(); } - summary->Refresh(); - daily->Refresh(); - Refresh(); } void SleepyHeadFrame::OnViewMenuDaily( wxCommandEvent& event ) @@ -280,9 +279,13 @@ void SleepyHeadFrame::OnViewMenuDaily( wxCommandEvent& event ) if (idx==wxNOT_FOUND) { daily=new Daily(this); main_auinotebook->AddPage(daily,_("Daily"),true); - id=pref["DefaultMachine"].GetInteger(); - Machine *m=cpap_machines[id]; - if (m) daily->RefreshData(m); + if (pref.Exists(wxT("DefaultMachine"))) + id=pref["DefaultMachine"].GetInteger(); + else id=0; + if (idRefreshData(m); + } daily->Refresh(); } else { @@ -298,11 +301,14 @@ void SleepyHeadFrame::OnViewMenuSummary( wxCommandEvent& event ) if (idx==wxNOT_FOUND) { summary=new Summary(this); main_auinotebook->AddPage(summary,_("Summary"),true); - id=pref["DefaultMachine"].GetInteger(); - Machine *m=cpap_machines[id]; - if (m) summary->RefreshData(m); + if (pref.Exists(wxT("DefaultMachine"))) + id=pref["DefaultMachine"].GetInteger(); + else id=0; + if (idRefreshData(m); + } summary->Refresh(); - } else { main_auinotebook->SetSelection(idx); } @@ -317,7 +323,7 @@ Summary::Summary(wxWindow *win) AddData(ahidata=new HistoryData(machine,days_shown)); AddData(pressure=new HistoryCodeData(machine,CPAP_PressureAverage,days_shown)); - AddData(leak=new HistoryCodeData(machine,CPAP_LeakAverage,days_shown)); + AddData(leak=new HistoryCodeData(machine,CPAP_LeakMedian,days_shown)); AddData(usage=new UsageHistoryData(machine,days_shown,UHD_Hours)); AddData(waketime=new UsageHistoryData(machine,days_shown,UHD_Waketime)); AddData(bedtime=new UsageHistoryData(machine,days_shown,UHD_Bedtime)); @@ -438,8 +444,8 @@ Daily::Daily(wxWindow *win) AddData(prd=new PressureData(CPAP_Pressure)); PRD=new gGraphWindow(ScrolledWindow,-1,wxT("Pressure"),wxPoint(0,0), wxSize(600,150), wxNO_BORDER); PRD->AddLayer(new gLineChart(prd,wxDARK_GREEN,4096,false)); - PRD->AddLayer(new gLineChart(pressure_iap,wxBLUE,4096,false)); - PRD->AddLayer(new gLineChart(pressure_eap,wxRED,4096,false)); + PRD->AddLayer(new gLineChart(pressure_iap,wxBLUE,4096,false,true)); + PRD->AddLayer(new gLineChart(pressure_eap,wxRED,4096,false,true)); AddData(frw=new FlowData()); FRW=new gGraphWindow(ScrolledWindow,-1,wxT("Flow Rate"),wxPoint(0,0), wxSize(600,150), wxNO_BORDER); diff --git a/graphs/graph.cpp b/graphs/graph.cpp index f5a0f5d6..094b3cfc 100644 --- a/graphs/graph.cpp +++ b/graphs/graph.cpp @@ -458,13 +458,17 @@ double gGraphWindow::MinY() //f=false; bool first=true; - double val; + double val,tmp; for (auto l=layers.begin();l!=layers.end();l++) { if (first) { val=(*l)->MinY(); - first=false; + if (!((val==(*l)->MaxY()) && (val==0))) + first=false; } else { - if ((*l)->MinY() < val) val = (*l)->MinY(); + tmp=(*l)->MinY(); + if (!((tmp==(*l)->MaxY()) && (tmp==0))) { // Ignore this layer if both are 0 + if (tmp < val) val = tmp; + } } } return min_y=val; @@ -476,13 +480,17 @@ double gGraphWindow::MaxY() //f=false; bool first=true; - double val; + double val,tmp; for (auto l=layers.begin();l!=layers.end();l++) { if (first) { val=(*l)->MaxY(); - first=false; + if (!((val==(*l)->MinY()) && (val==0))) + first=false; } else { - if ((*l)->MaxY()>val) val = (*l)->MaxY(); + tmp=(*l)->MaxY(); + if (!((tmp==(*l)->MinY()) && (tmp==0))) { // Ignore this layer if both are 0 + if (tmp > val) val = tmp; + } } } return max_y=val; @@ -531,13 +539,17 @@ double gGraphWindow::RealMinY() //f=false; bool first=true; - double val; + double val,tmp; for (auto l=layers.begin();l!=layers.end();l++) { if (first) { val=(*l)->RealMinY(); - first=false; + if (!((val==(*l)->RealMaxY()) && (val==0))) + first=false; } else { - if ((*l)->RealMinY() < val) val = (*l)->RealMinY(); + tmp=(*l)->RealMinY(); + if (!((tmp==(*l)->RealMaxY()) && (tmp==0))) { // Ignore this if both are 0 + if (tmp < val) val = tmp; + } } } return rmin_y=val; @@ -549,13 +561,17 @@ double gGraphWindow::RealMaxY() //f=false; bool first=true; - double val; + double val,tmp; for (auto l=layers.begin();l!=layers.end();l++) { if (first) { val=(*l)->RealMaxY(); - first=false; + if (!((val==(*l)->RealMinY()) && (val==0))) // Does this create a loop?? + first=false; } else { - if ((*l)->RealMaxY()>val) val = (*l)->RealMaxY(); + tmp=(*l)->RealMaxY(); + if (!((tmp==(*l)->RealMinY()) && (tmp==0))) { // Ignore this if both are 0 + if (tmp > val) val = tmp; + } } } return rmax_y=val; @@ -998,8 +1014,8 @@ void gBarChart::Plot(wxDC & dc, gGraphWindow & w) } */ -gLineChart::gLineChart(gPointData *d,const wxColor * col,int dlsize,bool a) -:gLayer(d),m_accelerate(a),m_drawlist_size(dlsize) +gLineChart::gLineChart(gPointData *d,const wxColor * col,int dlsize,bool a,bool _hide_axes) +:gLayer(d),m_accelerate(a),m_drawlist_size(dlsize),m_hide_axes(_hide_axes) { m_drawlist=new wxPoint [dlsize]; color.clear(); @@ -1238,7 +1254,6 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w) if (yy<=0) return; // assert(xx>=0); - static wxPoint screen[4096]; // max screen size static wxPen pen1(*wxLIGHT_GREY, 1, wxDOT); @@ -1261,8 +1276,10 @@ void gLineChart::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); - DrawYTicks(dc,w); - DrawXTicks(dc,w); + if (!m_hide_axes) { + DrawYTicks(dc,w); + DrawXTicks(dc,w); + } wxPen pen(*color[0], 1, wxSOLID); dc.SetPen(pen); @@ -1655,8 +1672,8 @@ void FlowData::Reload(Day *day) //max_y=t1; //min_y=-t1; - min_y=-100; - max_y=100; + min_y=-90; + max_y=90; real_min_x=min_x; real_min_y=min_y; @@ -1685,7 +1702,8 @@ void PressureData::Reload(Day *day) if (min_x>max_x) { max_x=max_x; } - max_y=0; + min_y=max_y=0; + int tt=0; bool first=true; for (auto s=day->begin();s!=day->end(); s++) { if ((*s)->events.find(code)==(*s)->events.end()) continue; @@ -1706,16 +1724,17 @@ void PressureData::Reload(Day *day) point[vc][t++]=r; assert(tmax_y) max_y=r.y; } - if (r.y>max_y) max_y=r.y; lastp=p; } np[vc]=t; + tt+=t; vc++; } @@ -1731,8 +1750,11 @@ void PressureData::Reload(Day *day) max_y=ceil(max_y); } } else { */ + if (tt>0) { min_y=floor(min_y); max_y=ceil(max_y+1); + if (min_y>1) min_y-=1; + } //} real_min_x=min_x; @@ -1761,8 +1783,6 @@ void TAPData::Reload(Day *day) return; } - const int max_slots=256; - static wxTimeSpan pTime[max_slots]; for (int i=0;iAddEvent(new Event(t,CPAP_EAP, {data1,data0})); + session->AddEvent(new Event(t,CPAP_EAP, {data1})); session->AddEvent(new Event(t,CPAP_IAP, {data0})); } else { session->AddEvent(new Event(t,cpapcode, {data0,data1})); diff --git a/version.h b/version.h index 2ac707fe..fe0b8187 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 = 1775; - static const long REVISION = 4252; + static const long BUILD = 1804; + static const long REVISION = 4413; //Miscellaneous Version Types - static const long BUILDS_COUNT = 6021; - #define RC_FILEVERSION 0,7,1775,4252 - #define RC_FILEVERSION_STRING "0, 7, 1775, 4252\0" - static const char FULLVERSION_STRING[] = "0.7.1775.4252"; + static const long BUILDS_COUNT = 6086; + #define RC_FILEVERSION 0,7,1804,4413 + #define RC_FILEVERSION_STRING "0, 7, 1804, 4413\0" + static const char FULLVERSION_STRING[] = "0.7.1804.4413"; //These values are to keep track of your versioning state, don't modify them. static const long BUILD_HISTORY = 62;