save frequency snap value

This commit is contained in:
Charles J. Cliffe 2015-07-18 21:49:53 -04:00
parent 8827ff9e26
commit db434348a4
3 changed files with 25 additions and 2 deletions

View File

@ -121,6 +121,7 @@ AppConfig::AppConfig() {
winH.store(0); winH.store(0);
winMax.store(false); winMax.store(false);
themeId.store(0); themeId.store(0);
snap.store(1);
} }
@ -186,6 +187,15 @@ int AppConfig::getTheme() {
} }
void AppConfig::setSnap(long long snapVal) {
this->snap.store(snapVal);
}
long long AppConfig::getSnap() {
return snap.load();
}
bool AppConfig::save() { bool AppConfig::save() {
DataTree cfg; DataTree cfg;
@ -200,8 +210,8 @@ bool AppConfig::save() {
*window_node->newChild("h") = winH.load(); *window_node->newChild("h") = winH.load();
*window_node->newChild("max") = winMax.load(); *window_node->newChild("max") = winMax.load();
*window_node->newChild("theme") = themeId.load(); *window_node->newChild("theme") = themeId.load();
*window_node->newChild("snap") = snap.load();
} }
DataNode *devices_node = cfg.rootNode()->newChild("devices"); DataNode *devices_node = cfg.rootNode()->newChild("devices");
@ -275,6 +285,11 @@ bool AppConfig::load() {
themeId.store(theme); themeId.store(theme);
} }
if (win_node->hasAnother("snap")) {
long long snapVal;
win_node->getNext("snap")->element()->get(snapVal);
snap.store(snapVal);
}
} }
if (cfg.rootNode()->hasAnother("devices")) { if (cfg.rootNode()->hasAnother("devices")) {

View File

@ -56,6 +56,9 @@ public:
void setTheme(int themeId); void setTheme(int themeId);
int getTheme(); int getTheme();
void setSnap(long long snapVal);
long long getSnap();
bool save(); bool save();
bool load(); bool load();
bool reset(); bool reset();
@ -65,4 +68,5 @@ private:
std::atomic_int winX,winY,winW,winH; std::atomic_int winX,winY,winW,winH;
std::atomic_bool winMax; std::atomic_bool winMax;
std::atomic_int themeId; std::atomic_int themeId;
std::atomic_llong snap;
}; };

View File

@ -320,6 +320,9 @@ AppFrame::AppFrame() :
this->Maximize(); this->Maximize();
} }
long long freqSnap = wxGetApp().getConfig()->getSnap();
wxGetApp().setFrequencySnap(freqSnap);
ThemeMgr::mgr.setTheme(wxGetApp().getConfig()->getTheme()); ThemeMgr::mgr.setTheme(wxGetApp().getConfig()->getTheme());
Show(); Show();
@ -528,6 +531,7 @@ void AppFrame::OnClose(wxCloseEvent& event) {
wxGetApp().getConfig()->setWindow(this->GetPosition(), this->GetClientSize()); wxGetApp().getConfig()->setWindow(this->GetPosition(), this->GetClientSize());
wxGetApp().getConfig()->setWindowMaximized(this->IsMaximized()); wxGetApp().getConfig()->setWindowMaximized(this->IsMaximized());
wxGetApp().getConfig()->setTheme(ThemeMgr::mgr.getTheme()); wxGetApp().getConfig()->setTheme(ThemeMgr::mgr.getTheme());
wxGetApp().getConfig()->setSnap(wxGetApp().getFrequencySnap());
wxGetApp().getConfig()->save(); wxGetApp().getConfig()->save();
event.Skip(); event.Skip();
} }