2
|
1 // Filename : main.cpp
|
6
|
2 // Last Change: 08-Oct-2011.
|
2
|
3 //
|
|
4
|
|
5 #include "common.h"
|
|
6 #include "main.h"
|
|
7 #include "myframe.h"
|
6
|
8 #include "testframe.cpp"
|
2
|
9
|
|
10 IMPLEMENT_APP(MyApp)
|
|
11
|
|
12 IMPLEMENT_CLASS( MyApp, wxApp )
|
|
13
|
|
14 MyApp::MyApp()
|
|
15 {
|
|
16 }
|
|
17 MyApp::~MyApp()
|
|
18 {
|
|
19 }
|
|
20
|
|
21 bool MyApp::OnInit()
|
|
22 {
|
|
23 if ( !wxApp::OnInit() ) return false;
|
|
24
|
|
25 wxImage::AddHandler( new wxJPEGHandler );
|
|
26
|
|
27 ConfInit();
|
|
28
|
6
|
29 /*
|
2
|
30 MyFrame *mainframe = new MyFrame( NULL, ID_MAIN, wxT("A Mover") );
|
|
31 mainframe->SetSize( rect );
|
|
32 mainframe->SetMinSize( wxSize( 580, 680 ) );
|
|
33 mainframe->Show(true);
|
6
|
34 */
|
|
35 TestFrame *tf = new TestFrame( NULL, ID_TEST, wxT("A Test") );
|
|
36 tf->Show(true);
|
|
37
|
2
|
38
|
|
39 return true;
|
|
40 }
|
|
41
|
|
42 int MyApp::OnExit()
|
|
43 {
|
|
44 config->SetPath( wxT("/Geometry") );
|
|
45 config->Write( wxT("x"), rect.x );
|
|
46 config->Write( wxT("y"), rect.y );
|
|
47 config->Write( wxT("w"), rect.width );
|
|
48 config->Write( wxT("h"), rect.height );
|
|
49
|
|
50 wxString key;
|
|
51 config->SetPath( wxT("/WorkDir") );
|
|
52 config->Write( wxT("dir"), dir );
|
|
53
|
|
54 delete config;
|
|
55
|
|
56 return 0;
|
|
57 }
|
|
58
|
|
59 void MyApp::ConfInit()
|
|
60 {
|
|
61 conf_file = wxGetCwd() + wxFILE_SEP_PATH + MYAPPNAME + wxT(".conf");
|
|
62 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
|
|
63
|
|
64 config->SetPath( wxT("/Geometry") );
|
|
65 config->Read( wxT("x"), &rect.x );
|
|
66 config->Read( wxT("y"), &rect.y );
|
|
67 config->Read( wxT("w"), &rect.width );
|
|
68 config->Read( wxT("h"), &rect.height );
|
|
69
|
|
70 config->SetPath( wxT("/WorkDir") );
|
|
71 config->Read( wxT("dir"), &dir );
|
|
72 }
|
|
73
|