Apply theme to bookmark panel, implement RGBA4f->wxColour operator

This commit is contained in:
Charles J. Cliffe 2016-09-29 21:57:23 -04:00
parent 003758b799
commit 560caccbc7
8 changed files with 51 additions and 28 deletions

View File

@ -594,6 +594,7 @@ AppFrame::AppFrame() :
waterfallCanvas->setLinesPerSecond(wflps);
ThemeMgr::mgr.setTheme(wxGetApp().getConfig()->getTheme());
bookmarkView->updateTheme();
int mpc =wxGetApp().getConfig()->getModemPropsCollapsed();
@ -1035,6 +1036,7 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
spectrumAvgMeter->Refresh();
gainCanvas->setThemeColors();
modemProps->updateTheme();
bookmarkView->updateTheme();
}
switch (event.GetId()) {

View File

@ -30,26 +30,10 @@ void ModemProperties::OnShow(wxShowEvent & /* event */) {
}
void ModemProperties::updateTheme() {
wxColour bgColor(
(unsigned char) (ThemeMgr::mgr.currentTheme->generalBackground.r * 255.0),
(unsigned char) (ThemeMgr::mgr.currentTheme->generalBackground.g * 255.0),
(unsigned char) (ThemeMgr::mgr.currentTheme->generalBackground.b * 255.0));
wxColour textColor(
(unsigned char) (ThemeMgr::mgr.currentTheme->text.r * 255.0),
(unsigned char) (ThemeMgr::mgr.currentTheme->text.g * 255.0),
(unsigned char) (ThemeMgr::mgr.currentTheme->text.b * 255.0));
wxColour btn(
(unsigned char) (ThemeMgr::mgr.currentTheme->button.r * 255.0),
(unsigned char) (ThemeMgr::mgr.currentTheme->button.g * 255.0),
(unsigned char) (ThemeMgr::mgr.currentTheme->button.b * 255.0));
wxColour btnHl(
(unsigned char) (ThemeMgr::mgr.currentTheme->buttonHighlight.r * 255.0),
(unsigned char) (ThemeMgr::mgr.currentTheme->buttonHighlight.g * 255.0),
(unsigned char) (ThemeMgr::mgr.currentTheme->buttonHighlight.b * 255.0));
wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
wxColour textColor(ThemeMgr::mgr.currentTheme->text);
wxColour btn(ThemeMgr::mgr.currentTheme->button);
wxColour btnHl(ThemeMgr::mgr.currentTheme->buttonHighlight);
m_propertyGrid->SetEmptySpaceColour(bgColor);
m_propertyGrid->SetCellBackgroundColour(bgColor);

View File

@ -337,7 +337,9 @@ void DemodulatorInstance::setDemodulatorType(std::string demod_type_in) {
outp->setTitle(getDemodulatorType() + ": " + frequencyToStr(getFrequency()));
}
#endif
}
}
wxGetApp().getBookmarkMgr().updateActiveList();
}
std::string DemodulatorInstance::getDemodulatorType() {

View File

@ -62,13 +62,13 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
bSizer1->Add( m_propPanel, 1, wxBOTTOM|wxEXPAND|wxTOP, 5 );
m_bookmarkButton = new wxButton( this, wxID_ANY, wxT("Bookmark"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer1->Add( m_bookmarkButton, 0, wxALL|wxEXPAND, 5 );
bSizer1->Add( m_bookmarkButton, 0, wxEXPAND, 5 );
m_activateButton = new wxButton( this, wxID_ANY, wxT("Activate"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer1->Add( m_activateButton, 0, wxALL|wxEXPAND, 5 );
bSizer1->Add( m_activateButton, 0, wxEXPAND, 5 );
m_removeButton = new wxButton( this, wxID_ANY, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer1->Add( m_removeButton, 0, wxALL|wxEXPAND, 5 );
bSizer1->Add( m_removeButton, 0, wxEXPAND, 5 );
this->SetSizer( bSizer1 );

View File

@ -952,7 +952,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@ -1040,7 +1040,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@ -1128,7 +1128,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -20,6 +20,32 @@ void BookmarkView::onUpdateTimer( wxTimerEvent& event ) {
}
}
void BookmarkView::updateTheme() {
wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
wxColour textColor(ThemeMgr::mgr.currentTheme->text);
wxColour btn(ThemeMgr::mgr.currentTheme->button);
wxColour btnHl(ThemeMgr::mgr.currentTheme->buttonHighlight);
m_treeView->SetBackgroundColour(bgColor);
m_treeView->SetForegroundColour(textColor);
m_propPanel->SetBackgroundColour(bgColor);
m_propPanel->SetForegroundColour(textColor);
m_labelLabel->SetForegroundColour(textColor);
m_frequencyVal->SetForegroundColour(textColor);
m_frequencyLabel->SetForegroundColour(textColor);
m_bandwidthVal->SetForegroundColour(textColor);
m_bandwidthLabel->SetForegroundColour(textColor);
m_modulationVal->SetForegroundColour(textColor);
m_modulationLabel->SetForegroundColour(textColor);
m_bookmarkButton->SetBackgroundColour(bgColor);
m_removeButton->SetBackgroundColour(bgColor);
m_activateButton->SetBackgroundColour(bgColor);
}
void BookmarkView::updateActiveList() {
doUpdateActive = true;
}
@ -53,7 +79,6 @@ void BookmarkView::doUpdateActiveList() {
m_treeView->Enable();
m_treeView->ExpandAll();
}
void BookmarkView::onTreeBeginLabelEdit( wxTreeEvent& event ) {

View File

@ -10,6 +10,7 @@ public:
void updateActiveList();
void activeSelection(DemodulatorInstance *dsel);
void updateTheme();
protected:

View File

@ -5,6 +5,7 @@
#include <map>
#include <vector>
#include <string>
#include <wx/colour.h>
#define COLOR_THEME_DEFAULT 0
#define COLOR_THEME_BW 1
@ -38,6 +39,14 @@ public:
}
RGBA4f operator*(float v) { return RGBA4f(r*v, g*v, b*v); }
operator wxColour() {
return wxColour(
(unsigned char) (r * 255.0),
(unsigned char) (g * 255.0),
(unsigned char) (b * 255.0));
}
};