mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-02-03 09:44:26 -05:00
Theme set/change now consistent over the UI
This commit is contained in:
parent
0b23a14678
commit
532f34c608
125
src/AppFrame.cpp
125
src/AppFrame.cpp
@ -929,6 +929,72 @@ void AppFrame::disableRig() {
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AppFrame::actionOnMenuDisplay(wxCommandEvent& event) {
|
||||
|
||||
//by default, is managed.
|
||||
bool bManaged = true;
|
||||
|
||||
if (event.GetId() == wxID_THEME_DEFAULT) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_DEFAULT);
|
||||
}
|
||||
else if (event.GetId() == wxID_THEME_SHARP) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_SHARP);
|
||||
}
|
||||
else if (event.GetId() == wxID_THEME_BW) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_BW);
|
||||
}
|
||||
else if (event.GetId() == wxID_THEME_RAD) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_RAD);
|
||||
}
|
||||
else if (event.GetId() == wxID_THEME_TOUCH) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_TOUCH);
|
||||
}
|
||||
else if (event.GetId() == wxID_THEME_HD) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_HD);
|
||||
}
|
||||
else if (event.GetId() == wxID_THEME_RADAR) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_RADAR);
|
||||
}
|
||||
//Display : font sizes
|
||||
else if (event.GetId() == wxID_DISPLAY_BASE) {
|
||||
GLFont::setScale(GLFont::GLFONT_SCALE_NORMAL);
|
||||
}
|
||||
else if (event.GetId() == wxID_DISPLAY_BASE + 1) {
|
||||
GLFont::setScale(GLFont::GLFONT_SCALE_MEDIUM);
|
||||
}
|
||||
else if (event.GetId() == wxID_DISPLAY_BASE + 2) {
|
||||
GLFont::setScale(GLFont::GLFONT_SCALE_LARGE);
|
||||
}
|
||||
else if (event.GetId() == wxID_DISPLAY_BOOKMARKS) {
|
||||
if (hideBookmarksItem->IsChecked()) {
|
||||
bookmarkSplitter->Unsplit(bookmarkView);
|
||||
bookmarkSplitter->Layout();
|
||||
}
|
||||
else {
|
||||
bookmarkSplitter->SplitVertically(bookmarkView, mainVisSplitter, wxGetApp().getConfig()->getBookmarkSplit());
|
||||
bookmarkSplitter->Layout();
|
||||
}
|
||||
}
|
||||
else {
|
||||
bManaged = false;
|
||||
}
|
||||
|
||||
//update theme choice in children elements:
|
||||
if (event.GetId() >= wxID_THEME_DEFAULT && event.GetId() <= wxID_THEME_RADAR) {
|
||||
|
||||
gainCanvas->setThemeColors();
|
||||
modemProps->updateTheme();
|
||||
bookmarkView->updateTheme();
|
||||
}
|
||||
|
||||
//force all windows refresh
|
||||
if (bManaged) {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
return bManaged;
|
||||
}
|
||||
|
||||
void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
|
||||
// if (event.GetId() >= wxID_RT_AUDIO_DEVICE && event.GetId() < wxID_RT_AUDIO_DEVICE + (int)devices.size()) {
|
||||
@ -1057,56 +1123,23 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
waterfallSpeedMeter->setLevel(sqrt(DEFAULT_WATERFALL_LPS));
|
||||
wxGetApp().getSpectrumProcessor()->setFFTAverageRate(0.65f);
|
||||
spectrumAvgMeter->setLevel(0.65f);
|
||||
demodModeSelector->Refresh();
|
||||
demodTuner->Refresh();
|
||||
|
||||
SetTitle(CUBICSDR_TITLE);
|
||||
currentSessionFile = "";
|
||||
bookmarkSplitter->Unsplit(bookmarkView);
|
||||
bookmarkSplitter->SplitVertically( bookmarkView, mainVisSplitter, wxGetApp().getConfig()->getBookmarkSplit() );
|
||||
hideBookmarksItem->Check(false);
|
||||
//force all windows refresh
|
||||
Refresh();
|
||||
|
||||
} else if (event.GetId() == wxID_CLOSE || event.GetId() == wxID_EXIT) {
|
||||
Close(false);
|
||||
} else if (event.GetId() == wxID_THEME_DEFAULT) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_DEFAULT);
|
||||
} else if (event.GetId() == wxID_THEME_SHARP) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_SHARP);
|
||||
} else if (event.GetId() == wxID_THEME_BW) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_BW);
|
||||
} else if (event.GetId() == wxID_THEME_RAD) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_RAD);
|
||||
} else if (event.GetId() == wxID_THEME_TOUCH) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_TOUCH);
|
||||
} else if (event.GetId() == wxID_THEME_HD) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_HD);
|
||||
} else if (event.GetId() == wxID_THEME_RADAR) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_RADAR);
|
||||
}
|
||||
//Display : font sizes
|
||||
else if (event.GetId() == wxID_DISPLAY_BASE) {
|
||||
GLFont::setScale(GLFont::GLFONT_SCALE_NORMAL);
|
||||
//force all windows refresh
|
||||
Refresh();
|
||||
else if (actionOnMenuDisplay(event)) {
|
||||
//done in actionOnMenuDisplay
|
||||
return;
|
||||
}
|
||||
else if (event.GetId() == wxID_DISPLAY_BASE + 1) {
|
||||
GLFont::setScale(GLFont::GLFONT_SCALE_MEDIUM);
|
||||
//force all windows refresh
|
||||
Refresh();
|
||||
}
|
||||
else if (event.GetId() == wxID_DISPLAY_BASE + 2) {
|
||||
GLFont::setScale(GLFont::GLFONT_SCALE_LARGE);
|
||||
//force all windows refresh
|
||||
Refresh();
|
||||
} else if (event.GetId() == wxID_DISPLAY_BOOKMARKS) {
|
||||
if (hideBookmarksItem->IsChecked()) {
|
||||
bookmarkSplitter->Unsplit(bookmarkView);
|
||||
bookmarkSplitter->Layout();
|
||||
} else {
|
||||
bookmarkSplitter->SplitVertically( bookmarkView, mainVisSplitter, wxGetApp().getConfig()->getBookmarkSplit() );
|
||||
bookmarkSplitter->Layout();
|
||||
}
|
||||
}
|
||||
|
||||
if (event.GetId() >= wxID_SETTINGS_BASE && event.GetId() < settingsIdMax) {
|
||||
else if (event.GetId() >= wxID_SETTINGS_BASE && event.GetId() < settingsIdMax) {
|
||||
int setIdx = event.GetId()-wxID_SETTINGS_BASE;
|
||||
int menuIdx = 0;
|
||||
for (std::vector<SoapySDR::ArgInfo>::iterator arg_i = settingArgs.begin(); arg_i != settingArgs.end(); arg_i++) {
|
||||
@ -1157,15 +1190,7 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.GetId() >= wxID_THEME_DEFAULT && event.GetId() <= wxID_THEME_RADAR) {
|
||||
demodTuner->Refresh();
|
||||
demodModeSelector->Refresh();
|
||||
waterfallSpeedMeter->Refresh();
|
||||
spectrumAvgMeter->Refresh();
|
||||
gainCanvas->setThemeColors();
|
||||
modemProps->updateTheme();
|
||||
bookmarkView->updateTheme();
|
||||
}
|
||||
|
||||
|
||||
if (event.GetId() == wxID_BANDWIDTH_MANUAL) {
|
||||
wxGetApp().setSampleRate(manualSampleRate);
|
||||
|
@ -138,6 +138,10 @@ private:
|
||||
void OnDoubleClickSash(wxSplitterEvent& event);
|
||||
void OnUnSplit(wxSplitterEvent& event);
|
||||
|
||||
//manage Display menu actions, return true if the event has been
|
||||
//treated.
|
||||
bool actionOnMenuDisplay(wxCommandEvent& event);
|
||||
|
||||
ScopeCanvas *scopeCanvas;
|
||||
SpectrumCanvas *spectrumCanvas;
|
||||
WaterfallCanvas *waterfallCanvas;
|
||||
|
@ -33,7 +33,6 @@ BookmarkViewVisualDragItem::BookmarkViewVisualDragItem(wxString labelValue) : wx
|
||||
sizer->Add(label, 1, wxALL | wxEXPAND, 5);
|
||||
|
||||
SetSizerAndFit(sizer);
|
||||
|
||||
Show();
|
||||
}
|
||||
|
||||
@ -192,9 +191,10 @@ void BookmarkView::updateTheme() {
|
||||
m_treeView->SetForegroundColour(textColor);
|
||||
|
||||
m_propPanel->SetBackgroundColour(bgColor);
|
||||
m_buttonPanel->SetBackgroundColour(bgColor);
|
||||
|
||||
m_propPanel->SetForegroundColour(textColor);
|
||||
|
||||
m_buttonPanel->SetBackgroundColour(bgColor);
|
||||
m_buttonPanel->SetForegroundColour(textColor);
|
||||
|
||||
m_labelLabel->SetForegroundColour(textColor);
|
||||
m_frequencyVal->SetForegroundColour(textColor);
|
||||
@ -203,6 +203,7 @@ void BookmarkView::updateTheme() {
|
||||
m_bandwidthLabel->SetForegroundColour(textColor);
|
||||
m_modulationVal->SetForegroundColour(textColor);
|
||||
m_modulationLabel->SetForegroundColour(textColor);
|
||||
|
||||
|
||||
refreshLayout();
|
||||
}
|
||||
@ -701,7 +702,12 @@ void BookmarkView::refreshLayout() {
|
||||
wxButton *BookmarkView::makeButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler) {
|
||||
wxButton *nButton = new wxButton( m_buttonPanel, wxID_ANY, labelVal);
|
||||
nButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, handler, nullptr, this);
|
||||
nButton->SetBackgroundColour(ThemeMgr::mgr.currentTheme->generalBackground);
|
||||
|
||||
wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
|
||||
wxColour textColor(ThemeMgr::mgr.currentTheme->text);
|
||||
|
||||
nButton->SetBackgroundColour(bgColor);
|
||||
nButton->SetForegroundColour(textColor);
|
||||
return nButton;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user