pcb_calculator rework: move track width panel to its own files panel_track_width_xx

This commit is contained in:
jean-pierre charras 2021-10-04 20:01:23 +02:00
parent eb819a3b25
commit f446d23deb
11 changed files with 4271 additions and 4088 deletions

View File

@ -19,7 +19,7 @@ set( PCB_CALCULATOR_SRCS
panel_attenuators.cpp panel_attenuators.cpp
panel_regulator.cpp panel_regulator.cpp
panel_color_code.cpp panel_color_code.cpp
tracks_width_versus_current.cpp panel_track_width.cpp
panel_via_size.cpp panel_via_size.cpp
transline_ident.cpp transline_ident.cpp
widgets/unit_selector.cpp widgets/unit_selector.cpp
@ -40,6 +40,7 @@ set( PCB_CALCULATOR_SRCS
dialogs/panel_regulator_base.cpp dialogs/panel_regulator_base.cpp
dialogs/panel_color_code_base.cpp dialogs/panel_color_code_base.cpp
dialogs/panel_via_size_base.cpp dialogs/panel_via_size_base.cpp
dialogs/panel_track_width_base.cpp
../common/env_vars.cpp # needed on MSW to avoid a link issue (a symbol not found) ../common/env_vars.cpp # needed on MSW to avoid a link issue (a symbol not found)
) )

View File

@ -0,0 +1,101 @@
/*
* 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_TRACK_WIDTH_H
#define PANEL_TRACK_WIDTH_H
#include "panel_track_width_base.h"
class PCB_CALCULATOR_SETTINGS;
class PANEL_TRACK_WIDTH : public PANEL_TRACK_WIDTH_BASE
{
public:
PANEL_TRACK_WIDTH( wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_TRACK_WIDTH();
void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg );
void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg );
/**
* Update the calculations the user changes the general parameters.
*/
void OnTWParametersChanged( wxCommandEvent& event ) override;
/**
* Update the calculations when the user changes the desired maximum current.
*/
void OnTWCalculateFromCurrent( wxCommandEvent& event ) override;
/**
* Update the calculations when the user changes the desired external trace width.
*/
void OnTWCalculateFromExtWidth( wxCommandEvent& event ) override;
/**
* Update the calculations when the user changes the desired internal trace width.
*/
void OnTWCalculateFromIntWidth( wxCommandEvent& event ) override;
/**
* Update the calculations when the user clicks the reset button.
*/
void OnTWResetButtonClick( wxCommandEvent& event ) override;
/**
* Calculate track width required based on given current and temperature rise.
*/
double TWCalculateWidth( double aCurrent, double aThickness, double aDeltaT_C,
bool aUseInternalLayer );
/**
* Calculate maximum current based on given width and temperature rise.
*/
double TWCalculateCurrent( double aWidth, double aThickness, double aDeltaT_C,
bool aUseInternalLayer );
/**
* Display the results of a calculation (including resulting values such
* as the resistance and power loss).
*/
void TWDisplayValues( double aCurrent, double aExtWidth, double aIntWidth,
double aExtThickness, double aIntThickness );
/**
* Update the fields to show whether the maximum current, external trace
* width, or internal trace width is currently the controlling parameter.
*/
void TWUpdateModeDisplay();
private:
enum // Which dimension is controlling the track width / current
{ // calculations:
TW_MASTER_CURRENT, // the maximum current,
TW_MASTER_EXT_WIDTH, // the external trace width,
TW_MASTER_INT_WIDTH // or the internal trace width?
} m_TWMode;
bool m_TWNested; // Used to stop events caused by setting the answers.
};
#endif

View File

