pcb_calculator rework: move regulator panel to its own files panel_regulator_xx
also rename regulators_funct.cpp to panel_regulator.cpp
This commit is contained in:
parent
11c91c7179
commit
0f48522342
|
@ -18,7 +18,7 @@ set( PCB_CALCULATOR_SRCS
|
||||||
pcb_calculator_frame.cpp
|
pcb_calculator_frame.cpp
|
||||||
pcb_calculator_settings.cpp
|
pcb_calculator_settings.cpp
|
||||||
datafile_read_write.cpp
|
datafile_read_write.cpp
|
||||||
regulators_funct.cpp
|
panel_regulator.cpp
|
||||||
tracks_width_versus_current.cpp
|
tracks_width_versus_current.cpp
|
||||||
via.cpp
|
via.cpp
|
||||||
transline_ident.cpp
|
transline_ident.cpp
|
||||||
|
@ -36,6 +36,7 @@ set( PCB_CALCULATOR_SRCS
|
||||||
dialogs/pcb_calculator_frame_base.cpp
|
dialogs/pcb_calculator_frame_base.cpp
|
||||||
dialogs/dialog_regulator_form_base.cpp
|
dialogs/dialog_regulator_form_base.cpp
|
||||||
dialogs/dialog_regulator_form.cpp
|
dialogs/dialog_regulator_form.cpp
|
||||||
|
dialogs/panel_regulator_base.cpp
|
||||||
../common/env_vars.cpp # needed on MSW to avoid a link issue (a symbol not found)
|
../common/env_vars.cpp # needed on MSW to avoid a link issue (a symbol not found)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <pcb_calculator_datafile_lexer.h>
|
#include <pcb_calculator_datafile_lexer.h>
|
||||||
#include <pcb_calculator_frame.h>
|
#include <pcb_calculator_frame.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
|
#include <panel_regulator.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace PCBCALC_DATA_T;
|
using namespace PCBCALC_DATA_T;
|
||||||
|
@ -46,7 +47,7 @@ static const char* getTokenName( T aTok )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_CALCULATOR_FRAME::ReadDataFile()
|
bool PANEL_REGULATOR::ReadDataFile()
|
||||||
{
|
{
|
||||||
FILE* file = wxFopen( GetDataFilename(), wxT( "rt" ) );
|
FILE* file = wxFopen( GetDataFilename(), wxT( "rt" ) );
|
||||||
|
|
||||||
|
@ -79,13 +80,17 @@ bool PCB_CALCULATOR_FRAME::ReadDataFile()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_choiceRegulatorSelector->Clear();
|
||||||
|
m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
|
||||||
|
SelectLastSelectedRegulator();
|
||||||
|
|
||||||
delete datafile;
|
delete datafile;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_CALCULATOR_FRAME::WriteDataFile()
|
bool PANEL_REGULATOR::WriteDataFile()
|
||||||
{
|
{
|
||||||
// Switch the locale to standard C (needed to read/write floating point numbers)
|
// Switch the locale to standard C (needed to read/write floating point numbers)
|
||||||
LOCALE_IO toggle;
|
LOCALE_IO toggle;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include "dialog_regulator_form_base.h"
|
#include "dialog_regulator_form_base.h"
|
||||||
|
|
||||||
class PCB_CALCULATOR_FRAME;
|
class PANEL_REGULATOR;
|
||||||
class REGULATOR_DATA;
|
class REGULATOR_DATA;
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class REGULATOR_DATA;
|
||||||
class DIALOG_REGULATOR_FORM : public DIALOG_REGULATOR_FORM_BASE
|
class DIALOG_REGULATOR_FORM : public DIALOG_REGULATOR_FORM_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DIALOG_REGULATOR_FORM( PCB_CALCULATOR_FRAME* parent, const wxString& aRegName )
|
DIALOG_REGULATOR_FORM( PANEL_REGULATOR* parent, const wxString& aRegName )
|
||||||
: DIALOG_REGULATOR_FORM_BASE( parent )
|
: DIALOG_REGULATOR_FORM_BASE( parent )
|
||||||
{
|
{
|
||||||
m_textCtrlName->SetValue( aRegName );
|
m_textCtrlName->SetValue( aRegName );
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* 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_REGULATOR_H
|
||||||
|
#define PANEL_REGULATOR_H
|
||||||
|
#include "panel_regulator_base.h"
|
||||||
|
#include "class_regulator_data.h"
|
||||||
|
|
||||||
|
class PCB_CALCULATOR_SETTINGS;
|
||||||
|
|
||||||
|
class PANEL_REGULATOR : public PANEL_REGULATOR_BASE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PANEL_REGULATOR( wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||||
|
~PANEL_REGULATOR();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load settings specific to the regulators
|
||||||
|
*/
|
||||||
|
void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the regulator page dialog display.
|
||||||
|
*
|
||||||
|
* Enable the current regulator drawings and the formula used for calculations.
|
||||||
|
*/
|
||||||
|
void RegulatorPageUpdate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If m_lastSelectedRegulatorName is empty, just calls RegulatorPageUpdate()
|
||||||
|
*/
|
||||||
|
void SelectLastSelectedRegulator();
|
||||||
|
|
||||||
|
void RegulatorsSolve();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write regulators parameters in configuration.
|
||||||
|
*
|
||||||
|
* @param aCfg is the configuration settings.
|
||||||
|
*/
|
||||||
|
void Regulators_WriteConfig( PCB_CALCULATOR_SETTINGS* aCfg );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the full filename of the selected pcb_calculator data file
|
||||||
|
*/
|
||||||
|
const wxString GetDataFilename();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the full filename of the selected pcb_calculator data file
|
||||||
|
* force the standard extension of the file (.pcbcalc).
|
||||||
|
*
|
||||||
|
* @param aFilename is the full filename, with or without extension.
|
||||||
|
*/
|
||||||
|
void SetDataFilename( const wxString& aFilename );
|
||||||
|
|
||||||
|
// R/W data files:
|
||||||
|
bool ReadDataFile();
|
||||||
|
bool WriteDataFile();
|
||||||
|
|
||||||
|
public:
|
||||||
|
REGULATOR_LIST m_RegulatorList; // the list of known regulators
|
||||||
|
wxString m_lastSelectedRegulatorName;
|
||||||
|
bool m_RegulatorListChanged; // Set when m_RegulatorList is modified
|
||||||
|
// and the corresponding file must be rewritten
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,267 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||||
|
// http://www.wxformbuilder.org/
|
||||||
|
//
|
||||||
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "panel_regulator_base.h"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
PANEL_REGULATOR_BASE::PANEL_REGULATOR_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||||
|
{
|
||||||
|
wxBoxSizer* bSizerMainReg;
|
||||||
|
bSizerMainReg = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizerColBalancer;
|
||||||
|
bSizerColBalancer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizeLeftpReg;
|
||||||
|
bSizeLeftpReg = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
bSizeLeftpReg->SetMinSize( wxSize( 400,-1 ) );
|
||||||
|
wxBoxSizer* bSizerType;
|
||||||
|
bSizerType = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
m_staticTextRegType = new wxStaticText( this, wxID_ANY, _("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticTextRegType->Wrap( -1 );
|
||||||
|
m_staticTextRegType->SetToolTip( _("Type of the regulator.\nThere are 2 types:\n- regulators which have a dedicated sense pin for the voltage regulation.\n- 3 terminal pins.") );
|
||||||
|
|
||||||
|
bSizerType->Add( m_staticTextRegType, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
wxString m_choiceRegTypeChoices[] = { _("Standard Type"), _("3 Terminal Type") };
|
||||||
|
int m_choiceRegTypeNChoices = sizeof( m_choiceRegTypeChoices ) / sizeof( wxString );
|
||||||
|
m_choiceRegType = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceRegTypeNChoices, m_choiceRegTypeChoices, 0 );
|
||||||
|
m_choiceRegType->SetSelection( 0 );
|
||||||
|
bSizerType->Add( m_choiceRegType, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizeLeftpReg->Add( bSizerType, 0, wxEXPAND|wxALL, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizeLeftpReg->Add( 0, 10, 0, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_bitmapRegul4pins = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizeLeftpReg->Add( m_bitmapRegul4pins, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 10 );
|
||||||
|
|
||||||
|
m_bitmapRegul3pins = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizeLeftpReg->Add( m_bitmapRegul3pins, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizeLeftpReg->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
wxStaticBoxSizer* sbSizerRegFormula;
|
||||||
|
sbSizerRegFormula = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Formula") ), wxVERTICAL );
|
||||||
|
|
||||||
|
m_RegulFormula = new wxStaticText( sbSizerRegFormula->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_RegulFormula->Wrap( -1 );
|
||||||
|
m_RegulFormula->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
||||||
|
|
||||||
|
sbSizerRegFormula->Add( m_RegulFormula, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizeLeftpReg->Add( sbSizerRegFormula, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizerColBalancer->Add( bSizeLeftpReg, 0, wxTOP|wxRIGHT|wxEXPAND, 6 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizerColBalancer->Add( 10, 0, 0, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizerRegulRight;
|
||||||
|
bSizerRegulRight = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
wxFlexGridSizer* fgSizerRegParams;
|
||||||
|
fgSizerRegParams = new wxFlexGridSizer( 6, 4, 4, 0 );
|
||||||
|
fgSizerRegParams->AddGrowableCol( 2 );
|
||||||
|
fgSizerRegParams->SetFlexibleDirection( wxBOTH );
|
||||||
|
fgSizerRegParams->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||||
|
|
||||||
|
m_rbRegulR1 = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||||
|
m_rbRegulR1->SetValue( true );
|
||||||
|
fgSizerRegParams->Add( m_rbRegulR1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_labelRegultR1 = new wxStaticText( this, wxID_ANY, _("R1:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_labelRegultR1->Wrap( -1 );
|
||||||
|
fgSizerRegParams->Add( m_labelRegultR1, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
m_RegulR1Value = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
fgSizerRegParams->Add( m_RegulR1Value, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_r1Units = new wxStaticText( this, wxID_ANY, _("kOhm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_r1Units->Wrap( -1 );
|
||||||
|
fgSizerRegParams->Add( m_r1Units, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
m_rbRegulR2 = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
fgSizerRegParams->Add( m_rbRegulR2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_labelRegultR2 = new wxStaticText( this, wxID_ANY, _("R2:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_labelRegultR2->Wrap( -1 );
|
||||||
|
fgSizerRegParams->Add( m_labelRegultR2, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
m_RegulR2Value = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
fgSizerRegParams->Add( m_RegulR2Value, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_r2Units = new wxStaticText( this, wxID_ANY, _("kOhm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_r2Units->Wrap( -1 );
|
||||||
|
fgSizerRegParams->Add( m_r2Units, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
m_rbRegulVout = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
fgSizerRegParams->Add( m_rbRegulVout, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_labelVout = new wxStaticText( this, wxID_ANY, _("Vout:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_labelVout->Wrap( -1 );
|
||||||
|
fgSizerRegParams->Add( m_labelVout, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
m_RegulVoutValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
fgSizerRegParams->Add( m_RegulVoutValue, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_unitsVout = new wxStaticText( this, wxID_ANY, _("V"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_unitsVout->Wrap( -1 );
|
||||||
|
fgSizerRegParams->Add( m_unitsVout, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
fgSizerRegParams->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_labelVRef = new wxStaticText( this, wxID_ANY, _("Vref:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_labelVRef->Wrap( -1 );
|
||||||
|
m_labelVRef->SetToolTip( _("The internal reference voltage of the regulator.\nShould not be 0.") );
|
||||||
|
|
||||||
|
fgSizerRegParams->Add( m_labelVRef, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
m_RegulVrefValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
fgSizerRegParams->Add( m_RegulVrefValue, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
m_unitsVref = new wxStaticText( this, wxID_ANY, _("V"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_unitsVref->Wrap( -1 );
|
||||||
|
fgSizerRegParams->Add( m_unitsVref, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
fgSizerRegParams->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_RegulIadjTitle = new wxStaticText( this, wxID_ANY, _("Iadj:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_RegulIadjTitle->Wrap( -1 );
|
||||||
|
m_RegulIadjTitle->SetToolTip( _("For 3 terminal regulators only, the Adjust pin current.") );
|
||||||
|
|
||||||
|
fgSizerRegParams->Add( m_RegulIadjTitle, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
m_RegulIadjValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
fgSizerRegParams->Add( m_RegulIadjValue, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
m_IadjUnitLabel = new wxStaticText( this, wxID_ANY, _("uA"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_IadjUnitLabel->Wrap( -1 );
|
||||||
|
fgSizerRegParams->Add( m_IadjUnitLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizerRegulRight->Add( fgSizerRegParams, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizerRegulButtonCalcReset;
|
||||||
|
bSizerRegulButtonCalcReset = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
|
||||||
|
bSizerRegulButtonCalcReset->Add( 0, 0, 3, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_buttonCalculate = new wxButton( this, wxID_ANY, _("Calculate"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizerRegulButtonCalcReset->Add( m_buttonCalculate, 6, wxTOP, 10 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizerRegulButtonCalcReset->Add( 0, 0, 2, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_buttonRegulReset = new wxButton( this, wxID_ANY, _("Reset to Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizerRegulButtonCalcReset->Add( m_buttonRegulReset, 6, wxTOP, 10 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizerRegulButtonCalcReset->Add( 0, 0, 3, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizerRegulRight->Add( bSizerRegulButtonCalcReset, 0, wxEXPAND|wxLEFT, 30 );
|
||||||
|
|
||||||
|
m_RegulMessage = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_RegulMessage->Wrap( -1 );
|
||||||
|
bSizerRegulRight->Add( m_RegulMessage, 0, wxALL, 10 );
|
||||||
|
|
||||||
|
wxStaticBoxSizer* sbSizerRegulatorsChooser;
|
||||||
|
sbSizerRegulatorsChooser = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Regulator") ), wxVERTICAL );
|
||||||
|
|
||||||
|
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, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_staticTextRegFile = new wxStaticText( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Regulators data file:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticTextRegFile->Wrap( -1 );
|
||||||
|
m_staticTextRegFile->SetToolTip( _("The name of the data file which stores known regulators parameters.") );
|
||||||
|
|
||||||
|
sbSizerRegulatorsChooser->Add( m_staticTextRegFile, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizerDataFile;
|
||||||
|
bSizerDataFile = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
m_regulators_fileNameCtrl = new wxTextCtrl( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizerDataFile->Add( m_regulators_fileNameCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_buttonDataFile = new wxButton( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizerDataFile->Add( m_buttonDataFile, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
sbSizerRegulatorsChooser->Add( bSizerDataFile, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizerReulBtn;
|
||||||
|
bSizerReulBtn = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
m_buttonEditItem = new wxButton( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Edit Regulator"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_buttonEditItem->SetToolTip( _("Edit the current selected regulator.") );
|
||||||
|
|
||||||
|
bSizerReulBtn->Add( m_buttonEditItem, 1, wxALL, 5 );
|
||||||
|
|
||||||
|
m_buttonAddItem = new wxButton( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Add Regulator"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_buttonAddItem->SetToolTip( _("Enter a new item to the current list of available regulators") );
|
||||||
|
|
||||||
|
bSizerReulBtn->Add( m_buttonAddItem, 1, wxALL, 5 );
|
||||||
|
|
||||||
|
m_buttonRemoveItem = new wxButton( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Remove Regulator"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_buttonRemoveItem->SetToolTip( _("Remove an item from the current list of available regulators") );
|
||||||
|
|
||||||
|
bSizerReulBtn->Add( m_buttonRemoveItem, 1, wxALL, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
sbSizerRegulatorsChooser->Add( bSizerReulBtn, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizerRegulRight->Add( sbSizerRegulatorsChooser, 0, wxEXPAND|wxRIGHT, 10 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizerColBalancer->Add( bSizerRegulRight, 1, wxEXPAND|wxTOP|wxLEFT, 10 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizerMainReg->Add( bSizerColBalancer, 0, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
this->SetSizer( bSizerMainReg );
|
||||||
|
this->Layout();
|
||||||
|
|
||||||
|
// Connect Events
|
||||||
|
m_choiceRegType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnRegulTypeSelection ), NULL, this );
|
||||||
|
m_buttonCalculate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnRegulatorCalcButtonClick ), NULL, this );
|
||||||
|
m_buttonRegulReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnRegulatorResetButtonClick ), NULL, this );
|
||||||
|
m_choiceRegulatorSelector->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnRegulatorSelection ), NULL, this );
|
||||||
|
m_buttonDataFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnDataFileSelection ), NULL, this );
|
||||||
|
m_buttonEditItem->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnEditRegulator ), NULL, this );
|
||||||
|
m_buttonAddItem->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnAddRegulator ), NULL, this );
|
||||||
|
m_buttonRemoveItem->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnRemoveRegulator ), NULL, this );
|
||||||
|
}
|
||||||
|
|
||||||
|
PANEL_REGULATOR_BASE::~PANEL_REGULATOR_BASE()
|
||||||
|
{
|
||||||
|
// Disconnect Events
|
||||||
|
m_choiceRegType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnRegulTypeSelection ), NULL, this );
|
||||||
|
m_buttonCalculate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnRegulatorCalcButtonClick ), NULL, this );
|
||||||
|
m_buttonRegulReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnRegulatorResetButtonClick ), NULL, this );
|
||||||
|
m_choiceRegulatorSelector->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnRegulatorSelection ), NULL, this );
|
||||||
|
m_buttonDataFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnDataFileSelection ), NULL, this );
|
||||||
|
m_buttonEditItem->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnEditRegulator ), NULL, this );
|
||||||
|
m_buttonAddItem->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnAddRegulator ), NULL, this );
|
||||||
|
m_buttonRemoveItem->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_REGULATOR_BASE::OnRemoveRegulator ), NULL, this );
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,93 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||||
|
// http://www.wxformbuilder.org/
|
||||||
|
//
|
||||||
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <wx/artprov.h>
|
||||||
|
#include <wx/xrc/xmlres.h>
|
||||||
|
#include <wx/intl.h>
|
||||||
|
#include <wx/string.h>
|
||||||
|
#include <wx/stattext.h>
|
||||||
|
#include <wx/gdicmn.h>
|
||||||
|
#include <wx/font.h>
|
||||||
|
#include <wx/colour.h>
|
||||||
|
#include <wx/settings.h>
|
||||||
|
#include <wx/choice.h>
|
||||||
|
#include <wx/sizer.h>
|
||||||
|
#include <wx/bitmap.h>
|
||||||
|
#include <wx/image.h>
|
||||||
|
#include <wx/icon.h>
|
||||||
|
#include <wx/statbmp.h>
|
||||||
|
#include <wx/statbox.h>
|
||||||
|
#include <wx/radiobut.h>
|
||||||
|
#include <wx/textctrl.h>
|
||||||
|
#include <wx/button.h>
|
||||||
|
#include <wx/panel.h>
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Class PANEL_REGULATOR_BASE
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
class PANEL_REGULATOR_BASE : public wxPanel
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxStaticText* m_staticTextRegType;
|
||||||
|
wxChoice* m_choiceRegType;
|
||||||
|
wxStaticBitmap* m_bitmapRegul4pins;
|
||||||
|
wxStaticBitmap* m_bitmapRegul3pins;
|
||||||
|
wxStaticText* m_RegulFormula;
|
||||||
|
wxRadioButton* m_rbRegulR1;
|
||||||
|
wxStaticText* m_labelRegultR1;
|
||||||
|
wxTextCtrl* m_RegulR1Value;
|
||||||
|
wxStaticText* m_r1Units;
|
||||||
|
wxRadioButton* m_rbRegulR2;
|
||||||
|
wxStaticText* m_labelRegultR2;
|
||||||
|
wxTextCtrl* m_RegulR2Value;
|
||||||
|
wxStaticText* m_r2Units;
|
||||||
|
wxRadioButton* m_rbRegulVout;
|
||||||
|
wxStaticText* m_labelVout;
|
||||||
|
wxTextCtrl* m_RegulVoutValue;
|
||||||
|
wxStaticText* m_unitsVout;
|
||||||
|
wxStaticText* m_labelVRef;
|
||||||
|
wxTextCtrl* m_RegulVrefValue;
|
||||||
|
wxStaticText* m_unitsVref;
|
||||||
|
wxStaticText* m_RegulIadjTitle;
|
||||||
|
wxTextCtrl* m_RegulIadjValue;
|
||||||
|
wxStaticText* m_IadjUnitLabel;
|
||||||
|
wxButton* m_buttonCalculate;
|
||||||
|
wxButton* m_buttonRegulReset;
|
||||||
|
wxStaticText* m_RegulMessage;
|
||||||
|
wxChoice* m_choiceRegulatorSelector;
|
||||||
|
wxStaticText* m_staticTextRegFile;
|
||||||
|
wxTextCtrl* m_regulators_fileNameCtrl;
|
||||||
|
wxButton* m_buttonDataFile;
|
||||||
|
wxButton* m_buttonEditItem;
|
||||||
|
wxButton* m_buttonAddItem;
|
||||||
|
wxButton* m_buttonRemoveItem;
|
||||||
|
|
||||||
|
// Virtual event handlers, overide them in your derived class
|
||||||
|
virtual void OnRegulTypeSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnRegulatorCalcButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnRegulatorResetButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnRegulatorSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnDataFileSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnEditRegulator( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnAddRegulator( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnRemoveRegulator( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
PANEL_REGULATOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 688,436 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||||
|
~PANEL_REGULATOR_BASE();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
|
@ -22,237 +22,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
||||||
bmainFrameSizer = new wxBoxSizer( wxVERTICAL );
|
bmainFrameSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_panelRegulators = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
m_panelRegulators = new PANEL_REGULATOR( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
wxBoxSizer* bSizerMainReg;
|
|
||||||
bSizerMainReg = new wxBoxSizer( wxVERTICAL );
|
|
||||||
|
|
||||||
wxBoxSizer* bSizerColBalancer;
|
|
||||||
bSizerColBalancer = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
wxBoxSizer* bSizeLeftpReg;
|
|
||||||
bSizeLeftpReg = new wxBoxSizer( wxVERTICAL );
|
|
||||||
|
|
||||||
bSizeLeftpReg->SetMinSize( wxSize( 400,-1 ) );
|
|
||||||
wxBoxSizer* bSizerType;
|
|
||||||
bSizerType = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
m_staticTextRegType = new wxStaticText( m_panelRegulators, wxID_ANY, _("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_staticTextRegType->Wrap( -1 );
|
|
||||||
m_staticTextRegType->SetToolTip( _("Type of the regulator.\nThere are 2 types:\n- regulators which have a dedicated sense pin for the voltage regulation.\n- 3 terminal pins.") );
|
|
||||||
|
|
||||||
bSizerType->Add( m_staticTextRegType, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
wxString m_choiceRegTypeChoices[] = { _("Standard Type"), _("3 Terminal Type") };
|
|
||||||
int m_choiceRegTypeNChoices = sizeof( m_choiceRegTypeChoices ) / sizeof( wxString );
|
|
||||||
m_choiceRegType = new wxChoice( m_panelRegulators, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceRegTypeNChoices, m_choiceRegTypeChoices, 0 );
|
|
||||||
m_choiceRegType->SetSelection( 0 );
|
|
||||||
bSizerType->Add( m_choiceRegType, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizeLeftpReg->Add( bSizerType, 0, wxEXPAND|wxALL, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizeLeftpReg->Add( 0, 10, 0, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
m_bitmapRegul4pins = new wxStaticBitmap( m_panelRegulators, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
bSizeLeftpReg->Add( m_bitmapRegul4pins, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 10 );
|
|
||||||
|
|
||||||
m_bitmapRegul3pins = new wxStaticBitmap( m_panelRegulators, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
bSizeLeftpReg->Add( m_bitmapRegul3pins, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizeLeftpReg->Add( 0, 0, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
wxStaticBoxSizer* sbSizerRegFormula;
|
|
||||||
sbSizerRegFormula = new wxStaticBoxSizer( new wxStaticBox( m_panelRegulators, wxID_ANY, _("Formula") ), wxVERTICAL );
|
|
||||||
|
|
||||||
m_RegulFormula = new wxStaticText( sbSizerRegFormula->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_RegulFormula->Wrap( -1 );
|
|
||||||
m_RegulFormula->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
|
||||||
|
|
||||||
sbSizerRegFormula->Add( m_RegulFormula, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizeLeftpReg->Add( sbSizerRegFormula, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerColBalancer->Add( bSizeLeftpReg, 0, wxTOP|wxRIGHT|wxEXPAND, 6 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerColBalancer->Add( 10, 0, 0, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
wxBoxSizer* bSizerRegulRight;
|
|
||||||
bSizerRegulRight = new wxBoxSizer( wxVERTICAL );
|
|
||||||
|
|
||||||
wxFlexGridSizer* fgSizerRegParams;
|
|
||||||
fgSizerRegParams = new wxFlexGridSizer( 6, 4, 4, 0 );
|
|
||||||
fgSizerRegParams->AddGrowableCol( 2 );
|
|
||||||
fgSizerRegParams->SetFlexibleDirection( wxBOTH );
|
|
||||||
fgSizerRegParams->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
|
||||||
|
|
||||||
m_rbRegulR1 = new wxRadioButton( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
|
||||||
m_rbRegulR1->SetValue( true );
|
|
||||||
fgSizerRegParams->Add( m_rbRegulR1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_labelRegultR1 = new wxStaticText( m_panelRegulators, wxID_ANY, _("R1:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_labelRegultR1->Wrap( -1 );
|
|
||||||
fgSizerRegParams->Add( m_labelRegultR1, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
m_RegulR1Value = new wxTextCtrl( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
fgSizerRegParams->Add( m_RegulR1Value, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_r1Units = new wxStaticText( m_panelRegulators, wxID_ANY, _("kOhm"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_r1Units->Wrap( -1 );
|
|
||||||
fgSizerRegParams->Add( m_r1Units, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
m_rbRegulR2 = new wxRadioButton( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
fgSizerRegParams->Add( m_rbRegulR2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_labelRegultR2 = new wxStaticText( m_panelRegulators, wxID_ANY, _("R2:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_labelRegultR2->Wrap( -1 );
|
|
||||||
fgSizerRegParams->Add( m_labelRegultR2, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
m_RegulR2Value = new wxTextCtrl( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
fgSizerRegParams->Add( m_RegulR2Value, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_r2Units = new wxStaticText( m_panelRegulators, wxID_ANY, _("kOhm"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_r2Units->Wrap( -1 );
|
|
||||||
fgSizerRegParams->Add( m_r2Units, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
m_rbRegulVout = new wxRadioButton( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
fgSizerRegParams->Add( m_rbRegulVout, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_labelVout = new wxStaticText( m_panelRegulators, wxID_ANY, _("Vout:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_labelVout->Wrap( -1 );
|
|
||||||
fgSizerRegParams->Add( m_labelVout, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
m_RegulVoutValue = new wxTextCtrl( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
fgSizerRegParams->Add( m_RegulVoutValue, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_unitsVout = new wxStaticText( m_panelRegulators, wxID_ANY, _("V"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_unitsVout->Wrap( -1 );
|
|
||||||
fgSizerRegParams->Add( m_unitsVout, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
fgSizerRegParams->Add( 0, 0, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
m_labelVRef = new wxStaticText( m_panelRegulators, wxID_ANY, _("Vref:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_labelVRef->Wrap( -1 );
|
|
||||||
m_labelVRef->SetToolTip( _("The internal reference voltage of the regulator.\nShould not be 0.") );
|
|
||||||
|
|
||||||
fgSizerRegParams->Add( m_labelVRef, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
m_RegulVrefValue = new wxTextCtrl( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
fgSizerRegParams->Add( m_RegulVrefValue, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
m_unitsVref = new wxStaticText( m_panelRegulators, wxID_ANY, _("V"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_unitsVref->Wrap( -1 );
|
|
||||||
fgSizerRegParams->Add( m_unitsVref, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
fgSizerRegParams->Add( 0, 0, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
m_RegulIadjTitle = new wxStaticText( m_panelRegulators, wxID_ANY, _("Iadj:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_RegulIadjTitle->Wrap( -1 );
|
|
||||||
m_RegulIadjTitle->SetToolTip( _("For 3 terminal regulators only, the Adjust pin current.") );
|
|
||||||
|
|
||||||
fgSizerRegParams->Add( m_RegulIadjTitle, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
m_RegulIadjValue = new wxTextCtrl( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
fgSizerRegParams->Add( m_RegulIadjValue, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
m_IadjUnitLabel = new wxStaticText( m_panelRegulators, wxID_ANY, _("uA"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_IadjUnitLabel->Wrap( -1 );
|
|
||||||
fgSizerRegParams->Add( m_IadjUnitLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerRegulRight->Add( fgSizerRegParams, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
wxBoxSizer* bSizerRegulButtonCalcReset;
|
|
||||||
bSizerRegulButtonCalcReset = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerRegulButtonCalcReset->Add( 0, 0, 3, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
m_buttonCalculate = new wxButton( m_panelRegulators, wxID_ANY, _("Calculate"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
bSizerRegulButtonCalcReset->Add( m_buttonCalculate, 6, wxTOP, 10 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerRegulButtonCalcReset->Add( 0, 0, 2, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
m_buttonRegulReset = new wxButton( m_panelRegulators, wxID_ANY, _("Reset to Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
bSizerRegulButtonCalcReset->Add( m_buttonRegulReset, 6, wxTOP, 10 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerRegulButtonCalcReset->Add( 0, 0, 3, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerRegulRight->Add( bSizerRegulButtonCalcReset, 0, wxEXPAND|wxLEFT, 30 );
|
|
||||||
|
|
||||||
m_RegulMessage = new wxStaticText( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_RegulMessage->Wrap( -1 );
|
|
||||||
bSizerRegulRight->Add( m_RegulMessage, 0, wxALL, 10 );
|
|
||||||
|
|
||||||
wxStaticBoxSizer* sbSizerRegulatorsChooser;
|
|
||||||
sbSizerRegulatorsChooser = new wxStaticBoxSizer( new wxStaticBox( m_panelRegulators, wxID_ANY, _("Regulator") ), wxVERTICAL );
|
|
||||||
|
|
||||||
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, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_staticTextRegFile = new wxStaticText( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Regulators data file:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_staticTextRegFile->Wrap( -1 );
|
|
||||||
m_staticTextRegFile->SetToolTip( _("The name of the data file which stores known regulators parameters.") );
|
|
||||||
|
|
||||||
sbSizerRegulatorsChooser->Add( m_staticTextRegFile, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
wxBoxSizer* bSizerDataFile;
|
|
||||||
bSizerDataFile = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
m_regulators_fileNameCtrl = new wxTextCtrl( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
bSizerDataFile->Add( m_regulators_fileNameCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_buttonDataFile = new wxButton( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
bSizerDataFile->Add( m_buttonDataFile, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
sbSizerRegulatorsChooser->Add( bSizerDataFile, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
wxBoxSizer* bSizerReulBtn;
|
|
||||||
bSizerReulBtn = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
m_buttonEditItem = new wxButton( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Edit Regulator"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_buttonEditItem->SetToolTip( _("Edit the current selected regulator.") );
|
|
||||||
|
|
||||||
bSizerReulBtn->Add( m_buttonEditItem, 1, wxALL, 5 );
|
|
||||||
|
|
||||||
m_buttonAddItem = new wxButton( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Add Regulator"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_buttonAddItem->SetToolTip( _("Enter a new item to the current list of available regulators") );
|
|
||||||
|
|
||||||
bSizerReulBtn->Add( m_buttonAddItem, 1, wxALL, 5 );
|
|
||||||
|
|
||||||
m_buttonRemoveItem = new wxButton( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Remove Regulator"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_buttonRemoveItem->SetToolTip( _("Remove an item from the current list of available regulators") );
|
|
||||||
|
|
||||||
bSizerReulBtn->Add( m_buttonRemoveItem, 1, wxALL, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
sbSizerRegulatorsChooser->Add( bSizerReulBtn, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerRegulRight->Add( sbSizerRegulatorsChooser, 0, wxEXPAND|wxRIGHT, 10 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerColBalancer->Add( bSizerRegulRight, 1, wxEXPAND|wxTOP|wxLEFT, 10 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerMainReg->Add( bSizerColBalancer, 0, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
m_panelRegulators->SetSizer( bSizerMainReg );
|
|
||||||
m_panelRegulators->Layout();
|
|
||||||
bSizerMainReg->Fit( m_panelRegulators );
|
|
||||||
m_Notebook->AddPage( m_panelRegulators, _("Regulators"), true );
|
m_Notebook->AddPage( m_panelRegulators, _("Regulators"), true );
|
||||||
m_panelAttenuators = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
m_panelAttenuators = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
wxBoxSizer* bSizerAtt;
|
wxBoxSizer* bSizerAtt;
|
||||||
|
@ -1986,14 +1756,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
||||||
// Connect Events
|
// Connect Events
|
||||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) );
|
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) );
|
||||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) );
|
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) );
|
||||||
m_choiceRegType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnRegulTypeSelection ), NULL, this );
|
|
||||||
m_buttonCalculate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnRegulatorCalcButtonClick ), NULL, this );
|
|
||||||
m_buttonRegulReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnRegulatorResetButtonClick ), NULL, this );
|
|
||||||
m_choiceRegulatorSelector->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnRegulatorSelection ), NULL, this );
|
|
||||||
m_buttonDataFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnDataFileSelection ), NULL, this );
|
|
||||||
m_buttonEditItem->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnEditRegulator ), NULL, this );
|
|
||||||
m_buttonAddItem->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnAddRegulator ), NULL, this );
|
|
||||||
m_buttonRemoveItem->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnRemoveRegulator ), NULL, this );
|
|
||||||
m_AttenuatorsSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnAttenuatorSelection ), NULL, this );
|
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_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_bpButtonCalcAtt->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateAttenuator ), NULL, this );
|
||||||
|
@ -2057,14 +1819,6 @@ PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE()
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) );
|
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PCB_CALCULATOR_FRAME_BASE::OnClosePcbCalc ) );
|
||||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) );
|
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PCB_CALCULATOR_FRAME_BASE::OnUpdateUI ) );
|
||||||
m_choiceRegType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnRegulTypeSelection ), NULL, this );
|
|
||||||
m_buttonCalculate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnRegulatorCalcButtonClick ), NULL, this );
|
|
||||||
m_buttonRegulReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnRegulatorResetButtonClick ), NULL, this );
|
|
||||||
m_choiceRegulatorSelector->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnRegulatorSelection ), NULL, this );
|
|
||||||
m_buttonDataFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnDataFileSelection ), NULL, this );
|
|
||||||
m_buttonEditItem->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnEditRegulator ), NULL, this );
|
|
||||||
m_buttonAddItem->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnAddRegulator ), NULL, this );
|
|
||||||
m_buttonRemoveItem->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnRemoveRegulator ), NULL, this );
|
|
||||||
m_AttenuatorsSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnAttenuatorSelection ), NULL, this );
|
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_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_bpButtonCalcAtt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateAttenuator ), NULL, this );
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -16,6 +16,7 @@ class UNIT_SELECTOR_LEN;
|
||||||
class UNIT_SELECTOR_RESISTOR;
|
class UNIT_SELECTOR_RESISTOR;
|
||||||
class UNIT_SELECTOR_THICKNESS;
|
class UNIT_SELECTOR_THICKNESS;
|
||||||
|
|
||||||
|
#include "panel_regulator.h"
|
||||||
#include "widgets/unit_selector.h"
|
#include "widgets/unit_selector.h"
|
||||||
#include "kiway_player.h"
|
#include "kiway_player.h"
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
|
@ -24,22 +25,22 @@ class UNIT_SELECTOR_THICKNESS;
|
||||||
#include <wx/font.h>
|
#include <wx/font.h>
|
||||||
#include <wx/colour.h>
|
#include <wx/colour.h>
|
||||||
#include <wx/settings.h>
|
#include <wx/settings.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/panel.h>
|
||||||
#include <wx/choice.h>
|
|
||||||
#include <wx/sizer.h>
|
|
||||||
#include <wx/bitmap.h>
|
#include <wx/bitmap.h>
|
||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
#include <wx/icon.h>
|
#include <wx/icon.h>
|
||||||
#include <wx/statbmp.h>
|
|
||||||
#include <wx/statbox.h>
|
|
||||||
#include <wx/radiobut.h>
|
|
||||||
#include <wx/textctrl.h>
|
|
||||||
#include <wx/button.h>
|
|
||||||
#include <wx/panel.h>
|
|
||||||
#include <wx/radiobox.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/bmpbuttn.h>
|
||||||
#include <wx/html/htmlwin.h>
|
#include <wx/html/htmlwin.h>
|
||||||
#include <wx/statline.h>
|
#include <wx/statline.h>
|
||||||
|
#include <wx/radiobut.h>
|
||||||
|
#include <wx/choice.h>
|
||||||
#include <wx/grid.h>
|
#include <wx/grid.h>
|
||||||
#include <wx/notebook.h>
|
#include <wx/notebook.h>
|
||||||
#include <wx/frame.h>
|
#include <wx/frame.h>
|
||||||
|
@ -57,40 +58,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
|
||||||
protected:
|
protected:
|
||||||
wxMenuBar* m_menubar;
|
wxMenuBar* m_menubar;
|
||||||
wxNotebook* m_Notebook;
|
wxNotebook* m_Notebook;
|
||||||
wxPanel* m_panelRegulators;
|
PANEL_REGULATOR* m_panelRegulators;
|
||||||
wxStaticText* m_staticTextRegType;
|
|
||||||
wxChoice* m_choiceRegType;
|
|
||||||
wxStaticBitmap* m_bitmapRegul4pins;
|
|
||||||
wxStaticBitmap* m_bitmapRegul3pins;
|
|
||||||
wxStaticText* m_RegulFormula;
|
|
||||||
wxRadioButton* m_rbRegulR1;
|
|
||||||
wxStaticText* m_labelRegultR1;
|
|
||||||
wxTextCtrl* m_RegulR1Value;
|
|
||||||
wxStaticText* m_r1Units;
|
|
||||||
wxRadioButton* m_rbRegulR2;
|
|
||||||
wxStaticText* m_labelRegultR2;
|
|
||||||
wxTextCtrl* m_RegulR2Value;
|
|
||||||
wxStaticText* m_r2Units;
|
|
||||||
wxRadioButton* m_rbRegulVout;
|
|
||||||
wxStaticText* m_labelVout;
|
|
||||||
wxTextCtrl* m_RegulVoutValue;
|
|
||||||
wxStaticText* m_unitsVout;
|
|
||||||
wxStaticText* m_labelVRef;
|
|
||||||
wxTextCtrl* m_RegulVrefValue;
|
|
||||||
wxStaticText* m_unitsVref;
|
|
||||||
wxStaticText* m_RegulIadjTitle;
|
|
||||||
wxTextCtrl* m_RegulIadjValue;
|
|
||||||
wxStaticText* m_IadjUnitLabel;
|
|
||||||
wxButton* m_buttonCalculate;
|
|
||||||
wxButton* m_buttonRegulReset;
|
|
||||||
wxStaticText* m_RegulMessage;
|
|
||||||
wxChoice* m_choiceRegulatorSelector;
|
|
||||||
wxStaticText* m_staticTextRegFile;
|
|
||||||
wxTextCtrl* m_regulators_fileNameCtrl;
|
|
||||||
wxButton* m_buttonDataFile;
|
|
||||||
wxButton* m_buttonEditItem;
|
|
||||||
wxButton* m_buttonAddItem;
|
|
||||||
wxButton* m_buttonRemoveItem;
|
|
||||||
wxPanel* m_panelAttenuators;
|
wxPanel* m_panelAttenuators;
|
||||||
wxRadioBox* m_AttenuatorsSelection;
|
wxRadioBox* m_AttenuatorsSelection;
|
||||||
wxStaticBitmap* m_attenuatorBitmap;
|
wxStaticBitmap* m_attenuatorBitmap;
|
||||||
|
@ -383,14 +351,6 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void OnClosePcbCalc( wxCloseEvent& event ) { event.Skip(); }
|
virtual void OnClosePcbCalc( wxCloseEvent& event ) { event.Skip(); }
|
||||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||||
virtual void OnRegulTypeSelection( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnRegulatorCalcButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnRegulatorResetButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnRegulatorSelection( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnDataFileSelection( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnEditRegulator( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnAddRegulator( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnRemoveRegulator( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnAttenuatorSelection( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnAttenuatorSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnCalculateAttenuator( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnCalculateAttenuator( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnESeriesSelection( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnESeriesSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
|
@ -18,13 +18,8 @@
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file regulators_funct.cpp
|
|
||||||
* Contains the partial functions of PCB_CALCULATOR_FRAME related to regulators
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
//#include <macros.h>
|
||||||
#include <macros.h>
|
|
||||||
|
|
||||||
#include <wx/choicdlg.h>
|
#include <wx/choicdlg.h>
|
||||||
#include <wx/filedlg.h>
|
#include <wx/filedlg.h>
|
||||||
|
@ -35,17 +30,42 @@
|
||||||
#include "pcb_calculator_settings.h"
|
#include "pcb_calculator_settings.h"
|
||||||
|
|
||||||
#include "dialogs/dialog_regulator_form.h"
|
#include "dialogs/dialog_regulator_form.h"
|
||||||
|
#include "../dialogs/panel_regulator.h"
|
||||||
|
|
||||||
|
#include <bitmaps.h>
|
||||||
|
|
||||||
extern double DoubleFromString( const wxString& TextValue );
|
extern double DoubleFromString( const wxString& TextValue );
|
||||||
|
|
||||||
|
PANEL_REGULATOR::PANEL_REGULATOR( wxWindow* parent, wxWindowID id,
|
||||||
|
const wxPoint& pos, const wxSize& size,
|
||||||
|
long style, const wxString& name ) :
|
||||||
|
PANEL_REGULATOR_BASE( parent, id, pos, size, style, name )
|
||||||
|
{
|
||||||
|
m_RegulatorListChanged = false;
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnRegulatorCalcButtonClick( wxCommandEvent& event )
|
m_IadjUnitLabel->SetLabel( wxT( "µA" ) );
|
||||||
|
m_r1Units->SetLabel( wxT( "kΩ" ) );
|
||||||
|
m_r2Units->SetLabel( wxT( "kΩ" ) );
|
||||||
|
|
||||||
|
m_bitmapRegul3pins->SetBitmap( KiBitmap( BITMAPS::regul_3pins ) );
|
||||||
|
m_bitmapRegul4pins->SetBitmap( KiBitmap( BITMAPS::regul ) );
|
||||||
|
|
||||||
|
m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
|
||||||
|
SelectLastSelectedRegulator();
|
||||||
|
}
|
||||||
|
|
||||||
|
PANEL_REGULATOR::~PANEL_REGULATOR()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PANEL_REGULATOR::OnRegulatorCalcButtonClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
RegulatorsSolve();
|
RegulatorsSolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnRegulatorResetButtonClick( wxCommandEvent& event )
|
void PANEL_REGULATOR::OnRegulatorResetButtonClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
m_RegulR1Value->SetValue( wxT( "10" ) );
|
m_RegulR1Value->SetValue( wxT( "10" ) );
|
||||||
m_RegulR2Value->SetValue( wxT( "10" ) );
|
m_RegulR2Value->SetValue( wxT( "10" ) );
|
||||||
|
@ -59,7 +79,7 @@ void PCB_CALCULATOR_FRAME::OnRegulatorResetButtonClick( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::RegulatorPageUpdate()
|
void PANEL_REGULATOR::RegulatorPageUpdate()
|
||||||
{
|
{
|
||||||
switch( m_choiceRegType->GetSelection() )
|
switch( m_choiceRegType->GetSelection() )
|
||||||
{
|
{
|
||||||
|
@ -80,24 +100,24 @@ void PCB_CALCULATOR_FRAME::RegulatorPageUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
// The new icon size must be taken in account
|
// The new icon size must be taken in account
|
||||||
m_panelRegulators->GetSizer()->Layout();
|
GetSizer()->Layout();
|
||||||
|
|
||||||
// Enable/disable buttons:
|
// Enable/disable buttons:
|
||||||
bool enbl = m_choiceRegulatorSelector->GetCount() > 0;
|
bool enbl = m_choiceRegulatorSelector->GetCount() > 0;
|
||||||
m_buttonEditItem->Enable( enbl );
|
m_buttonEditItem->Enable( enbl );
|
||||||
m_buttonRemoveItem->Enable( enbl );
|
m_buttonRemoveItem->Enable( enbl );
|
||||||
|
|
||||||
m_panelRegulators->Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnRegulTypeSelection( wxCommandEvent& event )
|
void PANEL_REGULATOR::OnRegulTypeSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
RegulatorPageUpdate();
|
RegulatorPageUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnRegulatorSelection( wxCommandEvent& event )
|
void PANEL_REGULATOR::OnRegulatorSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
||||||
REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
|
REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
|
||||||
|
@ -119,7 +139,7 @@ void PCB_CALCULATOR_FRAME::OnRegulatorSelection( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
|
void PANEL_REGULATOR::OnDataFileSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString fullfilename = GetDataFilename();
|
wxString fullfilename = GetDataFilename();
|
||||||
|
|
||||||
|
@ -127,7 +147,7 @@ void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
|
||||||
wildcard.Printf( _("PCB Calculator data file" ) + wxT( " (*.%s)|*.%s"),
|
wildcard.Printf( _("PCB Calculator data file" ) + wxT( " (*.%s)|*.%s"),
|
||||||
DataFileNameExt, DataFileNameExt );
|
DataFileNameExt, DataFileNameExt );
|
||||||
|
|
||||||
wxFileDialog dlg( m_panelRegulators, _("Select PCB Calculator Data File"),
|
wxFileDialog dlg( this, _("Select PCB Calculator Data File"),
|
||||||
wxEmptyString, fullfilename, wildcard, wxFD_OPEN );
|
wxEmptyString, fullfilename, wildcard, wxFD_OPEN );
|
||||||
|
|
||||||
if (dlg.ShowModal() == wxID_CANCEL)
|
if (dlg.ShowModal() == wxID_CANCEL)
|
||||||
|
@ -163,7 +183,7 @@ void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnAddRegulator( wxCommandEvent& event )
|
void PANEL_REGULATOR::OnAddRegulator( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DIALOG_REGULATOR_FORM dlg( this, wxEmptyString );
|
DIALOG_REGULATOR_FORM dlg( this, wxEmptyString );
|
||||||
|
|
||||||
|
@ -191,7 +211,7 @@ void PCB_CALCULATOR_FRAME::OnAddRegulator( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnEditRegulator( wxCommandEvent& event )
|
void PANEL_REGULATOR::OnEditRegulator( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
||||||
REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
|
REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
|
||||||
|
@ -215,7 +235,7 @@ void PCB_CALCULATOR_FRAME::OnEditRegulator( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnRemoveRegulator( wxCommandEvent& event )
|
void PANEL_REGULATOR::OnRemoveRegulator( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString name = wxGetSingleChoice( _("Remove Regulator"), wxEmptyString,
|
wxString name = wxGetSingleChoice( _("Remove Regulator"), wxEmptyString,
|
||||||
m_RegulatorList.GetRegList() );
|
m_RegulatorList.GetRegList() );
|
||||||
|
@ -234,7 +254,7 @@ void PCB_CALCULATOR_FRAME::OnRemoveRegulator( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::SelectLastSelectedRegulator()
|
void PANEL_REGULATOR::SelectLastSelectedRegulator()
|
||||||
{
|
{
|
||||||
// Find last selected in regulator list:
|
// Find last selected in regulator list:
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
|
@ -257,7 +277,7 @@ void PCB_CALCULATOR_FRAME::SelectLastSelectedRegulator()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
void PANEL_REGULATOR::RegulatorsSolve()
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
|
@ -366,7 +386,7 @@ void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::Regulators_WriteConfig( PCB_CALCULATOR_SETTINGS* aCfg )
|
void PANEL_REGULATOR::Regulators_WriteConfig( PCB_CALCULATOR_SETTINGS* aCfg )
|
||||||
{
|
{
|
||||||
// Save current parameter values in config.
|
// Save current parameter values in config.
|
||||||
aCfg->m_Regulators.r1 = m_RegulR1Value->GetValue();
|
aCfg->m_Regulators.r1 = m_RegulR1Value->GetValue();
|
||||||
|
@ -392,3 +412,49 @@ void PCB_CALCULATOR_FRAME::Regulators_WriteConfig( PCB_CALCULATOR_SETTINGS* aCfg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PANEL_REGULATOR::LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg )
|
||||||
|
{
|
||||||
|
m_RegulR1Value->SetValue( aCfg->m_Regulators.r1 );
|
||||||
|
m_RegulR2Value->SetValue( aCfg->m_Regulators.r2 );
|
||||||
|
m_RegulVrefValue->SetValue( aCfg->m_Regulators.vref );
|
||||||
|
m_RegulVoutValue->SetValue( aCfg->m_Regulators.vout );
|
||||||
|
SetDataFilename( aCfg->m_Regulators.data_file );
|
||||||
|
m_lastSelectedRegulatorName = aCfg->m_Regulators.selected_regulator;
|
||||||
|
m_choiceRegType->SetSelection( aCfg->m_Regulators.type );
|
||||||
|
|
||||||
|
wxRadioButton* regprms[3] = { m_rbRegulR1, m_rbRegulR2, m_rbRegulVout };
|
||||||
|
|
||||||
|
if( aCfg->m_Regulators.last_param >= 3 )
|
||||||
|
aCfg->m_Regulators.last_param = 0;
|
||||||
|
|
||||||
|
for( int ii = 0; ii < 3; ii++ )
|
||||||
|
regprms[ii]->SetValue( aCfg->m_Regulators.last_param == ii );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString PANEL_REGULATOR::GetDataFilename()
|
||||||
|
{
|
||||||
|
if( m_regulators_fileNameCtrl->GetValue().IsEmpty() )
|
||||||
|
return wxEmptyString;
|
||||||
|
|
||||||
|
wxFileName fn( m_regulators_fileNameCtrl->GetValue() );
|
||||||
|
fn.SetExt( DataFileNameExt );
|
||||||
|
return fn.GetFullPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PANEL_REGULATOR::SetDataFilename( const wxString& aFilename )
|
||||||
|
{
|
||||||
|
if( aFilename.IsEmpty() )
|
||||||
|
{
|
||||||
|
m_regulators_fileNameCtrl->SetValue( wxEmptyString );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxFileName fn( aFilename );
|
||||||
|
fn.SetExt( DataFileNameExt );
|
||||||
|
m_regulators_fileNameCtrl->SetValue( fn.GetFullPath() );
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,7 +22,6 @@
|
||||||
#include <geometry/shape_poly_set.h>
|
#include <geometry/shape_poly_set.h>
|
||||||
#include <kiface_base.h>
|
#include <kiface_base.h>
|
||||||
#include "attenuators/attenuator_classes.h"
|
#include "attenuators/attenuator_classes.h"
|
||||||
#include "class_regulator_data.h"
|
|
||||||
#include "pcb_calculator_frame.h"
|
#include "pcb_calculator_frame.h"
|
||||||
#include "pcb_calculator_settings.h"
|
#include "pcb_calculator_settings.h"
|
||||||
|
|
||||||
|
@ -44,7 +43,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
m_currTransLine = nullptr;
|
m_currTransLine = nullptr;
|
||||||
m_currTransLineType = DEFAULT_TYPE;
|
m_currTransLineType = DEFAULT_TYPE;
|
||||||
m_currAttenuator = nullptr;
|
m_currAttenuator = nullptr;
|
||||||
m_RegulatorListChanged = false;
|
|
||||||
m_TWMode = TW_MASTER_CURRENT;
|
m_TWMode = TW_MASTER_CURRENT;
|
||||||
m_TWNested = false;
|
m_TWNested = false;
|
||||||
|
|
||||||
|
@ -76,17 +74,12 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
m_staticTextAttMsg->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
m_staticTextAttMsg->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||||
|
|
||||||
m_IadjUnitLabel->SetLabel( wxT( "µA" ) );
|
|
||||||
|
|
||||||
m_attZinUnit->SetLabel( wxT( "Ω" ) );
|
m_attZinUnit->SetLabel( wxT( "Ω" ) );
|
||||||
m_attZoutUnit->SetLabel( wxT( "Ω" ) );
|
m_attZoutUnit->SetLabel( wxT( "Ω" ) );
|
||||||
m_attR1Unit->SetLabel( wxT( "Ω" ) );
|
m_attR1Unit->SetLabel( wxT( "Ω" ) );
|
||||||
m_attR2Unit->SetLabel( wxT( "Ω" ) );
|
m_attR2Unit->SetLabel( wxT( "Ω" ) );
|
||||||
m_attR3Unit->SetLabel( wxT( "Ω" ) );
|
m_attR3Unit->SetLabel( wxT( "Ω" ) );
|
||||||
|
|
||||||
m_r1Units->SetLabel( wxT( "kΩ" ) );
|
|
||||||
m_r2Units->SetLabel( wxT( "kΩ" ) );
|
|
||||||
|
|
||||||
m_reqResUnits->SetLabel( wxT( "kΩ" ) );
|
m_reqResUnits->SetLabel( wxT( "kΩ" ) );
|
||||||
m_exclude1Units->SetLabel( wxT( "kΩ" ) );
|
m_exclude1Units->SetLabel( wxT( "kΩ" ) );
|
||||||
m_exclude2Units->SetLabel( wxT( "kΩ" ) );
|
m_exclude2Units->SetLabel( wxT( "kΩ" ) );
|
||||||
|
@ -108,7 +101,7 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
LoadSettings( config() );
|
LoadSettings( config() );
|
||||||
|
|
||||||
ReadDataFile();
|
m_panelRegulators->ReadDataFile();
|
||||||
|
|
||||||
TranslineTypeSelection( m_currTransLineType );
|
TranslineTypeSelection( m_currTransLineType );
|
||||||
m_TranslineSelection->SetSelection( m_currTransLineType );
|
m_TranslineSelection->SetSelection( m_currTransLineType );
|
||||||
|
@ -126,9 +119,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
ElectricalSpacingUpdateData( m_ElectricalSpacingUnitsSelector->GetUnitScale() );
|
ElectricalSpacingUpdateData( m_ElectricalSpacingUnitsSelector->GetUnitScale() );
|
||||||
|
|
||||||
m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
|
|
||||||
SelectLastSelectedRegulator();
|
|
||||||
|
|
||||||
// Give an icon
|
// Give an icon
|
||||||
wxIcon icon;
|
wxIcon icon;
|
||||||
wxIconBundle icon_bundle;
|
wxIconBundle icon_bundle;
|
||||||
|
@ -204,8 +194,6 @@ void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
m_panelViaSize->Layout();
|
m_panelViaSize->Layout();
|
||||||
|
|
||||||
m_attenuatorBitmap->SetBitmap( *m_currAttenuator->m_SchBitMap );
|
m_attenuatorBitmap->SetBitmap( *m_currAttenuator->m_SchBitMap );
|
||||||
m_bitmapRegul3pins->SetBitmap( KiBitmap( BITMAPS::regul_3pins ) );
|
|
||||||
m_bitmapRegul4pins->SetBitmap( KiBitmap( BITMAPS::regul ) );
|
|
||||||
m_panelRegulators->Layout();
|
m_panelRegulators->Layout();
|
||||||
|
|
||||||
m_attenuatorBitmap->GetParent()->Layout();
|
m_attenuatorBitmap->GetParent()->Layout();
|
||||||
|
@ -245,12 +233,12 @@ void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnClosePcbCalc( wxCloseEvent& event )
|
void PCB_CALCULATOR_FRAME::OnClosePcbCalc( wxCloseEvent& event )
|
||||||
{
|
{
|
||||||
if( m_RegulatorListChanged )
|
if( m_panelRegulators->m_RegulatorListChanged )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString title = _( "Write Data Failed" );
|
wxString title = _( "Write Data Failed" );
|
||||||
|
|
||||||
if( GetDataFilename().IsEmpty() )
|
if( m_panelRegulators->GetDataFilename().IsEmpty() )
|
||||||
{
|
{
|
||||||
msg = _( "No data filename to save modifications.\n"
|
msg = _( "No data filename to save modifications.\n"
|
||||||
"Do you want to exit and abandon your changes?" );
|
"Do you want to exit and abandon your changes?" );
|
||||||
|
@ -260,11 +248,11 @@ void PCB_CALCULATOR_FRAME::OnClosePcbCalc( wxCloseEvent& event )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( !WriteDataFile() )
|
if( !m_panelRegulators->WriteDataFile() )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Unable to write file '%s'\n"
|
msg.Printf( _( "Unable to write file '%s'\n"
|
||||||
"Do you want to exit and abandon your changes?"),
|
"Do you want to exit and abandon your changes?"),
|
||||||
GetDataFilename() );
|
m_panelRegulators->GetDataFilename() );
|
||||||
|
|
||||||
if( wxMessageBox( msg, title, wxYES_NO | wxICON_ERROR ) == wxNO )
|
if( wxMessageBox( msg, title, wxYES_NO | wxICON_ERROR ) == wxNO )
|
||||||
return;
|
return;
|
||||||
|
@ -292,21 +280,7 @@ void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
m_BoardClassesUnitsSelector->SetSelection( cfg->m_BoardClassUnits );
|
m_BoardClassesUnitsSelector->SetSelection( cfg->m_BoardClassUnits );
|
||||||
|
|
||||||
// Regul panel config:
|
// Regul panel config:
|
||||||
m_RegulR1Value->SetValue( cfg->m_Regulators.r1 );
|
m_panelRegulators->LoadSettings( cfg );
|
||||||
m_RegulR2Value->SetValue( cfg->m_Regulators.r2 );
|
|
||||||
m_RegulVrefValue->SetValue( cfg->m_Regulators.vref );
|
|
||||||
m_RegulVoutValue->SetValue( cfg->m_Regulators.vout );
|
|
||||||
SetDataFilename( cfg->m_Regulators.data_file );
|
|
||||||
m_lastSelectedRegulatorName = cfg->m_Regulators.selected_regulator;
|
|
||||||
m_choiceRegType->SetSelection( cfg->m_Regulators.type );
|
|
||||||
|
|
||||||
wxRadioButton* regprms[3] = { m_rbRegulR1, m_rbRegulR2, m_rbRegulVout };
|
|
||||||
|
|
||||||
if( cfg->m_Regulators.last_param >= 3 )
|
|
||||||
cfg->m_Regulators.last_param = 0;
|
|
||||||
|
|
||||||
for( int ii = 0; ii < 3; ii++ )
|
|
||||||
regprms[ii]->SetValue( cfg->m_Regulators.last_param == ii );
|
|
||||||
|
|
||||||
// Electrical panel config
|
// Electrical panel config
|
||||||
m_ElectricalSpacingUnitsSelector->SetSelection( cfg->m_Electrical.spacing_units );
|
m_ElectricalSpacingUnitsSelector->SetSelection( cfg->m_Electrical.spacing_units );
|
||||||
|
@ -341,7 +315,7 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
cfg->m_Electrical.spacing_units = m_ElectricalSpacingUnitsSelector->GetSelection();
|
cfg->m_Electrical.spacing_units = m_ElectricalSpacingUnitsSelector->GetSelection();
|
||||||
cfg->m_Electrical.spacing_voltage = m_ElectricalSpacingVoltage->GetValue();
|
cfg->m_Electrical.spacing_voltage = m_ElectricalSpacingVoltage->GetValue();
|
||||||
|
|
||||||
Regulators_WriteConfig( cfg );
|
m_panelRegulators->Regulators_WriteConfig( cfg );
|
||||||
}
|
}
|
||||||
|
|
||||||
writeTrackWidthConfig();
|
writeTrackWidthConfig();
|
||||||
|
@ -374,29 +348,3 @@ void PCB_CALCULATOR_FRAME::OnTranslineSynthetize( wxCommandEvent& event )
|
||||||
m_currTransLine->synthesize();
|
m_currTransLine->synthesize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const wxString PCB_CALCULATOR_FRAME::GetDataFilename()
|
|
||||||
{
|
|
||||||
if( m_regulators_fileNameCtrl->GetValue().IsEmpty() )
|
|
||||||
return wxEmptyString;
|
|
||||||
|
|
||||||
wxFileName fn( m_regulators_fileNameCtrl->GetValue() );
|
|
||||||
fn.SetExt( DataFileNameExt );
|
|
||||||
return fn.GetFullPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::SetDataFilename( const wxString& aFilename )
|
|
||||||
{
|
|
||||||
if( aFilename.IsEmpty() )
|
|
||||||
{
|
|
||||||
m_regulators_fileNameCtrl->SetValue( wxEmptyString );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxFileName fn( aFilename );
|
|
||||||
fn.SetExt( DataFileNameExt );
|
|
||||||
m_regulators_fileNameCtrl->SetValue( fn.GetFullPath() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "pcb_calculator_frame_base.h"
|
#include "pcb_calculator_frame_base.h"
|
||||||
|
|
||||||
#include "attenuators/attenuator_classes.h"
|
#include "attenuators/attenuator_classes.h"
|
||||||
#include "class_regulator_data.h"
|
|
||||||
|
|
||||||
extern const wxString PcbCalcDataFileExt;
|
extern const wxString PcbCalcDataFileExt;
|
||||||
|
|
||||||
|
@ -100,23 +99,6 @@ private:
|
||||||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||||
|
|
||||||
// R/W data files:
|
|
||||||
bool ReadDataFile();
|
|
||||||
bool WriteDataFile();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the full filename of the selected pcb_calculator data file
|
|
||||||
*/
|
|
||||||
const wxString GetDataFilename();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the full filename of the selected pcb_calculator data file
|
|
||||||
* force the standard extension of the file (.pcbcalc).
|
|
||||||
*
|
|
||||||
* @param aFilename is the full filename, with or without extension.
|
|
||||||
*/
|
|
||||||
void SetDataFilename( const wxString& aFilename );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Panel-specific initializers
|
* Panel-specific initializers
|
||||||
*/
|
*/
|
||||||
|
@ -298,6 +280,7 @@ private:
|
||||||
void TransfAttenuatorResultsToPanel();
|
void TransfAttenuatorResultsToPanel();
|
||||||
|
|
||||||
// Regulators Panel
|
// Regulators Panel
|
||||||
|
#if 0
|
||||||
void OnRegulatorCalcButtonClick( wxCommandEvent& event ) override;
|
void OnRegulatorCalcButtonClick( wxCommandEvent& event ) override;
|
||||||
void OnRegulatorResetButtonClick( wxCommandEvent& event ) override;
|
void OnRegulatorResetButtonClick( wxCommandEvent& event ) override;
|
||||||
void OnRegulTypeSelection( wxCommandEvent& event ) override;
|
void OnRegulTypeSelection( wxCommandEvent& event ) override;
|
||||||
|
@ -306,35 +289,10 @@ private:
|
||||||
void OnAddRegulator( wxCommandEvent& event ) override;
|
void OnAddRegulator( wxCommandEvent& event ) override;
|
||||||
void OnEditRegulator( wxCommandEvent& event ) override;
|
void OnEditRegulator( wxCommandEvent& event ) override;
|
||||||
void OnRemoveRegulator( wxCommandEvent& event ) override;
|
void OnRemoveRegulator( wxCommandEvent& event ) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the regulator page dialog display.
|
|
||||||
*
|
|
||||||
* Enable the current regulator drawings and the formula used for calculations.
|
|
||||||
*/
|
|
||||||
void RegulatorPageUpdate();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If m_lastSelectedRegulatorName is empty, just calls RegulatorPageUpdate()
|
|
||||||
*/
|
|
||||||
void SelectLastSelectedRegulator();
|
|
||||||
|
|
||||||
void RegulatorsSolve();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write regulators parameters in configuration.
|
|
||||||
*
|
|
||||||
* @param aCfg is the configuration settings.
|
|
||||||
*/
|
|
||||||
void Regulators_WriteConfig( PCB_CALCULATOR_SETTINGS* aCfg );
|
|
||||||
|
|
||||||
public:
|
|
||||||
REGULATOR_LIST m_RegulatorList; // the list of known regulator
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_RegulatorListChanged; // Set when m_RegulatorList is modified and the corresponding file
|
|
||||||
// must be rewritten
|
|
||||||
|
|
||||||
enum // Which dimension is controlling the track width / current
|
enum // Which dimension is controlling the track width / current
|
||||||
{ // calculations:
|
{ // calculations:
|
||||||
TW_MASTER_CURRENT, // the maximum current,
|
TW_MASTER_CURRENT, // the maximum current,
|
||||||
|
@ -351,8 +309,6 @@ private:
|
||||||
ATTENUATOR* m_currAttenuator;
|
ATTENUATOR* m_currAttenuator;
|
||||||
std::vector<ATTENUATOR*> m_attenuator_list;
|
std::vector<ATTENUATOR*> m_attenuator_list;
|
||||||
|
|
||||||
wxString m_lastSelectedRegulatorName;
|
|
||||||
|
|
||||||
wxBitmap* m_ccValueNamesBitmap;
|
wxBitmap* m_ccValueNamesBitmap;
|
||||||
wxBitmap* m_ccValuesBitmap;
|
wxBitmap* m_ccValuesBitmap;
|
||||||
wxBitmap* m_ccMultipliersBitmap;
|
wxBitmap* m_ccMultipliersBitmap;
|
||||||
|
|
Loading…
Reference in New Issue