view src/appconf.cpp @ 2:45d4fd954c31 default tip

change layout.
author pyon@macmini
date Mon, 10 Jun 2019 22:17:33 +0900
parents f40a65687079
children
line wrap: on
line source

// Filename   : appconf.cpp
// Last Change: 2019-06-09 Sun 16:56:39.
//
#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 );
}

wxString AppConf::LoadWork( void )
{
	wxString dir;
    config->SetPath( "/Misc" );
    config->Read( "workdir", &dir );

    delete config;

	return dir;
}

wxString AppConf::LoadScanner( void )
{
	wxString scan;
    config->SetPath( "/Misc" );
    config->Read( "scanner", &scan );

    delete config;

	return scan;
}


/* Save */
void AppConf::SaveRect( wxRect rect )
{
    config->SetPath( "/Geometry" );
    config->Write( "geo", Rect2Geo( rect ) );

    delete config;
}

void AppConf::SaveWork( wxString dir )
{
    config->SetPath( "/Misc" );
    config->Write( "workdir", dir );

    delete config;
}