diff src/appconf.cpp @ 0:2f5584f0d127

first commit.
author pyon@macmini
date Sat, 08 Jun 2019 16:21:40 +0900
parents
children f40a65687079
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/appconf.cpp	Sat Jun 08 16:21:40 2019 +0900
@@ -0,0 +1,60 @@
+// Filename   : appconf.cpp
+// Last Change: 2019-06-07 ‹à 14:38:53.
+//
+#include "appconf.h"
+#include "util.h"
+
+AppConf::AppConf()
+{
+    conf_file = wxGetCwd() + wxFILE_SEP_PATH + "app.conf";
+    config = new wxFileConfig( "MyApp", "T.Mutoh", conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
+}
+
+AppConf::~AppConf()
+{
+}
+
+/* Load */
+wxRect AppConf::LoadRect()
+{
+	wxString buf;
+    config->SetPath( "/Geometry" );
+    config->Read( "geo", &buf );
+
+    delete config;
+
+	return Geo2Rect( buf );
+}
+
+void AppConf::LoadCcn( wxComboBox ccn, wxComboBox sss )
+{
+	wxString buf;
+    config->SetPath( "/Ccn" );
+    config->Read( "ccn", &buf );
+    config->Read( "sss", &buf );
+
+    delete config;
+}
+
+wxRect AppConf::LoadMask( int i )
+{
+	wxString buf;
+	wxString mask = wxString::Format( "mask%d", i );
+    config->SetPath( "/Mask" );
+    config->Read( mask, &buf );
+
+    delete config;
+
+	return Geo2Rect( buf );
+}
+
+
+/* Save */
+void AppConf::SaveRect( wxRect rect )
+{
+    config->SetPath( "/Geometry" );
+    config->Write( "geo", Rect2Geo( rect ) );
+
+    delete config;
+}
+