pcb_calculator rework: move eseries panel to its own files panel_eserie_xx

This commit is contained in:
jean-pierre charras 2021-10-05 13:47:40 +02:00
parent 187c685c64
commit d161d7431e
12 changed files with 2620 additions and 2412 deletions

View File

@ -18,6 +18,7 @@ set( PCB_CALCULATOR_SRCS
panel_board_class.cpp panel_board_class.cpp
panel_color_code.cpp panel_color_code.cpp
panel_electrical_spacing.cpp panel_electrical_spacing.cpp
panel_eserie.cpp
panel_regulator.cpp panel_regulator.cpp
panel_track_width.cpp panel_track_width.cpp
panel_via_size.cpp panel_via_size.cpp
@ -40,6 +41,7 @@ set( PCB_CALCULATOR_SRCS
dialogs/panel_board_class_base.cpp dialogs/panel_board_class_base.cpp
dialogs/panel_regulator_base.cpp dialogs/panel_regulator_base.cpp
dialogs/panel_color_code_base.cpp dialogs/panel_color_code_base.cpp
dialogs/panel_eserie_base.cpp
dialogs/panel_via_size_base.cpp dialogs/panel_via_size_base.cpp
dialogs/panel_track_width_base.cpp dialogs/panel_track_width_base.cpp
dialogs/panel_electrical_spacing_base.cpp dialogs/panel_electrical_spacing_base.cpp

View File

@ -0,0 +1,53 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-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 <http://www.gnu.org/licenses/>.
*/
#ifndef PANEL_E_SERIE_H
#define PANEL_E_SERIE_H
#include "panel_eserie_base.h"
class PCB_CALCULATOR_SETTINGS;
class PANEL_E_SERIE : public PANEL_E_SERIE_BASE
{
public:
PANEL_E_SERIE( wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_E_SERIE();
void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg );
void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg );
/**
* Called on calculate button and executes all E-series calculations
*/
void OnCalculateESeries( wxCommandEvent& event ) override;
/**
* Radio Buttons to select the E-serie for the resistor calculator.
*
* @param event contains the radio button state.
*/
void OnESeriesSelection( wxCommandEvent& event ) override;
};
#endif

View File

@ -0,0 +1,216 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "panel_eserie_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_E_SERIE_BASE::PANEL_E_SERIE_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizerESerie;
bSizerESerie = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bMiddleSizerESeries;
bMiddleSizerESeries = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizerESeriesInput;
sbSizerESeriesInput = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Inputs") ), wxVERTICAL );
wxFlexGridSizer* fgSizerAttPrms1;
fgSizerAttPrms1 = new wxFlexGridSizer( 4, 3, 3, 0 );
fgSizerAttPrms1->AddGrowableRow( 1 );
fgSizerAttPrms1->SetFlexibleDirection( wxBOTH );
fgSizerAttPrms1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_ESrequired = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("Required resistance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESrequired->Wrap( -1 );
fgSizerAttPrms1->Add( m_ESrequired, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_ResRequired = new wxTextCtrl( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerAttPrms1->Add( m_ResRequired, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_reqResUnits = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("kOhm"), wxDefaultPosition, wxDefaultSize, 0 );
m_reqResUnits->Wrap( -1 );
fgSizerAttPrms1->Add( m_reqResUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_ESrequired1 = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("Exclude value 1:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESrequired1->Wrap( -1 );
fgSizerAttPrms1->Add( m_ESrequired1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_ResExclude1 = new wxTextCtrl( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerAttPrms1->Add( m_ResExclude1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_exclude1Units = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("kOhm"), wxDefaultPosition, wxDefaultSize, 0 );
m_exclude1Units->Wrap( -1 );
fgSizerAttPrms1->Add( m_exclude1Units, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_ESrequired11 = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("Exclude value 2:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESrequired11->Wrap( -1 );
fgSizerAttPrms1->Add( m_ESrequired11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_ResExclude2 = new wxTextCtrl( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerAttPrms1->Add( m_ResExclude2, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_exclude2Units = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("kOhm"), wxDefaultPosition, wxDefaultSize, 0 );
m_exclude2Units->Wrap( -1 );
fgSizerAttPrms1->Add( m_exclude2Units, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
sbSizerESeriesInput->Add( fgSizerAttPrms1, 0, wxEXPAND|wxBOTTOM, 5 );
m_staticline6 = new wxStaticLine( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sbSizerESeriesInput->Add( m_staticline6, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxBoxSizer* bSizer40;
bSizer40 = new wxBoxSizer( wxHORIZONTAL );
m_e1 = new wxRadioButton( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("E1"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
bSizer40->Add( m_e1, 1, wxALL, 5 );
m_e3 = new wxRadioButton( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("E3"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer40->Add( m_e3, 1, wxALL, 5 );
m_e6 = new wxRadioButton( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("E6"), wxDefaultPosition, wxDefaultSize, 0 );
m_e6->SetValue( true );
bSizer40->Add( m_e6, 1, wxALL, 5 );
m_e12 = new wxRadioButton( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("E12"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer40->Add( m_e12, 1, wxALL, 5 );
sbSizerESeriesInput->Add( bSizer40, 1, wxEXPAND, 5 );
bMiddleSizerESeries->Add( sbSizerESeriesInput, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerESeriesSolutions;
sbSizerESeriesSolutions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Solutions") ), wxVERTICAL );
wxFlexGridSizer* fgSizerESerieResults;
fgSizerESerieResults = new wxFlexGridSizer( 6, 5, 3, 0 );
fgSizerESerieResults->AddGrowableCol( 1 );
fgSizerESerieResults->SetFlexibleDirection( wxBOTH );
fgSizerESerieResults->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_ESerieSimpleSolution = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("Simple solution:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESerieSimpleSolution->Wrap( -1 );
fgSizerESerieResults->Add( m_ESerieSimpleSolution, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeries_Sol2R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ESeries_Sol2R->SetMinSize( wxSize( 150,-1 ) );
fgSizerESerieResults->Add( m_ESeries_Sol2R, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_ESeriesSimpleErr = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("Error:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesSimpleErr->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesSimpleErr, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeriesError2R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerESerieResults->Add( m_ESeriesError2R, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_ESeriesSimplePercent = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesSimplePercent->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesSimplePercent, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_ESerie3RSolution1 = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("3R solution:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESerie3RSolution1->Wrap( -1 );
fgSizerESerieResults->Add( m_ESerie3RSolution1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeries_Sol3R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ESeries_Sol3R->SetMinSize( wxSize( 220,-1 ) );
fgSizerESerieResults->Add( m_ESeries_Sol3R, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_ESeriesAltErr = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("Error:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesAltErr->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesAltErr, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeriesError3R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerESerieResults->Add( m_ESeriesError3R, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_ESeriesAltPercent = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesAltPercent->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesAltPercent, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_ESeries4RSolution = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("4R solution:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeries4RSolution->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeries4RSolution, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeries_Sol4R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ESeries_Sol4R->SetMinSize( wxSize( 290,-1 ) );
fgSizerESerieResults->Add( m_ESeries_Sol4R, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxEXPAND, 5 );
m_ESeriesAltErr1 = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("Error:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesAltErr1->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesAltErr1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeriesError4R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerESerieResults->Add( m_ESeriesError4R, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeriesAltPercent1 = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesAltPercent1->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesAltPercent1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
sbSizerESeriesSolutions->Add( fgSizerESerieResults, 0, wxBOTTOM|wxEXPAND, 5 );
m_staticline7 = new wxStaticLine( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sbSizerESeriesSolutions->Add( m_staticline7, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_buttonEScalculate = new wxButton( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("Calculate"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerESeriesSolutions->Add( m_buttonEScalculate, 0, wxALL, 5 );
bMiddleSizerESeries->Add( sbSizerESeriesSolutions, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer47;
bSizer47 = new wxBoxSizer( wxVERTICAL );
bMiddleSizerESeries->Add( bSizer47, 1, wxALIGN_BOTTOM, 5 );
bSizerESerie->Add( bMiddleSizerESeries, 0, wxEXPAND|wxTOP, 5 );
wxBoxSizer* bLowerESerie;
bLowerESerie = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbLowerSizerEseriesHelp;
sbLowerSizerEseriesHelp = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Help") ), wxVERTICAL );
m_panelESeriesHelp = new wxHtmlWindow( sbLowerSizerEseriesHelp->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
sbLowerSizerEseriesHelp->Add( m_panelESeriesHelp, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bLowerESerie->Add( sbLowerSizerEseriesHelp, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerESerie->Add( bLowerESerie, 1, wxEXPAND, 5 );
this->SetSizer( bSizerESerie );
this->Layout();
// Connect Events
m_e1->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_E_SERIE_BASE::OnESeriesSelection ), NULL, this );
m_e3->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_E_SERIE_BASE::OnESeriesSelection ), NULL, this );
m_e6->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_E_SERIE_BASE::OnESeriesSelection ), NULL, this );
m_e12->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_E_SERIE_BASE::OnESeriesSelection ), NULL, this );
m_buttonEScalculate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_E_SERIE_BASE::OnCalculateESeries ), NULL, this );
}
PANEL_E_SERIE_BASE::~PANEL_E_SERIE_BASE()
{
// Disconnect Events
m_e1->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_E_SERIE_BASE::OnESeriesSelection ), NULL, this );
m_e3->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_E_SERIE_BASE::OnESeriesSelection ), NULL, this );
m_e6->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_E_SERIE_BASE::OnESeriesSelection ), NULL, this );
m_e12->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_E_SERIE_BASE::OnESeriesSelection ), NULL, this );
m_buttonEScalculate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_E_SERIE_BASE::OnCalculateESeries ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,86 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/radiobut.h>
#include <wx/statbox.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/html/htmlwin.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_E_SERIE_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_E_SERIE_BASE : public wxPanel
{
private:
protected:
wxStaticText* m_ESrequired;
wxTextCtrl* m_ResRequired;
wxStaticText* m_reqResUnits;
wxStaticText* m_ESrequired1;
wxTextCtrl* m_ResExclude1;
wxStaticText* m_exclude1Units;
wxStaticText* m_ESrequired11;
wxTextCtrl* m_ResExclude2;
wxStaticText* m_exclude2Units;
wxStaticLine* m_staticline6;
wxRadioButton* m_e1;
wxRadioButton* m_e3;
wxRadioButton* m_e6;
wxRadioButton* m_e12;
wxStaticText* m_ESerieSimpleSolution;
wxTextCtrl* m_ESeries_Sol2R;
wxStaticText* m_ESeriesSimpleErr;
wxTextCtrl* m_ESeriesError2R;
wxStaticText* m_ESeriesSimplePercent;
wxStaticText* m_ESerie3RSolution1;
wxTextCtrl* m_ESeries_Sol3R;
wxStaticText* m_ESeriesAltErr;
wxTextCtrl* m_ESeriesError3R;
wxStaticText* m_ESeriesAltPercent;
wxStaticText* m_ESeries4RSolution;
wxTextCtrl* m_ESeries_Sol4R;
wxStaticText* m_ESeriesAltErr1;
wxTextCtrl* m_ESeriesError4R;
wxStaticText* m_ESeriesAltPercent1;
wxStaticLine* m_staticline7;
wxButton* m_buttonEScalculate;
wxHtmlWindow* m_panelESeriesHelp;
// Virtual event handlers, overide them in your derived class
virtual void OnESeriesSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCalculateESeries( wxCommandEvent& event ) { event.Skip(); }
public:
PANEL_E_SERIE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 677,453 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_E_SERIE_BASE();
};

View File

@ -26,192 +26,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_Notebook->AddPage( m_panelRegulators, _("Regulators"), true ); m_Notebook->AddPage( m_panelRegulators, _("Regulators"), true );
m_panelAttenuators = new PANEL_ATTENUATORS( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelAttenuators = new PANEL_ATTENUATORS( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_Notebook->AddPage( m_panelAttenuators, _("RF Attenuators"), false ); m_Notebook->AddPage( m_panelAttenuators, _("RF Attenuators"), false );
m_panelESeries = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelESeries = new PANEL_E_SERIE( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerESerie;
bSizerESerie = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bMiddleSizerESeries;
bMiddleSizerESeries = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizerESeriesInput;
sbSizerESeriesInput = new wxStaticBoxSizer( new wxStaticBox( m_panelESeries, wxID_ANY, _("Inputs") ), wxVERTICAL );
wxFlexGridSizer* fgSizerAttPrms1;
fgSizerAttPrms1 = new wxFlexGridSizer( 4, 3, 3, 0 );
fgSizerAttPrms1->AddGrowableRow( 1 );
fgSizerAttPrms1->SetFlexibleDirection( wxBOTH );
fgSizerAttPrms1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_ESrequired = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("Required resistance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESrequired->Wrap( -1 );
fgSizerAttPrms1->Add( m_ESrequired, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_ResRequired = new wxTextCtrl( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerAttPrms1->Add( m_ResRequired, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_reqResUnits = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("kOhm"), wxDefaultPosition, wxDefaultSize, 0 );
m_reqResUnits->Wrap( -1 );
fgSizerAttPrms1->Add( m_reqResUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_ESrequired1 = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("Exclude value 1:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESrequired1->Wrap( -1 );
fgSizerAttPrms1->Add( m_ESrequired1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_ResExclude1 = new wxTextCtrl( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerAttPrms1->Add( m_ResExclude1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_exclude1Units = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("kOhm"), wxDefaultPosition, wxDefaultSize, 0 );
m_exclude1Units->Wrap( -1 );
fgSizerAttPrms1->Add( m_exclude1Units, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_ESrequired11 = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("Exclude value 2:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESrequired11->Wrap( -1 );
fgSizerAttPrms1->Add( m_ESrequired11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_ResExclude2 = new wxTextCtrl( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerAttPrms1->Add( m_ResExclude2, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_exclude2Units = new wxStaticText( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("kOhm"), wxDefaultPosition, wxDefaultSize, 0 );
m_exclude2Units->Wrap( -1 );
fgSizerAttPrms1->Add( m_exclude2Units, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
sbSizerESeriesInput->Add( fgSizerAttPrms1, 0, wxEXPAND|wxBOTTOM, 5 );
m_staticline6 = new wxStaticLine( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sbSizerESeriesInput->Add( m_staticline6, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxBoxSizer* bSizer40;
bSizer40 = new wxBoxSizer( wxHORIZONTAL );
m_e1 = new wxRadioButton( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("E1"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
bSizer40->Add( m_e1, 1, wxALL, 5 );
m_e3 = new wxRadioButton( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("E3"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer40->Add( m_e3, 1, wxALL, 5 );
m_e6 = new wxRadioButton( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("E6"), wxDefaultPosition, wxDefaultSize, 0 );
m_e6->SetValue( true );
bSizer40->Add( m_e6, 1, wxALL, 5 );
m_e12 = new wxRadioButton( sbSizerESeriesInput->GetStaticBox(), wxID_ANY, _("E12"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer40->Add( m_e12, 1, wxALL, 5 );
sbSizerESeriesInput->Add( bSizer40, 1, wxEXPAND, 5 );
bMiddleSizerESeries->Add( sbSizerESeriesInput, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerESeriesSolutions;
sbSizerESeriesSolutions = new wxStaticBoxSizer( new wxStaticBox( m_panelESeries, wxID_ANY, _("Solutions") ), wxVERTICAL );
wxFlexGridSizer* fgSizerESerieResults;
fgSizerESerieResults = new wxFlexGridSizer( 6, 5, 3, 0 );
fgSizerESerieResults->AddGrowableCol( 1 );
fgSizerESerieResults->SetFlexibleDirection( wxBOTH );
fgSizerESerieResults->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_ESerieSimpleSolution = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("Simple solution:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESerieSimpleSolution->Wrap( -1 );
fgSizerESerieResults->Add( m_ESerieSimpleSolution, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeries_Sol2R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ESeries_Sol2R->SetMinSize( wxSize( 150,-1 ) );
fgSizerESerieResults->Add( m_ESeries_Sol2R, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_ESeriesSimpleErr = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("Error:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesSimpleErr->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesSimpleErr, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeriesError2R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerESerieResults->Add( m_ESeriesError2R, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_ESeriesSimplePercent = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesSimplePercent->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesSimplePercent, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_ESerie3RSolution1 = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("3R solution:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESerie3RSolution1->Wrap( -1 );
fgSizerESerieResults->Add( m_ESerie3RSolution1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeries_Sol3R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ESeries_Sol3R->SetMinSize( wxSize( 220,-1 ) );
fgSizerESerieResults->Add( m_ESeries_Sol3R, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_ESeriesAltErr = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("Error:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesAltErr->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesAltErr, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeriesError3R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerESerieResults->Add( m_ESeriesError3R, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_ESeriesAltPercent = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesAltPercent->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesAltPercent, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_ESeries4RSolution = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("4R solution:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeries4RSolution->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeries4RSolution, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeries_Sol4R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ESeries_Sol4R->SetMinSize( wxSize( 290,-1 ) );
fgSizerESerieResults->Add( m_ESeries_Sol4R, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxEXPAND, 5 );
m_ESeriesAltErr1 = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("Error:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesAltErr1->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesAltErr1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeriesError4R = new wxTextCtrl( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerESerieResults->Add( m_ESeriesError4R, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_ESeriesAltPercent1 = new wxStaticText( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_ESeriesAltPercent1->Wrap( -1 );
fgSizerESerieResults->Add( m_ESeriesAltPercent1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
sbSizerESeriesSolutions->Add( fgSizerESerieResults, 0, wxBOTTOM|wxEXPAND, 5 );
m_staticline7 = new wxStaticLine( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sbSizerESeriesSolutions->Add( m_staticline7, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_buttonEScalculate = new wxButton( sbSizerESeriesSolutions->GetStaticBox(), wxID_ANY, _("Calculate"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerESeriesSolutions->Add( m_buttonEScalculate, 0, wxALL, 5 );
bMiddleSizerESeries->Add( sbSizerESeriesSolutions, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer47;
bSizer47 = new wxBoxSizer( wxVERTICAL );
bMiddleSizerESeries->Add( bSizer47, 1, wxALIGN_BOTTOM, 5 );
bSizerESerie->Add( bMiddleSizerESeries, 0, wxEXPAND|wxTOP, 5 );
wxBoxSizer* bLowerESerie;
bLowerESerie = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbLowerSizerEseriesHelp;
sbLowerSizerEseriesHelp = new wxStaticBoxSizer( new wxStaticBox( m_panelESeries, wxID_ANY, _("Help") ), wxVERTICAL );
m_panelESeriesHelp = new wxHtmlWindow( sbLowerSizerEseriesHelp->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
sbLowerSizerEseriesHelp->Add( m_panelESeriesHelp, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bLowerESerie->Add( sbLowerSizerEseriesHelp, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerESerie->Add( bLowerESerie, 1, wxEXPAND, 5 );
m_panelESeries->SetSizer( bSizerESerie );
m_panelESeries->Layout();
bSizerESerie->Fit( m_panelESeries );
m_Notebook->AddPage( m_panelESeries, _("E-Series"), false ); m_Notebook->AddPage( m_panelESeries, _("E-Series"), false );
m_panelColorCode = new PANEL_COLOR_CODE( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelColorCode = new PANEL_COLOR_CODE( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_Notebook->AddPage( m_panelColorCode, _("Color Code"), false ); m_Notebook->AddPage( m_panelColorCode, _("Color Code"), false );
@ -695,11 +510,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) );
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) ); this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) );
m_e1->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
m_e3->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
m_e6->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
m_e12->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
m_buttonEScalculate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateESeries ), NULL, this );
m_TranslineSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSelection ), NULL, this ); m_TranslineSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSelection ), NULL, this );
m_button_EpsilonR->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineEpsilonR_Button ), NULL, this ); m_button_EpsilonR->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineEpsilonR_Button ), NULL, this );
m_button_TanD->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineTanD_Button ), NULL, this ); m_button_TanD->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineTanD_Button ), NULL, this );
@ -716,11 +526,6 @@ PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE()
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) );
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) ); this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) );
m_e1->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
m_e3->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
m_e6->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
m_e12->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
m_buttonEScalculate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateESeries ), NULL, this );
m_TranslineSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSelection ), NULL, this ); m_TranslineSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSelection ), NULL, this );
m_button_EpsilonR->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineEpsilonR_Button ), NULL, this ); m_button_EpsilonR->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineEpsilonR_Button ), NULL, this );
m_button_TanD->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineTanD_Button ), NULL, this ); m_button_TanD->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineTanD_Button ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@ class UNIT_SELECTOR_RESISTOR;
#include "panel_regulator.h" #include "panel_regulator.h"
#include "panel_attenuators.h" #include "panel_attenuators.h"
#include "panel_eserie.h"
#include "panel_color_code.h" #include "panel_color_code.h"
#include "panel_via_size.h" #include "panel_via_size.h"
#include "panel_track_width.h" #include "panel_track_width.h"
@ -33,17 +34,15 @@ class UNIT_SELECTOR_RESISTOR;
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/image.h> #include <wx/image.h>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/radiobut.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/html/htmlwin.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/statbmp.h> #include <wx/statbmp.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/statbox.h>
#include <wx/radiobut.h>
#include <wx/bmpbuttn.h> #include <wx/bmpbuttn.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/frame.h> #include <wx/frame.h>
@ -63,39 +62,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
wxNotebook* m_Notebook; wxNotebook* m_Notebook;
PANEL_REGULATOR* m_panelRegulators; PANEL_REGULATOR* m_panelRegulators;
PANEL_ATTENUATORS* m_panelAttenuators; PANEL_ATTENUATORS* m_panelAttenuators;
wxPanel* m_panelESeries; PANEL_E_SERIE* m_panelESeries;
wxStaticText* m_ESrequired;
wxTextCtrl* m_ResRequired;
wxStaticText* m_reqResUnits;
wxStaticText* m_ESrequired1;
wxTextCtrl* m_ResExclude1;
wxStaticText* m_exclude1Units;
wxStaticText* m_ESrequired11;
wxTextCtrl* m_ResExclude2;
wxStaticText* m_exclude2Units;
wxStaticLine* m_staticline6;
wxRadioButton* m_e1;
wxRadioButton* m_e3;
wxRadioButton* m_e6;
wxRadioButton* m_e12;
wxStaticText* m_ESerieSimpleSolution;
wxTextCtrl* m_ESeries_Sol2R;
wxStaticText* m_ESeriesSimpleErr;
wxTextCtrl* m_ESeriesError2R;
wxStaticText* m_ESeriesSimplePercent;
wxStaticText* m_ESerie3RSolution1;
wxTextCtrl* m_ESeries_Sol3R;
wxStaticText* m_ESeriesAltErr;
wxTextCtrl* m_ESeriesError3R;
wxStaticText* m_ESeriesAltPercent;
wxStaticText* m_ESeries4RSolution;
wxTextCtrl* m_ESeries_Sol4R;
wxStaticText* m_ESeriesAltErr1;
wxTextCtrl* m_ESeriesError4R;
wxStaticText* m_ESeriesAltPercent1;
wxStaticLine* m_staticline7;
wxButton* m_buttonEScalculate;
wxHtmlWindow* m_panelESeriesHelp;
PANEL_COLOR_CODE* m_panelColorCode; PANEL_COLOR_CODE* m_panelColorCode;
wxPanel* m_panelTransline; wxPanel* m_panelTransline;
wxRadioBox* m_TranslineSelection; wxRadioBox* m_TranslineSelection;
@ -183,8 +150,6 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnClosePcbCalc( wxCloseEvent& event ) { event.Skip(); } virtual void OnClosePcbCalc( wxCloseEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnESeriesSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCalculateESeries( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTranslineSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnTranslineSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTranslineEpsilonR_Button( wxCommandEvent& event ) { event.Skip(); } virtual void OnTranslineEpsilonR_Button( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTranslineTanD_Button( wxCommandEvent& event ) { event.Skip(); } virtual void OnTranslineTanD_Button( wxCommandEvent& event ) { event.Skip(); }

View File

@ -20,9 +20,7 @@
*/ */
#include <array> #include <array>
#include "panel_eserie.h"
#include <string_utils.h>
#include "pcb_calculator_frame.h"
extern double DoubleFromString( const wxString& TextValue ); extern double DoubleFromString( const wxString& TextValue );
@ -38,10 +36,6 @@ extern double DoubleFromString( const wxString& TextValue );
#include "eserie.h" #include "eserie.h"
wxString eseries_help =
#include "eserie_help.h"
E_SERIE r; E_SERIE r;
@ -289,7 +283,7 @@ void E_SERIE::strip4( void )
} }
void PCB_CALCULATOR_FRAME::OnCalculateESeries( wxCommandEvent& event ) void PANEL_E_SERIE::OnCalculateESeries( wxCommandEvent& event )
{ {
double reqr; // required resistor stored in local copy double reqr; // required resistor stored in local copy
double error, err3 = 0; double error, err3 = 0;
@ -382,7 +376,8 @@ void PCB_CALCULATOR_FRAME::OnCalculateESeries( wxCommandEvent& event )
m_ESeries_Sol4R->SetValue( fs ); m_ESeries_Sol4R->SetValue( fs );
} }
void PCB_CALCULATOR_FRAME::OnESeriesSelection( wxCommandEvent& event )
void PANEL_E_SERIE::OnESeriesSelection( wxCommandEvent& event )
{ {
if( event.GetEventObject() == m_e1 ) if( event.GetEventObject() == m_e1 )
r.SetSeries( E1 ); r.SetSeries( E1 );
@ -393,12 +388,3 @@ void PCB_CALCULATOR_FRAME::OnESeriesSelection( wxCommandEvent& event )
else else
r.SetSeries( E6 ); r.SetSeries( E6 );
} }
void PCB_CALCULATOR_FRAME::initESeriesPanel() // initialize ESeries tab at each pcb-calculator start
{
wxString msg;
// show markdown formula explanation in lower help panel
ConvertMarkdown2Html( wxGetTranslation( eseries_help ), msg );
m_panelESeriesHelp->SetPage( msg );
}

View File

@ -0,0 +1,66 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2011 jean-pierre.charras
* Copyright (C) 1992-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 <http://www.gnu.org/licenses/>.
*/
/* see
* http://www.desmith.net/NMdS/Electronics/TraceWidth.html
* http://www.ultracad.com/articles/pcbtemp.pdf
* for more info
*/
#include <string_utils.h>
#include "pcb_calculator_settings.h"
#include <panel_eserie.h>
//#include <widgets/unit_selector.h>
#include <i18n_utility.h> // For _HKI definition
wxString eseries_help =
#include "eserie_help.h"
PANEL_E_SERIE::PANEL_E_SERIE( wxWindow* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name ) :
PANEL_E_SERIE_BASE( parent, id, pos, size, style, name )
{
m_reqResUnits->SetLabel( wxT( "kΩ" ) );
m_exclude1Units->SetLabel( wxT( "kΩ" ) );
m_exclude2Units->SetLabel( wxT( "kΩ" ) );
}
PANEL_E_SERIE::~PANEL_E_SERIE()
{
}
void PANEL_E_SERIE::SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg )
{
}
void PANEL_E_SERIE::LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg )
{
// initialize ESeries tab at each pcb-calculator start
wxString msg;
// show markdown formula explanation in lower help panel
ConvertMarkdown2Html( wxGetTranslation( eseries_help ), msg );
m_panelESeriesHelp->SetPage( msg );
}

View File

@ -61,10 +61,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
for( int ii = 0; ii < 8; ii++ ) for( int ii = 0; ii < 8; ii++ )
m_transline_list.push_back( new TRANSLINE_IDENT( tltype_list[ii] ) ); m_transline_list.push_back( new TRANSLINE_IDENT( tltype_list[ii] ) );
m_reqResUnits->SetLabel( wxT( "kΩ" ) );
m_exclude1Units->SetLabel( wxT( "kΩ" ) );
m_exclude2Units->SetLabel( wxT( "kΩ" ) );
m_EpsilonR_label->SetLabel( wxT( "εr" ) ); m_EpsilonR_label->SetLabel( wxT( "εr" ) );
LoadSettings( config() ); LoadSettings( config() );
@ -74,8 +70,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
TranslineTypeSelection( m_currTransLineType ); TranslineTypeSelection( m_currTransLineType );
m_TranslineSelection->SetSelection( m_currTransLineType ); m_TranslineSelection->SetSelection( m_currTransLineType );
initESeriesPanel();
// Give an icon // Give an icon
wxIcon icon; wxIcon icon;
wxIconBundle icon_bundle; wxIconBundle icon_bundle;
@ -139,9 +133,6 @@ void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event )
m_panelRegulators->Layout(); m_panelRegulators->Layout();
m_panelESeriesHelp->Refresh();
//m_htmlWinFormulas->Refresh();
// Until it's shown on screen the above won't work; but doing it anyway at least keeps // 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. // putting new OnUpdateUI events into the queue until it *is* shown on screen.
if( m_Notebook->IsShownOnScreen() ) if( m_Notebook->IsShownOnScreen() )
@ -232,6 +223,7 @@ void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
m_panelTrackWidth->LoadSettings( cfg ); m_panelTrackWidth->LoadSettings( cfg );
m_panelElectricalSpacing->LoadSettings( cfg ); m_panelElectricalSpacing->LoadSettings( cfg );
m_panelBoardClass->LoadSettings( cfg ); m_panelBoardClass->LoadSettings( cfg );
m_panelESeries->LoadSettings( cfg );
} }

View File

@ -95,23 +95,6 @@ private:
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override; void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override; void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
/**
* Panel-specific initializers
*/
void initESeriesPanel();
/**
* Called on calculate button and executes all E-series calculations
*/
void OnCalculateESeries( wxCommandEvent& event ) override;
/**
* Radio Buttons to select the E-serie for the resistor calculator.
*
* @param event contains the radio button state.
*/
void OnESeriesSelection( wxCommandEvent& event ) override;
/** /**
* Called on new transmission line selection. * Called on new transmission line selection.
*/ */