diff --git a/common/html_window.cpp b/common/html_window.cpp
index c500575626..aa7847dc3f 100644
--- a/common/html_window.cpp
+++ b/common/html_window.cpp
@@ -49,7 +49,13 @@ bool HTML_WINDOW::SetPage( const wxString& aSource )
}
-void HTML_WINDOW::onThemeChanged( wxSysColourChangedEvent &aEvent )
+void HTML_WINDOW::ThemeChanged()
{
SetPage( m_pageSource );
}
+
+
+void HTML_WINDOW::onThemeChanged( wxSysColourChangedEvent &aEvent )
+{
+ ThemeChanged();
+}
diff --git a/include/html_window.h b/include/html_window.h
index c952a86a18..250ee287b9 100644
--- a/include/html_window.h
+++ b/include/html_window.h
@@ -39,6 +39,11 @@ public:
bool SetPage( const wxString& aSource ) override;
+ /*
+ * Notify the HTML window the theme has changed.
+ */
+ void ThemeChanged();
+
private:
void onThemeChanged( wxSysColourChangedEvent &aEvent );
diff --git a/pcb_calculator/calculator_panels/calculator_panel.h b/pcb_calculator/calculator_panels/calculator_panel.h
new file mode 100644
index 0000000000..a02e7b17c9
--- /dev/null
+++ b/pcb_calculator/calculator_panels/calculator_panel.h
@@ -0,0 +1,59 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Ian McInerney
+ * Copyright (C) 2021 Kicad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#ifndef CALCULATOR_PANEL_H_
+#define CALCULATOR_PANEL_H_
+
+#include
+
+class PCB_CALCULATOR_SETTINGS;
+
+class CALCULATOR_PANEL : public wxPanel
+{
+public:
+ CALCULATOR_PANEL( wxWindow* aParent, wxWindowID aId, const wxPoint& aPos, const wxSize& aSize,
+ long aStyle, const wxString& aName )
+ : wxPanel( aParent, aId, aPos, aSize, aStyle, aName )
+ {}
+
+ ~CALCULATOR_PANEL() {}
+
+ /**
+ * Load the settings into the panel
+ *
+ *@param aCfg is the settings structure to load from
+ */
+ virtual void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg ) = 0;
+
+ /**
+ * Save the settings from the panel
+ *
+ *@param aCfg is the settings structure to save to
+ */
+ virtual void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg ) = 0;
+
+ /**
+ * Update UI elements of the panel when the theme changes to ensure the images
+ * and fonts/colors are appropriate for the new theme.
+ */
+ virtual void ThemeChanged() = 0;
+};
+
+#endif
diff --git a/pcb_calculator/calculator_panels/panel_attenuators.cpp b/pcb_calculator/calculator_panels/panel_attenuators.cpp
index c5e70eb32e..5c19c381e4 100644
--- a/pcb_calculator/calculator_panels/panel_attenuators.cpp
+++ b/pcb_calculator/calculator_panels/panel_attenuators.cpp
@@ -65,6 +65,24 @@ PANEL_ATTENUATORS::~PANEL_ATTENUATORS()
}
+void PANEL_ATTENUATORS::ThemeChanged()
+{
+ // Update the bitmaps
+ m_bpButtonCalcAtt->SetBitmap( KiBitmap( BITMAPS::small_down ) );
+ m_attenuatorBitmap->SetBitmap( KiBitmap( m_CurrAttenuator->m_SchBitmapName ) );
+
+ // Update the font
+ m_staticTextAttMsg->SetFont( KIUI::GetInfoFont( this ).Italic() );
+
+ // Update the HTML windows
+ m_Attenuator_Messages->ThemeChanged();
+ m_panelAttFormula->ThemeChanged();
+
+ Layout();
+ Refresh();
+}
+
+
void PANEL_ATTENUATORS::UpdateUI()
{
m_attenuatorBitmap->SetBitmap( KiBitmap( m_CurrAttenuator->m_SchBitmapName ) );
diff --git a/pcb_calculator/calculator_panels/panel_attenuators.h b/pcb_calculator/calculator_panels/panel_attenuators.h
index 2c1d99cea3..3c805eefcc 100644
--- a/pcb_calculator/calculator_panels/panel_attenuators.h
+++ b/pcb_calculator/calculator_panels/panel_attenuators.h
@@ -37,8 +37,12 @@ public:
~PANEL_ATTENUATORS();
wxRadioBox* GetAttenuatorsSelector() { return m_AttenuatorsSelection; }
- void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg );
- void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg );
+
+ // Methods from CALCULATOR_PANEL that must be overriden
+ void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg ) override;
+ void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg ) override;
+ void ThemeChanged() override;
+
void UpdateUI(); // Update bitmaps
void OnAttenuatorSelection( wxCommandEvent& event ) override;
diff --git a/pcb_calculator/calculator_panels/panel_attenuators_base.cpp b/pcb_calculator/calculator_panels/panel_attenuators_base.cpp
index 658669be3a..1b59874a2b 100644
--- a/pcb_calculator/calculator_panels/panel_attenuators_base.cpp
+++ b/pcb_calculator/calculator_panels/panel_attenuators_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version 3.10.0)
+// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
-PANEL_ATTENUATORS_BASE::PANEL_ATTENUATORS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
+PANEL_ATTENUATORS_BASE::PANEL_ATTENUATORS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : CALCULATOR_PANEL( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizerAtt;
bSizerAtt = new wxBoxSizer( wxHORIZONTAL );
diff --git a/pcb_calculator/calculator_panels/panel_attenuators_base.fbp b/pcb_calculator/calculator_panels/panel_attenuators_base.fbp
index 1009f4ae2e..a330414d39 100644
--- a/pcb_calculator/calculator_panels/panel_attenuators_base.fbp
+++ b/pcb_calculator/calculator_panels/panel_attenuators_base.fbp
@@ -46,7 +46,7 @@
PANEL_ATTENUATORS_BASE
500,300
- ; ; forward_declare
+ CALCULATOR_PANEL; calculator_panel.h; forward_declare
0
diff --git a/pcb_calculator/calculator_panels/panel_attenuators_base.h b/pcb_calculator/calculator_panels/panel_attenuators_base.h
index 4fd5211b2d..10014dc8e7 100644
--- a/pcb_calculator/calculator_panels/panel_attenuators_base.h
+++ b/pcb_calculator/calculator_panels/panel_attenuators_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version 3.10.0)
+// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -11,6 +11,7 @@
#include
#include
#include "html_window.h"
+#include "calculator_panel.h"
#include
#include
#include
@@ -36,7 +37,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_ATTENUATORS_BASE
///////////////////////////////////////////////////////////////////////////////
-class PANEL_ATTENUATORS_BASE : public wxPanel
+class PANEL_ATTENUATORS_BASE : public CALCULATOR_PANEL
{
private:
diff --git a/pcb_calculator/calculator_panels/panel_board_class.cpp b/pcb_calculator/calculator_panels/panel_board_class.cpp
index b0cdee7e93..bd5b48d4bf 100644
--- a/pcb_calculator/calculator_panels/panel_board_class.cpp
+++ b/pcb_calculator/calculator_panels/panel_board_class.cpp
@@ -38,6 +38,12 @@ PANEL_BOARD_CLASS::~PANEL_BOARD_CLASS()
}
+void PANEL_BOARD_CLASS::ThemeChanged()
+{
+ // TODO: Only the grid needs updating, but it isn't done automatically (https://trac.wxwidgets.org/ticket/19279)
+}
+
+
void PANEL_BOARD_CLASS::SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg )
{
aCfg->m_BoardClassUnits = m_BoardClassesUnitsSelector->GetSelection();
diff --git a/pcb_calculator/calculator_panels/panel_board_class.h b/pcb_calculator/calculator_panels/panel_board_class.h
index 2f10ff0692..854df465a6 100644
--- a/pcb_calculator/calculator_panels/panel_board_class.h
+++ b/pcb_calculator/calculator_panels/panel_board_class.h
@@ -34,11 +34,13 @@ public:
long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_BOARD_CLASS();
- void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg );
- void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg );
+ // Methods from CALCULATOR_PANEL that must be overriden
+ void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg ) override;
+ void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg ) override;
+ void ThemeChanged() override;
void OnBoardClassesUnitsSelection( wxCommandEvent& event ) override;
void BoardClassesUpdateData( double aUnitScale );
};
-#endif
\ No newline at end of file
+#endif
diff --git a/pcb_calculator/calculator_panels/panel_board_class_base.cpp b/pcb_calculator/calculator_panels/panel_board_class_base.cpp
index d36644a1ca..9a66c289f1 100644
--- a/pcb_calculator/calculator_panels/panel_board_class_base.cpp
+++ b/pcb_calculator/calculator_panels/panel_board_class_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Oct 26 2018)
+// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -11,7 +11,7 @@
///////////////////////////////////////////////////////////////////////////
-PANEL_BOARD_CLASS_BASE::PANEL_BOARD_CLASS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
+PANEL_BOARD_CLASS_BASE::PANEL_BOARD_CLASS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : CALCULATOR_PANEL( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizerBoardClass;
bSizerBoardClass = new wxBoxSizer( wxHORIZONTAL );
@@ -32,7 +32,7 @@ PANEL_BOARD_CLASS_BASE::PANEL_BOARD_CLASS_BASE( wxWindow* parent, wxWindowID id,
m_staticTextBrdClass = new wxStaticText( this, wxID_ANY, _("Note: Values are minimal values"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBrdClass->Wrap( -1 );
- m_staticTextBrdClass->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
+ m_staticTextBrdClass->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
brdclsSizerRight->Add( m_staticTextBrdClass, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
@@ -54,13 +54,13 @@ PANEL_BOARD_CLASS_BASE::PANEL_BOARD_CLASS_BASE( wxWindow* parent, wxWindowID id,
m_gridClassesValuesDisplay->SetColSize( 5, 100 );
m_gridClassesValuesDisplay->EnableDragColMove( false );
m_gridClassesValuesDisplay->EnableDragColSize( true );
- m_gridClassesValuesDisplay->SetColLabelSize( 30 );
m_gridClassesValuesDisplay->SetColLabelValue( 0, _("Class 1") );
m_gridClassesValuesDisplay->SetColLabelValue( 1, _("Class 2") );
m_gridClassesValuesDisplay->SetColLabelValue( 2, _("Class 3") );
m_gridClassesValuesDisplay->SetColLabelValue( 3, _("Class 4") );
m_gridClassesValuesDisplay->SetColLabelValue( 4, _("Class 5") );
m_gridClassesValuesDisplay->SetColLabelValue( 5, _("Class 6") );
+ m_gridClassesValuesDisplay->SetColLabelSize( 30 );
m_gridClassesValuesDisplay->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
@@ -70,12 +70,12 @@ PANEL_BOARD_CLASS_BASE::PANEL_BOARD_CLASS_BASE( wxWindow* parent, wxWindowID id,
m_gridClassesValuesDisplay->SetRowSize( 3, 24 );
m_gridClassesValuesDisplay->SetRowSize( 4, 24 );
m_gridClassesValuesDisplay->EnableDragRowSize( false );
- m_gridClassesValuesDisplay->SetRowLabelSize( 160 );
m_gridClassesValuesDisplay->SetRowLabelValue( 0, _("Lines width") );
m_gridClassesValuesDisplay->SetRowLabelValue( 1, _("Min clearance") );
m_gridClassesValuesDisplay->SetRowLabelValue( 2, _("Via: (diam - drill)") );
m_gridClassesValuesDisplay->SetRowLabelValue( 3, _("Plated Pad: (diam - drill)") );
m_gridClassesValuesDisplay->SetRowLabelValue( 4, _("NP Pad: (diam - drill)") );
+ m_gridClassesValuesDisplay->SetRowLabelSize( 160 );
m_gridClassesValuesDisplay->SetRowLabelAlignment( wxALIGN_RIGHT, wxALIGN_CENTER );
// Label Appearance
diff --git a/pcb_calculator/calculator_panels/panel_board_class_base.fbp b/pcb_calculator/calculator_panels/panel_board_class_base.fbp
index 2e3a034764..a360ac74ba 100644
--- a/pcb_calculator/calculator_panels/panel_board_class_base.fbp
+++ b/pcb_calculator/calculator_panels/panel_board_class_base.fbp
@@ -1,6 +1,6 @@
-
+