comparison src/appconf.cpp @ 0:2f5584f0d127

first commit.
author pyon@macmini
date Sat, 08 Jun 2019 16:21:40 +0900
parents
children f40a65687079
comparison
equal deleted inserted replaced
-1:000000000000 0:2f5584f0d127
1 // Filename : appconf.cpp
2 // Last Change: 2019-06-07 ‹à 14:38:53.
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
51
52 /* Save */
53 void AppConf::SaveRect( wxRect rect )
54 {
55 config->SetPath( "/Geometry" );
56 config->Write( "geo", Rect2Geo( rect ) );
57
58 delete config;
59 }
60