Fixed crash when selecting machine with no tabs open

This commit is contained in:
Mark Watkins 2011-05-29 16:10:32 +10:00
parent 563b3a793e
commit 0c000c6140
3 changed files with 27 additions and 30 deletions

View File

@ -7873,7 +7873,7 @@
<sleeplib/machine.h>
<list>
1306648365 /home/mark/projects/git/sleepyhead/version.h
1306649352 /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"
1306647571 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
1306649351 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
"wx_pch.h"
"version.h"
<wx/app.h>
@ -7905,7 +7905,7 @@
"SleepyHeadMain.h"
"sleeplib/profiles.h"
1306647888 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp
1306648364 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp
<wx/settings.h>
<wx/dcbuffer.h>
<wx/log.h>

View File

@ -91,23 +91,6 @@ SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame)
id=pref[wxT("DefaultMachine")].GetInteger();
}
if (id<cpap_machines.size()) {
Machine *m=cpap_machines[id];
int idx=main_auinotebook->GetPageIndex(daily);
if (idx!=wxNOT_FOUND) {
daily->RefreshData(m);
}
idx=main_auinotebook->GetPageIndex(summary);
if (idx!=wxNOT_FOUND) {
summary->RefreshData(m);
}
summary->Refresh();
daily->Refresh();
Refresh();
}
this->Connect(wxID_ANY, wxEVT_DO_SCREENSHOT, wxCommandEventHandler(SleepyHeadFrame::DoScreenshot));
//this->Connect(wxID_ANY, wxEVT_MACHINE_SELECTED, wxCommandEventHandler(SleepyHeadFrame::OnMachineSelected));
//this->Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SleepyHeadFrame::DoScreenshot));
@ -186,14 +169,14 @@ void SleepyHeadFrame::OnMachineSelected(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();
//Refresh();
}
void SleepyHeadFrame::OnScreenshot(wxCommandEvent& event)
{
@ -293,19 +276,33 @@ void SleepyHeadFrame::OnImportSD(wxCommandEvent &event)
void SleepyHeadFrame::OnViewMenuDaily( wxCommandEvent& event )
{
int idx=main_auinotebook->GetPageIndex(daily);
int id;
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);
daily->Refresh();
} else {
main_auinotebook->SetSelection(idx);
}
}
void SleepyHeadFrame::OnViewMenuSummary( wxCommandEvent& event )
{
int idx=main_auinotebook->GetPageIndex(summary);
int id,idx=main_auinotebook->GetPageIndex(summary);
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);
summary->Refresh();
} else {
main_auinotebook->SetSelection(idx);
}

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 = 1771;
static const long REVISION = 4228;
static const long BUILD = 1775;
static const long REVISION = 4252;
//Miscellaneous Version Types
static const long BUILDS_COUNT = 6012;
#define RC_FILEVERSION 0,7,1771,4228
#define RC_FILEVERSION_STRING "0, 7, 1771, 4228\0"
static const char FULLVERSION_STRING[] = "0.7.1771.4228";
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";
//These values are to keep track of your versioning state, don't modify them.
static const long BUILD_HISTORY = 62;