diff --git a/GUIFrame.cpp b/GUIFrame.cpp index 9a922610..c9a5eb1c 100644 --- a/GUIFrame.cpp +++ b/GUIFrame.cpp @@ -132,9 +132,6 @@ DailyPanel::DailyPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, con Calendar = new wxCalendarCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_MONDAY_FIRST|wxCAL_SEQUENTIAL_MONTH_SELECTION|wxCAL_SHOW_SURROUNDING_WEEKS ); m_mgr.AddPane( Calendar, wxAuiPaneInfo() .Left() .Caption( wxT("Selected Day") ).CloseButton( false ).MaximizeButton( false ).MinimizeButton( false ).PinButton( true ).PaneBorder( false ).Dock().Fixed().BottomDockable( false ).TopDockable( false ) ); - HTMLInfo = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); - m_mgr.AddPane( HTMLInfo, wxAuiPaneInfo() .Left() .Caption( wxT("Day Summary") ).CloseButton( false ).MaximizeButton( false ).MinimizeButton( false ).PinButton( true ).Dock().Resizable().FloatingSize( wxSize( 208,424 ) ).DockFixed( false ).Row( 0 ).Position( 1 ).MinSize( wxSize( 200,400 ) ).Layer( 0 ) ); - ScrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); ScrolledWindow->SetScrollRate( 5, 5 ); m_mgr.AddPane( ScrolledWindow, wxAuiPaneInfo() .Center() .Caption( wxT("Daily Information") ).CloseButton( false ).MaximizeButton( false ).MinimizeButton( false ).PinButton( true ).Dock().Resizable().FloatingSize( wxSize( -1,-1 ) ).Row( 0 ).Layer( 1 ).CentrePane() ); @@ -147,6 +144,10 @@ DailyPanel::DailyPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, con ScrolledWindow->SetSizer( fgSizer ); ScrolledWindow->Layout(); fgSizer->Fit( ScrolledWindow ); + Notebook = new wxAuiNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TAB_MOVE|wxAUI_NB_TAB_SPLIT ); + m_mgr.AddPane( Notebook, wxAuiPaneInfo() .Left() .CaptionVisible( false ).CloseButton( false ).MaximizeButton( false ).MinimizeButton( false ).PinButton( false ).PaneBorder( false ).Dock().Resizable().FloatingSize( wxDefaultSize ).DockFixed( false ).Position( 1 ).MinSize( wxSize( 220,-1 ) ) ); + + m_mgr.Update(); diff --git a/GUIFrame.h b/GUIFrame.h index fc2fd8c0..82d484ca 100644 --- a/GUIFrame.h +++ b/GUIFrame.h @@ -24,10 +24,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -86,9 +86,9 @@ class DailyPanel : public wxPanel protected: wxCalendarCtrl* Calendar; - wxHtmlWindow* HTMLInfo; wxScrolledWindow* ScrolledWindow; wxFlexGridSizer* fgSizer; + wxAuiNotebook* Notebook; // Virtual event handlers, overide them in your derived class virtual void OnCalendarMonth( wxCalendarEvent& event ) { event.Skip(); } diff --git a/SleepyHead.depend b/SleepyHead.depend index 7e4f562a..311498dd 100644 --- a/SleepyHead.depend +++ b/SleepyHead.depend @@ -7785,12 +7785,12 @@ "wx/progdlg.h" "wx/dialog.h" -1306939868 source:/home/mark/projects/git/sleepyhead/GUIFrame.cpp +1307154469 source:/home/mark/projects/git/sleepyhead/GUIFrame.cpp "wx/wxprec.h" "GUIFrame.h" -1306857828 /home/mark/projects/git/sleepyhead/GUIFrame.h +1307154004 /home/mark/projects/git/sleepyhead/GUIFrame.h @@ -7806,10 +7806,10 @@ - + @@ -7831,14 +7831,15 @@ 1305881106 /home/mark/projects/git/sleepyhead/SleepyHeadApp.h -1307058662 /home/mark/projects/git/sleepyhead/SleepyHeadMain.h - "SleepyHeadApp.h" +1307153810 /home/mark/projects/git/sleepyhead/SleepyHeadMain.h + + "SleepyHeadApp.h" "GUIFrame.h" "sleeplib/machine.h" "graphs/graph.h" -1307038106 /home/mark/projects/git/sleepyhead/libs/sleeplib/machine.h +1307151648 /home/mark/projects/git/sleepyhead/libs/sleeplib/machine.h @@ -7876,7 +7877,7 @@ -1307088642 /home/mark/projects/git/sleepyhead/version.h +1307154989 /home/mark/projects/git/sleepyhead/version.h 1306724655 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h "machine.h" @@ -7893,7 +7894,7 @@ "preferences.h" "tinyxml/tinyxml.h" -1307088511 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp +1307154989 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp "wx_pch.h" "version.h" @@ -7912,7 +7913,7 @@ "sleeplib/profiles.h" "sleeplib/machine_loader.h" -1307088318 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp +1307151759 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp @@ -7927,7 +7928,7 @@ -1307040615 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp +1307153428 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp @@ -8128,3 +8129,45 @@ 1302101440 /usr/include/wx-2.8/wx/generic/collpaneg.h +1302101441 /usr/include/wx-2.8/wx/dataview.h + "wx/defs.h" + "wx/control.h" + "wx/textctrl.h" + "wx/bitmap.h" + "wx/variant.h" + "wx/generic/dataview.h" + "wx/gtk/dataview.h" + "wx/generic/dataview.h" + +1302101441 /usr/include/wx-2.8/wx/generic/dataview.h + "wx/defs.h" + "wx/object.h" + "wx/list.h" + "wx/control.h" + "wx/scrolwin.h" + "wx/icon.h" + +1302101441 /usr/include/wx-2.8/wx/treectrl.h + "wx/defs.h" + "wx/control.h" + "wx/treebase.h" + "wx/textctrl.h" + "wx/generic/treectlg.h" + "wx/palmos/treectrl.h" + "wx/msw/treectrl.h" + "wx/generic/treectlg.h" + "wx/generic/treectlg.h" + "wx/generic/treectlg.h" + "wx/generic/treectlg.h" + "wx/generic/treectlg.h" + +1302101441 /usr/include/wx-2.8/wx/treebase.h + "wx/defs.h" + "wx/window.h" + "wx/event.h" + "wx/dynarray.h" + +1302101440 /usr/include/wx-2.8/wx/generic/treectlg.h + "wx/scrolwin.h" + "wx/pen.h" + diff --git a/SleepyHead.layout b/SleepyHead.layout index 160142b0..d5cbbeb9 100644 --- a/SleepyHead.layout +++ b/SleepyHead.layout @@ -10,14 +10,14 @@ - - + + - + - + @@ -29,10 +29,10 @@ - + - - + + diff --git a/SleepyHeadMain.cpp b/SleepyHeadMain.cpp index 2dda5525..c8fbaeb5 100644 --- a/SleepyHeadMain.cpp +++ b/SleepyHeadMain.cpp @@ -289,7 +289,6 @@ void SleepyHeadFrame::OnImportSD(wxCommandEvent &event) void SleepyHeadFrame::OnViewMenuDaily( wxCommandEvent& event ) { int idx=main_auinotebook->GetPageIndex(daily); - unsigned int id; if (idx==wxNOT_FOUND) { daily=new Daily(this,profile); main_auinotebook->AddPage(daily,_("Daily"),true); @@ -305,7 +304,7 @@ void SleepyHeadFrame::OnViewMenuDaily( wxCommandEvent& event ) void SleepyHeadFrame::OnViewMenuSummary( wxCommandEvent& event ) { - int id,idx=main_auinotebook->GetPageIndex(summary); + int idx=main_auinotebook->GetPageIndex(summary); if (idx==wxNOT_FOUND) { summary=new Summary(this,profile); main_auinotebook->AddPage(summary,_("Summary"),true); @@ -562,6 +561,7 @@ wxSize MyListBox::DoGetBestSize() const } */ + Daily::Daily(wxWindow *win,Profile *p) :DailyPanel(win),profile(p) { @@ -571,6 +571,12 @@ Daily::Daily(wxWindow *win,Profile *p) //m_mgr.AddPane(SessionList,wxLEFT,wxT("Sessions")); + HTMLInfo=new wxHtmlWindow(this); + EventTree=new wxTreeCtrl(this); + //Connect(wxID_ANY,EventTree + this->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( Daily::OnEventTreeSelection), NULL, this); + Notebook->AddPage(HTMLInfo,wxT("Details"),false,NULL); + Notebook->AddPage(EventTree,wxT("Events"),false,NULL); AddData(tap_eap=new TAPData(CPAP_EAP)); AddData(tap_iap=new TAPData(CPAP_IAP)); AddData(tap=new TAPData(CPAP_Pressure)); @@ -688,12 +694,26 @@ Daily::Daily(wxWindow *win,Profile *p) } Daily::~Daily() { + this->Disconnect(wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( Daily::OnEventTreeSelection), NULL, this); // delete SessionList; } void Daily::OnClose(wxCloseEvent &event) { Destroy(); } +void Daily::OnEventTreeSelection( wxTreeEvent& event ) +{ + wxTreeItemId id=event.GetItem(); + + if (!EventTree->ItemHasChildren(id)) { + wxDateTime d; + d.ParseFormat(EventTree->GetItemText(id),wxT("%Y-%m-%d %H:%M:%S")); + double st=(d-wxTimeSpan::Seconds(180)).GetMJD(); + double et=(d+wxTimeSpan::Seconds(180)).GetMJD(); + FRW->SetXBounds(st,et); + wxLogMessage(wxT("Tree Selected:")+d.Format()); + } +} void Daily::ResetDate() { @@ -719,7 +739,6 @@ void Daily::RefreshData() date-=wxTimeSpan::Days(1); Day *d=NULL; - if (profile->daylist.find(date)!=profile->daylist.end()) { vector::iterator di; for (di=profile->daylist[date].begin();di!=profile->daylist[date].end();di++) { @@ -744,6 +763,39 @@ void Daily::RefreshData() TAP_EAP->Show(true); } + EventTree->DeleteAllItems(); + wxTreeItemId root=EventTree->AddRoot(wxT("Events")); + map mcroot; + + for (vector::iterator s=d->begin();s!=d->end();s++) { + + map >::iterator m; + + wxTreeItemId ti,sroot; + + for (m=(*s)->events.begin();m!=(*s)->events.end();m++) { + MachineCode code=m->first; + if (code==CPAP_Leak) continue; + if (code==PRS1_Unknown12) continue; + wxTreeItemId mcr; + if (mcroot.find(code)==mcroot.end()) { + wxString s=DefaultMCLongNames[m->first]; + if (s.IsEmpty()) { + s=wxString::Format(wxT("Fixme: %i"),code); + } + + mcr=mcroot[code]=EventTree->AppendItem(root,s); + } else { + mcr=mcroot[code]; + } + for (vector::iterator e=(*s)->events[code].begin();e!=(*s)->events[code].end();e++) { + EventTree->AppendItem(mcr,(*e)->time().Format(wxT("%Y-%m-%d %H:%M:%S")),-1,-1); + } + } + } + EventTree->SortChildren(root); + EventTree->Expand(root); + fgSizer->Layout(); ScrolledWindow->FitInside(); @@ -759,7 +811,7 @@ void Daily::RefreshData() float rei=d->count(CPAP_RERA)/d->hours(); float vsi=d->count(CPAP_VSnore)/d->hours(); float fli=d->count(CPAP_FlowLimit)/d->hours(); - float p90=d->percentile(CPAP_Pressure,0,0.9); +// float p90=d->percentile(CPAP_Pressure,0,0.9); float eap90=d->percentile(CPAP_EAP,0,0.9); float iap90=d->percentile(CPAP_IAP,0,0.9); wxString submodel=_("Unknown Model"); @@ -898,7 +950,7 @@ void Daily::RefreshData() } */ } else { - HTMLInfo->SetPage(_("Please import some data")); + HTMLInfo->SetPage(_("No data available for this day")); /*if (SessionList->IsShown()) { m_mgr.DetachPane(SessionList); diff --git a/SleepyHeadMain.h b/SleepyHeadMain.h index 7da89a0f..4e2d7c69 100644 --- a/SleepyHeadMain.h +++ b/SleepyHeadMain.h @@ -11,9 +11,10 @@ #define SLEEPYHEADMAIN_H +#include +#include #include "SleepyHeadApp.h" -#include #include "GUIFrame.h" #include "sleeplib/machine.h" #include "graphs/graph.h" @@ -76,6 +77,7 @@ protected: virtual void OnCalendarMonth( wxCalendarEvent& event ); virtual void OnClose(wxCloseEvent &event); virtual void OnSelectSession( wxCommandEvent& event ); + virtual void OnEventTreeSelection( wxTreeEvent& event ); void AddData(gPointData *d) { Data.push_back(d); }; void UpdateGraphs(Day *day); @@ -87,6 +89,9 @@ protected: Profile *profile; list Data; + wxHtmlWindow *HTMLInfo; + wxTreeCtrl *EventTree; + //wxListBox *SessionList; }; diff --git a/WxWizFrame.fbp b/WxWizFrame.fbp index 431ffc4b..4b7d6b0c 100644 --- a/WxWizFrame.fbp +++ b/WxWizFrame.fbp @@ -714,89 +714,6 @@ - - 1 - 1 - 1 - 1 - - - - Day Summary - 1 - 0 - 0 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0 - - 0 - - 200,400 - 0 - - 1 - HTMLInfo - 1 - 467,397 - 208,424 - protected - 1 - - 1 - Resizable - 0 - 1 - - wxHW_SCROLLBAR_AUTO - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 1 @@ -891,6 +808,96 @@ 0 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + 0 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + 220,-1 + 0 + + 1 + Notebook + 0 + + + protected + 0 + + 1 + Resizable + + 1 + + wxAUI_NB_TAB_MOVE|wxAUI_NB_TAB_SPLIT + + -1 + 0 + + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 diff --git a/graphs/graph.cpp b/graphs/graph.cpp index 5ec5115a..1f5d9f78 100644 --- a/graphs/graph.cpp +++ b/graphs/graph.cpp @@ -998,7 +998,7 @@ void gCandleStick::Plot(wxDC & dc, gGraphWindow & w) dc.GradientFillLinear(rect,*color[i % color.size()],*wxLIGHT_GREY,dir); dc.DrawRectangle(rect); str=wxT(""); - if (m_names.size()>i) { + if ((int)m_names.size()>i) { str=m_names[i]+wxT(" "); } str+=wxString::Format(wxT("%0.2f"),data->point[0][i].x); @@ -1066,7 +1066,7 @@ void gBarChart::Plot(wxDC & dc, gGraphWindow & w) dc.SetPen( *wxBLACK_PEN ); float barwidth,pxr; - float px,py; + float px;//,py; if (m_direction==wxVERTICAL) { barwidth=(height-days)/float(days); @@ -1086,7 +1086,6 @@ void gBarChart::Plot(wxDC & dc, gGraphWindow & w) wxString str; bool draw_xticks_instead=false; - int cnt=0; for (int i=0;inp[0];i++) { if (data->point[0][i].x < w.min_x) continue; if (data->point[0][i].x >= w.max_x) break; @@ -1454,7 +1453,7 @@ void gFlagsLine::Plot(wxDC & dc, gGraphWindow & w) double line_h=(height+1)/double(total_lines); - int r=int(height) % total_lines; + //int r=int(height) % total_lines; double line_top=start_py+round(line_num*line_h)-1; //double line_bottom=line_top+line_h; diff --git a/libs/sleeplib/machine.cpp b/libs/sleeplib/machine.cpp index 2d598167..ede2df21 100644 --- a/libs/sleeplib/machine.cpp +++ b/libs/sleeplib/machine.cpp @@ -75,10 +75,11 @@ map DefaultMCShortNames; {CPAP_IAP, wxT("IAP")}, {PRS1_VSnore2, wxT("VS")}, {PRS1_PressurePulse,wxT("PP")} -}; +}; */ // Master list. Look up local name table first.. then these if not found. -map DefaultMCLongNames= { +map DefaultMCLongNames; +/*= { {CPAP_Obstructive, wxT("Obstructive Apnea")}, {CPAP_Hypopnea, wxT("Hypopnea")}, {CPAP_RERA, wxT("Respiratory Effort / Arrousal")}, @@ -88,8 +89,8 @@ map DefaultMCLongNames= { {CPAP_FlowLimit, wxT("Flow Limitation")}, {CPAP_Pressure, wxT("Pressure")}, {CPAP_Leak, wxT("Leak Rate")}, - {CPAP_EAP, wxT("BIPAP Exhalation Pressure")}, - {CPAP_IAP, wxT("BIPAP Inhalation Pressure")}, + {CPAP_EAP, wxT("BIPAP EPAP")}, + {CPAP_IAP, wxT("BIPAP IPAP")}, {PRS1_VSnore2, wxT("Vibratory Snore")}, {PRS1_PressurePulse,wxT("Pressue Pulse")} }; */ @@ -115,16 +116,32 @@ void InitMapsWithoutAwesomeInitializerLists() DefaultMCShortNames[CPAP_Hypopnea]=wxT("H"); DefaultMCShortNames[CPAP_RERA]=wxT("RE"); DefaultMCShortNames[CPAP_ClearAirway]=wxT("CA"); - DefaultMCShortNames[CPAP_CSR]=wxT("CSR"); + DefaultMCShortNames[CPAP_CSR]=wxT("CSR/PB"); DefaultMCShortNames[CPAP_VSnore]=wxT("VS"); DefaultMCShortNames[CPAP_FlowLimit]=wxT("FL"); DefaultMCShortNames[CPAP_Pressure]=wxT("P"); DefaultMCShortNames[CPAP_Leak]=wxT("LR"); - DefaultMCShortNames[CPAP_EAP]=wxT("EAP"); - DefaultMCShortNames[CPAP_IAP]=wxT("IAP"); - DefaultMCShortNames[PRS1_VSnore2]=wxT("VS"); + DefaultMCShortNames[CPAP_EAP]=wxT("EPAP"); + DefaultMCShortNames[CPAP_IAP]=wxT("IPAP"); + DefaultMCShortNames[PRS1_VSnore2]=wxT("VS2"); DefaultMCShortNames[PRS1_PressurePulse]=wxT("PP"); + DefaultMCLongNames[CPAP_Obstructive]=wxT("Obstructive Apnea"); + DefaultMCLongNames[CPAP_Hypopnea]=wxT("Hypopnea"); + DefaultMCLongNames[CPAP_RERA]=wxT("RERA"); + DefaultMCLongNames[CPAP_ClearAirway]=wxT("Clear Airway Apnea"); + DefaultMCLongNames[CPAP_CSR]=wxT("Periodic Breathing"); + DefaultMCLongNames[CPAP_VSnore]=wxT("Vibratory Snore"); + DefaultMCLongNames[CPAP_FlowLimit]=wxT("Flow Limitation"); + DefaultMCLongNames[CPAP_Pressure]=wxT("Pressure"); + DefaultMCLongNames[CPAP_Leak]=wxT("Leak Rate"); + DefaultMCLongNames[CPAP_EAP]=wxT("BIPAP EPAP"); + DefaultMCLongNames[CPAP_IAP]=wxT("BIPAP IPAP"); + DefaultMCLongNames[PRS1_VSnore2]=wxT("Vibratory Snore 2"); + DefaultMCLongNames[PRS1_PressurePulse]=wxT("Pressue Pulse"); + DefaultMCLongNames[PRS1_Unknown0E]=wxT("Unknown 0E"); + + } diff --git a/libs/sleeplib/machine.h b/libs/sleeplib/machine.h index b4967b79..b0663e70 100644 --- a/libs/sleeplib/machine.h +++ b/libs/sleeplib/machine.h @@ -75,6 +75,7 @@ enum PRTypes//:short }; extern map DefaultMCShortNames; +extern map DefaultMCLongNames; extern map PressureReliefNames; extern map CPAPModeNames; diff --git a/version.h b/version.h index fe9abe44..10cb635b 100644 --- a/version.h +++ b/version.h @@ -4,7 +4,7 @@ namespace AutoVersion{ //Date Version Types - static const char DATE[] = "03"; + static const char DATE[] = "04"; static const char MONTH[] = "06"; static const char YEAR[] = "2011"; static const char UBUNTU_VERSION_STYLE[] = "11.06"; @@ -16,14 +16,14 @@ namespace AutoVersion{ //Standard Version Type static const long MAJOR = 0; static const long MINOR = 7; - static const long BUILD = 2985; - static const long REVISION = 10912; + static const long BUILD = 3051; + static const long REVISION = 11257; //Miscellaneous Version Types - static const long BUILDS_COUNT = 8822; - #define RC_FILEVERSION 0,7,2985,10912 - #define RC_FILEVERSION_STRING "0, 7, 2985, 10912\0" - static const char FULLVERSION_STRING[] = "0.7.2985.10912"; + static const long BUILDS_COUNT = 8949; + #define RC_FILEVERSION 0,7,3051,11257 + #define RC_FILEVERSION_STRING "0, 7, 3051, 11257\0" + static const char FULLVERSION_STRING[] = "0.7.3051.11257"; //These values are to keep track of your versioning state, don't modify them. static const long BUILD_HISTORY = 62;