diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt
index 14e6576421..caabda4846 100644
--- a/pcb_calculator/CMakeLists.txt
+++ b/pcb_calculator/CMakeLists.txt
@@ -44,7 +44,6 @@ set( PCB_CALCULATOR_SRCS
transline/twistedpair.cpp
transline_dlg_funct.cpp
attenuators/attenuator_classes.cpp
- dialogs/pcb_calculator_frame_base.cpp
dialogs/dialog_regulator_form_base.cpp
dialogs/dialog_regulator_form.cpp
../common/env_vars.cpp # needed on MSW to avoid a link issue (a symbol not found)
diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp
deleted file mode 100644
index ffcc0ca5f3..0000000000
--- a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
-// http://www.wxformbuilder.org/
-//
-// PLEASE DO *NOT* EDIT THIS FILE!
-///////////////////////////////////////////////////////////////////////////
-
-#include "pcb_calculator_frame_base.h"
-
-///////////////////////////////////////////////////////////////////////////
-
-PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : KIWAY_PLAYER( parent, id, title, pos, size, style, name )
-{
- this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
- m_menubar = new wxMenuBar( 0 );
- this->SetMenuBar( m_menubar );
-
- wxBoxSizer* bmainFrameSizer;
- bmainFrameSizer = new wxBoxSizer( wxVERTICAL );
-
- m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
-
- bmainFrameSizer->Add( m_Notebook, 1, wxEXPAND, 5 );
-
-
- this->SetSizer( bmainFrameSizer );
- this->Layout();
-
- this->Centre( wxBOTH );
-
- // Connect Events
- this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) );
- this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) );
-}
-
-PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE()
-{
- // Disconnect Events
- this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) );
- this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) );
-
-}
diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp
deleted file mode 100644
index 20f6aed144..0000000000
--- a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp
+++ /dev/null
@@ -1,151 +0,0 @@
-
-
-
-
-
diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.h b/pcb_calculator/dialogs/pcb_calculator_frame_base.h
deleted file mode 100644
index d9fa499b62..0000000000
--- a/pcb_calculator/dialogs/pcb_calculator_frame_base.h
+++ /dev/null
@@ -1,50 +0,0 @@
-///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
-// http://www.wxformbuilder.org/
-//
-// PLEASE DO *NOT* EDIT THIS FILE!
-///////////////////////////////////////////////////////////////////////////
-
-#pragma once
-
-#include
-#include
-#include
-#include "kiway_player.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-///////////////////////////////////////////////////////////////////////////
-
-
-///////////////////////////////////////////////////////////////////////////////
-/// Class PCB_CALCULATOR_FRAME_BASE
-///////////////////////////////////////////////////////////////////////////////
-class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
-{
- private:
-
- protected:
- wxMenuBar* m_menubar;
- wxNotebook* m_Notebook;
-
- // Virtual event handlers, override them in your derived class
- virtual void OnClosePcbCalc( wxCloseEvent& event ) { event.Skip(); }
- virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
-
-
- public:
-
- PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Calculator"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 646,361 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL, const wxString& name = wxT("pcb_calculator") );
-
- ~PCB_CALCULATOR_FRAME_BASE();
-
-};
-
diff --git a/pcb_calculator/pcb_calculator_frame.cpp b/pcb_calculator/pcb_calculator_frame.cpp
index 8b37384ce8..0fe5d4190b 100644
--- a/pcb_calculator/pcb_calculator_frame.cpp
+++ b/pcb_calculator/pcb_calculator_frame.cpp
@@ -17,14 +17,19 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
*/
+#include
#include
+#include
+#include
+
#include
#include
#include
#include
-#include "attenuators/attenuator_classes.h"
-#include "pcb_calculator_frame.h"
-#include "pcb_calculator_settings.h"
+
+#include
+#include
+#include
#include
#include
@@ -38,32 +43,51 @@
PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
- PCB_CALCULATOR_FRAME_BASE( aParent ),
+ KIWAY_PLAYER( aParent, wxID_ANY,
+ _( "PCB Calculator" ), // Window title
+ wxDefaultPosition,
+ wxSize( 646,361 ), // Default size
+ wxDEFAULT_FRAME_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE | wxTAB_TRAVERSAL,
+ wxT( "pcb_calculator" ) ), // Window name
m_lastNotebookPage( -1 ),
m_macHack( true )
{
- SetKiway( this, aKiway );
-
SHAPE_POLY_SET dummy; // A ugly trick to force the linker to include
// some methods in code and avoid link errors
- AddCalculator( new PANEL_REGULATOR( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
+ SetKiway( this, aKiway );
+
+ SetSizeHints( wxDefaultSize, wxDefaultSize );
+
+ m_menubar = new wxMenuBar( 0 );
+ SetMenuBar( m_menubar );
+
+ m_mainSizer = new wxBoxSizer( wxVERTICAL );
+ m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
+
+ m_mainSizer->Add( m_notebook, 1, wxEXPAND, 5 );
+
+ SetSizer( m_mainSizer );
+ Layout();
+ Centre( wxBOTH );
+
+ AddCalculator( new PANEL_REGULATOR( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
_( "Regulators" ) );
- AddCalculator( new PANEL_ATTENUATORS( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
+ AddCalculator( new PANEL_ATTENUATORS( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
_( "RF Attenuators" ) );
- AddCalculator( new PANEL_E_SERIE( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
+ AddCalculator( new PANEL_E_SERIE( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
_( "E-Series" ) );
- AddCalculator( new PANEL_COLOR_CODE( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
+ AddCalculator( new PANEL_COLOR_CODE( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
_( "Color Code" ) );
- AddCalculator( new PANEL_TRANSLINE( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
+ AddCalculator( new PANEL_TRANSLINE( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
_( "TransLine ") );
- AddCalculator( new PANEL_VIA_SIZE( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
+ AddCalculator( new PANEL_VIA_SIZE( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
_( "Via Size" ) );
- AddCalculator( new PANEL_TRACK_WIDTH( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
+ AddCalculator( new PANEL_TRACK_WIDTH( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
_( "Track Width" ) );
- AddCalculator( new PANEL_ELECTRICAL_SPACING( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
+ AddCalculator( new PANEL_ELECTRICAL_SPACING( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
_( "Electrical Spacing" ) );
- AddCalculator( new PANEL_BOARD_CLASS( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
+ AddCalculator( new PANEL_BOARD_CLASS( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ),
_("Board Classes") );
LoadSettings( config() );
@@ -92,6 +116,10 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
if( m_framePos == wxDefaultPosition )
Centre();
+ // Connect Events
+ Bind( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME::OnClosePcbCalc ), this );
+ Bind( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME::OnUpdateUI ), this );
+
Bind( wxEVT_SYS_COLOUR_CHANGED,
wxSysColourChangedEventHandler( PCB_CALCULATOR_FRAME::onThemeChanged ), this );
}
@@ -111,7 +139,7 @@ void PCB_CALCULATOR_FRAME::AddCalculator( CALCULATOR_PANEL *aPanel, const wxStri
m_panels.push_back( aPanel );
m_panelTypes[ typeid( aPanel ).name() ] = aPanel;
- m_Notebook->AddPage( aPanel, panelUIName, false );
+ m_notebook->AddPage( aPanel, panelUIName, false );
}
@@ -130,7 +158,7 @@ void PCB_CALCULATOR_FRAME::onThemeChanged( wxSysColourChangedEvent& aEvent )
void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event )
{
- if( m_Notebook->GetSelection() != m_lastNotebookPage )
+ if( m_notebook->GetSelection() != m_lastNotebookPage )
{
// Kick all the things that wxWidgets can't seem to redraw on its own.
// This is getting seriously ridiculous....
@@ -169,7 +197,7 @@ void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event )
// Until it's shown on screen the above won't work; but doing it anyway at least keeps
// putting new OnUpdateUI events into the queue until it *is* shown on screen.
- if( m_Notebook->IsShownOnScreen() )
+ if( m_notebook->IsShownOnScreen() )
{
// Work around an OSX bug where the wxGrid children don't get placed correctly until
// the first resize event.
@@ -193,7 +221,7 @@ void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event )
}
#endif
- m_lastNotebookPage = m_Notebook->GetSelection();
+ m_lastNotebookPage = m_notebook->GetSelection();
}
}
}
@@ -243,7 +271,7 @@ void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
PCB_CALCULATOR_SETTINGS* cfg = static_cast( aCfg );
- m_Notebook->ChangeSelection( cfg->m_LastPage );
+ m_notebook->ChangeSelection( cfg->m_LastPage );
for( auto& panel : m_panels )
panel->LoadSettings( cfg );
@@ -262,7 +290,7 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
if( cfg )
{
- cfg->m_LastPage = m_Notebook->GetSelection();
+ cfg->m_LastPage = m_notebook->GetSelection();
for( auto& panel : m_panels )
panel->SaveSettings( cfg );
diff --git a/pcb_calculator/pcb_calculator_frame.h b/pcb_calculator/pcb_calculator_frame.h
index 07c67ebbae..7ae9a02881 100644
--- a/pcb_calculator/pcb_calculator_frame.h
+++ b/pcb_calculator/pcb_calculator_frame.h
@@ -17,11 +17,15 @@
* with this program. If not, see .
*/
-#ifndef PCB_CALCULATOR_H
-#define PCB_CALCULATOR_H
+#ifndef PCB_CALCULATOR_FRAME_H_
+#define PCB_CALCULATOR_FRAME_H_
-#include "calculator_panels/calculator_panel.h"
-#include "pcb_calculator_frame_base.h"
+#include
+#include
+
+class wxMenuBar;
+class wxNotebook;
+class wxBoxSizer;
class APP_SETTINGS_BASE;
class KIWAY;
@@ -31,7 +35,7 @@ class PANEL_TRANSLINE;
/**
* PCB calculator the main frame.
*/
-class PCB_CALCULATOR_FRAME : public PCB_CALCULATOR_FRAME_BASE
+class PCB_CALCULATOR_FRAME : public KIWAY_PLAYER
{
public:
PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent );
@@ -61,9 +65,9 @@ public:
private:
// Event handlers
- void OnClosePcbCalc( wxCloseEvent& event ) override;
+ void OnClosePcbCalc( wxCloseEvent& event );
- void OnUpdateUI( wxUpdateUIEvent& event ) override;
+ void OnUpdateUI( wxUpdateUIEvent& event );
void onThemeChanged( wxSysColourChangedEvent& aEvent );
@@ -72,8 +76,12 @@ private:
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
private:
- int m_lastNotebookPage;
- bool m_macHack;
+ wxMenuBar* m_menubar;
+ wxNotebook* m_notebook;
+ wxBoxSizer* m_mainSizer;
+
+ int m_lastNotebookPage;
+ bool m_macHack;
std::vector m_panels;
std::map m_panelTypes;