From 77a81428789fb224e7de8cf9131c94d24ef5c3ff Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 4 Jun 2011 13:18:11 +1000 Subject: [PATCH] Summary Tab Average Calculations now Date Dependant --- SleepyHead.depend | 8 ++++---- SleepyHeadMain.cpp | 19 +++++++++++++------ graphs/graph.cpp | 10 +++++++--- libs/sleeplib/machine.cpp | 6 ++++-- version.h | 12 ++++++------ 5 files changed, 34 insertions(+), 21 deletions(-) diff --git a/SleepyHead.depend b/SleepyHead.depend index 9ffd69a5..c09c9af5 100644 --- a/SleepyHead.depend +++ b/SleepyHead.depend @@ -7877,7 +7877,7 @@ -1307155688 /home/mark/projects/git/sleepyhead/version.h +1307157388 /home/mark/projects/git/sleepyhead/version.h 1306724655 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h "machine.h" @@ -7894,7 +7894,7 @@ "preferences.h" "tinyxml/tinyxml.h" -1307154989 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp +1307157388 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp "wx_pch.h" "version.h" @@ -7913,7 +7913,7 @@ "sleeplib/profiles.h" "sleeplib/machine_loader.h" -1307151759 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp +1307157064 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp @@ -7928,7 +7928,7 @@ -1307153428 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp +1307156731 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp diff --git a/SleepyHeadMain.cpp b/SleepyHeadMain.cpp index ab60b612..697f1873 100644 --- a/SleepyHeadMain.cpp +++ b/SleepyHeadMain.cpp @@ -408,7 +408,7 @@ void Summary::ResetProfile(Profile *p) } void Summary::RefreshData() { - wxDateTime first=StartDatePicker->GetValue(); + wxDateTime first=StartDatePicker->GetValue()-wxTimeSpan::Day(); wxDateTime last=EndDatePicker->GetValue(); for (list::iterator h=Data.begin();h!=Data.end();h++) { @@ -515,26 +515,30 @@ void Summary::OnRBSelect( wxCommandEvent& event ) StartDatePicker->SetValue(start); EndDatePicker->SetValue(end); - for (list::iterator h=Data.begin();h!=Data.end();h++) { + RefreshData(); + /*for (list::iterator h=Data.begin();h!=Data.end();h++) { (*h)->SetDateRange(start-wxTimeSpan::Day(),end); - } + } */ } void Summary::OnStartDateChanged( wxDateEvent& event ) { + RefreshData(); +/* wxDateTime start=StartDatePicker->GetValue()-wxTimeSpan::Days(2); wxDateTime end=EndDatePicker->GetValue()-wxTimeSpan::Day(); for (list::iterator h=Data.begin();h!=Data.end();h++) { (*h)->SetDateRange(start,end); - } + } */ } void Summary::OnEndDateChanged( wxDateEvent& event ) { - wxDateTime start=StartDatePicker->GetValue()-wxTimeSpan::Days(2); + RefreshData(); + /*wxDateTime start=StartDatePicker->GetValue()-wxTimeSpan::Days(2); wxDateTime end=EndDatePicker->GetValue()-wxTimeSpan::Day(); for (list::iterator h=Data.begin();h!=Data.end();h++) { (*h)->SetDateRange(start,end); - } + } */ } void Summary::OnClose(wxCloseEvent &event) { @@ -711,6 +715,9 @@ void Daily::OnEventTreeSelection( wxTreeEvent& event ) double st=(d-wxTimeSpan::Seconds(180)).GetMJD(); double et=(d+wxTimeSpan::Seconds(180)).GetMJD(); FRW->SetXBounds(st,et); + SF->SetXBounds(st,et); + PRD->SetXBounds(st,et); + LEAK->SetXBounds(st,et); wxLogMessage(wxT("Tree Selected:")+d.Format()); } } diff --git a/graphs/graph.cpp b/graphs/graph.cpp index 1f5d9f78..b193d3a0 100644 --- a/graphs/graph.cpp +++ b/graphs/graph.cpp @@ -1939,12 +1939,16 @@ void HistoryData::Reload(Day *day) } double HistoryData::GetAverage() { - double val=0; + double x,val=0; + int cnt=0; for (int i=0;imax_x)) continue; val+=point[0][i].y; + cnt++; } - if (!np[0]) return 0; - val/=np[0]; + if (!cnt) return 0; + val/=cnt; return val; } void HistoryData::SetDateRange(wxDateTime start,wxDateTime end) diff --git a/libs/sleeplib/machine.cpp b/libs/sleeplib/machine.cpp index ede2df21..1de4afca 100644 --- a/libs/sleeplib/machine.cpp +++ b/libs/sleeplib/machine.cpp @@ -140,8 +140,10 @@ void InitMapsWithoutAwesomeInitializerLists() DefaultMCLongNames[PRS1_VSnore2]=wxT("Vibratory Snore 2"); DefaultMCLongNames[PRS1_PressurePulse]=wxT("Pressue Pulse"); DefaultMCLongNames[PRS1_Unknown0E]=wxT("Unknown 0E"); - - + DefaultMCLongNames[PRS1_Unknown00]=wxT("Unknown 00"); + DefaultMCLongNames[PRS1_Unknown01]=wxT("Unknown 01"); + DefaultMCLongNames[PRS1_Unknown0B]=wxT("Unknown 0B"); + DefaultMCLongNames[PRS1_Unknown10]=wxT("Unknown 10"); } diff --git a/version.h b/version.h index 74a9f75a..0b7d3e6f 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 = 3053; - static const long REVISION = 11270; + static const long BUILD = 3059; + static const long REVISION = 11307; //Miscellaneous Version Types - static const long BUILDS_COUNT = 8956; - #define RC_FILEVERSION 0,7,3053,11270 - #define RC_FILEVERSION_STRING "0, 7, 3053, 11270\0" - static const char FULLVERSION_STRING[] = "0.7.3053.11270"; + static const long BUILDS_COUNT = 8974; + #define RC_FILEVERSION 0,7,3059,11307 + #define RC_FILEVERSION_STRING "0, 7, 3059, 11307\0" + static const char FULLVERSION_STRING[] = "0.7.3059.11307"; //These values are to keep track of your versioning state, don't modify them. static const long BUILD_HISTORY = 62;