diff --git a/CMakeLists.txt b/CMakeLists.txt index 933e81e..2629358 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,5 +73,8 @@ add_executable( fc2dconfig src/fc2dconfig.cpp src/paths.cpp src/modellist.cpp + src/configfile.cpp + src/toml.c + src/tomlcpp.cpp ) target_link_libraries( fc2dconfig ${wxWidgets_LIBRARIES} ) diff --git a/src/fc2dconfig.cpp b/src/fc2dconfig.cpp index f4a6d60..15ae4a1 100644 --- a/src/fc2dconfig.cpp +++ b/src/fc2dconfig.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #ifndef WX_PRECOMP @@ -22,6 +23,7 @@ class ConfigurationFrame : public wxFrame { std::vector modelVec; wxCheckBox* useHaarCheckBox; wxChoice* modelNameChoice; + void loadExistingConfig(); // loads existing config file and populates controls void OnApply(wxCommandEvent& event); void OnExit(wxCommandEvent& event); }; @@ -85,6 +87,21 @@ ConfigurationFrame::ConfigurationFrame() : wxFrame(NULL, wxID_ANY, "Configure " Bind(wxEVT_BUTTON, &ConfigurationFrame::OnApply, this, wxID_APPLY); Bind(wxEVT_BUTTON, &ConfigurationFrame::OnExit, this, wxID_CANCEL); + + loadExistingConfig(); +} + +void ConfigurationFrame::loadExistingConfig() { + struct optData configData; + configFileOpen(&configData); + + useHaarCheckBox->SetValue(configData.useHaar); + for (int i = 0; i < modelVec.size(); i++) { + if (modelVec[i] == configData.model) { + modelNameChoice->SetSelection(i); + break; + } + } } void ConfigurationFrame::OnApply(wxCommandEvent& event) {