0
|
1 // Filename : appconf.cpp
|
1
|
2 // Last Change: 2019-06-09 Sun 16:56:39.
|
0
|
3 //
|
|
4 #include "appconf.h"
|
|
5 #include "util.h"
|
|
6
|
|
7 AppConf::AppConf()
|
|
8 {
|
|
9 conf_file = wxGetCwd() + wxFILE_SEP_PATH + "app.conf";
|
|
10 config = new wxFileConfig( "MyApp", "T.Mutoh", conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
|
|
11 }
|
|
12
|
|
13 AppConf::~AppConf()
|
|
14 {
|
|
15 }
|
|
16
|
|
17 /* Load */
|
|
18 wxRect AppConf::LoadRect()
|
|
19 {
|
|
20 wxString buf;
|
|
21 config->SetPath( "/Geometry" );
|
|
22 config->Read( "geo", &buf );
|
|
23
|
|
24 delete config;
|
|
25
|
|
26 return Geo2Rect( buf );
|
|
27 }
|
|
28
|
|
29 void AppConf::LoadCcn( wxComboBox ccn, wxComboBox sss )
|
|
30 {
|
|
31 wxString buf;
|
|
32 config->SetPath( "/Ccn" );
|
|
33 config->Read( "ccn", &buf );
|
|
34 config->Read( "sss", &buf );
|
|
35
|
|
36 delete config;
|
|
37 }
|
|
38
|
|
39 wxRect AppConf::LoadMask( int i )
|
|
40 {
|
|
41 wxString buf;
|
|
42 wxString mask = wxString::Format( "mask%d", i );
|
|
43 config->SetPath( "/Mask" );
|
|
44 config->Read( mask, &buf );
|
|
45
|
|
46 delete config;
|
|
47
|
|
48 return Geo2Rect( buf );
|
|
49 }
|
|
50
|
1
|
51 wxString AppConf::LoadWork( void )
|
|
52 {
|
|
53 wxString dir;
|
|
54 config->SetPath( "/Misc" );
|
|
55 config->Read( "workdir", &dir );
|
|
56
|
|
57 delete config;
|
|
58
|
|
59 return dir;
|
|
60 }
|
|
61
|
|
62 wxString AppConf::LoadScanner( void )
|
|
63 {
|
|
64 wxString scan;
|
|
65 config->SetPath( "/Misc" );
|
|
66 config->Read( "scanner", &scan );
|
|
67
|
|
68 delete config;
|
|
69
|
|
70 return scan;
|
|
71 }
|
|
72
|
0
|
73
|
|
74 /* Save */
|
|
75 void AppConf::SaveRect( wxRect rect )
|
|
76 {
|
|
77 config->SetPath( "/Geometry" );
|
|
78 config->Write( "geo", Rect2Geo( rect ) );
|
|
79
|
|
80 delete config;
|
|
81 }
|
|
82
|
1
|
83 void AppConf::SaveWork( wxString dir )
|
|
84 {
|
|
85 config->SetPath( "/Misc" );
|
|
86 config->Write( "workdir", dir );
|
|
87
|
|
88 delete config;
|
|
89 }
|
|
90
|