Mercurial > mercurial > hgweb_mover2.cgi
comparison src/main.cpp @ 0:7bf900d47e9e
start mover2
author | pyon@macmini |
---|---|
date | Sat, 15 Oct 2011 13:24:27 +0900 |
parents | |
children | b47bd4618c16 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7bf900d47e9e |
---|---|
1 // Filename : main.cpp | |
2 // Last Change: 15-Oct-2011. | |
3 // | |
4 | |
5 #include "common.h" | |
6 #include "main.h" | |
7 #include "myframe.h" | |
8 //#include "testframe.cpp" | |
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 | |
29 wxString progname = wxT("A Mover"); | |
30 wxString verstr = wxString::Format( wxT(" - v%d.%d ( build %d )"), VER, REV, BLD ); | |
31 wxString title = progname + verstr; | |
32 | |
33 MyFrame *mainframe = new MyFrame( NULL, ID_MAIN, title ); | |
34 mainframe->SetSize( rect ); | |
35 mainframe->SetMinSize( wxSize( 580, 680 ) ); | |
36 mainframe->Show(true); | |
37 /* | |
38 TestFrame *tf = new TestFrame( NULL, ID_TEST, wxT("A Test") ); | |
39 tf->Show(true); | |
40 */ | |
41 | |
42 return true; | |
43 } | |
44 | |
45 int MyApp::OnExit() | |
46 { | |
47 config->SetPath( wxT("/Geometry") ); | |
48 config->Write( wxT("x"), rect.x ); | |
49 config->Write( wxT("y"), rect.y ); | |
50 config->Write( wxT("w"), rect.width ); | |
51 config->Write( wxT("h"), rect.height ); | |
52 | |
53 config->SetPath( wxT("/WorkDir") ); | |
54 config->Write( wxT("workdir"), workdir ); | |
55 | |
56 config->SetPath( wxT("/Param") ); | |
57 config->Write( wxT("lmin"), lmin ); | |
58 config->Write( wxT("lmax"), lmax ); | |
59 config->Write( wxT("bmin"), bmin ); | |
60 config->Write( wxT("bmax"), bmax ); | |
61 | |
62 delete config; | |
63 | |
64 return 0; | |
65 } | |
66 | |
67 void MyApp::ConfInit() | |
68 { | |
69 conf_file = wxGetCwd() + wxFILE_SEP_PATH + MYAPPNAME + wxT(".conf"); | |
70 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); | |
71 | |
72 config->SetPath( wxT("/Geometry") ); | |
73 config->Read( wxT("x"), &rect.x ); | |
74 config->Read( wxT("y"), &rect.y ); | |
75 config->Read( wxT("w"), &rect.width ); | |
76 config->Read( wxT("h"), &rect.height ); | |
77 | |
78 config->SetPath( wxT("/WorkDir") ); | |
79 config->Read( wxT("workdir"), &workdir ); | |
80 | |
81 config->SetPath( wxT("/Param") ); | |
82 config->Read( wxT("lmin"), lmin ); | |
83 config->Read( wxT("lmax"), lmax ); | |
84 config->Read( wxT("bmin"), bmin ); | |
85 config->Read( wxT("bmax"), bmax ); | |
86 } | |
87 |