Some more pcb calculator refresh hacks.
Also adjusts the spacing and decimal point in the E-series page. Fixes https://gitlab.com/kicad/code/kicad/issues/5634
This commit is contained in:
parent
9094ba8033
commit
55020ce2c7
|
@ -1,5 +1,5 @@
|
|||
// Do not edit this file, it is autogenerated by CMake from the .md file
|
||||
_HKI( "## Pi attenuator\n"
|
||||
_HKI( "### Pi attenuator\n"
|
||||
"__Zin__ desired input impedance in Ω<br>\n"
|
||||
"__Zout__ desired output impedance<br>\n"
|
||||
"__Zin = Zout__<br><br>\n"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Pi attenuator
|
||||
### Pi attenuator
|
||||
__Zin__ desired input impedance in Ω<br>
|
||||
__Zout__ desired output impedance<br>
|
||||
__Zin = Zout__<br><br>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Do not edit this file, it is autogenerated by CMake from the .md file
|
||||
_HKI( "## Splitted attenuator\n"
|
||||
"### Attenuation is 6dB\n"
|
||||
_HKI( "### Split attenuator\n"
|
||||
"#### Attenuation is 6dB\n"
|
||||
"___Z<sub>in</sub>___ desired input impedance in Ω<br>\n"
|
||||
"___Z<sub>out</sub>___ desired output impedance in Ω<br>\n"
|
||||
"___Z<sub>in</sub> = Z<sub>out</sub>___\n"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## Splitted attenuator
|
||||
### Attenuation is 6dB
|
||||
### Split attenuator
|
||||
#### Attenuation is 6dB
|
||||
___Z<sub>in</sub>___ desired input impedance in Ω<br>
|
||||
___Z<sub>out</sub>___ desired output impedance in Ω<br>
|
||||
___Z<sub>in</sub> = Z<sub>out</sub>___
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Do not edit this file, it is autogenerated by CMake from the .md file
|
||||
_HKI( "## Tee attenuator\n"
|
||||
_HKI( "### Tee attenuator\n"
|
||||
"__Zin__ desired input impedance in Ω<br>\n"
|
||||
"__Zout__ desired output impedance<br>\n"
|
||||
"__Zin = Zout__<br><br>\n"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Tee attenuator
|
||||
### Tee attenuator
|
||||
__Zin__ desired input impedance in Ω<br>
|
||||
__Zout__ desired output impedance<br>
|
||||
__Zin = Zout__<br><br>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* XPM */
|
||||
const static char *via_xpm[] = {
|
||||
const static char *via_dims_xpm[] = {
|
||||
"175 176 874 2",
|
||||
" c None",
|
||||
". c #FFFFFF",
|
|
@ -130,8 +130,5 @@ void PCB_CALCULATOR_FRAME::BoardClassesUpdateData( double aUnitScale )
|
|||
txt = NOVAL;
|
||||
m_gridClassesValuesDisplay->SetCellValue(4, ii, txt );
|
||||
}
|
||||
|
||||
m_gridClassesValuesDisplay->SetRowLabelSize( wxGRID_AUTOSIZE );
|
||||
m_gridClassesValuesDisplay->AutoSize();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2011 jean-pierre.charras
|
||||
* Copyright (C) 2011 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2011-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
|
||||
|
@ -19,10 +19,22 @@
|
|||
*/
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
#include "bitmaps/color_code_value_and_name.xpm"
|
||||
#include "bitmaps/color_code_value.xpm"
|
||||
#include "bitmaps/color_code_multiplier.xpm"
|
||||
#include "bitmaps/color_code_tolerance.xpm"
|
||||
#include "pcb_calculator_frame.h"
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::initColorCodePanel()
|
||||
{
|
||||
m_ccValueNamesBitmap = new wxBitmap( color_code_value_and_name_xpm );
|
||||
m_ccValuesBitmap = new wxBitmap( color_code_value_xpm );
|
||||
m_ccMultipliersBitmap = new wxBitmap( color_code_multiplier_xpm );
|
||||
m_ccTolerancesBitmap = new wxBitmap( color_code_tolerance_xpm );
|
||||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::OnToleranceSelection( wxCommandEvent& event )
|
||||
{
|
||||
ToleranceSelection( event.GetSelection() );
|
||||
|
@ -34,27 +46,22 @@ void PCB_CALCULATOR_FRAME::ToleranceSelection( int aSelection )
|
|||
/* For tolerance = 5 or 10 %, there are 3 bands for the value
|
||||
* but for tolerance < 5 %, there are 4 bands
|
||||
*/
|
||||
bool show4thBand;
|
||||
switch( aSelection )
|
||||
{
|
||||
case 0: // 5 or 10 %
|
||||
show4thBand = false;
|
||||
break;
|
||||
case 1: // < 5 %
|
||||
show4thBand = true;
|
||||
break;
|
||||
default: // Show 4th band if something went wrong
|
||||
show4thBand = true;
|
||||
break;
|
||||
}
|
||||
bool oldstate = m_Band4Label->IsShown();
|
||||
if( oldstate != show4thBand )
|
||||
{
|
||||
m_Band4bitmap->Show(show4thBand);
|
||||
m_Band4Label->Show(show4thBand);
|
||||
// m_Band4Label visibility has changed:
|
||||
// The new size must be taken in account
|
||||
m_panelColorCode->GetSizer()->Layout();
|
||||
m_panelColorCode->Refresh();
|
||||
}
|
||||
bool show4thBand = aSelection != 0;
|
||||
|
||||
m_Band4bitmap->Show(show4thBand);
|
||||
m_Band4Label->Show(show4thBand);
|
||||
|
||||
// m_Band4Label visibility has changed:
|
||||
// The new size must be taken in account
|
||||
m_panelColorCode->GetSizer()->Layout();
|
||||
|
||||
// All this shouldn't be necessary but if you want the bitmaps to show up on OSX it is.
|
||||
m_Band1bitmap->SetBitmap( *m_ccValueNamesBitmap );
|
||||
m_Band2bitmap->SetBitmap( *m_ccValuesBitmap );
|
||||
m_Band3bitmap->SetBitmap( *m_ccValuesBitmap );
|
||||
m_Band4bitmap->SetBitmap( *m_ccValuesBitmap );
|
||||
m_Band_mult_bitmap->SetBitmap( *m_ccMultipliersBitmap );
|
||||
m_Band_tol_bitmap->SetBitmap( *m_ccTolerancesBitmap );
|
||||
|
||||
m_panelColorCode->Refresh();
|
||||
}
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "../bitmaps/regul.xpm"
|
||||
#include "../bitmaps/regul_3pins.xpm"
|
||||
#include "../bitmaps/via.xpm"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -170,7 +169,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
fgSizerRegParams->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerRegulRight->Add( fgSizerRegParams, 0, wxEXPAND|wxALL, 5 );
|
||||
bSizerRegulRight->Add( fgSizerRegParams, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRegulButtonCalcReset;
|
||||
bSizerRegulButtonCalcReset = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
@ -199,7 +198,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
wxArrayString m_choiceRegulatorSelectorChoices;
|
||||
m_choiceRegulatorSelector = new wxChoice( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceRegulatorSelectorChoices, 0 );
|
||||
m_choiceRegulatorSelector->SetSelection( 0 );
|
||||
sbSizerRegulatorsChooser->Add( m_choiceRegulatorSelector, 0, wxALL|wxEXPAND, 5 );
|
||||
sbSizerRegulatorsChooser->Add( m_choiceRegulatorSelector, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextRegFile = new wxStaticText( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Regulators data file:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextRegFile->Wrap( -1 );
|
||||
|
@ -241,14 +240,14 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
sbSizerRegulatorsChooser->Add( bSizerReulBtn, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerRegulRight->Add( sbSizerRegulatorsChooser, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
bSizerRegulRight->Add( sbSizerRegulatorsChooser, 0, wxEXPAND|wxRIGHT, 10 );
|
||||
|
||||
m_RegulMessage = new wxStaticText( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_RegulMessage->Wrap( -1 );
|
||||
bSizerRegulRight->Add( m_RegulMessage, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizerMainReg->Add( bSizerRegulRight, 1, wxEXPAND|wxTOP|wxLEFT, 5 );
|
||||
bSizerMainReg->Add( bSizerRegulRight, 1, wxEXPAND|wxTOP|wxLEFT, 10 );
|
||||
|
||||
|
||||
m_panelRegulators->SetSizer( bSizerMainReg );
|
||||
|
@ -1138,11 +1137,14 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
wxBoxSizer* bSizerViaSize;
|
||||
bSizerViaSize = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizerViaLeftColumn;
|
||||
bSizerViaLeftColumn = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbSizerVS_Inputs;
|
||||
sbSizerVS_Inputs = new wxStaticBoxSizer( new wxStaticBox( m_panelViaSize, wxID_ANY, _("Parameters") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerVS_Inputs;
|
||||
fgSizerVS_Inputs = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizerVS_Inputs = new wxFlexGridSizer( 0, 3, 4, 0 );
|
||||
fgSizerVS_Inputs->AddGrowableCol( 1 );
|
||||
fgSizerVS_Inputs->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerVS_Inputs->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
@ -1154,24 +1156,24 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
fgSizerVS_Inputs->Add( m_staticTextHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_textCtrlHoleDia = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_choiceHoleDiaChoices;
|
||||
m_choiceHoleDia = new UNIT_SELECTOR_LEN( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHoleDiaChoices, 0 );
|
||||
m_choiceHoleDia->SetSelection( 0 );
|
||||
fgSizerVS_Inputs->Add( m_choiceHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_choiceHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextPlatingThickness = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Plating thickness (T):"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextPlatingThickness->Wrap( -1 );
|
||||
fgSizerVS_Inputs->Add( m_staticTextPlatingThickness, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlPlatingThickness = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlPlatingThickness, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlPlatingThickness, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_choicePlatingThicknessChoices;
|
||||
m_choicePlatingThickness = new UNIT_SELECTOR_LEN( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePlatingThicknessChoices, 0 );
|
||||
m_choicePlatingThickness->SetSelection( 0 );
|
||||
fgSizerVS_Inputs->Add( m_choicePlatingThickness, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
fgSizerVS_Inputs->Add( m_choicePlatingThickness, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextViaLength = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Via length:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextViaLength->Wrap( -1 );
|
||||
|
@ -1180,12 +1182,12 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
fgSizerVS_Inputs->Add( m_staticTextViaLength, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_textCtrlViaLength = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlViaLength, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlViaLength, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_choiceViaLengthChoices;
|
||||
m_choiceViaLength = new UNIT_SELECTOR_LEN( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceViaLengthChoices, 0 );
|
||||
m_choiceViaLength->SetSelection( 0 );
|
||||
fgSizerVS_Inputs->Add( m_choiceViaLength, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_choiceViaLength, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextViaPadDia = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Via pad diameter:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextViaPadDia->Wrap( -1 );
|
||||
|
@ -1194,12 +1196,12 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
fgSizerVS_Inputs->Add( m_staticTextViaPadDia, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_textCtrlViaPadDia = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlViaPadDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlViaPadDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_choiceViaPadDiaChoices;
|
||||
m_choiceViaPadDia = new UNIT_SELECTOR_LEN( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceViaPadDiaChoices, 0 );
|
||||
m_choiceViaPadDia->SetSelection( 0 );
|
||||
fgSizerVS_Inputs->Add( m_choiceViaPadDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_choiceViaPadDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextClearanceDia = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Clearance hole diameter:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextClearanceDia->Wrap( -1 );
|
||||
|
@ -1208,12 +1210,12 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
fgSizerVS_Inputs->Add( m_staticTextClearanceDia, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_textCtrlClearanceDia = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlClearanceDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlClearanceDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_choiceClearanceDiaChoices;
|
||||
m_choiceClearanceDia = new UNIT_SELECTOR_LEN( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceClearanceDiaChoices, 0 );
|
||||
m_choiceClearanceDia->SetSelection( 0 );
|
||||
fgSizerVS_Inputs->Add( m_choiceClearanceDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_choiceClearanceDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextImpedance = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Z0:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextImpedance->Wrap( -1 );
|
||||
|
@ -1222,86 +1224,107 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
fgSizerVS_Inputs->Add( m_staticTextImpedance, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_textCtrlImpedance = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlImpedance, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlImpedance, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_choiceImpedanceChoices;
|
||||
m_choiceImpedance = new UNIT_SELECTOR_RESISTOR( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceImpedanceChoices, 0 );
|
||||
m_choiceImpedance->SetSelection( 0 );
|
||||
fgSizerVS_Inputs->Add( m_choiceImpedance, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_choiceImpedance, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticAppliedCurrent = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Applied current:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticAppliedCurrent->Wrap( -1 );
|
||||
fgSizerVS_Inputs->Add( m_staticAppliedCurrent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_textCtrlAppliedCurrent = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlAppliedCurrent, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlAppliedCurrent, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextAppliedCurrentUnits = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("A"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextAppliedCurrentUnits->Wrap( -1 );
|
||||
fgSizerVS_Inputs->Add( m_staticTextAppliedCurrentUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
fgSizerVS_Inputs->Add( m_staticTextAppliedCurrentUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextResistivity = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Plating resistivity (Ohm.m):"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextResistivity->Wrap( -1 );
|
||||
m_staticTextResistivity->SetToolTip( _("Specific resistance in ohms * meters") );
|
||||
|
||||
fgSizerVS_Inputs->Add( m_staticTextResistivity, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
fgSizerVS_Inputs->Add( m_staticTextResistivity, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlPlatingResistivity = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlPlatingResistivity, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlPlatingResistivity, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_button_ResistivityVia = new wxButton( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
|
||||
fgSizerVS_Inputs->Add( m_button_ResistivityVia, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_button_ResistivityVia, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextPermittivity = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Er:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextPermittivity->Wrap( -1 );
|
||||
m_staticTextPermittivity->SetToolTip( _("Relative dielectric constant (epsilon r)") );
|
||||
|
||||
fgSizerVS_Inputs->Add( m_staticTextPermittivity, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
fgSizerVS_Inputs->Add( m_staticTextPermittivity, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlPlatingPermittivity = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlPlatingPermittivity, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlPlatingPermittivity, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_button_Permittivity = new wxButton( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
|
||||
fgSizerVS_Inputs->Add( m_button_Permittivity, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_button_Permittivity, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextTemperatureDiff = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Temperature rise:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextTemperatureDiff->Wrap( -1 );
|
||||
m_staticTextTemperatureDiff->SetToolTip( _("Maximum acceptable rise in temperature") );
|
||||
|
||||
fgSizerVS_Inputs->Add( m_staticTextTemperatureDiff, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
fgSizerVS_Inputs->Add( m_staticTextTemperatureDiff, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlTemperatureDiff = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlTemperatureDiff, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlTemperatureDiff, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextTemperatureUnits = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("deg C"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextTemperatureUnits->Wrap( -1 );
|
||||
fgSizerVS_Inputs->Add( m_staticTextTemperatureUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
fgSizerVS_Inputs->Add( m_staticTextTemperatureUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextRiseTime = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Pulse rise time:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextRiseTime->Wrap( -1 );
|
||||
m_staticTextRiseTime->SetToolTip( _("Pulse rise time to calculate reactance") );
|
||||
|
||||
fgSizerVS_Inputs->Add( m_staticTextRiseTime, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
|
||||
fgSizerVS_Inputs->Add( m_staticTextRiseTime, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlRiseTime = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlRiseTime, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
fgSizerVS_Inputs->Add( m_textCtrlRiseTime, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextRiseTimeUnits = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("ns"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextRiseTimeUnits->Wrap( -1 );
|
||||
m_staticTextRiseTimeUnits->SetToolTip( _("nanoseconds") );
|
||||
|
||||
fgSizerVS_Inputs->Add( m_staticTextRiseTimeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
fgSizerVS_Inputs->Add( m_staticTextRiseTimeUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
sbSizerVS_Inputs->Add( fgSizerVS_Inputs, 0, wxEXPAND, 5 );
|
||||
|
||||
m_bitmap10 = new wxStaticBitmap( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxBitmap( via_xpm ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_bitmap10->SetToolTip( _("Top view of via") );
|
||||
|
||||
sbSizerVS_Inputs->Add( m_bitmap10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
|
||||
bSizerViaLeftColumn->Add( sbSizerVS_Inputs, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_panelViaBitmap = new wxPanel( m_panelViaSize, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_panelViaBitmap->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNHIGHLIGHT ) );
|
||||
|
||||
wxBoxSizer* bSizer143;
|
||||
bSizer143 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
bSizerViaSize->Add( sbSizerVS_Inputs, 1, wxEXPAND|wxALL, 5 );
|
||||
bSizer143->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_viaBitmap = new wxStaticBitmap( m_panelViaBitmap, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_viaBitmap->SetToolTip( _("Top view of via") );
|
||||
|
||||
bSizer143->Add( m_viaBitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10 );
|
||||
|
||||
|
||||
bSizer143->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelViaBitmap->SetSizer( bSizer143 );
|
||||
m_panelViaBitmap->Layout();
|
||||
bSizer143->Fit( m_panelViaBitmap );
|
||||
bSizerViaLeftColumn->Add( m_panelViaBitmap, 1, wxEXPAND | wxALL, 8 );
|
||||
|
||||
|
||||
bSizerViaSize->Add( bSizerViaLeftColumn, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRight;
|
||||
bSizerRight = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -1312,6 +1335,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
wxFlexGridSizer* fgSizerTW_Results11;
|
||||
fgSizerTW_Results11 = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizerTW_Results11->AddGrowableCol( 1 );
|
||||
fgSizerTW_Results11->AddGrowableCol( 2 );
|
||||
fgSizerTW_Results11->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerTW_Results11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
|
@ -1447,7 +1471,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
m_staticTextWarning->Wrap( -1 );
|
||||
m_staticTextWarning->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
||||
|
||||
sbSizerVS_Result->Add( m_staticTextWarning, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
sbSizerVS_Result->Add( m_staticTextWarning, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerRight->Add( sbSizerVS_Result, 1, wxEXPAND|wxALL, 5 );
|
||||
|
@ -1532,8 +1556,8 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
|
||||
bSizeLeft->Add( sbSizerTW_Prms, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_htmlWinFormulas = new wxHtmlWindow( m_panelTrackWidth, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_NO_SELECTION|wxHW_SCROLLBAR_AUTO|wxBORDER_SIMPLE );
|
||||
bSizeLeft->Add( m_htmlWinFormulas, 1, wxEXPAND|wxLEFT|wxTOP, 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 );
|
||||
|
@ -1749,23 +1773,23 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
wxArrayString m_ElectricalSpacingUnitsSelectorChoices;
|
||||
m_ElectricalSpacingUnitsSelector = new UNIT_SELECTOR_LEN( m_panelElectricalSpacing, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ElectricalSpacingUnitsSelectorChoices, 0 );
|
||||
m_ElectricalSpacingUnitsSelector->SetSelection( -1 );
|
||||
bLeftSizerElectricalClearance->Add( m_ElectricalSpacingUnitsSelector, 0, wxALL|wxEXPAND, 5 );
|
||||
bLeftSizerElectricalClearance->Add( m_ElectricalSpacingUnitsSelector, 0, wxEXPAND|wxTOP|wxBOTTOM, 20 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( m_panelElectricalSpacing, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bLeftSizerElectricalClearance->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
|
||||
bLeftSizerElectricalClearance->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
m_staticText891 = new wxStaticText( m_panelElectricalSpacing, wxID_ANY, _("Voltage > 500V:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText891->Wrap( -1 );
|
||||
bLeftSizerElectricalClearance->Add( m_staticText891, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
bLeftSizerElectricalClearance->Add( m_staticText891, 0, wxTOP, 5 );
|
||||
|
||||
m_ElectricalSpacingVoltage = new wxTextCtrl( m_panelElectricalSpacing, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bLeftSizerElectricalClearance->Add( m_ElectricalSpacingVoltage, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
bLeftSizerElectricalClearance->Add( m_ElectricalSpacingVoltage, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
m_buttonElectSpacingRefresh = new wxButton( m_panelElectricalSpacing, wxID_ANY, _("Update Values"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bLeftSizerElectricalClearance->Add( m_buttonElectSpacingRefresh, 0, wxALL|wxEXPAND, 5 );
|
||||
bLeftSizerElectricalClearance->Add( m_buttonElectSpacingRefresh, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizerElectricalClearance->Add( bLeftSizerElectricalClearance, 0, wxEXPAND, 5 );
|
||||
bSizerElectricalClearance->Add( bLeftSizerElectricalClearance, 0, wxEXPAND|wxALL, 10 );
|
||||
|
||||
wxBoxSizer* bElectricalSpacingSizerRight;
|
||||
bElectricalSpacingSizerRight = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -1786,6 +1810,13 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
m_gridElectricalSpacingValues->SetMargins( 0, 0 );
|
||||
|
||||
// Columns
|
||||
m_gridElectricalSpacingValues->SetColSize( 0, 100 );
|
||||
m_gridElectricalSpacingValues->SetColSize( 1, 100 );
|
||||
m_gridElectricalSpacingValues->SetColSize( 2, 100 );
|
||||
m_gridElectricalSpacingValues->SetColSize( 3, 100 );
|
||||
m_gridElectricalSpacingValues->SetColSize( 4, 100 );
|
||||
m_gridElectricalSpacingValues->SetColSize( 5, 100 );
|
||||
m_gridElectricalSpacingValues->SetColSize( 6, 100 );
|
||||
m_gridElectricalSpacingValues->EnableDragColMove( false );
|
||||
m_gridElectricalSpacingValues->EnableDragColSize( true );
|
||||
m_gridElectricalSpacingValues->SetColLabelSize( 30 );
|
||||
|
@ -1799,18 +1830,27 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
m_gridElectricalSpacingValues->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Rows
|
||||
m_gridElectricalSpacingValues->AutoSizeRows();
|
||||
m_gridElectricalSpacingValues->SetRowSize( 0, 24 );
|
||||
m_gridElectricalSpacingValues->SetRowSize( 1, 24 );
|
||||
m_gridElectricalSpacingValues->SetRowSize( 2, 24 );
|
||||
m_gridElectricalSpacingValues->SetRowSize( 3, 24 );
|
||||
m_gridElectricalSpacingValues->SetRowSize( 4, 24 );
|
||||
m_gridElectricalSpacingValues->SetRowSize( 5, 24 );
|
||||
m_gridElectricalSpacingValues->SetRowSize( 6, 24 );
|
||||
m_gridElectricalSpacingValues->SetRowSize( 7, 24 );
|
||||
m_gridElectricalSpacingValues->SetRowSize( 8, 24 );
|
||||
m_gridElectricalSpacingValues->SetRowSize( 9, 24 );
|
||||
m_gridElectricalSpacingValues->EnableDragRowSize( false );
|
||||
m_gridElectricalSpacingValues->SetRowLabelSize( 100 );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 0, _("0 ... 15V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 1, _("16 ... 30V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 2, _("31 ... 50V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 3, _("51 ... 100V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 4, _("101 ... 150V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 5, _("151 ... 170V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 6, _("171 ... 250V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 7, _("251 ... 300V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 8, _("301 ... 500V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 0, _("0 .. 15V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 1, _("16 .. 30V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 2, _("31 .. 50V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 3, _("51 .. 100V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 4, _("101 .. 150V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 5, _("151 .. 170V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 6, _("171 .. 250V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 7, _("251 .. 300V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 8, _("301 .. 500V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelValue( 9, _(" > 500V") );
|
||||
m_gridElectricalSpacingValues->SetRowLabelAlignment( wxALIGN_RIGHT, wxALIGN_CENTER );
|
||||
|
||||
|
@ -1818,14 +1858,14 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
|
||||
// Cell Defaults
|
||||
m_gridElectricalSpacingValues->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_TOP );
|
||||
bElectricalSpacingSizerRight->Add( m_gridElectricalSpacingValues, 0, wxALL|wxEXPAND, 5 );
|
||||
bElectricalSpacingSizerRight->Add( m_gridElectricalSpacingValues, 0, wxALL, 5 );
|
||||
|
||||
m_staticText88 = new wxStaticText( m_panelElectricalSpacing, wxID_ANY, _("* B1 - Internal Conductors\n* B2 - External Conductors, uncoated, sea level to 3050 m\n* B3 - External Conductors, uncoated, over 3050 m\n* B4 - External Conductors, with permanent polymer coating (any elevation)\n* A5 - External Conductors, with conformal coating over assembly (any elevation)\n* A6 - External Component lead/termination, uncoated\n* A7 - External Component lead termination, with conformal coating (any elevation)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText88->Wrap( -1 );
|
||||
bElectricalSpacingSizerRight->Add( m_staticText88, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizerElectricalClearance->Add( bElectricalSpacingSizerRight, 1, wxEXPAND, 5 );
|
||||
bSizerElectricalClearance->Add( bElectricalSpacingSizerRight, 1, wxEXPAND|wxLEFT, 20 );
|
||||
|
||||
|
||||
m_panelElectricalSpacing->SetSizer( bSizerElectricalClearance );
|
||||
|
@ -1836,10 +1876,16 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
wxBoxSizer* bSizerBoardClass;
|
||||
bSizerBoardClass = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizerUnitsMargins;
|
||||
bSizerUnitsMargins = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxArrayString m_BoardClassesUnitsSelectorChoices;
|
||||
m_BoardClassesUnitsSelector = new UNIT_SELECTOR_LEN( m_panelBoardClass, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_BoardClassesUnitsSelectorChoices, 0 );
|
||||
m_BoardClassesUnitsSelector->SetSelection( 0 );
|
||||
bSizerBoardClass->Add( m_BoardClassesUnitsSelector, 0, wxALL, 5 );
|
||||
bSizerUnitsMargins->Add( m_BoardClassesUnitsSelector, 0, wxTOP|wxBOTTOM|wxRIGHT, 32 );
|
||||
|
||||
|
||||
bSizerBoardClass->Add( bSizerUnitsMargins, 0, wxLEFT, 10 );
|
||||
|
||||
wxBoxSizer* brdclsSizerRight;
|
||||
brdclsSizerRight = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -1860,9 +1906,15 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
m_gridClassesValuesDisplay->SetMargins( 0, 0 );
|
||||
|
||||
// Columns
|
||||
m_gridClassesValuesDisplay->SetColSize( 0, 100 );
|
||||
m_gridClassesValuesDisplay->SetColSize( 1, 100 );
|
||||
m_gridClassesValuesDisplay->SetColSize( 2, 100 );
|
||||
m_gridClassesValuesDisplay->SetColSize( 3, 100 );
|
||||
m_gridClassesValuesDisplay->SetColSize( 4, 100 );
|
||||
m_gridClassesValuesDisplay->SetColSize( 5, 100 );
|
||||
m_gridClassesValuesDisplay->EnableDragColMove( false );
|
||||
m_gridClassesValuesDisplay->EnableDragColSize( true );
|
||||
m_gridClassesValuesDisplay->SetColLabelSize( 70 );
|
||||
m_gridClassesValuesDisplay->SetColLabelSize( 30 );
|
||||
m_gridClassesValuesDisplay->SetColLabelValue( 0, _("Class 1") );
|
||||
m_gridClassesValuesDisplay->SetColLabelValue( 1, _("Class 2") );
|
||||
m_gridClassesValuesDisplay->SetColLabelValue( 2, _("Class 3") );
|
||||
|
@ -1872,7 +1924,11 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
m_gridClassesValuesDisplay->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Rows
|
||||
m_gridClassesValuesDisplay->AutoSizeRows();
|
||||
m_gridClassesValuesDisplay->SetRowSize( 0, 24 );
|
||||
m_gridClassesValuesDisplay->SetRowSize( 1, 24 );
|
||||
m_gridClassesValuesDisplay->SetRowSize( 2, 24 );
|
||||
m_gridClassesValuesDisplay->SetRowSize( 3, 24 );
|
||||
m_gridClassesValuesDisplay->SetRowSize( 4, 24 );
|
||||
m_gridClassesValuesDisplay->EnableDragRowSize( false );
|
||||
m_gridClassesValuesDisplay->SetRowLabelSize( 160 );
|
||||
m_gridClassesValuesDisplay->SetRowLabelValue( 0, _("Lines width") );
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -280,7 +280,8 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
|
|||
wxStaticText* m_staticTextRiseTime;
|
||||
wxTextCtrl* m_textCtrlRiseTime;
|
||||
wxStaticText* m_staticTextRiseTimeUnits;
|
||||
wxStaticBitmap* m_bitmap10;
|
||||
wxPanel* m_panelViaBitmap;
|
||||
wxStaticBitmap* m_viaBitmap;
|
||||
wxStaticText* m_staticTextArea11;
|
||||
wxStaticText* m_ViaResistance;
|
||||
wxStaticText* m_IntTrackAreaUnitLabel1;
|
||||
|
|
|
@ -19,84 +19,68 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <dialog_helpers.h>
|
||||
#include "class_regulator_data.h"
|
||||
#include "attenuators/attenuator_classes.h"
|
||||
#include "pcb_calculator_frame.h"
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <dialog_helpers.h>
|
||||
#include "class_regulator_data.h"
|
||||
#include "pcb_calculator_frame.h"
|
||||
#include <wx/wx.h>
|
||||
|
||||
#ifdef BENCHMARK
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "eserie.h"
|
||||
#include "profile.h"
|
||||
|
||||
|
||||
wxString eseries_help =
|
||||
#include "eserie_help.h"
|
||||
|
||||
eserie r;
|
||||
eserie r;
|
||||
|
||||
void eserie::set_reqR( double aR )
|
||||
{
|
||||
reqR = aR;
|
||||
}
|
||||
|
||||
void eserie::set_rb( uint32_t a_rb )
|
||||
{
|
||||
rb_state = a_rb;
|
||||
}
|
||||
|
||||
std::array<r_data, S4R + 1> eserie::get_rslt( void )
|
||||
{
|
||||
return results;
|
||||
}
|
||||
|
||||
void eserie::exclude( double aValue )
|
||||
void eserie::Exclude( double aValue )
|
||||
{
|
||||
if( aValue ) // if there is a value to exclude other than a wire jumper
|
||||
{
|
||||
for( r_data& i : luts[rb_state] ) // then search it in the selected E-Serie lookup table
|
||||
for( r_data& i : luts[m_series] ) // then search it in the selected E-Serie lookup table
|
||||
{
|
||||
if( i.e_value == aValue ) // if value to exclude found
|
||||
{
|
||||
i.e_use = false; // disable its use
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void eserie::simple_solution( uint32_t aSize )
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
results[S2R].e_value = std::numeric_limits<double>::max(); // assume no 2R solution or max deviation
|
||||
m_results[S2R].e_value = std::numeric_limits<double>::max(); // assume no 2R solution or max deviation
|
||||
|
||||
for( i = 0; i < aSize; i++ )
|
||||
{
|
||||
if( abs( cmb_lut[i].e_value - reqR ) < abs( results[S2R].e_value ) )
|
||||
if( abs( m_cmb_lut[i].e_value - m_required_value ) < abs( m_results[S2R].e_value ) )
|
||||
{
|
||||
results[S2R].e_value = cmb_lut[i].e_value - reqR; // save signed deviation in Ohms
|
||||
results[S2R].e_name = cmb_lut[i].e_name; // save combination text
|
||||
results[S2R].e_use = true; // this is a possible solution
|
||||
m_results[S2R].e_value = m_cmb_lut[i].e_value - m_required_value; // save signed deviation in Ohms
|
||||
m_results[S2R].e_name = m_cmb_lut[i].e_name; // save combination text
|
||||
m_results[S2R].e_use = true; // this is a possible solution
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void eserie::combine4( uint32_t aSize )
|
||||
{
|
||||
uint32_t i,j;
|
||||
double tmp;
|
||||
std::string s;
|
||||
|
||||
results[S4R].e_use = false; // disable 4R solution, until
|
||||
results[S4R].e_value = results[S3R].e_value; // 4R becomes better than 3R solution
|
||||
m_results[S4R].e_use = false; // disable 4R solution, until
|
||||
m_results[S4R].e_value = m_results[S3R].e_value; // 4R becomes better than 3R solution
|
||||
|
||||
#ifdef BENCHMARK
|
||||
PROF_COUNTER combine4_timer; // start timer to count execution time
|
||||
|
@ -106,90 +90,84 @@ void eserie::combine4( uint32_t aSize )
|
|||
{ // scan valid intermediate 2R solutions
|
||||
for( j = 0; j < aSize; j++ ) // inner loop combines all with itself
|
||||
{
|
||||
tmp = cmb_lut[i].e_value + cmb_lut[j].e_value; // calculate 2R+2R serial
|
||||
tmp -= reqR; // calculate 4R deviation
|
||||
tmp = m_cmb_lut[i].e_value + m_cmb_lut[j].e_value; // calculate 2R+2R serial
|
||||
tmp -= m_required_value; // calculate 4R deviation
|
||||
|
||||
if( abs( tmp ) < abs( results[S4R].e_value ) ) // if new 4R is better
|
||||
if( abs( tmp ) < abs( m_results[S4R].e_value ) ) // if new 4R is better
|
||||
{
|
||||
results[S4R].e_value = tmp; // save amount of benefit
|
||||
m_results[S4R].e_value = tmp; // save amount of benefit
|
||||
std::string s = "( ";
|
||||
s.append( cmb_lut[i].e_name ); // mention 1st 2 component
|
||||
s.append( m_cmb_lut[i].e_name ); // mention 1st 2 component
|
||||
s.append( " ) + ( " ); // in series
|
||||
s.append( cmb_lut[j].e_name ); // with 2nd 2 components
|
||||
s.append( m_cmb_lut[j].e_name ); // with 2nd 2 components
|
||||
s.append( " )" );
|
||||
results[S4R].e_name = s; // save the result and
|
||||
results[S4R].e_use = true; // enable for later use
|
||||
m_results[S4R].e_name = s; // save the result and
|
||||
m_results[S4R].e_use = true; // enable for later use
|
||||
}
|
||||
|
||||
tmp = ( cmb_lut[i].e_value * cmb_lut[j].e_value ) /
|
||||
( cmb_lut[i].e_value + cmb_lut[j].e_value ); // calculate 2R|2R parallel
|
||||
tmp -= reqR; // calculate 4R deviation
|
||||
tmp = ( m_cmb_lut[i].e_value * m_cmb_lut[j].e_value ) /
|
||||
( m_cmb_lut[i].e_value + m_cmb_lut[j].e_value ); // calculate 2R|2R parallel
|
||||
tmp -= m_required_value; // calculate 4R deviation
|
||||
|
||||
if( abs( tmp ) < abs( results[S4R].e_value ) ) // if new 4R is better
|
||||
if( abs( tmp ) < abs( m_results[S4R].e_value ) ) // if new 4R is better
|
||||
{
|
||||
results[S4R].e_value = tmp; // save amount of benefit
|
||||
m_results[S4R].e_value = tmp; // save amount of benefit
|
||||
std::string s = "( ";
|
||||
s.append( cmb_lut[i].e_name ); // mention 1st 2 component
|
||||
s.append( m_cmb_lut[i].e_name ); // mention 1st 2 component
|
||||
s.append( " ) | ( " ); // in parallel
|
||||
s.append( cmb_lut[j].e_name ); // with 2nd 2 components
|
||||
s.append( m_cmb_lut[j].e_name ); // with 2nd 2 components
|
||||
s.append( " )" );
|
||||
results[S4R].e_name = s; // save the result
|
||||
results[S4R].e_use = true; // enable later use
|
||||
m_results[S4R].e_name = s; // save the result
|
||||
m_results[S4R].e_use = true; // enable later use
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BENCHMARK
|
||||
if( rb_state == E12 )
|
||||
{
|
||||
if( m_series == E12 )
|
||||
std::cout<<"4R Time = "<<combine4_timer.msecs()<<" mSec"<<std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void eserie::new_calc( void )
|
||||
|
||||
void eserie::NewCalc( void )
|
||||
{
|
||||
for( r_data& i : cmb_lut )
|
||||
{
|
||||
i.e_use = false; // before any calculation is done, assume that
|
||||
}
|
||||
for( r_data& i : m_cmb_lut )
|
||||
i.e_use = false; // before any calculation is done, assume that
|
||||
|
||||
for( r_data& i : results )
|
||||
{
|
||||
i.e_use = false; // no combinations and no results are available
|
||||
}
|
||||
for( r_data& i : m_results )
|
||||
i.e_use = false; // no combinations and no results are available
|
||||
|
||||
for( r_data& i : luts[rb_state])
|
||||
{
|
||||
i.e_use = true; // all selecte E-values available
|
||||
}
|
||||
for( r_data& i : luts[m_series])
|
||||
i.e_use = true; // all selecte E-values available
|
||||
}
|
||||
|
||||
|
||||
uint32_t eserie::combine2( void )
|
||||
{
|
||||
uint32_t combi2R = 0; // target index counts calculated 2R combinations
|
||||
std::string s;
|
||||
|
||||
for( const r_data& i : luts[rb_state] ) // outer loop to sweep selected source lookup table
|
||||
for( const r_data& i : luts[m_series] ) // outer loop to sweep selected source lookup table
|
||||
{
|
||||
if( i.e_use )
|
||||
{
|
||||
for( const r_data& j : luts[rb_state] ) // inner loop to combine values with itself
|
||||
for( const r_data& j : luts[m_series] ) // inner loop to combine values with itself
|
||||
{
|
||||
if( j.e_use )
|
||||
{
|
||||
cmb_lut[combi2R].e_use = true;
|
||||
cmb_lut[combi2R].e_value = i.e_value + j.e_value; // calculate 2R serial
|
||||
m_cmb_lut[combi2R].e_use = true;
|
||||
m_cmb_lut[combi2R].e_value = i.e_value + j.e_value; // calculate 2R serial
|
||||
s = i.e_name;
|
||||
s.append( " + " );
|
||||
cmb_lut[combi2R].e_name = s.append(j.e_name);
|
||||
m_cmb_lut[combi2R].e_name = s.append( j.e_name);
|
||||
combi2R++; // next destination
|
||||
cmb_lut[combi2R].e_use = true; // calculate 2R parallel
|
||||
cmb_lut[combi2R].e_value = i.e_value * j.e_value /
|
||||
( i.e_value + j.e_value );
|
||||
m_cmb_lut[combi2R].e_use = true; // calculate 2R parallel
|
||||
m_cmb_lut[combi2R].e_value = i.e_value * j.e_value /
|
||||
( i.e_value + j.e_value );
|
||||
s = i.e_name;
|
||||
s.append( " | " );
|
||||
cmb_lut[combi2R].e_name = s.append( j.e_name );
|
||||
m_cmb_lut[combi2R].e_name = s.append( j.e_name );
|
||||
combi2R++; // next destination
|
||||
}
|
||||
}
|
||||
|
@ -198,112 +176,116 @@ uint32_t eserie::combine2( void )
|
|||
return ( combi2R );
|
||||
}
|
||||
|
||||
|
||||
void eserie::combine3( uint32_t aSize )
|
||||
{
|
||||
uint32_t j = 0;
|
||||
double tmp = 0; // avoid warning for being uninitialized
|
||||
std::string s;
|
||||
|
||||
results[S3R].e_use = false; // disable 3R solution, until
|
||||
results[S3R].e_value = results[S2R].e_value; // 3R becomes better than 2R solution
|
||||
m_results[S3R].e_use = false; // disable 3R solution, until
|
||||
m_results[S3R].e_value = m_results[S2R].e_value; // 3R becomes better than 2R solution
|
||||
|
||||
for( const r_data& i : luts[rb_state] ) // 3R Outer loop to selected primary E serie LUT
|
||||
for( const r_data& i : luts[m_series] ) // 3R Outer loop to selected primary E serie LUT
|
||||
{
|
||||
if( i.e_use ) // skip all excluded values
|
||||
{
|
||||
for( j = 0; j < aSize; j++ ) // inner loop combines with all 2R intermediate results
|
||||
{ // R+2R serial combi
|
||||
tmp = cmb_lut[j].e_value + i.e_value;
|
||||
tmp -= reqR; // calculate deviation
|
||||
tmp = m_cmb_lut[j].e_value + i.e_value;
|
||||
tmp -= m_required_value; // calculate deviation
|
||||
|
||||
if( abs( tmp ) < abs( results[S3R].e_value ) ) // compare if better
|
||||
if( abs( tmp ) < abs( m_results[S3R].e_value ) ) // compare if better
|
||||
{ // then take it
|
||||
s = i.e_name; // mention 3rd component
|
||||
s.append( " + ( " ); // in series
|
||||
s.append( cmb_lut[j].e_name ); // with 2R combination
|
||||
s.append( m_cmb_lut[j].e_name ); // with 2R combination
|
||||
s.append( " )" );
|
||||
results[S3R].e_name = s; // save S3R result
|
||||
results[S3R].e_value = tmp; // save amount of benefit
|
||||
results[S3R].e_use = true; // enable later use
|
||||
m_results[S3R].e_name = s; // save S3R result
|
||||
m_results[S3R].e_value = tmp; // save amount of benefit
|
||||
m_results[S3R].e_use = true; // enable later use
|
||||
}
|
||||
|
||||
tmp = i.e_value * cmb_lut[j].e_value /
|
||||
( i.e_value + cmb_lut[j].e_value ); // calculate R + 2R parallel
|
||||
tmp -= reqR; // calculate deviation
|
||||
tmp = i.e_value * m_cmb_lut[j].e_value /
|
||||
( i.e_value + m_cmb_lut[j].e_value ); // calculate R + 2R parallel
|
||||
tmp -= m_required_value; // calculate deviation
|
||||
|
||||
if( abs( tmp ) < abs( results[S3R].e_value ) ) // compare if better
|
||||
if( abs( tmp ) < abs( m_results[S3R].e_value ) ) // compare if better
|
||||
{ // then take it
|
||||
s = i.e_name; // mention 3rd component
|
||||
s.append( " | ( " ); // in parallel
|
||||
s.append( cmb_lut[j].e_name ); // with 2R combination
|
||||
s.append( m_cmb_lut[j].e_name ); // with 2R combination
|
||||
s.append( " )" );
|
||||
results[S3R].e_name = s;
|
||||
results[S3R].e_value = tmp; // save amount of benefit
|
||||
results[S3R].e_use = true; // enable later use
|
||||
m_results[S3R].e_name = s;
|
||||
m_results[S3R].e_value = tmp; // save amount of benefit
|
||||
m_results[S3R].e_use = true; // enable later use
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if there is a 3R result with remaining deviation
|
||||
if( ( results[S3R].e_use == true ) && tmp )
|
||||
if(( m_results[S3R].e_use == true ) && tmp )
|
||||
{ // consider to search a possibly better 4R solution
|
||||
combine4( aSize ); // calculate 4R for small series always
|
||||
}
|
||||
}
|
||||
|
||||
void eserie::calculate( void )
|
||||
|
||||
void eserie::Calculate( void )
|
||||
{
|
||||
uint32_t no_of_2Rcombi = 0;
|
||||
|
||||
no_of_2Rcombi = combine2(); // combine all 2R combinations for selected E serie
|
||||
simple_solution( no_of_2Rcombi ); // search for simple 2 component solution
|
||||
|
||||
if( results[S2R].e_value ) // if simple 2R result is not exact
|
||||
{
|
||||
if( m_results[S2R].e_value ) // if simple 2R result is not exact
|
||||
combine3( no_of_2Rcombi ); // continiue searching for a possibly better solution
|
||||
}
|
||||
|
||||
strip3();
|
||||
strip4();
|
||||
}
|
||||
|
||||
|
||||
void eserie::strip3( void )
|
||||
{
|
||||
std::string s;
|
||||
|
||||
if( results[S3R].e_use ) // if there is a 3 term result available
|
||||
if( m_results[S3R].e_use ) // if there is a 3 term result available
|
||||
{ // what is connected either by two "|" or by 3 plus
|
||||
s = results[S3R].e_name;
|
||||
s = m_results[S3R].e_name;
|
||||
|
||||
if( ( std::count( s.begin(), s.end(), '+' ) == 2 ) || \
|
||||
( std::count( s.begin(), s.end(), '|' ) == 2 ) )
|
||||
if( ( std::count( s.begin(), s.end(), '+' ) == 2 )
|
||||
|| ( std::count( s.begin(), s.end(), '|' ) == 2 ) )
|
||||
{ // then strip one pair of braces
|
||||
s.erase( s.find( "(" ), 1 ); // it is known sure, this is available
|
||||
s.erase( s.find( ")" ), 1 ); // in any unstripped 3R result term
|
||||
results[S3R].e_name = s; // use stripped result
|
||||
m_results[S3R].e_name = s; // use stripped result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void eserie::strip4( void )
|
||||
{
|
||||
std::string s;
|
||||
|
||||
if( results[S4R].e_use ) // if there is a 4 term result available
|
||||
if( m_results[S4R].e_use ) // if there is a 4 term result available
|
||||
{ // what are connected either by 3 "+" or by 3 "|"
|
||||
s = results[S4R].e_name;
|
||||
s = m_results[S4R].e_name;
|
||||
|
||||
if( ( std::count( s.begin(), s.end(), '+' ) == 3 ) ||
|
||||
( std::count( s.begin(), s.end(), '|' ) == 3 ) )
|
||||
if( ( std::count( s.begin(), s.end(), '+' ) == 3 )
|
||||
|| ( std::count( s.begin(), s.end(), '|' ) == 3 ) )
|
||||
{ // then strip two pair of braces
|
||||
s.erase( s.find( "(" ), 1 ); // it is known sure, they are available
|
||||
s.erase( s.find( ")" ), 1 ); // in any unstripped 4R result term
|
||||
s.erase( s.find( "(" ), 1 );
|
||||
s.erase( s.find( ")" ), 1 );
|
||||
results[S4R].e_name = s; // use stripped result
|
||||
m_results[S4R].e_name = s; // use stripped result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::OnCalculateESeries( wxCommandEvent& event )
|
||||
{
|
||||
double reqr; // required resistor stored in local copy
|
||||
|
@ -311,18 +293,18 @@ void PCB_CALCULATOR_FRAME::OnCalculateESeries( wxCommandEvent& event )
|
|||
wxString es, fs; // error and formula strings
|
||||
|
||||
reqr = ( 1000 * DoubleFromString( m_ResRequired->GetValue() ) );
|
||||
r.set_reqR(reqr); // keep a local copy of requred resistor value
|
||||
r.new_calc(); // assume all values available
|
||||
r.SetRequiredValue( reqr ); // keep a local copy of requred resistor value
|
||||
r.NewCalc(); // assume all values available
|
||||
/*
|
||||
* Exclude itself. For the case, a value from the available series is found as required value,
|
||||
* the calculator assumes this value needs a replacement for the reason of being not available.
|
||||
* Two further exclude values can be entered to exclude and are skipped as not being availabe.
|
||||
* All values entered in KiloOhms are converted to Ohm for internal calculation
|
||||
*/
|
||||
r.exclude( 1000 * DoubleFromString( m_ResRequired->GetValue() ) );
|
||||
r.exclude( 1000 * DoubleFromString( m_ResExclude1->GetValue() ) );
|
||||
r.exclude( 1000 * DoubleFromString( m_ResExclude2->GetValue() ) );
|
||||
r.calculate();
|
||||
r.Exclude( 1000 * DoubleFromString( m_ResRequired->GetValue()));
|
||||
r.Exclude( 1000 * DoubleFromString( m_ResExclude1->GetValue()));
|
||||
r.Exclude( 1000 * DoubleFromString( m_ResExclude2->GetValue()));
|
||||
r.Calculate();
|
||||
|
||||
fs = r.get_rslt()[S2R].e_name; // show 2R solution formula string
|
||||
m_ESeries_Sol2R->SetValue( fs );
|
||||
|
@ -332,13 +314,9 @@ void PCB_CALCULATOR_FRAME::OnCalculateESeries( wxCommandEvent& event )
|
|||
if( error )
|
||||
{
|
||||
if( std::abs( error ) < 0.01 )
|
||||
{
|
||||
es.Printf( "<%.2f", 0.01 );
|
||||
}
|
||||
else
|
||||
{
|
||||
es.Printf( "%+.2f",error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -355,13 +333,9 @@ void PCB_CALCULATOR_FRAME::OnCalculateESeries( wxCommandEvent& event )
|
|||
if( err3 )
|
||||
{
|
||||
if( std::abs( err3 ) < 0.01 )
|
||||
{
|
||||
es.Printf( "<%.2f", 0.01 );
|
||||
}
|
||||
else
|
||||
{
|
||||
es.Printf( "%+.2f",err3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -389,13 +363,9 @@ void PCB_CALCULATOR_FRAME::OnCalculateESeries( wxCommandEvent& event )
|
|||
error = ( reqr / error - 1 ) * 100; // error in percent
|
||||
|
||||
if( error )
|
||||
{
|
||||
es.Printf( "%+.2f",error );
|
||||
}
|
||||
else
|
||||
{
|
||||
es = _( "Exact" );
|
||||
}
|
||||
|
||||
m_ESeriesError4R->SetValue( es );
|
||||
}
|
||||
|
@ -412,16 +382,16 @@ void PCB_CALCULATOR_FRAME::OnCalculateESeries( wxCommandEvent& event )
|
|||
void PCB_CALCULATOR_FRAME::OnESeriesSelection( wxCommandEvent& event )
|
||||
{
|
||||
if( event.GetEventObject() == m_e1 )
|
||||
r.set_rb( E1 );
|
||||
r.SetSeries( E1 );
|
||||
else if( event.GetEventObject() == m_e3 )
|
||||
r.set_rb( E3 );
|
||||
r.SetSeries( E3 );
|
||||
else if( event.GetEventObject() == m_e12 )
|
||||
r.set_rb( E12 );
|
||||
r.SetSeries( E12 );
|
||||
else
|
||||
r.set_rb( E6 );
|
||||
r.SetSeries( E6 );
|
||||
}
|
||||
|
||||
void PCB_CALCULATOR_FRAME::ES_Init() // initialize ESeries tab at each pcb-calculator start
|
||||
void PCB_CALCULATOR_FRAME::initESeriesPanel() // initialize ESeries tab at each pcb-calculator start
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 <janvi@veith.net>
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-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
|
||||
|
@ -18,10 +18,6 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file eserie.h
|
||||
*/
|
||||
|
||||
extern double DoubleFromString( const wxString& TextValue );
|
||||
|
||||
/**
|
||||
|
@ -126,113 +122,114 @@ struct r_data {
|
|||
|
||||
class eserie
|
||||
{
|
||||
private:
|
||||
public:
|
||||
/**
|
||||
* If any value of the selected E-serie not available, it can be entered as an exclude value.
|
||||
*
|
||||
* @param aValue is the value to exclude from calculation
|
||||
* Values to exclude are set to false in the selected E-serie source lookup table
|
||||
*/
|
||||
void Exclude( double aValue );
|
||||
|
||||
/**
|
||||
* initialize next calculation and erase results from previous calculation
|
||||
*/
|
||||
void NewCalc( void );
|
||||
|
||||
/**
|
||||
* called on calculate button to execute all the 2R, 3R and 4R calculations
|
||||
*/
|
||||
void Calculate( void );
|
||||
|
||||
/**
|
||||
* Interface for CheckBox, RadioButton, RequriedResistor and calculated Results
|
||||
*/
|
||||
void SetSeries( uint32_t aSeries ) { m_series = aSeries; }
|
||||
void SetRequiredValue( double aValue ) { m_required_value = aValue; }
|
||||
|
||||
std::array<r_data,S4R+1> get_rslt( void ) { return m_results; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Build all 2R combinations from the selected E-serie values
|
||||
*
|
||||
* Pre-calculated value combinations are saved in intermediate look up table m_cmb_lut
|
||||
* @return is the number of found combinations what also depends from exclude values
|
||||
*/
|
||||
uint32_t combine2( void );
|
||||
|
||||
/**
|
||||
* Search for closest two component solution
|
||||
*
|
||||
* @param aSize is the number of valid 2R combinations in m_cmb_lut on where to search
|
||||
* The 2R result with smallest deviation will be saved in results
|
||||
*/
|
||||
void simple_solution( uint32_t aSize );
|
||||
|
||||
/**
|
||||
* Check if there is a better 3 R solution than previous one using only two components.
|
||||
*
|
||||
* @param aSize gives the number of available combinations to be checked inside m_cmb_lut
|
||||
* Therefore m_cmb_lut is combinated with the primary E-serie look up table
|
||||
* The 3R result with smallest deviation will be saved in results if better than 2R
|
||||
*/
|
||||
void combine3( uint32_t aSize );
|
||||
|
||||
/**
|
||||
* Check if there is a better four component solution.
|
||||
*
|
||||
* @param aSsize gives the number of 2R combinations to be checked inside m_cmb_lut
|
||||
* Occupied calculation time depends from number of available E-serie values
|
||||
* with the power of 4 why execution for E12 is conditional with 4R check box
|
||||
* for the case the previously found 3R solution is already exact
|
||||
*/
|
||||
void combine4( uint32_t aSize );
|
||||
|
||||
/*
|
||||
* Strip redundant braces from three component result
|
||||
*
|
||||
* Example: R1+(R2+R3) become R1+R2+R3
|
||||
* and R1|(R2|R3) become R1|R2|R3
|
||||
* while R1+(R2|R3) or (R1+R2)|R3) remains untouched
|
||||
*/
|
||||
void strip3( void );
|
||||
|
||||
/*
|
||||
* Strip redundant braces from four component result
|
||||
*
|
||||
* Example: (R1+R2)+(R3+R4) become R1+R2+R3+R4
|
||||
* and (R1|R2)|(R2|R3) become R1|R2|R3|R4
|
||||
* while (R1+R2)|(R3+R4) remains untouched
|
||||
*/
|
||||
void strip4( void );
|
||||
|
||||
private:
|
||||
std::vector<std::vector<r_data>> luts {
|
||||
{ E1_VAL },
|
||||
{ E1_VAL, E3_ADD },
|
||||
{ E1_VAL, E3_ADD, E6_ADD },
|
||||
{ E1_VAL, E3_ADD, E6_ADD, E12_ADD }
|
||||
};
|
||||
/*
|
||||
* TODO: Manual array size calculation is dangerous. Unlike legacy ANSI-C Arrays
|
||||
* std::array can not drop length param by providing aggregate init list up
|
||||
* to C++17. Reserved array size should be 2*E12² of std::vector primary list.
|
||||
* Exceeding memory limit 7442 will crash the calculator without any warnings !
|
||||
* Compare to previous MAX_COMB macro for legacy ANSI-C array automatic solution
|
||||
* #define E12_SIZE sizeof ( e12_lut ) / sizeof ( r_data )
|
||||
* #define MAX_COMB (2 * E12_SIZE * E12_SIZE)
|
||||
* 2 component combinations including redundant swappable terms are for the moment
|
||||
* 72 combinations for E1
|
||||
* 512 combinations for E3
|
||||
* 1922 combinations for E6
|
||||
* 7442 combinations for E12
|
||||
*/
|
||||
/*
|
||||
* TODO: Manual array size calculation is dangerous. Unlike legacy ANSI-C Arrays
|
||||
* std::array can not drop length param by providing aggregate init list up
|
||||
* to C++17. Reserved array size should be 2*E12² of std::vector primary list.
|
||||
* Exceeding memory limit 7442 will crash the calculator without any warnings !
|
||||
* Compare to previous MAX_COMB macro for legacy ANSI-C array automatic solution
|
||||
* #define E12_SIZE sizeof ( e12_lut ) / sizeof ( r_data )
|
||||
* #define MAX_COMB (2 * E12_SIZE * E12_SIZE)
|
||||
* 2 component combinations including redundant swappable terms are for the moment
|
||||
* 72 combinations for E1
|
||||
* 512 combinations for E3
|
||||
* 1922 combinations for E6
|
||||
* 7442 combinations for E12
|
||||
*/
|
||||
|
||||
#define MAX_CMB 7442 // maximum combinations for E12
|
||||
|
||||
std::array<r_data,MAX_CMB> cmb_lut; // intermediate 2R combinations
|
||||
std::array<r_data,S4R+1> results; // 2R, 3R and 4R results
|
||||
uint32_t rb_state = E6; // Radio Button State
|
||||
uint32_t cb_state = false; // Check Box 4R enable
|
||||
double reqR; // required Resistor
|
||||
|
||||
/**
|
||||
* Build all 2R combinations from the selected E-serie values
|
||||
*
|
||||
* Pre-calculated value combinations are saved in intermediate look up table cmb_lut
|
||||
* @return is the number of found combinations what also depends from exclude values
|
||||
*/
|
||||
uint32_t combine2( void );
|
||||
|
||||
/**
|
||||
* Search for closest two component solution
|
||||
*
|
||||
* @param aSize is the number of valid 2R combinations in cmb_lut on where to search
|
||||
* The 2R result with smallest deviation will be saved in results
|
||||
*/
|
||||
void simple_solution( uint32_t aSize );
|
||||
|
||||
/**
|
||||
* Check if there is a better 3 R solution than previous one using only two components.
|
||||
*
|
||||
* @param aSize gives the number of available combinations to be checked inside cmb_lut
|
||||
* Therefore cmb_lut is combinated with the primary E-serie look up table
|
||||
* The 3R result with smallest deviation will be saved in results if better than 2R
|
||||
*/
|
||||
void combine3( uint32_t aSize );
|
||||
|
||||
/**
|
||||
* Check if there is a better four component solution.
|
||||
*
|
||||
* @param aSsize gives the number of 2R combinations to be checked inside cmb_lut
|
||||
* Occupied calculation time depends from number of available E-serie values
|
||||
* with the power of 4 why execution for E12 is conditional with 4R check box
|
||||
* for the case the previously found 3R solution is already exact
|
||||
*/
|
||||
void combine4( uint32_t aSize );
|
||||
|
||||
/*
|
||||
* Strip redundant braces from three component result
|
||||
*
|
||||
* Example: R1+(R2+R3) become R1+R2+R3
|
||||
* and R1|(R2|R3) become R1|R2|R3
|
||||
* while R1+(R2|R3) or (R1+R2)|R3) remains untouched
|
||||
*/
|
||||
void strip3( void );
|
||||
|
||||
/*
|
||||
* Strip redundant braces from four component result
|
||||
*
|
||||
* Example: (R1+R2)+(R3+R4) become R1+R2+R3+R4
|
||||
* and (R1|R2)|(R2|R3) become R1|R2|R3|R4
|
||||
* while (R1+R2)|(R3+R4) remains untouched
|
||||
*/
|
||||
void strip4( void );
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* If any value of the selected E-serie not available, it can be entered as an exclude value.
|
||||
*
|
||||
* @param aValue is the value to exclude from calculation
|
||||
* Values to exclude are set to false in the selected E-serie source lookup table
|
||||
*/
|
||||
void exclude( double aValue );
|
||||
|
||||
/**
|
||||
* initialize next calculation and erase results from previous calculation
|
||||
*/
|
||||
void new_calc( void );
|
||||
|
||||
/**
|
||||
* called on calculate button to execute all the 2R, 3R and 4R calculations
|
||||
*/
|
||||
void calculate( void );
|
||||
|
||||
/**
|
||||
* Interface for CheckBox, RadioButton, RequriedResistor and calculated Results
|
||||
*/
|
||||
void set_rb ( uint32_t a_rb );
|
||||
void set_reqR ( double aR );
|
||||
std::array<r_data,S4R+1> get_rslt ( void );
|
||||
std::array<r_data, MAX_CMB> m_cmb_lut; // intermediate 2R combinations
|
||||
std::array<r_data, S4R+1> m_results; // 2R, 3R and 4R results
|
||||
uint32_t m_series = E6; // Radio Button State
|
||||
uint32_t m_enable_4R = false; // Check Box 4R enable
|
||||
double m_required_value; // required Resistor
|
||||
};
|
||||
|
|
|
@ -3,10 +3,10 @@ _HKI( "E-series defined in IEC 60063 are a widely accepted system of preferred\n
|
|||
"numbers for electronic components. Available values are approximately\n"
|
||||
"equally spaced in a logarithmic scale.\n"
|
||||
"\n"
|
||||
" E12: 1,0 1,2 1,5 1,8 2,2 2,7 3,3 3,9 4,7 5,6 6,8 8,2\n"
|
||||
" E6: 1,0 - 1,5 - 2,2 - 3,3 - 4,7 - 6,8 -\n"
|
||||
" E3: 1,0 - - - 2,2 - - - 4,7 - - -\n"
|
||||
" E1: 1,0 - - - - - - - - - - -\n"
|
||||
" E12: 1.0 1.2 1.5 1.8 2.2 2.7 3.3 3.9 4.7 5.6 6.8 8.2\n"
|
||||
" E6: 1.0 - 1.5 - 2.2 - 3.3 - 4.7 - 6.8 -\n"
|
||||
" E3: 1.0 - - - 2.2 - - - 4.7 - - -\n"
|
||||
" E1: 1.0 - - - - - - - - - - -\n"
|
||||
"\n"
|
||||
"This calculator finds combinations of standard E-series components to\n"
|
||||
"create arbitrary values. You can enter the required resistance from 0,0025 to 4000 kOhm. \n"
|
||||
|
|
|
@ -2,10 +2,10 @@ E-series defined in IEC 60063 are a widely accepted system of preferred
|
|||
numbers for electronic components. Available values are approximately
|
||||
equally spaced in a logarithmic scale.
|
||||
|
||||
E12: 1,0 1,2 1,5 1,8 2,2 2,7 3,3 3,9 4,7 5,6 6,8 8,2
|
||||
E6: 1,0 - 1,5 - 2,2 - 3,3 - 4,7 - 6,8 -
|
||||
E3: 1,0 - - - 2,2 - - - 4,7 - - -
|
||||
E1: 1,0 - - - - - - - - - - -
|
||||
E12: 1.0 1.2 1.5 1.8 2.2 2.7 3.3 3.9 4.7 5.6 6.8 8.2
|
||||
E6: 1.0 - 1.5 - 2.2 - 3.3 - 4.7 - 6.8 -
|
||||
E3: 1.0 - - - 2.2 - - - 4.7 - - -
|
||||
E1: 1.0 - - - - - - - - - - -
|
||||
|
||||
This calculator finds combinations of standard E-series components to
|
||||
create arbitrary values. You can enter the required resistance from 0,0025 to 4000 kOhm.
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
#include <bitmaps.h>
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <kiface_i.h>
|
||||
#include "bitmaps/color_code_value_and_name.xpm"
|
||||
#include "bitmaps/color_code_value.xpm"
|
||||
#include "bitmaps/color_code_multiplier.xpm"
|
||||
#include "bitmaps/color_code_tolerance.xpm"
|
||||
#include "bitmaps/via_dims.xpm"
|
||||
#include "attenuators/attenuator_classes.h"
|
||||
#include "class_regulator_data.h"
|
||||
#include "pcb_calculator_frame.h"
|
||||
|
@ -51,8 +48,9 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_TWMode = TW_MASTER_CURRENT;
|
||||
m_TWNested = false;
|
||||
|
||||
// TODO: make regulator bitmaps transparent so we can remove this
|
||||
// TODO: make regulator & via bitmaps transparent so we can remove these
|
||||
m_panelRegulatorBitmaps->SetBackgroundColour( *wxWHITE );
|
||||
m_panelViaBitmap->SetBackgroundColour( *wxWHITE );
|
||||
|
||||
SHAPE_POLY_SET dummy; // A ugly trick to force the linker to include
|
||||
// some methods in code and avoid link errors
|
||||
|
@ -91,9 +89,10 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
TranslineTypeSelection( m_currTransLineType );
|
||||
m_TranslineSelection->SetSelection( m_currTransLineType );
|
||||
|
||||
TW_Init(); // Track Width
|
||||
VS_Init(); // Via Size
|
||||
ES_Init(); // E-Series
|
||||
initTrackWidthPanel();
|
||||
initColorCodePanel();
|
||||
initViaSizePanel();
|
||||
initESeriesPanel();
|
||||
|
||||
SetAttenuator( m_AttenuatorsSelection->GetSelection() );
|
||||
|
||||
|
@ -137,6 +136,11 @@ PCB_CALCULATOR_FRAME::~PCB_CALCULATOR_FRAME()
|
|||
for( unsigned ii = 0; ii < m_attenuator_list.size(); ii++ )
|
||||
delete m_attenuator_list[ii];
|
||||
|
||||
delete m_ccValueNamesBitmap;
|
||||
delete m_ccValuesBitmap;
|
||||
delete m_ccMultipliersBitmap;
|
||||
delete m_ccTolerancesBitmap;
|
||||
|
||||
// This needed for OSX: avoids furter OnDraw processing after this destructor and before
|
||||
// the native window is destroyed
|
||||
this->Freeze();
|
||||
|
@ -165,19 +169,13 @@ void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
static wxBitmap* valueNameBitmap = new wxBitmap( color_code_value_and_name_xpm );
|
||||
m_Band1bitmap->SetBitmap( *valueNameBitmap );
|
||||
ToleranceSelection( m_rbToleranceSelection->GetSelection() );
|
||||
|
||||
static wxBitmap* valueBitmap = new wxBitmap( color_code_value_xpm );
|
||||
m_Band2bitmap->SetBitmap( *valueBitmap );
|
||||
m_Band3bitmap->SetBitmap( *valueBitmap );
|
||||
m_Band4bitmap->SetBitmap( *valueBitmap );
|
||||
static wxBitmap* viaBitmap = new wxBitmap( via_dims_xpm );
|
||||
m_viaBitmap->SetBitmap( *viaBitmap );
|
||||
|
||||
static wxBitmap* multiplierBitmap = new wxBitmap( color_code_multiplier_xpm );
|
||||
m_Band_mult_bitmap->SetBitmap( *multiplierBitmap );
|
||||
|
||||
static wxBitmap* toleranceBitmap = new wxBitmap( color_code_tolerance_xpm );
|
||||
m_Band_tol_bitmap->SetBitmap( *toleranceBitmap );
|
||||
m_panelESeriesHelp->Refresh();
|
||||
m_htmlWinFormulas->Refresh();
|
||||
|
||||
// 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.
|
||||
|
@ -288,9 +286,9 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
Regulators_WriteConfig( cfg );
|
||||
}
|
||||
|
||||
TW_WriteConfig();
|
||||
writeTrackWidthConfig();
|
||||
|
||||
VS_WriteConfig();
|
||||
writeViaSizeConfig();
|
||||
|
||||
for( unsigned ii = 0; ii < m_transline_list.size(); ii++ )
|
||||
m_transline_list[ii]->WriteConfig();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2020 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* 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
|
||||
|
@ -17,10 +17,6 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file pcb_calculator.h
|
||||
*/
|
||||
|
||||
#ifndef PCB_CALCULATOR_H
|
||||
#define PCB_CALCULATOR_H
|
||||
|
||||
|
@ -38,42 +34,15 @@ class KIWAY;
|
|||
class PCB_CALCULATOR_SETTINGS;
|
||||
|
||||
|
||||
/* Class PCB_CALCULATOR_FRAME_BASE
|
||||
This is the main frame for this application
|
||||
*/
|
||||
/*
|
||||
* Class PCB_CALCULATOR_FRAME_BASE
|
||||
* This is the main frame for this application
|
||||
*/
|
||||
class PCB_CALCULATOR_FRAME : public PCB_CALCULATOR_FRAME_BASE
|
||||
{
|
||||
public:
|
||||
REGULATOR_LIST m_RegulatorList; // the list of known regulator
|
||||
|
||||
private:
|
||||
bool m_RegulatorListChanged; // set to true when m_RegulatorList
|
||||
// was modified, and the corresponging file
|
||||
// must be rewritten
|
||||
|
||||
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;
|
||||
TRANSLINE* m_currTransLine; // a pointer to the active transline
|
||||
// List of translines: ordered like in dialog menu list
|
||||
std::vector<TRANSLINE_IDENT*> m_transline_list;
|
||||
|
||||
ATTENUATOR* m_currAttenuator;
|
||||
// List ofattenuators: ordered like in dialog menu list
|
||||
std::vector<ATTENUATOR*> m_attenuator_list;
|
||||
wxString m_lastSelectedRegulatorName; // last regulator name selected
|
||||
|
||||
int m_lastNotebookPage;
|
||||
int m_lastRadioButton;
|
||||
|
||||
public:
|
||||
PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
~PCB_CALCULATOR_FRAME();
|
||||
|
||||
|
@ -103,24 +72,17 @@ private:
|
|||
*/
|
||||
void SetDataFilename( const wxString& aFilename );
|
||||
|
||||
// Trace width / maximum current capability calculations.
|
||||
/**
|
||||
* Function TW_Init
|
||||
* Read config and init dialog widgets values
|
||||
* Panel-specific initializers
|
||||
*/
|
||||
void TW_Init();
|
||||
|
||||
/**
|
||||
* E-Series Resistor calculator Panel
|
||||
* Called on calculator start to display markdown formula explanations
|
||||
*/
|
||||
void ES_Init( void );
|
||||
void initTrackWidthPanel();
|
||||
void initESeriesPanel();
|
||||
void initColorCodePanel();
|
||||
void initViaSizePanel();
|
||||
|
||||
/**
|
||||
* Called on calculate button and executes all E-series calculations
|
||||
*
|
||||
*/
|
||||
|
||||
void OnCalculateESeries( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
|
@ -130,10 +92,10 @@ private:
|
|||
void OnESeriesSelection( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function TW_WriteConfig
|
||||
* Function writeTrackWidthConfig
|
||||
* Write Track width parameters in config
|
||||
*/
|
||||
void TW_WriteConfig();
|
||||
void writeTrackWidthConfig();
|
||||
|
||||
/**
|
||||
* Function OnTWParametersChanged
|
||||
|
@ -199,19 +161,11 @@ private:
|
|||
*/
|
||||
void TWUpdateModeDisplay();
|
||||
|
||||
// Via size calculations
|
||||
|
||||
/**
|
||||
* Function VS_Init
|
||||
* Read config and init dialog widgets values
|
||||
*/
|
||||
void VS_Init();
|
||||
|
||||
/**
|
||||
* Function VS_WriteConfig
|
||||
* Function writeViaSizeConfig
|
||||
* Write Via Size parameters in config
|
||||
*/
|
||||
void VS_WriteConfig();
|
||||
void writeViaSizeConfig();
|
||||
|
||||
/**
|
||||
* Function OnViaCalculate
|
||||
|
@ -235,10 +189,9 @@ private:
|
|||
void onUpdateViaCalcErrorText( wxUpdateUIEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnViaResetButtonClick
|
||||
* Called when the user clicks the reset button. This sets
|
||||
* the parameters to their default values.
|
||||
*/
|
||||
* Function OnViaResetButtonClick
|
||||
* Called when the user clicks the reset button; sets the parameters to their default values.
|
||||
*/
|
||||
void OnViaResetButtonClick( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
|
@ -255,69 +208,65 @@ private:
|
|||
void OnElectricalSpacingRefresh( wxCommandEvent& event ) override;
|
||||
void ElectricalSpacingUpdateData( double aUnitScale );
|
||||
|
||||
// Transline functions:
|
||||
/**
|
||||
* Function OnTranslineSelection
|
||||
* Called on new transmission line selection
|
||||
*/
|
||||
*/
|
||||
void OnTranslineSelection( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTransLineResetButtonClick
|
||||
* Called when the user clicks the reset button. This sets
|
||||
* the parameters to their default values.
|
||||
*/
|
||||
* Called when the user clicks the reset button; sets the parameters to their default values.
|
||||
*/
|
||||
void OnTransLineResetButtonClick( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTranslineAnalyse
|
||||
* Run a new analyse for the current transline with current parameters
|
||||
* and displays the electrical parameters
|
||||
* Run a new analyse for the current transline with current parameters and displays the
|
||||
* electrical parameters
|
||||
*/
|
||||
void OnTranslineAnalyse( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTranslineSynthetize
|
||||
* Run a new synthezis for the current transline with current parameters
|
||||
* and displays the geometrical parameters
|
||||
* Run a new synthezis for the current transline with current parameters and displays the
|
||||
* geometrical parameters
|
||||
*/
|
||||
void OnTranslineSynthetize( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTranslineEpsilonR_Button
|
||||
* Shows a list of current relative dielectric constant(Er)
|
||||
* and set the selected value in main dialog frame
|
||||
* Shows a list of current relative dielectric constant(Er) and set the selected value in
|
||||
* main dialog frame
|
||||
*/
|
||||
void OnTranslineEpsilonR_Button( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTranslineTanD_Button
|
||||
* Shows a list of current dielectric loss factor (tangent delta)
|
||||
* and set the selected value in main dialog frame
|
||||
* Shows a list of current dielectric loss factor (tangent delta) and set the selected value
|
||||
* in main dialog frame
|
||||
*/
|
||||
void OnTranslineTanD_Button( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTranslineRho_Button
|
||||
* Shows a list of current Specific resistance list (rho)
|
||||
* and set the selected value in main dialog frame
|
||||
* Shows a list of current Specific resistance list (rho) and set the selected value in main
|
||||
* dialog frame
|
||||
*/
|
||||
void OnTranslineRho_Button( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function TranslineTypeSelection
|
||||
* Must be called after selection of a new transline.
|
||||
* Update all values, labels and tool tips of parameters needed
|
||||
* by the new transline
|
||||
* Irrelevant parameters texts are blanked.
|
||||
* Must be called after selection of a new transline. Update all values, labels and tool
|
||||
* tips of parameters needed by the new transline; irrelevant parameters are blanked.
|
||||
* @param aType = the TRANSLINE_TYPE_ID of the new selected transline
|
||||
*/
|
||||
void TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType );
|
||||
|
||||
/**
|
||||
* Function TransfDlgDataToTranslineParams
|
||||
* Read values entered in dialog frame, and transfert these
|
||||
* values in current transline parameters, converted in normalized units
|
||||
* Read values entered in dialog frame, and transfert these values in current transline
|
||||
* parameters, converted in normalized units
|
||||
*/
|
||||
void TransfDlgDataToTranslineParams();
|
||||
|
||||
|
@ -352,11 +301,7 @@ private:
|
|||
|
||||
/**
|
||||
* Function SelectLastSelectedRegulator
|
||||
* select in choice box the last selected regulator
|
||||
* (name in m_lastSelectedRegulatorName)
|
||||
* and update the displayed values.
|
||||
* if m_lastSelectedRegulatorName is empty, just calls
|
||||
* RegulatorPageUpdate()
|
||||
* If m_lastSelectedRegulatorName is empty, just calls RegulatorPageUpdate()
|
||||
*/
|
||||
void SelectLastSelectedRegulator();
|
||||
|
||||
|
@ -417,6 +362,35 @@ public:
|
|||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_RegulatorListChanged; // Set when m_RegulatorList is modified and the corresponging file
|
||||
// must be rewritten
|
||||
|
||||
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;
|
||||
TRANSLINE* m_currTransLine;
|
||||
std::vector<TRANSLINE_IDENT*> m_transline_list;
|
||||
|
||||
ATTENUATOR* m_currAttenuator;
|
||||
std::vector<ATTENUATOR*> m_attenuator_list;
|
||||
|
||||
wxString m_lastSelectedRegulatorName;
|
||||
|
||||
wxBitmap* m_ccValueNamesBitmap;
|
||||
wxBitmap* m_ccValuesBitmap;
|
||||
wxBitmap* m_ccMultipliersBitmap;
|
||||
wxBitmap* m_ccTolerancesBitmap;
|
||||
|
||||
int m_lastNotebookPage;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ wxString tracks_width_versus_current_formula =
|
|||
extern double DoubleFromString( const wxString& TextValue );
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::TW_WriteConfig()
|
||||
void PCB_CALCULATOR_FRAME::writeTrackWidthConfig()
|
||||
{
|
||||
// Save current parameters values in config.
|
||||
auto cfg = static_cast<PCB_CALCULATOR_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
|
@ -414,7 +414,7 @@ double PCB_CALCULATOR_FRAME::TWCalculateCurrent( double aWidth, double aThicknes
|
|||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::TW_Init()
|
||||
void PCB_CALCULATOR_FRAME::initTrackWidthPanel()
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ void PCB_CALCULATOR_FRAME::OnViaResetButtonClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::VS_Init()
|
||||
void PCB_CALCULATOR_FRAME::initViaSizePanel()
|
||||
{
|
||||
auto cfg = static_cast<PCB_CALCULATOR_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
|
||||
|
@ -152,7 +152,8 @@ void PCB_CALCULATOR_FRAME::VS_Init()
|
|||
m_textCtrlRiseTime->SetValue( cfg->m_ViaSize.pulse_rise_time );
|
||||
}
|
||||
|
||||
void PCB_CALCULATOR_FRAME::VS_WriteConfig()
|
||||
|
||||
void PCB_CALCULATOR_FRAME::writeViaSizeConfig()
|
||||
{
|
||||
auto cfg = static_cast<PCB_CALCULATOR_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
|
||||
|
@ -175,6 +176,7 @@ void PCB_CALCULATOR_FRAME::VS_WriteConfig()
|
|||
cfg->m_ViaSize.pulse_rise_time = m_textCtrlRiseTime->GetValue();
|
||||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::OnViaCalculate( wxCommandEvent& event )
|
||||
{
|
||||
// Load parameters
|
||||
|
|
Loading…
Reference in New Issue