pcb_calculator rework: move attenuators panel to its own files panel_attenuators_xx
This commit is contained in:
parent
bf8a020501
commit
21d3662ed3
|
@ -9,7 +9,6 @@ include_directories(
|
|||
|
||||
set( PCB_CALCULATOR_SRCS
|
||||
eserie.cpp
|
||||
attenuators.cpp
|
||||
board_classes_values.cpp
|
||||
colorcode.cpp
|
||||
common_data.cpp
|
||||
|
@ -18,6 +17,7 @@ set( PCB_CALCULATOR_SRCS
|
|||
pcb_calculator_frame.cpp
|
||||
pcb_calculator_settings.cpp
|
||||
datafile_read_write.cpp
|
||||
panel_attenuators.cpp
|
||||
panel_regulator.cpp
|
||||
tracks_width_versus_current.cpp
|
||||
via.cpp
|
||||
|
@ -36,6 +36,7 @@ set( PCB_CALCULATOR_SRCS
|
|||
dialogs/pcb_calculator_frame_base.cpp
|
||||
dialogs/dialog_regulator_form_base.cpp
|
||||
dialogs/dialog_regulator_form.cpp
|
||||
dialogs/panel_attenuators_base.cpp
|
||||
dialogs/panel_regulator_base.cpp
|
||||
../common/env_vars.cpp # needed on MSW to avoid a link issue (a symbol not found)
|
||||
)
|
||||
|
|
|
@ -1,160 +0,0 @@
|
|||
/**
|
||||
* @file attenuators.cpp
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 jean-pierre.charras
|
||||
* Copyright (C) 2015 Kicad Developers, see change_log.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 2
|
||||
* 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, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <string_utils.h>
|
||||
|
||||
#include "pcb_calculator_frame.h"
|
||||
|
||||
extern double DoubleFromString( const wxString& TextValue );
|
||||
|
||||
// Called on a attenuator selection
|
||||
void PCB_CALCULATOR_FRAME::OnAttenuatorSelection( wxCommandEvent& event )
|
||||
{
|
||||
SetAttenuator( (unsigned) event.GetSelection() );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::SetAttenuator( unsigned aIdx )
|
||||
{
|
||||
if( aIdx >=m_attenuator_list.size() )
|
||||
aIdx = m_attenuator_list.size() - 1;
|
||||
|
||||
m_currAttenuator = m_attenuator_list[aIdx];
|
||||
TransfAttenuatorDataToPanel();
|
||||
m_Attenuator_Messages->SetPage( wxEmptyString );
|
||||
m_Att_R1_Value->SetValue( wxEmptyString );
|
||||
m_Att_R2_Value->SetValue( wxEmptyString );
|
||||
m_Att_R3_Value->SetValue( wxEmptyString );
|
||||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::OnCalculateAttenuator( wxCommandEvent& event )
|
||||
{
|
||||
TransfPanelDataToAttenuator();
|
||||
m_currAttenuator->Calculate();
|
||||
TransfAttenuatorResultsToPanel();
|
||||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::TransfPanelDataToAttenuator()
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
msg = m_AttValueCtrl->GetValue();
|
||||
m_currAttenuator->m_Attenuation = DoubleFromString(msg);
|
||||
msg = m_ZinValueCtrl->GetValue();
|
||||
m_currAttenuator->m_Zin = DoubleFromString(msg);
|
||||
msg = m_ZoutValueCtrl->GetValue();
|
||||
m_currAttenuator->m_Zout = DoubleFromString(msg);
|
||||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::TransfAttenuatorDataToPanel()
|
||||
{
|
||||
m_attenuatorBitmap->SetBitmap( *m_currAttenuator->m_SchBitMap );
|
||||
|
||||
wxString msg;
|
||||
|
||||
msg.Printf( wxT( "%g" ), m_currAttenuator->m_Attenuation );
|
||||
m_AttValueCtrl->SetValue( msg );
|
||||
m_AttValueCtrl->Enable( m_currAttenuator->m_Attenuation_Enable );
|
||||
|
||||
m_ZinValueCtrl->Enable( m_currAttenuator->m_Zin_Enable );
|
||||
|
||||
if( m_currAttenuator->m_Zin_Enable )
|
||||
msg.Printf( wxT( "%g" ), m_currAttenuator->m_Zin );
|
||||
else
|
||||
msg.Clear();
|
||||
|
||||
m_ZinValueCtrl->SetValue( msg );
|
||||
|
||||
msg.Printf( wxT( "%g" ), m_currAttenuator->m_Zout );
|
||||
m_ZoutValueCtrl->SetValue( msg );
|
||||
|
||||
if( m_currAttenuator->m_FormulaName )
|
||||
{
|
||||
if( m_currAttenuator->m_FormulaName->StartsWith( "<!" ) )
|
||||
{
|
||||
m_panelAttFormula->SetPage( *m_currAttenuator->m_FormulaName );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString html_txt;
|
||||
ConvertMarkdown2Html( wxGetTranslation( *m_currAttenuator->m_FormulaName ), html_txt );
|
||||
m_panelAttFormula->SetPage( html_txt );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_panelAttFormula->SetPage( wxEmptyString );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::TransfAttenuatorResultsToPanel()
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
m_Attenuator_Messages->SetPage( wxEmptyString );
|
||||
|
||||
if( m_currAttenuator->m_Error )
|
||||
{
|
||||
msg.Printf( _( "Attenuation more than %f dB" ),
|
||||
m_currAttenuator->m_MinimumATT );
|
||||
m_Attenuator_Messages->AppendToPage( wxT( "<br><b>Error!</b></br><br><em>" ) );
|
||||
m_Attenuator_Messages->AppendToPage( msg );
|
||||
m_Attenuator_Messages->AppendToPage( wxT( "</em></br>" ) );
|
||||
|
||||
// Display -- as resistor values:
|
||||
msg = wxT( "--" );
|
||||
m_Att_R1_Value->SetValue( msg );
|
||||
m_Att_R2_Value->SetValue( msg );
|
||||
if( m_currAttenuator->m_ResultCount >= 3 )
|
||||
m_Att_R3_Value->SetValue( msg );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
msg.Printf( wxT( "%g" ), m_currAttenuator->m_R1 );
|
||||
m_Att_R1_Value->SetValue( msg );
|
||||
msg.Printf( wxT( "%g" ), m_currAttenuator->m_R2 );
|
||||
m_Att_R2_Value->SetValue( msg );
|
||||
|
||||
if( m_currAttenuator->m_ResultCount < 3 )
|
||||
{
|
||||
m_Att_R3_Value->SetValue( wxEmptyString );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( wxT( "%g" ), m_currAttenuator->m_R3 );
|
||||
m_Att_R3_Value->SetValue( msg );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 3
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PANEL_ATTENUATORS_H
|
||||
#define PANEL_ATTENUATORS_H
|
||||
#include "panel_attenuators_base.h"
|
||||
|
||||
class ATTENUATOR;
|
||||
|
||||
class PANEL_ATTENUATORS : public PANEL_ATTENUATORS_BASE
|
||||
{
|
||||
public:
|
||||
PANEL_ATTENUATORS( wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
~PANEL_ATTENUATORS();
|
||||
|
||||
wxRadioBox* GetAttenuatorsSelector() { return m_AttenuatorsSelection; }
|
||||
void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg );
|
||||
void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg );
|
||||
void UpdateUI(); // Update bitmaps
|
||||
|
||||
void OnAttenuatorSelection( wxCommandEvent& event ) override;
|
||||
void SetAttenuator( unsigned aIdx );
|
||||
void OnCalculateAttenuator( wxCommandEvent& event ) override;
|
||||
void TransfPanelDataToAttenuator();
|
||||
void TransfAttenuatorDataToPanel();
|
||||
void TransfAttenuatorResultsToPanel();
|
||||
|
||||
public:
|
||||
ATTENUATOR* m_CurrAttenuator;
|
||||
std::vector<ATTENUATOR*> m_AttenuatorList;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,195 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "panel_attenuators_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_ATTENUATORS_BASE::PANEL_ATTENUATORS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||
{
|
||||
wxBoxSizer* bSizerAtt;
|
||||
bSizerAtt = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bLeftSizerAtt;
|
||||
bLeftSizerAtt = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
bLeftSizerAtt->SetMinSize( wxSize( 260,-1 ) );
|
||||
wxString m_AttenuatorsSelectionChoices[] = { _("PI"), _("Tee"), _("Bridged tee"), _("Resistive splitter") };
|
||||
int m_AttenuatorsSelectionNChoices = sizeof( m_AttenuatorsSelectionChoices ) / sizeof( wxString );
|
||||
m_AttenuatorsSelection = new wxRadioBox( this, wxID_ANY, _("Attenuators"), wxDefaultPosition, wxDefaultSize, m_AttenuatorsSelectionNChoices, m_AttenuatorsSelectionChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_AttenuatorsSelection->SetSelection( 2 );
|
||||
bLeftSizerAtt->Add( m_AttenuatorsSelection, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
bLeftSizerAtt->Add( 0, 5, 0, wxEXPAND, 5 );
|
||||
|
||||
m_attenuatorBitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bLeftSizerAtt->Add( m_attenuatorBitmap, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10 );
|
||||
|
||||
|
||||
bSizerAtt->Add( bLeftSizerAtt, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bMiddleSizerAtt;
|
||||
bMiddleSizerAtt = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbSizerAttPrms;
|
||||
sbSizerAttPrms = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Parameters") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerAttPrms;
|
||||
fgSizerAttPrms = new wxFlexGridSizer( 3, 3, 3, 0 );
|
||||
fgSizerAttPrms->AddGrowableRow( 1 );
|
||||
fgSizerAttPrms->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerAttPrms->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_attenuationLabel = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Attenuation:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attenuationLabel->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_attenuationLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_AttValueCtrl = new wxTextCtrl( sbSizerAttPrms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttPrms->Add( m_AttValueCtrl, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_attUnit = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("dB"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attUnit->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_attUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_attenuationZinLabel = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Zin:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attenuationZinLabel->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_attenuationZinLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_ZinValueCtrl = new wxTextCtrl( sbSizerAttPrms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttPrms->Add( m_ZinValueCtrl, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_attZinUnit = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attZinUnit->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_attZinUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_ZoutLabel = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Zout:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ZoutLabel->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_ZoutLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_ZoutValueCtrl = new wxTextCtrl( sbSizerAttPrms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttPrms->Add( m_ZoutValueCtrl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_attZoutUnit = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attZoutUnit->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_attZoutUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
sbSizerAttPrms->Add( fgSizerAttPrms, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bMiddleSizerAtt->Add( sbSizerAttPrms, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerAttButt;
|
||||
bSizerAttButt = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_buttonAlcAtt = new wxButton( this, wxID_ANY, _("Calculate"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerAttButt->Add( m_buttonAlcAtt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_bpButtonCalcAtt = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizerAttButt->Add( m_bpButtonCalcAtt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bMiddleSizerAtt->Add( bSizerAttButt, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerAttValues;
|
||||
sbSizerAttValues = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Values") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerAttResults;
|
||||
fgSizerAttResults = new wxFlexGridSizer( 3, 3, 3, 0 );
|
||||
fgSizerAttResults->AddGrowableCol( 1 );
|
||||
fgSizerAttResults->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerAttResults->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_attenuatorR1Label = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("R1:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attenuatorR1Label->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attenuatorR1Label, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_Att_R1_Value = new wxTextCtrl( sbSizerAttValues->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttResults->Add( m_Att_R1_Value, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_attR1Unit = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attR1Unit->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attR1Unit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_attenuatorR2Label = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("R2:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attenuatorR2Label->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attenuatorR2Label, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_Att_R2_Value = new wxTextCtrl( sbSizerAttValues->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttResults->Add( m_Att_R2_Value, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_attR2Unit = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attR2Unit->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attR2Unit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_attenuatorR3Label = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("R3:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attenuatorR3Label->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attenuatorR3Label, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_Att_R3_Value = new wxTextCtrl( sbSizerAttValues->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttResults->Add( m_Att_R3_Value, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_attR3Unit = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attR3Unit->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attR3Unit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
sbSizerAttValues->Add( fgSizerAttResults, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bMiddleSizerAtt->Add( sbSizerAttValues, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerMessages;
|
||||
bSizerMessages = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizerIndentLabel;
|
||||
bSizerIndentLabel = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextAttMsg = new wxStaticText( this, wxID_ANY, _("Messages"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextAttMsg->Wrap( -1 );
|
||||
bSizerIndentLabel->Add( m_staticTextAttMsg, 0, wxALL, 2 );
|
||||
|
||||
|
||||
bSizerMessages->Add( bSizerIndentLabel, 0, wxLEFT, 6 );
|
||||
|
||||
m_Attenuator_Messages = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_NO_SELECTION|wxHW_SCROLLBAR_AUTO );
|
||||
bSizerMessages->Add( m_Attenuator_Messages, 1, wxEXPAND|wxBOTTOM|wxRIGHT, 8 );
|
||||
|
||||
|
||||
bMiddleSizerAtt->Add( bSizerMessages, 1, wxEXPAND|wxLEFT, 3 );
|
||||
|
||||
|
||||
bSizerAtt->Add( bMiddleSizerAtt, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbRightSizerFormula;
|
||||
sbRightSizerFormula = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Formula") ), wxVERTICAL );
|
||||
|
||||
m_panelAttFormula = new wxHtmlWindow( sbRightSizerFormula->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
|
||||
sbRightSizerFormula->Add( m_panelAttFormula, 1, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizerAtt->Add( sbRightSizerFormula, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerAtt );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
m_AttenuatorsSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PANEL_ATTENUATORS_BASE::OnAttenuatorSelection ), NULL, this );
|
||||
m_buttonAlcAtt->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_ATTENUATORS_BASE::OnCalculateAttenuator ), NULL, this );
|
||||
m_bpButtonCalcAtt->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_ATTENUATORS_BASE::OnCalculateAttenuator ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_ATTENUATORS_BASE::~PANEL_ATTENUATORS_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_AttenuatorsSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PANEL_ATTENUATORS_BASE::OnAttenuatorSelection ), NULL, this );
|
||||
m_buttonAlcAtt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_ATTENUATORS_BASE::OnCalculateAttenuator ), NULL, this );
|
||||
m_bpButtonCalcAtt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_ATTENUATORS_BASE::OnCalculateAttenuator ), NULL, this );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,80 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_ATTENUATORS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PANEL_ATTENUATORS_BASE : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxRadioBox* m_AttenuatorsSelection;
|
||||
wxStaticBitmap* m_attenuatorBitmap;
|
||||
wxStaticText* m_attenuationLabel;
|
||||
wxTextCtrl* m_AttValueCtrl;
|
||||
wxStaticText* m_attUnit;
|
||||
wxStaticText* m_attenuationZinLabel;
|
||||
wxTextCtrl* m_ZinValueCtrl;
|
||||
wxStaticText* m_attZinUnit;
|
||||
wxStaticText* m_ZoutLabel;
|
||||
wxTextCtrl* m_ZoutValueCtrl;
|
||||
wxStaticText* m_attZoutUnit;
|
||||
wxButton* m_buttonAlcAtt;
|
||||
wxBitmapButton* m_bpButtonCalcAtt;
|
||||
wxStaticText* m_attenuatorR1Label;
|
||||
wxTextCtrl* m_Att_R1_Value;
|
||||
wxStaticText* m_attR1Unit;
|
||||
wxStaticText* m_attenuatorR2Label;
|
||||
wxTextCtrl* m_Att_R2_Value;
|
||||
wxStaticText* m_attR2Unit;
|
||||
wxStaticText* m_attenuatorR3Label;
|
||||
wxTextCtrl* m_Att_R3_Value;
|
||||
wxStaticText* m_attR3Unit;
|
||||
wxStaticText* m_staticTextAttMsg;
|
||||
wxHtmlWindow* m_Attenuator_Messages;
|
||||
wxHtmlWindow* m_panelAttFormula;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnAttenuatorSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCalculateAttenuator( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
PANEL_ATTENUATORS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
~PANEL_ATTENUATORS_BASE();
|
||||
|
||||
};
|
||||
|
|
@ -24,175 +24,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_panelRegulators = new PANEL_REGULATOR( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_Notebook->AddPage( m_panelRegulators, _("Regulators"), true );
|
||||
m_panelAttenuators = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerAtt;
|
||||
bSizerAtt = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bLeftSizerAtt;
|
||||
bLeftSizerAtt = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
bLeftSizerAtt->SetMinSize( wxSize( 260,-1 ) );
|
||||
wxString m_AttenuatorsSelectionChoices[] = { _("PI"), _("Tee"), _("Bridged tee"), _("Resistive splitter") };
|
||||
int m_AttenuatorsSelectionNChoices = sizeof( m_AttenuatorsSelectionChoices ) / sizeof( wxString );
|
||||
m_AttenuatorsSelection = new wxRadioBox( m_panelAttenuators, wxID_ANY, _("Attenuators"), wxDefaultPosition, wxDefaultSize, m_AttenuatorsSelectionNChoices, m_AttenuatorsSelectionChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_AttenuatorsSelection->SetSelection( 2 );
|
||||
bLeftSizerAtt->Add( m_AttenuatorsSelection, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
bLeftSizerAtt->Add( 0, 5, 0, wxEXPAND, 5 );
|
||||
|
||||
m_attenuatorBitmap = new wxStaticBitmap( m_panelAttenuators, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bLeftSizerAtt->Add( m_attenuatorBitmap, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10 );
|
||||
|
||||
|
||||
bSizerAtt->Add( bLeftSizerAtt, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bMiddleSizerAtt;
|
||||
bMiddleSizerAtt = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbSizerAttPrms;
|
||||
sbSizerAttPrms = new wxStaticBoxSizer( new wxStaticBox( m_panelAttenuators, wxID_ANY, _("Parameters") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerAttPrms;
|
||||
fgSizerAttPrms = new wxFlexGridSizer( 3, 3, 3, 0 );
|
||||
fgSizerAttPrms->AddGrowableRow( 1 );
|
||||
fgSizerAttPrms->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerAttPrms->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_attenuationLabel = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Attenuation:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attenuationLabel->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_attenuationLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_AttValueCtrl = new wxTextCtrl( sbSizerAttPrms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttPrms->Add( m_AttValueCtrl, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_attUnit = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("dB"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attUnit->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_attUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_attenuationZinLabel = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Zin:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attenuationZinLabel->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_attenuationZinLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_ZinValueCtrl = new wxTextCtrl( sbSizerAttPrms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttPrms->Add( m_ZinValueCtrl, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_attZinUnit = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attZinUnit->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_attZinUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_ZoutLabel = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Zout:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ZoutLabel->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_ZoutLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_ZoutValueCtrl = new wxTextCtrl( sbSizerAttPrms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttPrms->Add( m_ZoutValueCtrl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_attZoutUnit = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attZoutUnit->Wrap( -1 );
|
||||
fgSizerAttPrms->Add( m_attZoutUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
sbSizerAttPrms->Add( fgSizerAttPrms, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bMiddleSizerAtt->Add( sbSizerAttPrms, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerAttButt;
|
||||
bSizerAttButt = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_buttonAlcAtt = new wxButton( m_panelAttenuators, wxID_ANY, _("Calculate"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerAttButt->Add( m_buttonAlcAtt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_bpButtonCalcAtt = new wxBitmapButton( m_panelAttenuators, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizerAttButt->Add( m_bpButtonCalcAtt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bMiddleSizerAtt->Add( bSizerAttButt, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerAttValues;
|
||||
sbSizerAttValues = new wxStaticBoxSizer( new wxStaticBox( m_panelAttenuators, wxID_ANY, _("Values") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerAttResults;
|
||||
fgSizerAttResults = new wxFlexGridSizer( 3, 3, 3, 0 );
|
||||
fgSizerAttResults->AddGrowableCol( 1 );
|
||||
fgSizerAttResults->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerAttResults->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_attenuatorR1Label = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("R1:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attenuatorR1Label->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attenuatorR1Label, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_Att_R1_Value = new wxTextCtrl( sbSizerAttValues->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttResults->Add( m_Att_R1_Value, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_attR1Unit = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attR1Unit->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attR1Unit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_attenuatorR2Label = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("R2:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attenuatorR2Label->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attenuatorR2Label, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_Att_R2_Value = new wxTextCtrl( sbSizerAttValues->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttResults->Add( m_Att_R2_Value, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_attR2Unit = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attR2Unit->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attR2Unit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_attenuatorR3Label = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("R3:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attenuatorR3Label->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attenuatorR3Label, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_Att_R3_Value = new wxTextCtrl( sbSizerAttValues->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerAttResults->Add( m_Att_R3_Value, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_attR3Unit = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_attR3Unit->Wrap( -1 );
|
||||
fgSizerAttResults->Add( m_attR3Unit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
sbSizerAttValues->Add( fgSizerAttResults, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bMiddleSizerAtt->Add( sbSizerAttValues, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerMessages;
|
||||
bSizerMessages = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizerIndentLabel;
|
||||
bSizerIndentLabel = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextAttMsg = new wxStaticText( m_panelAttenuators, wxID_ANY, _("Messages"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextAttMsg->Wrap( -1 );
|
||||
bSizerIndentLabel->Add( m_staticTextAttMsg, 0, wxALL, 2 );
|
||||
|
||||
|
||||
bSizerMessages->Add( bSizerIndentLabel, 0, wxLEFT, 6 );
|
||||
|
||||
m_Attenuator_Messages = new wxHtmlWindow( m_panelAttenuators, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_NO_SELECTION|wxHW_SCROLLBAR_AUTO );
|
||||
bSizerMessages->Add( m_Attenuator_Messages, 1, wxEXPAND|wxBOTTOM|wxRIGHT, 8 );
|
||||
|
||||
|
||||
bMiddleSizerAtt->Add( bSizerMessages, 1, wxEXPAND|wxLEFT, 3 );
|
||||
|
||||
|
||||
bSizerAtt->Add( bMiddleSizerAtt, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbRightSizerFormula;
|
||||
sbRightSizerFormula = new wxStaticBoxSizer( new wxStaticBox( m_panelAttenuators, wxID_ANY, _("Formula") ), wxVERTICAL );
|
||||
|
||||
m_panelAttFormula = new wxHtmlWindow( sbRightSizerFormula->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
|
||||
sbRightSizerFormula->Add( m_panelAttFormula, 1, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizerAtt->Add( sbRightSizerFormula, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
m_panelAttenuators->SetSizer( bSizerAtt );
|
||||
m_panelAttenuators->Layout();
|
||||
bSizerAtt->Fit( m_panelAttenuators );
|
||||
m_panelAttenuators = new PANEL_ATTENUATORS( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_Notebook->AddPage( m_panelAttenuators, _("RF Attenuators"), false );
|
||||
m_panelESeries = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerESerie;
|
||||
|
@ -1756,9 +1588,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) );
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) );
|
||||
m_AttenuatorsSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnAttenuatorSelection ), NULL, this );
|
||||
m_buttonAlcAtt->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateAttenuator ), NULL, this );
|
||||
m_bpButtonCalcAtt->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateAttenuator ), NULL, this );
|
||||
m_e1->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
|
||||
m_e3->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
|
||||
m_e6->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
|
||||
|
@ -1819,9 +1648,6 @@ PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE()
|
|||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) );
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) );
|
||||
m_AttenuatorsSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnAttenuatorSelection ), NULL, this );
|
||||
m_buttonAlcAtt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateAttenuator ), NULL, this );
|
||||
m_bpButtonCalcAtt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateAttenuator ), NULL, this );
|
||||
m_e1->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
|
||||
m_e3->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
|
||||
m_e6->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this );
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,6 +17,7 @@ class UNIT_SELECTOR_RESISTOR;
|
|||
class UNIT_SELECTOR_THICKNESS;
|
||||
|
||||
#include "panel_regulator.h"
|
||||
#include "panel_attenuators.h"
|
||||
#include "widgets/unit_selector.h"
|
||||
#include "kiway_player.h"
|
||||
#include <wx/string.h>
|
||||
|
@ -29,18 +30,18 @@ class UNIT_SELECTOR_THICKNESS;
|
|||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/frame.h>
|
||||
|
@ -59,32 +60,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
|
|||
wxMenuBar* m_menubar;
|
||||
wxNotebook* m_Notebook;
|
||||
PANEL_REGULATOR* m_panelRegulators;
|
||||
wxPanel* m_panelAttenuators;
|
||||
wxRadioBox* m_AttenuatorsSelection;
|
||||
wxStaticBitmap* m_attenuatorBitmap;
|
||||
wxStaticText* m_attenuationLabel;
|
||||
wxTextCtrl* m_AttValueCtrl;
|
||||
wxStaticText* m_attUnit;
|
||||
wxStaticText* m_attenuationZinLabel;
|
||||
wxTextCtrl* m_ZinValueCtrl;
|
||||
wxStaticText* m_attZinUnit;
|
||||
wxStaticText* m_ZoutLabel;
|
||||
wxTextCtrl* m_ZoutValueCtrl;
|
||||
wxStaticText* m_attZoutUnit;
|
||||
wxButton* m_buttonAlcAtt;
|
||||
wxBitmapButton* m_bpButtonCalcAtt;
|
||||
wxStaticText* m_attenuatorR1Label;
|
||||
wxTextCtrl* m_Att_R1_Value;
|
||||
wxStaticText* m_attR1Unit;
|
||||
wxStaticText* m_attenuatorR2Label;
|
||||
wxTextCtrl* m_Att_R2_Value;
|
||||
wxStaticText* m_attR2Unit;
|
||||
wxStaticText* m_attenuatorR3Label;
|
||||
wxTextCtrl* m_Att_R3_Value;
|
||||
wxStaticText* m_attR3Unit;
|
||||
wxStaticText* m_staticTextAttMsg;
|
||||
wxHtmlWindow* m_Attenuator_Messages;
|
||||
wxHtmlWindow* m_panelAttFormula;
|
||||
PANEL_ATTENUATORS* m_panelAttenuators;
|
||||
wxPanel* m_panelESeries;
|
||||
wxStaticText* m_ESrequired;
|
||||
wxTextCtrl* m_ResRequired;
|
||||
|
@ -351,8 +327,6 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
|
|||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnClosePcbCalc( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnAttenuatorSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCalculateAttenuator( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnESeriesSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCalculateESeries( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnToleranceSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
|
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2011 jean-pierre.charras
|
||||
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 3
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <wx/choicdlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
#include "pcb_calculator_settings.h"
|
||||
#include "attenuators/attenuator_classes.h"
|
||||
#include "../dialogs/panel_attenuators.h"
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <string_utils.h>
|
||||
#include <widgets/ui_common.h>
|
||||
|
||||
extern double DoubleFromString( const wxString& TextValue );
|
||||
|
||||
|
||||
PANEL_ATTENUATORS::PANEL_ATTENUATORS( wxWindow* parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name ) :
|
||||
PANEL_ATTENUATORS_BASE( parent, id, pos, size, style, name )
|
||||
{
|
||||
m_CurrAttenuator = nullptr;
|
||||
m_bpButtonCalcAtt->SetBitmap( KiBitmap( BITMAPS::small_down ) );
|
||||
|
||||
// Populate attenuator list ordered like in dialog menu list
|
||||
m_AttenuatorList.push_back( new ATTENUATOR_PI() );
|
||||
m_AttenuatorList.push_back( new ATTENUATOR_TEE() );
|
||||
m_AttenuatorList.push_back( new ATTENUATOR_BRIDGE() );
|
||||
m_AttenuatorList.push_back( new ATTENUATOR_SPLITTER() );
|
||||
m_CurrAttenuator = m_AttenuatorList[0];
|
||||
|
||||
m_staticTextAttMsg->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||
|
||||
m_attZinUnit->SetLabel( wxT( "Ω" ) );
|
||||
m_attZoutUnit->SetLabel( wxT( "Ω" ) );
|
||||
m_attR1Unit->SetLabel( wxT( "Ω" ) );
|
||||
m_attR2Unit->SetLabel( wxT( "Ω" ) );
|
||||
m_attR3Unit->SetLabel( wxT( "Ω" ) );
|
||||
}
|
||||
|
||||
|
||||
PANEL_ATTENUATORS::~PANEL_ATTENUATORS()
|
||||
{
|
||||
for( unsigned ii = 0; ii < m_AttenuatorList.size(); ii++ )
|
||||
delete m_AttenuatorList[ii];
|
||||
}
|
||||
|
||||
|
||||
void PANEL_ATTENUATORS::UpdateUI()
|
||||
{
|
||||
m_attenuatorBitmap->SetBitmap( *m_CurrAttenuator->m_SchBitMap );
|
||||
|
||||
m_attenuatorBitmap->GetParent()->Layout();
|
||||
m_attenuatorBitmap->GetParent()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void PANEL_ATTENUATORS::LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg )
|
||||
{
|
||||
wxASSERT( aCfg );
|
||||
|
||||
for( ATTENUATOR* attenuator : m_AttenuatorList )
|
||||
attenuator->ReadConfig();
|
||||
|
||||
m_AttenuatorsSelection->SetSelection( aCfg->m_Attenuators.type );
|
||||
SetAttenuator( m_AttenuatorsSelection->GetSelection() );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_ATTENUATORS::SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg )
|
||||
{
|
||||
wxASSERT( aCfg );
|
||||
|
||||
aCfg->m_Attenuators.type = m_AttenuatorsSelection->GetSelection();
|
||||
|
||||
for( unsigned ii = 0; ii < m_AttenuatorList.size(); ii++ )
|
||||
m_AttenuatorList[ii]->WriteConfig();
|
||||
}
|
||||
|
||||
|
||||
// Called on a attenuator selection
|
||||
void PANEL_ATTENUATORS::OnAttenuatorSelection( wxCommandEvent& event )
|
||||
{
|
||||
SetAttenuator( (unsigned) event.GetSelection() );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void PANEL_ATTENUATORS::SetAttenuator( unsigned aIdx )
|
||||
{
|
||||
if( aIdx >=m_AttenuatorList.size() )
|
||||
aIdx = m_AttenuatorList.size() - 1;
|
||||
|
||||
m_CurrAttenuator = m_AttenuatorList[aIdx];
|
||||
TransfAttenuatorDataToPanel();
|
||||
m_Attenuator_Messages->SetPage( wxEmptyString );
|
||||
m_Att_R1_Value->SetValue( wxEmptyString );
|
||||
m_Att_R2_Value->SetValue( wxEmptyString );
|
||||
m_Att_R3_Value->SetValue( wxEmptyString );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_ATTENUATORS::OnCalculateAttenuator( wxCommandEvent& event )
|
||||
{
|
||||
TransfPanelDataToAttenuator();
|
||||
m_CurrAttenuator->Calculate();
|
||||
TransfAttenuatorResultsToPanel();
|
||||
}
|
||||
|
||||
|
||||
void PANEL_ATTENUATORS::TransfPanelDataToAttenuator()
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
msg = m_AttValueCtrl->GetValue();
|
||||
m_CurrAttenuator->m_Attenuation = DoubleFromString(msg);
|
||||
msg = m_ZinValueCtrl->GetValue();
|
||||
m_CurrAttenuator->m_Zin = DoubleFromString(msg);
|
||||
msg = m_ZoutValueCtrl->GetValue();
|
||||
m_CurrAttenuator->m_Zout = DoubleFromString(msg);
|
||||
}
|
||||
|
||||
|
||||
void PANEL_ATTENUATORS::TransfAttenuatorDataToPanel()
|
||||
{
|
||||
m_attenuatorBitmap->SetBitmap( *m_CurrAttenuator->m_SchBitMap );
|
||||
|
||||
wxString msg;
|
||||
|
||||
msg.Printf( wxT( "%g" ), m_CurrAttenuator->m_Attenuation );
|
||||
m_AttValueCtrl->SetValue( msg );
|
||||
m_AttValueCtrl->Enable( m_CurrAttenuator->m_Attenuation_Enable );
|
||||
|
||||
m_ZinValueCtrl->Enable( m_CurrAttenuator->m_Zin_Enable );
|
||||
|
||||
if( m_CurrAttenuator->m_Zin_Enable )
|
||||
msg.Printf( wxT( "%g" ), m_CurrAttenuator->m_Zin );
|
||||
else
|
||||
msg.Clear();
|
||||
|
||||
m_ZinValueCtrl->SetValue( msg );
|
||||
|
||||
msg.Printf( wxT( "%g" ), m_CurrAttenuator->m_Zout );
|
||||
m_ZoutValueCtrl->SetValue( msg );
|
||||
|
||||
if( m_CurrAttenuator->m_FormulaName )
|
||||
{
|
||||
if( m_CurrAttenuator->m_FormulaName->StartsWith( "<!" ) )
|
||||
{
|
||||
m_panelAttFormula->SetPage( *m_CurrAttenuator->m_FormulaName );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString html_txt;
|
||||
ConvertMarkdown2Html( wxGetTranslation( *m_CurrAttenuator->m_FormulaName ), html_txt );
|
||||
m_panelAttFormula->SetPage( html_txt );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_panelAttFormula->SetPage( wxEmptyString );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_ATTENUATORS::TransfAttenuatorResultsToPanel()
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
m_Attenuator_Messages->SetPage( wxEmptyString );
|
||||
|
||||
if( m_CurrAttenuator->m_Error )
|
||||
{
|
||||
msg.Printf( _( "Attenuation more than %f dB" ),
|
||||
m_CurrAttenuator->m_MinimumATT );
|
||||
m_Attenuator_Messages->AppendToPage( wxT( "<br><b>Error!</b></br><br><em>" ) );
|
||||
m_Attenuator_Messages->AppendToPage( msg );
|
||||
m_Attenuator_Messages->AppendToPage( wxT( "</em></br>" ) );
|
||||
|
||||
// Display -- as resistor values:
|
||||
msg = wxT( "--" );
|
||||
m_Att_R1_Value->SetValue( msg );
|
||||
m_Att_R2_Value->SetValue( msg );
|
||||
if( m_CurrAttenuator->m_ResultCount >= 3 )
|
||||
m_Att_R3_Value->SetValue( msg );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
msg.Printf( wxT( "%g" ), m_CurrAttenuator->m_R1 );
|
||||
m_Att_R1_Value->SetValue( msg );
|
||||
msg.Printf( wxT( "%g" ), m_CurrAttenuator->m_R2 );
|
||||
m_Att_R2_Value->SetValue( msg );
|
||||
|
||||
if( m_CurrAttenuator->m_ResultCount < 3 )
|
||||
{
|
||||
m_Att_R3_Value->SetValue( wxEmptyString );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( wxT( "%g" ), m_CurrAttenuator->m_R3 );
|
||||
m_Att_R3_Value->SetValue( msg );
|
||||
}
|
||||
}
|
|
@ -35,14 +35,12 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_lastNotebookPage( -1 ),
|
||||
m_macHack( true )
|
||||
{
|
||||
m_bpButtonCalcAtt->SetBitmap( KiBitmap( BITMAPS::small_down ) );
|
||||
m_bpButtonAnalyze->SetBitmap( KiBitmap( BITMAPS::small_down ) );
|
||||
m_bpButtonSynthetize->SetBitmap( KiBitmap( BITMAPS::small_up ) );
|
||||
|
||||
SetKiway( this, aKiway );
|
||||
m_currTransLine = nullptr;
|
||||
m_currTransLineType = DEFAULT_TYPE;
|
||||
m_currAttenuator = nullptr;
|
||||
m_TWMode = TW_MASTER_CURRENT;
|
||||
m_TWNested = false;
|
||||
|
||||
|
@ -65,21 +63,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
for( int ii = 0; ii < 8; ii++ )
|
||||
m_transline_list.push_back( new TRANSLINE_IDENT( tltype_list[ii] ) );
|
||||
|
||||
// Populate attenuator list ordered like in dialog menu list
|
||||
m_attenuator_list.push_back( new ATTENUATOR_PI() );
|
||||
m_attenuator_list.push_back( new ATTENUATOR_TEE() );
|
||||
m_attenuator_list.push_back( new ATTENUATOR_BRIDGE() );
|
||||
m_attenuator_list.push_back( new ATTENUATOR_SPLITTER() );
|
||||
m_currAttenuator = m_attenuator_list[0];
|
||||
|
||||
m_staticTextAttMsg->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||
|
||||
m_attZinUnit->SetLabel( wxT( "Ω" ) );
|
||||
m_attZoutUnit->SetLabel( wxT( "Ω" ) );
|
||||
m_attR1Unit->SetLabel( wxT( "Ω" ) );
|
||||
m_attR2Unit->SetLabel( wxT( "Ω" ) );
|
||||
m_attR3Unit->SetLabel( wxT( "Ω" ) );
|
||||
|
||||
m_reqResUnits->SetLabel( wxT( "kΩ" ) );
|
||||
m_exclude1Units->SetLabel( wxT( "kΩ" ) );
|
||||
m_exclude2Units->SetLabel( wxT( "kΩ" ) );
|
||||
|
@ -111,8 +94,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
initViaSizePanel();
|
||||
initESeriesPanel();
|
||||
|
||||
SetAttenuator( m_AttenuatorsSelection->GetSelection() );
|
||||
|
||||
ToleranceSelection( m_rbToleranceSelection->GetSelection() );
|
||||
|
||||
BoardClassesUpdateData( m_BoardClassesUnitsSelector->GetUnitScale() );
|
||||
|
@ -151,9 +132,6 @@ PCB_CALCULATOR_FRAME::~PCB_CALCULATOR_FRAME()
|
|||
for( unsigned ii = 0; ii < m_transline_list.size(); ii++ )
|
||||
delete m_transline_list[ii];
|
||||
|
||||
for( unsigned ii = 0; ii < m_attenuator_list.size(); ii++ )
|
||||
delete m_attenuator_list[ii];
|
||||
|
||||
delete m_ccValueNamesBitmap;
|
||||
delete m_ccValuesBitmap;
|
||||
delete m_ccMultipliersBitmap;
|
||||
|
@ -177,28 +155,26 @@ void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
event2.SetInt( m_currTransLineType );
|
||||
m_TranslineSelection->Command( event2 );
|
||||
|
||||
for( int i = 0; i < m_attenuator_list.size(); ++i )
|
||||
for( int i = 0; i < m_panelAttenuators->m_AttenuatorList.size(); ++i )
|
||||
{
|
||||
if( m_attenuator_list[i] == m_currAttenuator )
|
||||
if( m_panelAttenuators->m_AttenuatorList[i] == m_panelAttenuators->m_CurrAttenuator )
|
||||
{
|
||||
event2.SetEventObject( m_AttenuatorsSelection );
|
||||
event2.SetEventObject( m_panelAttenuators->GetAttenuatorsSelector() );
|
||||
event2.SetInt( i );
|
||||
m_AttenuatorsSelection->Command( event2 );
|
||||
m_panelAttenuators->GetAttenuatorsSelector()->Command( event2 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_panelAttenuators->UpdateUI();
|
||||
|
||||
ToleranceSelection( m_rbToleranceSelection->GetSelection() );
|
||||
|
||||
m_viaBitmap->SetBitmap( KiBitmap( BITMAPS::viacalc ) );
|
||||
m_panelViaSize->Layout();
|
||||
|
||||
m_attenuatorBitmap->SetBitmap( *m_currAttenuator->m_SchBitMap );
|
||||
m_panelRegulators->Layout();
|
||||
|
||||
m_attenuatorBitmap->GetParent()->Layout();
|
||||
m_attenuatorBitmap->GetParent()->Refresh();
|
||||
|
||||
m_panelESeriesHelp->Refresh();
|
||||
m_htmlWinFormulas->Refresh();
|
||||
|
||||
|
@ -276,9 +252,11 @@ void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
m_currTransLineType = static_cast<TRANSLINE_TYPE_ID>( cfg->m_TransLine.type );
|
||||
m_Notebook->ChangeSelection( cfg->m_LastPage );
|
||||
m_rbToleranceSelection->SetSelection( cfg->m_ColorCodeTolerance );
|
||||
m_AttenuatorsSelection->SetSelection( cfg->m_Attenuators.type );
|
||||
m_BoardClassesUnitsSelector->SetSelection( cfg->m_BoardClassUnits );
|
||||
|
||||
// Attenuators panel config:
|
||||
m_panelAttenuators->LoadSettings( cfg );
|
||||
|
||||
// Regul panel config:
|
||||
m_panelRegulators->LoadSettings( cfg );
|
||||
|
||||
|
@ -288,9 +266,6 @@ void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
for( TRANSLINE_IDENT* transline : m_transline_list )
|
||||
transline->ReadConfig();
|
||||
|
||||
for( ATTENUATOR* attenuator : m_attenuator_list )
|
||||
attenuator->ReadConfig();
|
||||
}
|
||||
|
||||
|
||||
|
@ -308,7 +283,6 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
{
|
||||
cfg->m_LastPage = m_Notebook->GetSelection();
|
||||
cfg->m_TransLine.type = m_currTransLineType;
|
||||
cfg->m_Attenuators.type = m_AttenuatorsSelection->GetSelection();
|
||||
cfg->m_ColorCodeTolerance = m_rbToleranceSelection->GetSelection();
|
||||
cfg->m_BoardClassUnits = m_BoardClassesUnitsSelector->GetSelection();
|
||||
|
||||
|
@ -316,6 +290,7 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
cfg->m_Electrical.spacing_voltage = m_ElectricalSpacingVoltage->GetValue();
|
||||
|
||||
m_panelRegulators->Regulators_WriteConfig( cfg );
|
||||
m_panelAttenuators->SaveSettings( cfg );
|
||||
}
|
||||
|
||||
writeTrackWidthConfig();
|
||||
|
@ -324,9 +299,6 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
for( unsigned ii = 0; ii < m_transline_list.size(); ii++ )
|
||||
m_transline_list[ii]->WriteConfig();
|
||||
|
||||
for( unsigned ii = 0; ii < m_attenuator_list.size(); ii++ )
|
||||
m_attenuator_list[ii]->WriteConfig();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -271,27 +271,6 @@ private:
|
|||
void OnToleranceSelection( wxCommandEvent& event ) override;
|
||||
void ToleranceSelection( int aSelection );
|
||||
|
||||
// Attenuators Panel
|
||||
void OnAttenuatorSelection( wxCommandEvent& event ) override;
|
||||
void SetAttenuator( unsigned aIdx );
|
||||
void OnCalculateAttenuator( wxCommandEvent& event ) override;
|
||||
void TransfPanelDataToAttenuator();
|
||||
void TransfAttenuatorDataToPanel();
|
||||
void TransfAttenuatorResultsToPanel();
|
||||
|
||||
// Regulators Panel
|
||||
#if 0
|
||||
void OnRegulatorCalcButtonClick( wxCommandEvent& event ) override;
|
||||
void OnRegulatorResetButtonClick( wxCommandEvent& event ) override;
|
||||
void OnRegulTypeSelection( wxCommandEvent& event ) override;
|
||||
void OnRegulatorSelection( wxCommandEvent& event ) override;
|
||||
void OnDataFileSelection( wxCommandEvent& event ) override;
|
||||
void OnAddRegulator( wxCommandEvent& event ) override;
|
||||
void OnEditRegulator( wxCommandEvent& event ) override;
|
||||
void OnRemoveRegulator( wxCommandEvent& event ) override;
|
||||
#endif
|
||||
|
||||
|
||||
private:
|
||||
enum // Which dimension is controlling the track width / current
|
||||
{ // calculations:
|
||||
|
@ -306,9 +285,6 @@ private:
|
|||
TRANSLINE* m_currTransLine;
|
||||
std::vector<TRANSLINE_IDENT*> m_transline_list;
|
||||
|
||||
ATTENUATOR* m_currAttenuator;
|
||||
std::vector<ATTENUATOR*> m_attenuator_list;
|
||||
|
||||
wxBitmap* m_ccValueNamesBitmap;
|
||||
wxBitmap* m_ccValuesBitmap;
|
||||
wxBitmap* m_ccMultipliersBitmap;
|
||||
|
|
Loading…
Reference in New Issue