mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 12:18:37 -05:00
Save and load splitter sash positions
This commit is contained in:
parent
5870c7f7a2
commit
2085d0f2c9
@ -290,6 +290,10 @@ AppConfig::AppConfig() : configName("") {
|
|||||||
spectrumAvgSpeed.store(0.65f);
|
spectrumAvgSpeed.store(0.65f);
|
||||||
dbOffset.store(0);
|
dbOffset.store(0);
|
||||||
modemPropsCollapsed.store(false);
|
modemPropsCollapsed.store(false);
|
||||||
|
mainSplit = -1;
|
||||||
|
visSplit = -1;
|
||||||
|
bookmarkSplit = -1;
|
||||||
|
|
||||||
#ifdef USE_HAMLIB
|
#ifdef USE_HAMLIB
|
||||||
rigEnabled.store(false);
|
rigEnabled.store(false);
|
||||||
rigModel.store(1);
|
rigModel.store(1);
|
||||||
@ -441,6 +445,31 @@ std::vector<SDRManualDef> AppConfig::getManualDevices() {
|
|||||||
return manualDevices;
|
return manualDevices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppConfig::setMainSplit(float value) {
|
||||||
|
mainSplit.store(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
float AppConfig::getMainSplit() {
|
||||||
|
return mainSplit.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppConfig::setVisSplit(float value) {
|
||||||
|
visSplit.store(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
float AppConfig::getVisSplit() {
|
||||||
|
return visSplit.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppConfig::setBookmarkSplit(float value) {
|
||||||
|
bookmarkSplit.store(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
float AppConfig::getBookmarkSplit() {
|
||||||
|
return bookmarkSplit.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AppConfig::setConfigName(std::string configName) {
|
void AppConfig::setConfigName(std::string configName) {
|
||||||
this->configName = configName;
|
this->configName = configName;
|
||||||
}
|
}
|
||||||
@ -487,6 +516,10 @@ bool AppConfig::save() {
|
|||||||
*window_node->newChild("spectrum_avg") = spectrumAvgSpeed.load();
|
*window_node->newChild("spectrum_avg") = spectrumAvgSpeed.load();
|
||||||
*window_node->newChild("modemprops_collapsed") = modemPropsCollapsed.load();;
|
*window_node->newChild("modemprops_collapsed") = modemPropsCollapsed.load();;
|
||||||
*window_node->newChild("db_offset") = dbOffset.load();
|
*window_node->newChild("db_offset") = dbOffset.load();
|
||||||
|
|
||||||
|
*window_node->newChild("main_split") = mainSplit.load();
|
||||||
|
*window_node->newChild("vis_split") = visSplit.load();
|
||||||
|
*window_node->newChild("bookmark_split") = bookmarkSplit.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
DataNode *devices_node = cfg.rootNode()->newChild("devices");
|
DataNode *devices_node = cfg.rootNode()->newChild("devices");
|
||||||
@ -644,6 +677,24 @@ bool AppConfig::load() {
|
|||||||
offset_node->element()->get(offsetValue);
|
offset_node->element()->get(offsetValue);
|
||||||
setDBOffset(offsetValue);
|
setDBOffset(offsetValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (win_node->hasAnother("main_split")) {
|
||||||
|
float gVal;
|
||||||
|
win_node->getNext("main_split")->element()->get(gVal);
|
||||||
|
mainSplit.store(gVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (win_node->hasAnother("vis_split")) {
|
||||||
|
float gVal;
|
||||||
|
win_node->getNext("vis_split")->element()->get(gVal);
|
||||||
|
visSplit.store(gVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (win_node->hasAnother("bookmark_split")) {
|
||||||
|
float gVal;
|
||||||
|
win_node->getNext("bookmark_split")->element()->get(gVal);
|
||||||
|
bookmarkSplit.store(gVal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfg.rootNode()->hasAnother("devices")) {
|
if (cfg.rootNode()->hasAnother("devices")) {
|
||||||
|
@ -118,6 +118,16 @@ public:
|
|||||||
void setManualDevices(std::vector<SDRManualDef> manuals);
|
void setManualDevices(std::vector<SDRManualDef> manuals);
|
||||||
std::vector<SDRManualDef> getManualDevices();
|
std::vector<SDRManualDef> getManualDevices();
|
||||||
|
|
||||||
|
void setMainSplit(float value);
|
||||||
|
float getMainSplit();
|
||||||
|
|
||||||
|
void setVisSplit(float value);
|
||||||
|
float getVisSplit();
|
||||||
|
|
||||||
|
void setBookmarkSplit(float value);
|
||||||
|
float getBookmarkSplit();
|
||||||
|
|
||||||
|
|
||||||
#if USE_HAMLIB
|
#if USE_HAMLIB
|
||||||
int getRigModel();
|
int getRigModel();
|
||||||
void setRigModel(int rigModel);
|
void setRigModel(int rigModel);
|
||||||
@ -160,7 +170,7 @@ private:
|
|||||||
std::atomic_llong snap;
|
std::atomic_llong snap;
|
||||||
std::atomic_llong centerFreq;
|
std::atomic_llong centerFreq;
|
||||||
std::atomic_int waterfallLinesPerSec;
|
std::atomic_int waterfallLinesPerSec;
|
||||||
std::atomic<float> spectrumAvgSpeed;
|
std::atomic<float> spectrumAvgSpeed, mainSplit, visSplit, bookmarkSplit;
|
||||||
std::atomic_int dbOffset;
|
std::atomic_int dbOffset;
|
||||||
std::vector<SDRManualDef> manualDevices;
|
std::vector<SDRManualDef> manualDevices;
|
||||||
#if USE_HAMLIB
|
#if USE_HAMLIB
|
||||||
|
@ -69,9 +69,10 @@ AppFrame::AppFrame() :
|
|||||||
//attribList.PlatformDefaults().MinRGBA(8, 8, 8, 8).DoubleBuffer().Depth(16).EndList();
|
//attribList.PlatformDefaults().MinRGBA(8, 8, 8, 8).DoubleBuffer().Depth(16).EndList();
|
||||||
|
|
||||||
mainSplitter = new wxSplitterWindow( this, wxID_MAIN_SPLITTER, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH | wxSP_LIVE_UPDATE );
|
mainSplitter = new wxSplitterWindow( this, wxID_MAIN_SPLITTER, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH | wxSP_LIVE_UPDATE );
|
||||||
mainSplitter->SetSashGravity(10.0/37.0);
|
mainSplitter->SetSashGravity(10.0f / 37.0f);
|
||||||
mainSplitter->SetMinimumPaneSize(1);
|
mainSplitter->SetMinimumPaneSize(1);
|
||||||
|
|
||||||
|
|
||||||
wxPanel *demodPanel = new wxPanel(mainSplitter, wxID_ANY);
|
wxPanel *demodPanel = new wxPanel(mainSplitter, wxID_ANY);
|
||||||
|
|
||||||
#ifdef CUBICSDR_HEADER_IMAGE
|
#ifdef CUBICSDR_HEADER_IMAGE
|
||||||
@ -277,13 +278,13 @@ AppFrame::AppFrame() :
|
|||||||
|
|
||||||
// vbox->Add(demodTray, 12, wxEXPAND | wxALL, 0);
|
// vbox->Add(demodTray, 12, wxEXPAND | wxALL, 0);
|
||||||
// vbox->AddSpacer(1);
|
// vbox->AddSpacer(1);
|
||||||
bookmarkSplitter = new wxSplitterWindow( mainSplitter, wxID_VIS_SPLITTER, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH | wxSP_LIVE_UPDATE );
|
bookmarkSplitter = new wxSplitterWindow( mainSplitter, wxID_BM_SPLITTER, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH | wxSP_LIVE_UPDATE );
|
||||||
bookmarkSplitter->SetMinimumPaneSize(1);
|
bookmarkSplitter->SetMinimumPaneSize(1);
|
||||||
bookmarkSplitter->SetSashGravity(1.0/20.0);
|
bookmarkSplitter->SetSashGravity(1.0f / 20.0f);
|
||||||
|
|
||||||
mainVisSplitter = new wxSplitterWindow( bookmarkSplitter, wxID_VIS_SPLITTER, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH | wxSP_LIVE_UPDATE );
|
mainVisSplitter = new wxSplitterWindow( bookmarkSplitter, wxID_VIS_SPLITTER, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH | wxSP_LIVE_UPDATE );
|
||||||
mainVisSplitter->SetMinimumPaneSize(1);
|
mainVisSplitter->SetMinimumPaneSize(1);
|
||||||
mainVisSplitter->SetSashGravity(6.0/25.0);
|
mainVisSplitter->SetSashGravity(6.0f / 25.0f);
|
||||||
|
|
||||||
// mainVisSplitter->Connect( wxEVT_IDLE, wxIdleEventHandler( AppFrame::mainVisSplitterIdle ), NULL, this );
|
// mainVisSplitter->Connect( wxEVT_IDLE, wxIdleEventHandler( AppFrame::mainVisSplitterIdle ), NULL, this );
|
||||||
|
|
||||||
@ -648,6 +649,19 @@ AppFrame::AppFrame() :
|
|||||||
modemProps->setCollapsed(true);
|
modemProps->setCollapsed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int msPos = wxGetApp().getConfig()->getMainSplit();
|
||||||
|
if (msPos != -1) {
|
||||||
|
mainSplitter->SetSashPosition(msPos);
|
||||||
|
}
|
||||||
|
int bsPos = wxGetApp().getConfig()->getBookmarkSplit();
|
||||||
|
if (bsPos != -1) {
|
||||||
|
bookmarkSplitter->SetSashPosition(bsPos);
|
||||||
|
}
|
||||||
|
int vsPos = wxGetApp().getConfig()->getVisSplit();
|
||||||
|
if (vsPos != -1) {
|
||||||
|
mainVisSplitter->SetSashPosition(vsPos);
|
||||||
|
}
|
||||||
|
|
||||||
Show();
|
Show();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -1289,6 +1303,9 @@ void AppFrame::OnClose(wxCloseEvent& event) {
|
|||||||
wxGetApp().getConfig()->setWaterfallLinesPerSec(waterfallDataThread->getLinesPerSecond());
|
wxGetApp().getConfig()->setWaterfallLinesPerSec(waterfallDataThread->getLinesPerSecond());
|
||||||
wxGetApp().getConfig()->setManualDevices(SDREnumerator::getManuals());
|
wxGetApp().getConfig()->setManualDevices(SDREnumerator::getManuals());
|
||||||
wxGetApp().getConfig()->setModemPropsCollapsed(modemProps->isCollapsed());
|
wxGetApp().getConfig()->setModemPropsCollapsed(modemProps->isCollapsed());
|
||||||
|
wxGetApp().getConfig()->setMainSplit(mainSplitter->GetSashPosition());
|
||||||
|
wxGetApp().getConfig()->setVisSplit(mainVisSplitter->GetSashPosition());
|
||||||
|
wxGetApp().getConfig()->setBookmarkSplit(bookmarkSplitter->GetSashPosition());
|
||||||
#ifdef USE_HAMLIB
|
#ifdef USE_HAMLIB
|
||||||
wxGetApp().getConfig()->setRigEnabled(rigEnableMenuItem->IsChecked());
|
wxGetApp().getConfig()->setRigEnabled(rigEnableMenuItem->IsChecked());
|
||||||
wxGetApp().getConfig()->setRigModel(rigModel);
|
wxGetApp().getConfig()->setRigModel(rigModel);
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#define wxID_MAIN_SPLITTER 2050
|
#define wxID_MAIN_SPLITTER 2050
|
||||||
#define wxID_VIS_SPLITTER 2051
|
#define wxID_VIS_SPLITTER 2051
|
||||||
|
#define wxID_BM_SPLITTER 2052
|
||||||
|
|
||||||
#define wxID_THEME_DEFAULT 2100
|
#define wxID_THEME_DEFAULT 2100
|
||||||
#define wxID_THEME_SHARP 2101
|
#define wxID_THEME_SHARP 2101
|
||||||
|
Loading…
Reference in New Issue
Block a user