@ -0,0 +1,332 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/unit_selector.h"
#include "panel_track_width_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_TRACK_WIDTH_BASE::PANEL_TRACK_WIDTH_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizerTrackWidth;
bSizerTrackWidth = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizeLeft;
bSizeLeft = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerTW_Prms;
sbSizerTW_Prms = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Parameters") ), wxVERTICAL );
wxFlexGridSizer* fgSizerTWprms;
fgSizerTWprms = new wxFlexGridSizer( 4, 3, 0, 0 );
fgSizerTWprms->AddGrowableCol( 1 );
fgSizerTWprms->SetFlexibleDirection( wxBOTH );
fgSizerTWprms->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextCurrent = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Current:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCurrent->Wrap( -1 );
fgSizerTWprms->Add( m_staticTextCurrent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM, 5 );
m_TrackCurrentValue = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTWprms->Add( m_TrackCurrentValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText62 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("A"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText62->Wrap( -1 );
fgSizerTWprms->Add( m_staticText62, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText63 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Temperature rise:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText63->Wrap( -1 );
fgSizerTWprms->Add( m_staticText63, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM, 5 );
m_TrackDeltaTValue = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTWprms->Add( m_TrackDeltaTValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_trackTempUnits = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("deg C"), wxDefaultPosition, wxDefaultSize, 0 );
m_trackTempUnits->Wrap( -1 );
fgSizerTWprms->Add( m_trackTempUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText66 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Conductor length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText66->Wrap( -1 );
fgSizerTWprms->Add( m_staticText66, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM, 5 );
m_TrackLengthValue = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTWprms->Add( m_TrackLengthValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxArrayString m_TW_CuLength_choiceUnitChoices;
m_TW_CuLength_choiceUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_TW_CuLength_choiceUnitChoices, 0 );
m_TW_CuLength_choiceUnit->SetSelection( 0 );
fgSizerTWprms->Add( m_TW_CuLength_choiceUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
m_staticText103 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Copper resistivity:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText103->Wrap( -1 );
fgSizerTWprms->Add( m_staticText103, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM, 5 );
m_TWResistivity = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
fgSizerTWprms->Add( m_TWResistivity, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_resistivityUnits = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("ohm-meter"), wxDefaultPosition, wxDefaultSize, 0 );
m_resistivityUnits->Wrap( -1 );
fgSizerTWprms->Add( m_resistivityUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
sbSizerTW_Prms->Add( fgSizerTWprms, 0, wxEXPAND, 5 );
bSizeLeft->Add( sbSizerTW_Prms, 0, wxALL|wxEXPAND, 5 );
m_htmlWinFormulas = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_NO_SELECTION|wxHW_SCROLLBAR_AUTO );
bSizeLeft->Add( m_htmlWinFormulas, 1, wxEXPAND|wxALL, 8 );
bSizerTrackWidth->Add( bSizeLeft, 1, wxEXPAND, 5 );
wxBoxSizer* bSizeRight;
bSizeRight = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerTW_Result;
sbSizerTW_Result = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("External Layer Traces") ), wxVERTICAL );
wxFlexGridSizer* fgSizerTW_Results;
fgSizerTW_Results = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerTW_Results->AddGrowableCol( 1 );
fgSizerTW_Results->SetFlexibleDirection( wxBOTH );
fgSizerTW_Results->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextExtWidth = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Trace width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextExtWidth->Wrap( -1 );
m_staticTextExtWidth->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
fgSizerTW_Results->Add( m_staticTextExtWidth, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
m_ExtTrackWidthValue = new wxTextCtrl( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTW_Results->Add( m_ExtTrackWidthValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxArrayString m_TW_ExtTrackWidth_choiceUnitChoices;
m_TW_ExtTrackWidth_choiceUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_TW_ExtTrackWidth_choiceUnitChoices, 0 );
m_TW_ExtTrackWidth_choiceUnit->SetSelection( 0 );
fgSizerTW_Results->Add( m_TW_ExtTrackWidth_choiceUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_staticText65 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Trace thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText65->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText65, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ExtTrackThicknessValue = new wxTextCtrl( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTW_Results->Add( m_ExtTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 );
wxArrayString m_ExtTrackThicknessUnitChoices;
m_ExtTrackThicknessUnit = new UNIT_SELECTOR_THICKNESS( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ExtTrackThicknessUnitChoices, 0 );
m_ExtTrackThicknessUnit->SetSelection( 0 );
fgSizerTW_Results->Add( m_ExtTrackThicknessUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 );
m_staticline3 = new wxStaticLine( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline4 = new wxStaticLine( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results->Add( m_staticline4, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline5 = new wxStaticLine( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results->Add( m_staticline5, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticTextArea = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Cross-section area:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextArea->Wrap( -1 );
fgSizerTW_Results->Add( m_staticTextArea, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ExtTrackAreaValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExtTrackAreaValue->Wrap( -1 );
fgSizerTW_Results->Add( m_ExtTrackAreaValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_extTrackAreaUnitLabel = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("mm ^ 2"), wxDefaultPosition, wxDefaultSize, 0 );
m_extTrackAreaUnitLabel->Wrap( -1 );
fgSizerTW_Results->Add( m_extTrackAreaUnitLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText651 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Resistance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText651->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText651, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ExtTrackResistValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExtTrackResistValue->Wrap( -1 );
fgSizerTW_Results->Add( m_ExtTrackResistValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_extTrackResUnits = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("ohm"), wxDefaultPosition, wxDefaultSize, 0 );
m_extTrackResUnits->Wrap( -1 );
fgSizerTW_Results->Add( m_extTrackResUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText661 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Voltage drop:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText661->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText661, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ExtTrackVDropValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExtTrackVDropValue->Wrap( -1 );
fgSizerTW_Results->Add( m_ExtTrackVDropValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText83 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("V"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText83->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText83, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText79 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Power loss:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText79->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText79, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ExtTrackLossValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExtTrackLossValue->Wrap( -1 );
fgSizerTW_Results->Add( m_ExtTrackLossValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText791 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("W"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText791->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText791, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
sbSizerTW_Result->Add( fgSizerTW_Results, 0, wxEXPAND, 5 );
bSizeRight->Add( sbSizerTW_Result, 1, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizerTW_Result1;
sbSizerTW_Result1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Internal Layer Traces") ), wxVERTICAL );
wxFlexGridSizer* fgSizerTW_Results1;
fgSizerTW_Results1 = new wxFlexGridSizer( 7, 3, 0, 0 );
fgSizerTW_Results1->AddGrowableCol( 1 );
fgSizerTW_Results1->SetFlexibleDirection( wxBOTH );
fgSizerTW_Results1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextIntWidth = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Trace width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextIntWidth->Wrap( -1 );
m_staticTextIntWidth->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
fgSizerTW_Results1->Add( m_staticTextIntWidth, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
m_IntTrackWidthValue = new wxTextCtrl( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTW_Results1->Add( m_IntTrackWidthValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxArrayString m_TW_IntTrackWidth_choiceUnitChoices;
m_TW_IntTrackWidth_choiceUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_TW_IntTrackWidth_choiceUnitChoices, 0 );
m_TW_IntTrackWidth_choiceUnit->SetSelection( 0 );
fgSizerTW_Results1->Add( m_TW_IntTrackWidth_choiceUnit, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_staticText652 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Trace thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText652->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText652, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_IntTrackThicknessValue = new wxTextCtrl( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTW_Results1->Add( m_IntTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
wxArrayString m_IntTrackThicknessUnitChoices;
m_IntTrackThicknessUnit = new UNIT_SELECTOR_THICKNESS( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_IntTrackThicknessUnitChoices, 0 );
m_IntTrackThicknessUnit->SetSelection( 0 );
fgSizerTW_Results1->Add( m_IntTrackThicknessUnit, 0, wxALL, 5 );
m_staticline8 = new wxStaticLine( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results1->Add( m_staticline8, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline9 = new wxStaticLine( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results1->Add( m_staticline9, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline10 = new wxStaticLine( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results1->Add( m_staticline10, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticTextArea1 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Cross-section area:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextArea1->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticTextArea1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_IntTrackAreaValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_IntTrackAreaValue->Wrap( -1 );
fgSizerTW_Results1->Add( m_IntTrackAreaValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 );
m_intTrackAreaUnitLabel = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("mm ^ 2"), wxDefaultPosition, wxDefaultSize, 0 );
m_intTrackAreaUnitLabel->Wrap( -1 );
fgSizerTW_Results1->Add( m_intTrackAreaUnitLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText6511 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Resistance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6511->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText6511, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_IntTrackResistValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_IntTrackResistValue->Wrap( -1 );
fgSizerTW_Results1->Add( m_IntTrackResistValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_intTrackResUnits = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("ohm"), wxDefaultPosition, wxDefaultSize, 0 );
m_intTrackResUnits->Wrap( -1 );
fgSizerTW_Results1->Add( m_intTrackResUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText6611 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Voltage drop:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6611->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText6611, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_IntTrackVDropValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_IntTrackVDropValue->Wrap( -1 );
fgSizerTW_Results1->Add( m_IntTrackVDropValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText831 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("V"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText831->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText831, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText792 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Power loss:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText792->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText792, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_IntTrackLossValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_IntTrackLossValue->Wrap( -1 );
fgSizerTW_Results1->Add( m_IntTrackLossValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText7911 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("W"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7911->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText7911, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
sbSizerTW_Result1->Add( fgSizerTW_Results1, 0, wxEXPAND, 5 );
bSizeRight->Add( sbSizerTW_Result1, 1, wxEXPAND|wxALL, 5 );
m_buttonTrackWidthReset = new wxButton( this, wxID_ANY, _("Reset to Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
bSizeRight->Add( m_buttonTrackWidthReset, 0, wxALIGN_RIGHT|wxALL, 5 );
bSizerTrackWidth->Add( bSizeRight, 0, wxEXPAND, 5 );
this->SetSizer( bSizerTrackWidth );
this->Layout();
// Connect Events
m_TrackCurrentValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWCalculateFromCurrent ), NULL, this );
m_TrackDeltaTValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_TrackLengthValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_TW_CuLength_choiceUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_TWResistivity->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackWidthValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWCalculateFromExtWidth ), NULL, this );
m_TW_ExtTrackWidth_choiceUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackThicknessValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackThicknessUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackWidthValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWCalculateFromIntWidth ), NULL, this );
m_TW_IntTrackWidth_choiceUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackThicknessValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackThicknessUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_buttonTrackWidthReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWResetButtonClick ), NULL, this );
}
PANEL_TRACK_WIDTH_BASE::~PANEL_TRACK_WIDTH_BASE()
{
// Disconnect Events
m_TrackCurrentValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWCalculateFromCurrent ), NULL, this );
m_TrackDeltaTValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_TrackLengthValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_TW_CuLength_choiceUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_TWResistivity->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackWidthValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWCalculateFromExtWidth ), NULL, this );
m_TW_ExtTrackWidth_choiceUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackThicknessValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackThicknessUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackWidthValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWCalculateFromIntWidth ), NULL, this );
m_TW_IntTrackWidth_choiceUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackThicknessValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackThicknessUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWParametersChanged ), NULL, this );
m_buttonTrackWidthReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_TRACK_WIDTH_BASE::OnTWResetButtonClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,116 @@
///////////////////////////////////////////////////////////////////////////
// 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>
class UNIT_SELECTOR_LEN;
class UNIT_SELECTOR_THICKNESS;
#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/choice.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/html/htmlwin.h>
#include <wx/statline.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_TRACK_WIDTH_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_TRACK_WIDTH_BASE : public wxPanel
{
private:
protected:
wxStaticText* m_staticTextCurrent;
wxTextCtrl* m_TrackCurrentValue;
wxStaticText* m_staticText62;
wxStaticText* m_staticText63;
wxTextCtrl* m_TrackDeltaTValue;
wxStaticText* m_trackTempUnits;
wxStaticText* m_staticText66;
wxTextCtrl* m_TrackLengthValue;
UNIT_SELECTOR_LEN* m_TW_CuLength_choiceUnit;
wxStaticText* m_staticText103;
wxTextCtrl* m_TWResistivity;
wxStaticText* m_resistivityUnits;
wxHtmlWindow* m_htmlWinFormulas;
wxStaticText* m_staticTextExtWidth;
wxTextCtrl* m_ExtTrackWidthValue;
UNIT_SELECTOR_LEN* m_TW_ExtTrackWidth_choiceUnit;
wxStaticText* m_staticText65;
wxTextCtrl* m_ExtTrackThicknessValue;
UNIT_SELECTOR_THICKNESS* m_ExtTrackThicknessUnit;
wxStaticLine* m_staticline3;
wxStaticLine* m_staticline4;
wxStaticLine* m_staticline5;
wxStaticText* m_staticTextArea;
wxStaticText* m_ExtTrackAreaValue;
wxStaticText* m_extTrackAreaUnitLabel;
wxStaticText* m_staticText651;
wxStaticText* m_ExtTrackResistValue;
wxStaticText* m_extTrackResUnits;
wxStaticText* m_staticText661;
wxStaticText* m_ExtTrackVDropValue;
wxStaticText* m_staticText83;
wxStaticText* m_staticText79;
wxStaticText* m_ExtTrackLossValue;
wxStaticText* m_staticText791;
wxStaticText* m_staticTextIntWidth;
wxTextCtrl* m_IntTrackWidthValue;
UNIT_SELECTOR_LEN* m_TW_IntTrackWidth_choiceUnit;
wxStaticText* m_staticText652;
wxTextCtrl* m_IntTrackThicknessValue;
UNIT_SELECTOR_THICKNESS* m_IntTrackThicknessUnit;
wxStaticLine* m_staticline8;
wxStaticLine* m_staticline9;
wxStaticLine* m_staticline10;
wxStaticText* m_staticTextArea1;
wxStaticText* m_IntTrackAreaValue;
wxStaticText* m_intTrackAreaUnitLabel;
wxStaticText* m_staticText6511;
wxStaticText* m_IntTrackResistValue;
wxStaticText* m_intTrackResUnits;
wxStaticText* m_staticText6611;
wxStaticText* m_IntTrackVDropValue;
wxStaticText* m_staticText831;
wxStaticText* m_staticText792;
wxStaticText* m_IntTrackLossValue;
wxStaticText* m_staticText7911;
wxButton* m_buttonTrackWidthReset;
// Virtual event handlers, overide them in your derived class
virtual void OnTWCalculateFromCurrent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTWParametersChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTWCalculateFromExtWidth( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTWCalculateFromIntWidth( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTWResetButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
PANEL_TRACK_WIDTH_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 623,457 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_TRACK_WIDTH_BASE();
};

View File

@ -676,288 +676,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_Notebook->AddPage( m_panelTransline, _("TransLine"), false ); m_Notebook->AddPage( m_panelTransline, _("TransLine"), false );
m_panelViaSize = new PANEL_VIA_SIZE( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelViaSize = new PANEL_VIA_SIZE( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_Notebook->AddPage( m_panelViaSize, _("Via Size"), false ); m_Notebook->AddPage( m_panelViaSize, _("Via Size"), false );
m_panelTrackWidth = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelTrackWidth = new PANEL_TRACK_WIDTH( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerTrackWidth;
bSizerTrackWidth = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizeLeft;
bSizeLeft = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerTW_Prms;
sbSizerTW_Prms = new wxStaticBoxSizer( new wxStaticBox( m_panelTrackWidth, wxID_ANY, _("Parameters") ), wxVERTICAL );
wxFlexGridSizer* fgSizerTWprms;
fgSizerTWprms = new wxFlexGridSizer( 4, 3, 0, 0 );
fgSizerTWprms->AddGrowableCol( 1 );
fgSizerTWprms->SetFlexibleDirection( wxBOTH );
fgSizerTWprms->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextCurrent = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Current:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCurrent->Wrap( -1 );
fgSizerTWprms->Add( m_staticTextCurrent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM, 5 );
m_TrackCurrentValue = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTWprms->Add( m_TrackCurrentValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText62 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("A"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText62->Wrap( -1 );
fgSizerTWprms->Add( m_staticText62, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText63 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Temperature rise:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText63->Wrap( -1 );
fgSizerTWprms->Add( m_staticText63, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM, 5 );
m_TrackDeltaTValue = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTWprms->Add( m_TrackDeltaTValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_trackTempUnits = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("deg C"), wxDefaultPosition, wxDefaultSize, 0 );
m_trackTempUnits->Wrap( -1 );
fgSizerTWprms->Add( m_trackTempUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText66 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Conductor length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText66->Wrap( -1 );
fgSizerTWprms->Add( m_staticText66, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM, 5 );
m_TrackLengthValue = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTWprms->Add( m_TrackLengthValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxArrayString m_TW_CuLength_choiceUnitChoices;
m_TW_CuLength_choiceUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_TW_CuLength_choiceUnitChoices, 0 );
m_TW_CuLength_choiceUnit->SetSelection( 0 );
fgSizerTWprms->Add( m_TW_CuLength_choiceUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
m_staticText103 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Copper resistivity:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText103->Wrap( -1 );
fgSizerTWprms->Add( m_staticText103, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM, 5 );
m_TWResistivity = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
fgSizerTWprms->Add( m_TWResistivity, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_resistivityUnits = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("ohm-meter"), wxDefaultPosition, wxDefaultSize, 0 );
m_resistivityUnits->Wrap( -1 );
fgSizerTWprms->Add( m_resistivityUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
sbSizerTW_Prms->Add( fgSizerTWprms, 0, wxEXPAND, 5 );
bSizeLeft->Add( sbSizerTW_Prms, 0, wxALL|wxEXPAND, 5 );
m_htmlWinFormulas = new wxHtmlWindow( m_panelTrackWidth, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_NO_SELECTION|wxHW_SCROLLBAR_AUTO );
bSizeLeft->Add( m_htmlWinFormulas, 1, wxEXPAND|wxALL, 8 );
bSizerTrackWidth->Add( bSizeLeft, 1, wxEXPAND, 5 );
wxBoxSizer* bSizeRight;
bSizeRight = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerTW_Result;
sbSizerTW_Result = new wxStaticBoxSizer( new wxStaticBox( m_panelTrackWidth, wxID_ANY, _("External Layer Traces") ), wxVERTICAL );
wxFlexGridSizer* fgSizerTW_Results;
fgSizerTW_Results = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerTW_Results->AddGrowableCol( 1 );
fgSizerTW_Results->SetFlexibleDirection( wxBOTH );
fgSizerTW_Results->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextExtWidth = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Trace width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextExtWidth->Wrap( -1 );
m_staticTextExtWidth->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
fgSizerTW_Results->Add( m_staticTextExtWidth, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
m_ExtTrackWidthValue = new wxTextCtrl( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTW_Results->Add( m_ExtTrackWidthValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxArrayString m_TW_ExtTrackWidth_choiceUnitChoices;
m_TW_ExtTrackWidth_choiceUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_TW_ExtTrackWidth_choiceUnitChoices, 0 );
m_TW_ExtTrackWidth_choiceUnit->SetSelection( 0 );
fgSizerTW_Results->Add( m_TW_ExtTrackWidth_choiceUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_staticText65 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Trace thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText65->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText65, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ExtTrackThicknessValue = new wxTextCtrl( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTW_Results->Add( m_ExtTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 );
wxArrayString m_ExtTrackThicknessUnitChoices;
m_ExtTrackThicknessUnit = new UNIT_SELECTOR_THICKNESS( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ExtTrackThicknessUnitChoices, 0 );
m_ExtTrackThicknessUnit->SetSelection( 0 );
fgSizerTW_Results->Add( m_ExtTrackThicknessUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 );
m_staticline3 = new wxStaticLine( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline4 = new wxStaticLine( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results->Add( m_staticline4, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline5 = new wxStaticLine( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results->Add( m_staticline5, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticTextArea = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Cross-section area:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextArea->Wrap( -1 );
fgSizerTW_Results->Add( m_staticTextArea, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ExtTrackAreaValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExtTrackAreaValue->Wrap( -1 );
fgSizerTW_Results->Add( m_ExtTrackAreaValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_extTrackAreaUnitLabel = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("mm ^ 2"), wxDefaultPosition, wxDefaultSize, 0 );
m_extTrackAreaUnitLabel->Wrap( -1 );
fgSizerTW_Results->Add( m_extTrackAreaUnitLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText651 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Resistance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText651->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText651, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ExtTrackResistValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExtTrackResistValue->Wrap( -1 );
fgSizerTW_Results->Add( m_ExtTrackResistValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_extTrackResUnits = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("ohm"), wxDefaultPosition, wxDefaultSize, 0 );
m_extTrackResUnits->Wrap( -1 );
fgSizerTW_Results->Add( m_extTrackResUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText661 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Voltage drop:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText661->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText661, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ExtTrackVDropValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExtTrackVDropValue->Wrap( -1 );
fgSizerTW_Results->Add( m_ExtTrackVDropValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText83 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("V"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText83->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText83, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText79 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Power loss:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText79->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText79, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ExtTrackLossValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExtTrackLossValue->Wrap( -1 );
fgSizerTW_Results->Add( m_ExtTrackLossValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText791 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("W"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText791->Wrap( -1 );
fgSizerTW_Results->Add( m_staticText791, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
sbSizerTW_Result->Add( fgSizerTW_Results, 0, wxEXPAND, 5 );
bSizeRight->Add( sbSizerTW_Result, 1, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizerTW_Result1;
sbSizerTW_Result1 = new wxStaticBoxSizer( new wxStaticBox( m_panelTrackWidth, wxID_ANY, _("Internal Layer Traces") ), wxVERTICAL );
wxFlexGridSizer* fgSizerTW_Results1;
fgSizerTW_Results1 = new wxFlexGridSizer( 7, 3, 0, 0 );
fgSizerTW_Results1->AddGrowableCol( 1 );
fgSizerTW_Results1->SetFlexibleDirection( wxBOTH );
fgSizerTW_Results1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextIntWidth = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Trace width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextIntWidth->Wrap( -1 );
m_staticTextIntWidth->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
fgSizerTW_Results1->Add( m_staticTextIntWidth, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
m_IntTrackWidthValue = new wxTextCtrl( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTW_Results1->Add( m_IntTrackWidthValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxArrayString m_TW_IntTrackWidth_choiceUnitChoices;
m_TW_IntTrackWidth_choiceUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_TW_IntTrackWidth_choiceUnitChoices, 0 );
m_TW_IntTrackWidth_choiceUnit->SetSelection( 0 );
fgSizerTW_Results1->Add( m_TW_IntTrackWidth_choiceUnit, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_staticText652 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Trace thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText652->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText652, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_IntTrackThicknessValue = new wxTextCtrl( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerTW_Results1->Add( m_IntTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
wxArrayString m_IntTrackThicknessUnitChoices;
m_IntTrackThicknessUnit = new UNIT_SELECTOR_THICKNESS( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_IntTrackThicknessUnitChoices, 0 );
m_IntTrackThicknessUnit->SetSelection( 0 );
fgSizerTW_Results1->Add( m_IntTrackThicknessUnit, 0, wxALL, 5 );
m_staticline8 = new wxStaticLine( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results1->Add( m_staticline8, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline9 = new wxStaticLine( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results1->Add( m_staticline9, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline10 = new wxStaticLine( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results1->Add( m_staticline10, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticTextArea1 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Cross-section area:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextArea1->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticTextArea1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_IntTrackAreaValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_IntTrackAreaValue->Wrap( -1 );
fgSizerTW_Results1->Add( m_IntTrackAreaValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 );
m_intTrackAreaUnitLabel = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("mm ^ 2"), wxDefaultPosition, wxDefaultSize, 0 );
m_intTrackAreaUnitLabel->Wrap( -1 );
fgSizerTW_Results1->Add( m_intTrackAreaUnitLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText6511 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Resistance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6511->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText6511, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_IntTrackResistValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_IntTrackResistValue->Wrap( -1 );
fgSizerTW_Results1->Add( m_IntTrackResistValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_intTrackResUnits = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("ohm"), wxDefaultPosition, wxDefaultSize, 0 );
m_intTrackResUnits->Wrap( -1 );
fgSizerTW_Results1->Add( m_intTrackResUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText6611 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Voltage drop:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6611->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText6611, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_IntTrackVDropValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_IntTrackVDropValue->Wrap( -1 );
fgSizerTW_Results1->Add( m_IntTrackVDropValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText831 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("V"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText831->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText831, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText792 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Power loss:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText792->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText792, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_IntTrackLossValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_IntTrackLossValue->Wrap( -1 );
fgSizerTW_Results1->Add( m_IntTrackLossValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText7911 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("W"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7911->Wrap( -1 );
fgSizerTW_Results1->Add( m_staticText7911, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
sbSizerTW_Result1->Add( fgSizerTW_Results1, 0, wxEXPAND, 5 );
bSizeRight->Add( sbSizerTW_Result1, 1, wxEXPAND|wxALL, 5 );
m_buttonTrackWidthReset = new wxButton( m_panelTrackWidth, wxID_ANY, _("Reset to Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
bSizeRight->Add( m_buttonTrackWidthReset, 0, wxALIGN_RIGHT|wxALL, 5 );
bSizerTrackWidth->Add( bSizeRight, 0, wxEXPAND, 5 );
m_panelTrackWidth->SetSizer( bSizerTrackWidth );
m_panelTrackWidth->Layout();
bSizerTrackWidth->Fit( m_panelTrackWidth );
m_Notebook->AddPage( m_panelTrackWidth, _("Track Width"), false ); m_Notebook->AddPage( m_panelTrackWidth, _("Track Width"), false );
m_panelElectricalSpacing = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelElectricalSpacing = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerElectricalClearance; wxBoxSizer* bSizerElectricalClearance;
@ -1179,20 +898,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_SynthetizeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this ); m_SynthetizeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this );
m_bpButtonSynthetize->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this ); m_bpButtonSynthetize->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this );
m_buttonTransLineReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTransLineResetButtonClick ), NULL, this ); m_buttonTransLineReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTransLineResetButtonClick ), NULL, this );
m_TrackCurrentValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWCalculateFromCurrent ), NULL, this );
m_TrackDeltaTValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_TrackLengthValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_TW_CuLength_choiceUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_TWResistivity->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackWidthValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWCalculateFromExtWidth ), NULL, this );
m_TW_ExtTrackWidth_choiceUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackThicknessValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackThicknessUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackWidthValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWCalculateFromIntWidth ), NULL, this );
m_TW_IntTrackWidth_choiceUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackThicknessValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackThicknessUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_buttonTrackWidthReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWResetButtonClick ), NULL, this );
m_ElectricalSpacingUnitsSelector->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingUnitsSelection ), NULL, this ); m_ElectricalSpacingUnitsSelector->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingUnitsSelection ), NULL, this );
m_buttonElectSpacingRefresh->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingRefresh ), NULL, this ); m_buttonElectSpacingRefresh->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingRefresh ), NULL, this );
m_BoardClassesUnitsSelector->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnBoardClassesUnitsSelection ), NULL, this ); m_BoardClassesUnitsSelector->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnBoardClassesUnitsSelection ), NULL, this );
@ -1217,20 +922,6 @@ PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE()
m_SynthetizeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this ); m_SynthetizeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this );
m_bpButtonSynthetize->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this ); m_bpButtonSynthetize->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this );
m_buttonTransLineReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTransLineResetButtonClick ), NULL, this ); m_buttonTransLineReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTransLineResetButtonClick ), NULL, this );
m_TrackCurrentValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWCalculateFromCurrent ), NULL, this );
m_TrackDeltaTValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_TrackLengthValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_TW_CuLength_choiceUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_TWResistivity->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackWidthValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWCalculateFromExtWidth ), NULL, this );
m_TW_ExtTrackWidth_choiceUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackThicknessValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_ExtTrackThicknessUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackWidthValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWCalculateFromIntWidth ), NULL, this );
m_TW_IntTrackWidth_choiceUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackThicknessValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_IntTrackThicknessUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this );
m_buttonTrackWidthReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWResetButtonClick ), NULL, this );
m_ElectricalSpacingUnitsSelector->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingUnitsSelection ), NULL, this ); m_ElectricalSpacingUnitsSelector->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingUnitsSelection ), NULL, this );
m_buttonElectSpacingRefresh->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingRefresh ), NULL, this ); m_buttonElectSpacingRefresh->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingRefresh ), NULL, this );
m_BoardClassesUnitsSelector->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnBoardClassesUnitsSelection ), NULL, this ); m_BoardClassesUnitsSelector->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnBoardClassesUnitsSelection ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -14,12 +14,12 @@ class UNIT_SELECTOR_ANGLE;
class UNIT_SELECTOR_FREQUENCY; class UNIT_SELECTOR_FREQUENCY;
class UNIT_SELECTOR_LEN; class UNIT_SELECTOR_LEN;
class UNIT_SELECTOR_RESISTOR; class UNIT_SELECTOR_RESISTOR;
class UNIT_SELECTOR_THICKNESS;
#include "panel_regulator.h" #include "panel_regulator.h"
#include "panel_attenuators.h" #include "panel_attenuators.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 "kiway_player.h" #include "kiway_player.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/menu.h> #include <wx/menu.h>
@ -175,63 +175,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
wxStaticText* m_Message8; wxStaticText* m_Message8;
wxButton* m_buttonTransLineReset; wxButton* m_buttonTransLineReset;
PANEL_VIA_SIZE* m_panelViaSize; PANEL_VIA_SIZE* m_panelViaSize;
wxPanel* m_panelTrackWidth; PANEL_TRACK_WIDTH* m_panelTrackWidth;
wxStaticText* m_staticTextCurrent;
wxTextCtrl* m_TrackCurrentValue;
wxStaticText* m_staticText62;
wxStaticText* m_staticText63;
wxTextCtrl* m_TrackDeltaTValue;
wxStaticText* m_trackTempUnits;
wxStaticText* m_staticText66;
wxTextCtrl* m_TrackLengthValue;
UNIT_SELECTOR_LEN* m_TW_CuLength_choiceUnit;
wxStaticText* m_staticText103;
wxTextCtrl* m_TWResistivity;
wxStaticText* m_resistivityUnits;
wxHtmlWindow* m_htmlWinFormulas;
wxStaticText* m_staticTextExtWidth;
wxTextCtrl* m_ExtTrackWidthValue;
UNIT_SELECTOR_LEN* m_TW_ExtTrackWidth_choiceUnit;
wxStaticText* m_staticText65;
wxTextCtrl* m_ExtTrackThicknessValue;
UNIT_SELECTOR_THICKNESS* m_ExtTrackThicknessUnit;
wxStaticLine* m_staticline3;
wxStaticLine* m_staticline4;
wxStaticLine* m_staticline5;
wxStaticText* m_staticTextArea;
wxStaticText* m_ExtTrackAreaValue;
wxStaticText* m_extTrackAreaUnitLabel;
wxStaticText* m_staticText651;
wxStaticText* m_ExtTrackResistValue;
wxStaticText* m_extTrackResUnits;
wxStaticText* m_staticText661;
wxStaticText* m_ExtTrackVDropValue;
wxStaticText* m_staticText83;
wxStaticText* m_staticText79;
wxStaticText* m_ExtTrackLossValue;
wxStaticText* m_staticText791;
wxStaticText* m_staticTextIntWidth;
wxTextCtrl* m_IntTrackWidthValue;
UNIT_SELECTOR_LEN* m_TW_IntTrackWidth_choiceUnit;
wxStaticText* m_staticText652;
wxTextCtrl* m_IntTrackThicknessValue;
UNIT_SELECTOR_THICKNESS* m_IntTrackThicknessUnit;
wxStaticLine* m_staticline8;
wxStaticLine* m_staticline9;
wxStaticLine* m_staticline10;
wxStaticText* m_staticTextArea1;
wxStaticText* m_IntTrackAreaValue;
wxStaticText* m_intTrackAreaUnitLabel;
wxStaticText* m_staticText6511;
wxStaticText* m_IntTrackResistValue;
wxStaticText* m_intTrackResUnits;
wxStaticText* m_staticText6611;
wxStaticText* m_IntTrackVDropValue;
wxStaticText* m_staticText831;
wxStaticText* m_staticText792;
wxStaticText* m_IntTrackLossValue;
wxStaticText* m_staticText7911;
wxButton* m_buttonTrackWidthReset;
wxPanel* m_panelElectricalSpacing; wxPanel* m_panelElectricalSpacing;
UNIT_SELECTOR_LEN* m_ElectricalSpacingUnitsSelector; UNIT_SELECTOR_LEN* m_ElectricalSpacingUnitsSelector;
wxStaticLine* m_staticline2; wxStaticLine* m_staticline2;
@ -260,11 +204,6 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
virtual void OnTranslineAnalyse( wxCommandEvent& event ) { event.Skip(); } virtual void OnTranslineAnalyse( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTranslineSynthetize( wxCommandEvent& event ) { event.Skip(); } virtual void OnTranslineSynthetize( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTransLineResetButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnTransLineResetButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTWCalculateFromCurrent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTWParametersChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTWCalculateFromExtWidth( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTWCalculateFromIntWidth( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTWResetButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnElectricalSpacingUnitsSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnElectricalSpacingUnitsSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnElectricalSpacingRefresh( wxCommandEvent& event ) { event.Skip(); } virtual void OnElectricalSpacingRefresh( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBoardClassesUnitsSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnBoardClassesUnitsSelection( wxCommandEvent& event ) { event.Skip(); }

View File

@ -29,11 +29,13 @@
#include <kiface_base.h> #include <kiface_base.h>
#include <string_utils.h> #include <string_utils.h>
#include "class_regulator_data.h" //#include "pcb_calculator_frame.h"
#include "pcb_calculator_frame.h"
#include "pcb_calculator_settings.h" #include "pcb_calculator_settings.h"
#include "units_scales.h" #include "units_scales.h"
#include <panel_track_width.h>
#include <widgets/unit_selector.h>
#include <i18n_utility.h> // For _HKI definition
wxString tracks_width_versus_current_formula = wxString tracks_width_versus_current_formula =
#include "tracks_width_versus_current_formula.h" #include "tracks_width_versus_current_formula.h"
@ -42,28 +44,47 @@ extern double DoubleFromString( const wxString& TextValue );
// The IPC2221 formula used to calculate track width is valid only for copper material // The IPC2221 formula used to calculate track width is valid only for copper material
const double copper_resistivity = 1.72e-8; const double copper_resistivity = 1.72e-8;
void PCB_CALCULATOR_FRAME::writeTrackWidthConfig()
{
// Save current parameters values in config.
auto cfg = static_cast<PCB_CALCULATOR_SETTINGS*>( Kiface().KifaceSettings() );
cfg->m_TrackWidth.current = m_TrackCurrentValue->GetValue(); PANEL_TRACK_WIDTH::PANEL_TRACK_WIDTH( wxWindow* parent, wxWindowID id,
cfg->m_TrackWidth.delta_tc = m_TrackDeltaTValue->GetValue(); const wxPoint& pos, const wxSize& size,
cfg->m_TrackWidth.track_len = m_TrackLengthValue->GetValue(); long style, const wxString& name ) :
cfg->m_TrackWidth.track_len_units = m_TW_CuLength_choiceUnit->GetSelection(); PANEL_TRACK_WIDTH_BASE( parent, id, pos, size, style, name )
cfg->m_TrackWidth.resistivity = m_TWResistivity->GetValue(); {
cfg->m_TrackWidth.ext_track_width = m_ExtTrackWidthValue->GetValue(); m_trackTempUnits->SetLabel( wxT( "°C" ) );
cfg->m_TrackWidth.ext_track_width_units = m_TW_ExtTrackWidth_choiceUnit->GetSelection(); m_resistivityUnits->SetLabel( wxT( "Ω•m" ) );
cfg->m_TrackWidth.ext_track_thickness = m_ExtTrackThicknessValue->GetValue();
cfg->m_TrackWidth.ext_track_thickness_units = m_ExtTrackThicknessUnit->GetSelection(); m_extTrackResUnits->SetLabel( wxT( "" ) );
cfg->m_TrackWidth.int_track_width = m_IntTrackWidthValue->GetValue(); m_intTrackResUnits->SetLabel( wxT( "" ) );
cfg->m_TrackWidth.int_track_width_units = m_TW_IntTrackWidth_choiceUnit->GetSelection();
cfg->m_TrackWidth.int_track_thickness = m_IntTrackThicknessValue->GetValue(); m_TWMode = TW_MASTER_CURRENT;
cfg->m_TrackWidth.int_track_thickness_units = m_IntTrackThicknessUnit->GetSelection(); m_TWNested = false;
} }
void PCB_CALCULATOR_FRAME::OnTWParametersChanged( wxCommandEvent& event ) PANEL_TRACK_WIDTH::~PANEL_TRACK_WIDTH()
{
}
void PANEL_TRACK_WIDTH::SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg )
{
aCfg->m_TrackWidth.current = m_TrackCurrentValue->GetValue();
aCfg->m_TrackWidth.delta_tc = m_TrackDeltaTValue->GetValue();
aCfg->m_TrackWidth.track_len = m_TrackLengthValue->GetValue();
aCfg->m_TrackWidth.track_len_units = m_TW_CuLength_choiceUnit->GetSelection();
aCfg->m_TrackWidth.resistivity = m_TWResistivity->GetValue();
aCfg->m_TrackWidth.ext_track_width = m_ExtTrackWidthValue->GetValue();
aCfg->m_TrackWidth.ext_track_width_units = m_TW_ExtTrackWidth_choiceUnit->GetSelection();
aCfg->m_TrackWidth.ext_track_thickness = m_ExtTrackThicknessValue->GetValue();
aCfg->m_TrackWidth.ext_track_thickness_units = m_ExtTrackThicknessUnit->GetSelection();
aCfg->m_TrackWidth.int_track_width = m_IntTrackWidthValue->GetValue();
aCfg->m_TrackWidth.int_track_width_units = m_TW_IntTrackWidth_choiceUnit->GetSelection();
aCfg->m_TrackWidth.int_track_thickness = m_IntTrackThicknessValue->GetValue();
aCfg->m_TrackWidth.int_track_thickness_units = m_IntTrackThicknessUnit->GetSelection();
}
void PANEL_TRACK_WIDTH::OnTWParametersChanged( wxCommandEvent& event )
{ {
switch(m_TWMode) switch(m_TWMode)
{ {
@ -80,7 +101,7 @@ void PCB_CALCULATOR_FRAME::OnTWParametersChanged( wxCommandEvent& event )
} }
void PCB_CALCULATOR_FRAME::OnTWCalculateFromCurrent( wxCommandEvent& event ) void PANEL_TRACK_WIDTH::OnTWCalculateFromCurrent( wxCommandEvent& event )
{ {
// Setting the calculated values generates further events. Stop them. // Setting the calculated values generates further events. Stop them.
if( m_TWNested ) if( m_TWNested )
@ -120,7 +141,7 @@ void PCB_CALCULATOR_FRAME::OnTWCalculateFromCurrent( wxCommandEvent& event )
} }
void PCB_CALCULATOR_FRAME::OnTWCalculateFromExtWidth( wxCommandEvent& event ) void PANEL_TRACK_WIDTH::OnTWCalculateFromExtWidth( wxCommandEvent& event )
{ {
// Setting the calculated values generates further events. Stop them. // Setting the calculated values generates further events. Stop them.
if( m_TWNested ) if( m_TWNested )
@ -164,7 +185,7 @@ void PCB_CALCULATOR_FRAME::OnTWCalculateFromExtWidth( wxCommandEvent& event )
} }
void PCB_CALCULATOR_FRAME::OnTWCalculateFromIntWidth( wxCommandEvent& event ) void PANEL_TRACK_WIDTH::OnTWCalculateFromIntWidth( wxCommandEvent& event )
{ {
// Setting the calculated values generates further events. Stop them. // Setting the calculated values generates further events. Stop them.
if( m_TWNested ) if( m_TWNested )
@ -209,26 +230,30 @@ void PCB_CALCULATOR_FRAME::OnTWCalculateFromIntWidth( wxCommandEvent& event )
} }
void PCB_CALCULATOR_FRAME::OnTWResetButtonClick( wxCommandEvent& event ) void PANEL_TRACK_WIDTH::OnTWResetButtonClick( wxCommandEvent& event )
{ {
// a wxString:Format( "%g", xx) is used to use local separator in floats // Note: a wxString:Format( "%g", xx) is used to use local separator in floats
// Init main parameters:
m_TrackCurrentValue->SetValue( wxString::Format( "%g", 1.0 ) ); m_TrackCurrentValue->SetValue( wxString::Format( "%g", 1.0 ) );
m_TrackDeltaTValue->SetValue( wxString::Format( "%g", 10.0 ) ); m_TrackDeltaTValue->SetValue( wxString::Format( "%g", 10.0 ) );
m_TrackLengthValue->SetValue( wxString::Format( "%g", 20.0 ) ); m_TrackLengthValue->SetValue( wxString::Format( "%g", 20.0 ) );
m_TW_CuLength_choiceUnit->SetSelection( 0 ); m_TW_CuLength_choiceUnit->SetSelection( 0 );
m_TWResistivity->SetValue( wxString::Format( "%g", copper_resistivity ) ); m_TWResistivity->SetValue( wxString::Format( "%g", copper_resistivity ) );
m_ExtTrackWidthValue->SetValue( wxString::Format( "%g", 0.2 ) );
// m_ExtTrackWidthValue is not reinitialized: it will be calculated from previous parameters
m_TW_ExtTrackWidth_choiceUnit->SetSelection( 0 ); m_TW_ExtTrackWidth_choiceUnit->SetSelection( 0 );
m_ExtTrackThicknessValue->SetValue( wxString::Format( "%g", 0.035 ) ); m_ExtTrackThicknessValue->SetValue( wxString::Format( "%g", 0.035 ) );
m_ExtTrackThicknessUnit->SetSelection( 0 ); m_ExtTrackThicknessUnit->SetSelection( 0 );
m_IntTrackWidthValue->SetValue( wxString::Format( "%g", 0.2 ) );
// m_IntTrackWidthValue is not reinitialized: it will be calculated from previous parameters
m_TW_IntTrackWidth_choiceUnit->SetSelection( 0 ); m_TW_IntTrackWidth_choiceUnit->SetSelection( 0 );
m_IntTrackThicknessValue->SetValue( wxString::Format( "%g", 0.035 ) ); m_IntTrackThicknessValue->SetValue( wxString::Format( "%g", 0.035 ) );
m_IntTrackThicknessUnit->SetSelection( 0 ); m_IntTrackThicknessUnit->SetSelection( 0 );
} }
void PCB_CALCULATOR_FRAME::TWDisplayValues( double aCurrent, double aExtWidth, void PANEL_TRACK_WIDTH::TWDisplayValues( double aCurrent, double aExtWidth,
double aIntWidth, double aExtThickness, double aIntThickness ) double aIntWidth, double aExtThickness, double aIntThickness )
{ {
wxString msg; wxString msg;
@ -302,7 +327,7 @@ void PCB_CALCULATOR_FRAME::TWDisplayValues( double aCurrent, double aExtWidth,
} }
void PCB_CALCULATOR_FRAME::TWUpdateModeDisplay() void PANEL_TRACK_WIDTH::TWUpdateModeDisplay()
{ {
wxFont labelfont; wxFont labelfont;
wxFont controlfont; wxFont controlfont;
@ -363,8 +388,7 @@ void PCB_CALCULATOR_FRAME::TWUpdateModeDisplay()
// Text sizes have changed when the font weight was changes // Text sizes have changed when the font weight was changes
// So, run the page layout to reflect the changes // So, run the page layout to reflect the changes
wxWindow* page = m_Notebook->GetPage ( 1 ); GetSizer()->Layout();
page->GetSizer()->Layout();
} }
/* calculate track width for external or internal layers /* calculate track width for external or internal layers
@ -375,7 +399,7 @@ void PCB_CALCULATOR_FRAME::TWUpdateModeDisplay()
* and dT = temperature rise in degree C * and dT = temperature rise in degree C
* Of course we want to know trackWidth * Of course we want to know trackWidth
*/ */
double PCB_CALCULATOR_FRAME::TWCalculateWidth( double aCurrent, double aThickness, double aDeltaT_C, double PANEL_TRACK_WIDTH::TWCalculateWidth( double aCurrent, double aThickness, double aDeltaT_C,
bool aUseInternalLayer ) bool aUseInternalLayer )
{ {
// Appropriate scale for requested layer. // Appropriate scale for requested layer.
@ -386,8 +410,7 @@ double PCB_CALCULATOR_FRAME::TWCalculateWidth( double aCurrent, double aThicknes
/* formula is Imax = scale * dT^0.44 * A^0.725 /* formula is Imax = scale * dT^0.44 * A^0.725
* or * or
* log(Imax) = log(scale) + 0.44*log(dT) * log(Imax) = log(scale) + 0.44*log(dT) +(0.725*(log(aThickness) + log(trackWidth))
* +(0.725*(log(aThickness) + log(trackWidth))
* log(trackWidth) * 0.725 = log(Imax) - log(scale) - 0.44*log(dT) - 0.725*log(aThickness) * log(trackWidth) * 0.725 = log(Imax) - log(scale) - 0.44*log(dT) - 0.725*log(aThickness)
*/ */
double dtmp = log( aCurrent ) - log( scale ) - 0.44 * log( aDeltaT_C ) - 0.725 * log( aThickness ); double dtmp = log( aCurrent ) - log( scale ) - 0.44 * log( aDeltaT_C ) - 0.725 * log( aThickness );
@ -399,7 +422,7 @@ double PCB_CALCULATOR_FRAME::TWCalculateWidth( double aCurrent, double aThicknes
} }
double PCB_CALCULATOR_FRAME::TWCalculateCurrent( double aWidth, double aThickness, double aDeltaT_C, double PANEL_TRACK_WIDTH::TWCalculateCurrent( double aWidth, double aThickness, double aDeltaT_C,
bool aUseInternalLayer ) bool aUseInternalLayer )
{ {
// Appropriate scale for requested layer. // Appropriate scale for requested layer.
@ -411,11 +434,12 @@ double PCB_CALCULATOR_FRAME::TWCalculateCurrent( double aWidth, double aThicknes
double area = aThickness * aWidth; double area = aThickness * aWidth;
double current = scale * pow( aDeltaT_C, 0.44 ) * pow( area, 0.725 ); double current = scale * pow( aDeltaT_C, 0.44 ) * pow( area, 0.725 );
return current; return current;
} }
void PCB_CALCULATOR_FRAME::initTrackWidthPanel() void PANEL_TRACK_WIDTH::LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg )
{ {
wxString msg; wxString msg;
@ -423,25 +447,23 @@ void PCB_CALCULATOR_FRAME::initTrackWidthPanel()
m_TWNested = true; m_TWNested = true;
// Read parameter values. // Read parameter values.
auto cfg = static_cast<PCB_CALCULATOR_SETTINGS*>( Kiface().KifaceSettings() ); m_TrackCurrentValue->SetValue( aCfg->m_TrackWidth.current );
m_TrackDeltaTValue->SetValue( aCfg->m_TrackWidth.delta_tc );
m_TrackCurrentValue->SetValue( cfg->m_TrackWidth.current ); m_TrackLengthValue->SetValue( aCfg->m_TrackWidth.track_len );
m_TrackDeltaTValue->SetValue( cfg->m_TrackWidth.delta_tc ); m_TW_CuLength_choiceUnit->SetSelection( aCfg->m_TrackWidth.track_len_units );
m_TrackLengthValue->SetValue( cfg->m_TrackWidth.track_len );
m_TW_CuLength_choiceUnit->SetSelection( cfg->m_TrackWidth.track_len_units );
#if 0 // the IPC formula is valid for copper traces, so we do not currently adjust the resistivity #if 0 // the IPC formula is valid for copper traces, so we do not currently adjust the resistivity
m_TWResistivity->SetValue( cfg->m_TrackWidth.resistivity ); m_TWResistivity->SetValue( aCfg->m_TrackWidth.resistivity );
#else #else
m_TWResistivity->SetValue( wxString::Format( "%g", copper_resistivity ) ); m_TWResistivity->SetValue( wxString::Format( "%g", copper_resistivity ) );
#endif #endif
m_ExtTrackWidthValue->SetValue( cfg->m_TrackWidth.ext_track_width ); m_ExtTrackWidthValue->SetValue( aCfg->m_TrackWidth.ext_track_width );
m_TW_ExtTrackWidth_choiceUnit->SetSelection( cfg->m_TrackWidth.ext_track_width_units ); m_TW_ExtTrackWidth_choiceUnit->SetSelection( aCfg->m_TrackWidth.ext_track_width_units );
m_ExtTrackThicknessValue->SetValue( cfg->m_TrackWidth.ext_track_thickness ); m_ExtTrackThicknessValue->SetValue( aCfg->m_TrackWidth.ext_track_thickness );
m_ExtTrackThicknessUnit->SetSelection( cfg->m_TrackWidth.ext_track_thickness_units ); m_ExtTrackThicknessUnit->SetSelection( aCfg->m_TrackWidth.ext_track_thickness_units );
m_IntTrackWidthValue->SetValue( cfg->m_TrackWidth.int_track_width ); m_IntTrackWidthValue->SetValue( aCfg->m_TrackWidth.int_track_width );
m_TW_IntTrackWidth_choiceUnit->SetSelection( cfg->m_TrackWidth.int_track_width_units ); m_TW_IntTrackWidth_choiceUnit->SetSelection( aCfg->m_TrackWidth.int_track_width_units );
m_IntTrackThicknessValue->SetValue( cfg->m_TrackWidth.int_track_thickness ); m_IntTrackThicknessValue->SetValue( aCfg->m_TrackWidth.int_track_thickness );
m_IntTrackThicknessUnit->SetSelection( cfg->m_TrackWidth.int_track_thickness_units ); m_IntTrackThicknessUnit->SetSelection( aCfg->m_TrackWidth.int_track_thickness_units );
if( tracks_width_versus_current_formula.StartsWith( "<!" ) ) if( tracks_width_versus_current_formula.StartsWith( "<!" ) )
m_htmlWinFormulas->SetPage( tracks_width_versus_current_formula ); m_htmlWinFormulas->SetPage( tracks_width_versus_current_formula );

View File

@ -41,8 +41,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetKiway( this, aKiway ); SetKiway( this, aKiway );
m_currTransLine = nullptr; m_currTransLine = nullptr;
m_currTransLineType = DEFAULT_TYPE; m_currTransLineType = DEFAULT_TYPE;
m_TWMode = TW_MASTER_CURRENT;
m_TWNested = false;
SHAPE_POLY_SET dummy; // A ugly trick to force the linker to include SHAPE_POLY_SET dummy; // A ugly trick to force the linker to include
// some methods in code and avoid link errors // some methods in code and avoid link errors
@ -69,12 +67,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_EpsilonR_label->SetLabel( wxT( "εr" ) ); m_EpsilonR_label->SetLabel( wxT( "εr" ) );
m_trackTempUnits->SetLabel( wxT( "°C" ) );
m_resistivityUnits->SetLabel( wxT( "Ω•m" ) );
m_extTrackResUnits->SetLabel( wxT( "" ) );
m_intTrackResUnits->SetLabel( wxT( "" ) );
LoadSettings( config() ); LoadSettings( config() );
m_panelRegulators->ReadDataFile(); m_panelRegulators->ReadDataFile();
@ -82,7 +74,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 );
initTrackWidthPanel();
initESeriesPanel(); initESeriesPanel();
BoardClassesUpdateData( m_BoardClassesUnitsSelector->GetUnitScale() ); BoardClassesUpdateData( m_BoardClassesUnitsSelector->GetUnitScale() );
@ -157,7 +148,7 @@ void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event )
m_panelRegulators->Layout(); m_panelRegulators->Layout();
m_panelESeriesHelp->Refresh(); m_panelESeriesHelp->Refresh();
m_htmlWinFormulas->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.
@ -251,6 +242,8 @@ void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
transline->ReadConfig(); transline->ReadConfig();
m_panelViaSize->LoadSettings( cfg ); m_panelViaSize->LoadSettings( cfg );
m_panelTrackWidth->LoadSettings( cfg );
} }
@ -277,10 +270,9 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
m_panelAttenuators->SaveSettings( cfg ); m_panelAttenuators->SaveSettings( cfg );
m_panelColorCode->SaveSettings( cfg ); m_panelColorCode->SaveSettings( cfg );
m_panelViaSize->SaveSettings( cfg ); m_panelViaSize->SaveSettings( cfg );
m_panelTrackWidth->SaveSettings( cfg );
} }
writeTrackWidthConfig();
for( unsigned ii = 0; ii < m_transline_list.size(); ii++ ) for( unsigned ii = 0; ii < m_transline_list.size(); ii++ )
m_transline_list[ii]->WriteConfig(); m_transline_list[ii]->WriteConfig();

View File

@ -102,7 +102,6 @@ private:
/** /**
* Panel-specific initializers * Panel-specific initializers
*/ */
void initTrackWidthPanel();
void initESeriesPanel(); void initESeriesPanel();
/** /**
@ -117,61 +116,6 @@ private:
*/ */
void OnESeriesSelection( wxCommandEvent& event ) override; void OnESeriesSelection( wxCommandEvent& event ) override;
/**
* Write track width parameters in configuration.
*/
void writeTrackWidthConfig();
/**
* Update the calculations the user changes the general parameters.
*/
void OnTWParametersChanged( wxCommandEvent& event ) override;
/**
* Update the calculations when the user changes the desired maximum current.
*/
void OnTWCalculateFromCurrent( wxCommandEvent& event ) override;
/**
* Update the calculations when the user changes the desired external trace width.
*/
void OnTWCalculateFromExtWidth( wxCommandEvent& event ) override;
/**
* Update the calculations when the user changes the desired internal trace width.
*/
void OnTWCalculateFromIntWidth( wxCommandEvent& event ) override;
/**
* Update the calculations when the user clicks the reset button.
*/
void OnTWResetButtonClick( wxCommandEvent& event ) override;
/**
* Calculate track width required based on given current and temperature rise.
*/
double TWCalculateWidth( double aCurrent, double aThickness, double aDeltaT_C,
bool aUseInternalLayer );
/**
* Calculate maximum current based on given width and temperature rise.
*/
double TWCalculateCurrent( double aWidth, double aThickness, double aDeltaT_C,
bool aUseInternalLayer );
/**
* Display the results of a calculation (including resulting values such
* as the resistance and power loss).
*/
void TWDisplayValues( double aCurrent, double aExtWidth, double aIntWidth,
double aExtThickness, double aIntThickness );
/**
* Update the fields to show whether the maximum current, external trace
* width, or internal trace width is currently the controlling parameter.
*/
void TWUpdateModeDisplay();
// Electrical spacing panel: // Electrical spacing panel:
void OnElectricalSpacingUnitsSelection( wxCommandEvent& event ) override; void OnElectricalSpacingUnitsSelection( wxCommandEvent& event ) override;
@ -235,15 +179,6 @@ private:
void TransfDlgDataToTranslineParams(); void TransfDlgDataToTranslineParams();
private: private:
enum // Which dimension is controlling the track width / current
{ // calculations:
TW_MASTER_CURRENT, // the maximum current,
TW_MASTER_EXT_WIDTH, // the external trace width,
TW_MASTER_INT_WIDTH // or the internal trace width?
} m_TWMode;
bool m_TWNested; // Used to stop events caused by setting the answers.
enum TRANSLINE_TYPE_ID m_currTransLineType; enum TRANSLINE_TYPE_ID m_currTransLineType;
TRANSLINE* m_currTransLine; TRANSLINE* m_currTransLine;
std::vector<TRANSLINE_IDENT*> m_transline_list; std::vector<TRANSLINE_IDENT*> m_transline_list;