Split out the regulator dialog into unique file and fix filenames
This commit is contained in:
parent
2ade8031dc
commit
3a88992f8e
|
@ -35,7 +35,8 @@ set( PCB_CALCULATOR_SRCS
|
||||||
transline_dlg_funct.cpp
|
transline_dlg_funct.cpp
|
||||||
attenuators/attenuator_classes.cpp
|
attenuators/attenuator_classes.cpp
|
||||||
dialogs/pcb_calculator_frame_base.cpp
|
dialogs/pcb_calculator_frame_base.cpp
|
||||||
dialogs/dialog_regulator_data_base.cpp
|
dialogs/dialog_regulator_form_base.cpp
|
||||||
|
dialogs/dialog_regulator_form.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)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
#ifndef CLASS_REGULATOR_DATA_H
|
|
||||||
#define CLASS_REGULATOR_DATA_H
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file class_regulator_data.h
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2011 jean-pierre.charras
|
* Copyright (C) 1992-2011 jean-pierre.charras
|
||||||
* Copyright (C) 1992-2011 Kicad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2020 Kicad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -29,6 +22,14 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file class_regulator_data.h
|
||||||
|
* Contains structures for storage of regulator data
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CLASS_REGULATOR_DATA_H
|
||||||
|
#define CLASS_REGULATOR_DATA_H
|
||||||
|
|
||||||
#include <refdes_utils.h>
|
#include <refdes_utils.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -28,6 +28,7 @@ void PCB_CALCULATOR_FRAME::OnToleranceSelection( wxCommandEvent& event )
|
||||||
ToleranceSelection( event.GetSelection() );
|
ToleranceSelection( event.GetSelection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::ToleranceSelection( int aSelection )
|
void PCB_CALCULATOR_FRAME::ToleranceSelection( int aSelection )
|
||||||
{
|
{
|
||||||
/* For tolerance = 5 or 10 %, there are 3 bands for the value
|
/* For tolerance = 5 or 10 %, there are 3 bands for the value
|
||||||
|
@ -56,5 +57,4 @@ void PCB_CALCULATOR_FRAME::ToleranceSelection( int aSelection )
|
||||||
m_panelColorCode->GetSizer()->Layout();
|
m_panelColorCode->GetSizer()->Layout();
|
||||||
m_panelColorCode->Refresh();
|
m_panelColorCode->Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1992-2011 jean-pierre.charras
|
||||||
|
* Copyright (C) 1992-2020 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 "class_regulator_data.h"
|
||||||
|
#include "pcb_calculator_frame.h"
|
||||||
|
#include "dialog_regulator_form.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern double DoubleFromString( const wxString& TextValue );
|
||||||
|
|
||||||
|
|
||||||
|
void DIALOG_REGULATOR_FORM::OnOKClick( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
if( !IsOK() )
|
||||||
|
{
|
||||||
|
wxMessageBox( _( "Bad or missing parameters!" ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EndModal( wxID_OK );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool DIALOG_REGULATOR_FORM::IsOK()
|
||||||
|
{
|
||||||
|
bool success = true;
|
||||||
|
|
||||||
|
if( m_textCtrlName->GetValue().IsEmpty() )
|
||||||
|
success = false;
|
||||||
|
if( m_textCtrlVref->GetValue().IsEmpty() )
|
||||||
|
success = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double vref = DoubleFromString( m_textCtrlVref->GetValue() );
|
||||||
|
if( fabs( vref ) < 0.01 )
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
if( m_choiceRegType->GetSelection() == 1 )
|
||||||
|
{
|
||||||
|
if( m_RegulIadjValue->GetValue().IsEmpty() )
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DIALOG_REGULATOR_FORM::UpdateDialog()
|
||||||
|
{
|
||||||
|
bool enbl = m_choiceRegType->GetSelection() == 1;
|
||||||
|
m_RegulIadjValue->Enable( enbl );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DIALOG_REGULATOR_FORM::CopyRegulatorDataToDialog( REGULATOR_DATA* aItem )
|
||||||
|
{
|
||||||
|
m_textCtrlName->SetValue( aItem->m_Name );
|
||||||
|
wxString value;
|
||||||
|
value.Printf( wxT( "%g" ), aItem->m_Vref );
|
||||||
|
m_textCtrlVref->SetValue( value );
|
||||||
|
value.Printf( wxT( "%g" ), aItem->m_Iadj );
|
||||||
|
m_RegulIadjValue->SetValue( value );
|
||||||
|
m_choiceRegType->SetSelection( aItem->m_Type );
|
||||||
|
UpdateDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
REGULATOR_DATA* DIALOG_REGULATOR_FORM::BuildRegulatorFromData()
|
||||||
|
{
|
||||||
|
double vref = DoubleFromString( m_textCtrlVref->GetValue() );
|
||||||
|
double iadj = DoubleFromString( m_RegulIadjValue->GetValue() );
|
||||||
|
int type = m_choiceRegType->GetSelection();
|
||||||
|
|
||||||
|
if( type != 1 )
|
||||||
|
iadj = 0.0;
|
||||||
|
|
||||||
|
REGULATOR_DATA* item = new REGULATOR_DATA( m_textCtrlName->GetValue(), vref, type, iadj );
|
||||||
|
return item;
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1992-2011 jean-pierre.charras
|
||||||
|
* Copyright (C) 1992-2020 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file dialog_regulator_form.h
|
||||||
|
* Subclass of DIALOG_REGULATOR_FORM_BASE, which is generated by wxFormBuilder.
|
||||||
|
*
|
||||||
|
* This dialog is used to add / edit regulators to the list on the
|
||||||
|
* regulator tab of the pcb calculator
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DIALOG_REGULATOR_FORM_H
|
||||||
|
#define DIALOG_REGULATOR_FORM_H
|
||||||
|
|
||||||
|
#include "dialog_regulator_form_base.h"
|
||||||
|
|
||||||
|
class PCB_CALCULATOR_FRAME;
|
||||||
|
class REGULATOR_DATA;
|
||||||
|
|
||||||
|
class DIALOG_REGULATOR_FORM : public DIALOG_REGULATOR_FORM_BASE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DIALOG_REGULATOR_FORM( PCB_CALCULATOR_FRAME* parent, const wxString& aRegName )
|
||||||
|
: DIALOG_REGULATOR_FORM_BASE( parent )
|
||||||
|
{
|
||||||
|
m_textCtrlName->SetValue( aRegName );
|
||||||
|
m_textCtrlName->Enable( aRegName.IsEmpty() );
|
||||||
|
UpdateDialog();
|
||||||
|
|
||||||
|
m_sdbSizerOK->SetDefault();
|
||||||
|
|
||||||
|
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||||
|
FinishDialogSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
~DIALOG_REGULATOR_FORM(){};
|
||||||
|
|
||||||
|
// Event called functions:
|
||||||
|
void OnOKClick( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function IsOK()
|
||||||
|
* @return true if regulator parameters are acceptable
|
||||||
|
*/
|
||||||
|
bool IsOK();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function CopyRegulatorDataToDialog
|
||||||
|
* Transfert data from dialog to aItem
|
||||||
|
* @param aItem = a pointer to the REGULATOR_DATA
|
||||||
|
*/
|
||||||
|
void CopyRegulatorDataToDialog( REGULATOR_DATA* aItem );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function BuildRegulatorFromData
|
||||||
|
* Creates a new REGULATOR_DATA from dialog
|
||||||
|
* @return a pointer to the new REGULATOR_DATA
|
||||||
|
*/
|
||||||
|
REGULATOR_DATA* BuildRegulatorFromData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable Iadj realted widgets, according to
|
||||||
|
* the regulator type
|
||||||
|
*/
|
||||||
|
void UpdateDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* called when the current regulator type is changed
|
||||||
|
*/
|
||||||
|
void OnRegTypeSelection( wxCommandEvent& event ) override
|
||||||
|
{
|
||||||
|
UpdateDialog();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIALOG_REGULATOR_FORM_H
|
|
@ -1,15 +1,15 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version v3.8.0)
|
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "dialog_regulator_data_base.h"
|
#include "dialog_regulator_form_base.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DIALOG_EDITOR_DATA_BASE::DIALOG_EDITOR_DATA_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
DIALOG_REGULATOR_FORM_BASE::DIALOG_REGULATOR_FORM_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||||
{
|
{
|
||||||
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
|
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
|
||||||
|
|
||||||
|
@ -95,14 +95,14 @@ DIALOG_EDITOR_DATA_BASE::DIALOG_EDITOR_DATA_BASE( wxWindow* parent, wxWindowID i
|
||||||
this->Centre( wxBOTH );
|
this->Centre( wxBOTH );
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
m_choiceRegType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnRegTypeSelection ), NULL, this );
|
m_choiceRegType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_REGULATOR_FORM_BASE::OnRegTypeSelection ), NULL, this );
|
||||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnOKClick ), NULL, this );
|
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_REGULATOR_FORM_BASE::OnOKClick ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
DIALOG_EDITOR_DATA_BASE::~DIALOG_EDITOR_DATA_BASE()
|
DIALOG_REGULATOR_FORM_BASE::~DIALOG_REGULATOR_FORM_BASE()
|
||||||
{
|
{
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
m_choiceRegType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnRegTypeSelection ), NULL, this );
|
m_choiceRegType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_REGULATOR_FORM_BASE::OnRegTypeSelection ), NULL, this );
|
||||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnOKClick ), NULL, this );
|
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_REGULATOR_FORM_BASE::OnOKClick ), NULL, this );
|
||||||
|
|
||||||
}
|
}
|
|
@ -11,12 +11,12 @@
|
||||||
<property name="embedded_files_path">res</property>
|
<property name="embedded_files_path">res</property>
|
||||||
<property name="encoding">UTF-8</property>
|
<property name="encoding">UTF-8</property>
|
||||||
<property name="event_generation">connect</property>
|
<property name="event_generation">connect</property>
|
||||||
<property name="file">dialog_regulator_data_base</property>
|
<property name="file">dialog_regulator_form_base</property>
|
||||||
<property name="first_id">1000</property>
|
<property name="first_id">1000</property>
|
||||||
<property name="help_provider">none</property>
|
<property name="help_provider">none</property>
|
||||||
<property name="indent_with_spaces"></property>
|
<property name="indent_with_spaces"></property>
|
||||||
<property name="internationalize">1</property>
|
<property name="internationalize">1</property>
|
||||||
<property name="name">dialog_regulator_data</property>
|
<property name="name">dialog_regulator_form_base</property>
|
||||||
<property name="namespace"></property>
|
<property name="namespace"></property>
|
||||||
<property name="path">.</property>
|
<property name="path">.</property>
|
||||||
<property name="precompiled_header"></property>
|
<property name="precompiled_header"></property>
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="maximum_size"></property>
|
<property name="maximum_size"></property>
|
||||||
<property name="minimum_size">-1,-1</property>
|
<property name="minimum_size">-1,-1</property>
|
||||||
<property name="name">DIALOG_EDITOR_DATA_BASE</property>
|
<property name="name">DIALOG_REGULATOR_FORM_BASE</property>
|
||||||
<property name="pos"></property>
|
<property name="pos"></property>
|
||||||
<property name="size">-1,-1</property>
|
<property name="size">-1,-1</property>
|
||||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||||
|
@ -53,16 +53,16 @@
|
||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
<object class="wxBoxSizer" expanded="1">
|
<object class="wxBoxSizer" expanded="0">
|
||||||
<property name="minimum_size">300,-1</property>
|
<property name="minimum_size">300,-1</property>
|
||||||
<property name="name">bSizerMain</property>
|
<property name="name">bSizerMain</property>
|
||||||
<property name="orient">wxVERTICAL</property>
|
<property name="orient">wxVERTICAL</property>
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND</property>
|
<property name="flag">wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxFlexGridSizer" expanded="1">
|
<object class="wxFlexGridSizer" expanded="0">
|
||||||
<property name="cols">3</property>
|
<property name="cols">3</property>
|
||||||
<property name="flexible_direction">wxHORIZONTAL</property>
|
<property name="flexible_direction">wxHORIZONTAL</property>
|
||||||
<property name="growablecols">1</property>
|
<property name="growablecols">1</property>
|
||||||
|
@ -74,11 +74,11 @@
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
<property name="rows">4</property>
|
<property name="rows">4</property>
|
||||||
<property name="vgap">0</property>
|
<property name="vgap">0</property>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -135,11 +135,11 @@
|
||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxTextCtrl" expanded="1">
|
<object class="wxTextCtrl" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -199,21 +199,21 @@
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND</property>
|
<property name="flag">wxEXPAND</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="spacer" expanded="1">
|
<object class="spacer" expanded="0">
|
||||||
<property name="height">0</property>
|
<property name="height">0</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="width">0</property>
|
<property name="width">0</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -270,11 +270,11 @@
|
||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxTextCtrl" expanded="1">
|
<object class="wxTextCtrl" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -334,11 +334,11 @@
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -395,11 +395,11 @@
|
||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -456,11 +456,11 @@
|
||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxChoice" expanded="1">
|
<object class="wxChoice" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -521,21 +521,21 @@
|
||||||
<event name="OnChoice">OnRegTypeSelection</event>
|
<event name="OnChoice">OnRegTypeSelection</event>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND</property>
|
<property name="flag">wxEXPAND</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="spacer" expanded="1">
|
<object class="spacer" expanded="0">
|
||||||
<property name="height">0</property>
|
<property name="height">0</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="width">0</property>
|
<property name="width">0</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -592,11 +592,11 @@
|
||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxTextCtrl" expanded="1">
|
<object class="wxTextCtrl" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -656,11 +656,11 @@
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticText" expanded="1">
|
<object class="wxStaticText" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -719,21 +719,21 @@
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND</property>
|
<property name="flag">wxEXPAND</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="spacer" expanded="1">
|
<object class="spacer" expanded="0">
|
||||||
<property name="height">0</property>
|
<property name="height">0</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="width">0</property>
|
<property name="width">0</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND</property>
|
<property name="flag">wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticLine" expanded="1">
|
<object class="wxStaticLine" expanded="0">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
<property name="RightDockable">1</property>
|
<property name="RightDockable">1</property>
|
||||||
|
@ -787,11 +787,11 @@
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALL|wxEXPAND</property>
|
<property name="flag">wxALL|wxEXPAND</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
<object class="wxStdDialogButtonSizer" expanded="0">
|
||||||
<property name="Apply">0</property>
|
<property name="Apply">0</property>
|
||||||
<property name="Cancel">1</property>
|
<property name="Cancel">1</property>
|
||||||
<property name="ContextHelp">0</property>
|
<property name="ContextHelp">0</property>
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version v3.8.0)
|
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -28,9 +28,9 @@
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// Class DIALOG_EDITOR_DATA_BASE
|
/// Class DIALOG_REGULATOR_FORM_BASE
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class DIALOG_EDITOR_DATA_BASE : public DIALOG_SHIM
|
class DIALOG_REGULATOR_FORM_BASE : public DIALOG_SHIM
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ class DIALOG_EDITOR_DATA_BASE : public DIALOG_SHIM
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DIALOG_EDITOR_DATA_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Regulator Parameters"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
DIALOG_REGULATOR_FORM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Regulator Parameters"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||||
~DIALOG_EDITOR_DATA_BASE();
|
~DIALOG_REGULATOR_FORM_BASE();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/**
|
|
||||||
* @file regulators_funct.cpp
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
|
@ -20,143 +17,31 @@
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* 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 <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
|
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
||||||
#include "class_regulator_data.h"
|
#include "class_regulator_data.h"
|
||||||
#include "dialog_regulator_data_base.h"
|
|
||||||
#include "pcb_calculator_frame.h"
|
#include "pcb_calculator_frame.h"
|
||||||
#include "pcb_calculator_settings.h"
|
#include "pcb_calculator_settings.h"
|
||||||
|
|
||||||
|
#include "dialogs/dialog_regulator_form.h"
|
||||||
|
|
||||||
extern double DoubleFromString( const wxString& TextValue );
|
extern double DoubleFromString( const wxString& TextValue );
|
||||||
|
|
||||||
class DIALOG_EDITOR_DATA: public DIALOG_EDITOR_DATA_BASE
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DIALOG_EDITOR_DATA( PCB_CALCULATOR_FRAME * parent, const wxString & aRegName )
|
|
||||||
: DIALOG_EDITOR_DATA_BASE( parent )
|
|
||||||
{
|
|
||||||
m_textCtrlName->SetValue( aRegName );
|
|
||||||
m_textCtrlName->Enable( aRegName.IsEmpty() );
|
|
||||||
UpdateDialog();
|
|
||||||
|
|
||||||
m_sdbSizerOK->SetDefault();
|
|
||||||
|
|
||||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
|
||||||
FinishDialogSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
~DIALOG_EDITOR_DATA() {};
|
|
||||||
|
|
||||||
// Event called functions:
|
|
||||||
void OnOKClick( wxCommandEvent& event ) override;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function IsOK()
|
|
||||||
* @return true if regulator parameters are acceptable
|
|
||||||
*/
|
|
||||||
bool IsOK();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function CopyRegulatorDataToDialog
|
|
||||||
* Transfert data from dialog to aItem
|
|
||||||
* @param aItem = a pointer to the REGULATOR_DATA
|
|
||||||
*/
|
|
||||||
void CopyRegulatorDataToDialog( REGULATOR_DATA * aItem );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function BuildRegulatorFromData
|
|
||||||
* Creates a new REGULATOR_DATA from dialog
|
|
||||||
* @return a pointer to the new REGULATOR_DATA
|
|
||||||
*/
|
|
||||||
REGULATOR_DATA * BuildRegulatorFromData();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable/disable Iadj realted widgets, according to
|
|
||||||
* the regulator type
|
|
||||||
*/
|
|
||||||
void UpdateDialog()
|
|
||||||
{
|
|
||||||
bool enbl = m_choiceRegType->GetSelection() == 1;
|
|
||||||
m_RegulIadjValue->Enable( enbl );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* called when the current regulator type is changed
|
|
||||||
*/
|
|
||||||
void OnRegTypeSelection( wxCommandEvent& event ) override
|
|
||||||
{
|
|
||||||
UpdateDialog();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_EDITOR_DATA::OnOKClick( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
if( !IsOK() )
|
|
||||||
{
|
|
||||||
wxMessageBox( _("Bad or missing parameters!") );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EndModal( wxID_OK );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DIALOG_EDITOR_DATA::IsOK()
|
|
||||||
{
|
|
||||||
bool success = true;
|
|
||||||
|
|
||||||
if( m_textCtrlName->GetValue().IsEmpty() )
|
|
||||||
success = false;
|
|
||||||
if( m_textCtrlVref->GetValue().IsEmpty() )
|
|
||||||
success = false;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
double vref = DoubleFromString( m_textCtrlVref->GetValue() );
|
|
||||||
if( fabs(vref) < 0.01 )
|
|
||||||
success = false;
|
|
||||||
}
|
|
||||||
if( m_choiceRegType->GetSelection() == 1 )
|
|
||||||
{
|
|
||||||
if( m_RegulIadjValue->GetValue().IsEmpty() )
|
|
||||||
success = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DIALOG_EDITOR_DATA::CopyRegulatorDataToDialog( REGULATOR_DATA * aItem )
|
|
||||||
{
|
|
||||||
m_textCtrlName->SetValue( aItem->m_Name );
|
|
||||||
wxString value;
|
|
||||||
value.Printf( wxT("%g"), aItem->m_Vref );
|
|
||||||
m_textCtrlVref->SetValue( value );
|
|
||||||
value.Printf( wxT("%g"), aItem->m_Iadj );
|
|
||||||
m_RegulIadjValue->SetValue( value );
|
|
||||||
m_choiceRegType->SetSelection( aItem->m_Type );
|
|
||||||
UpdateDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
REGULATOR_DATA * DIALOG_EDITOR_DATA::BuildRegulatorFromData()
|
|
||||||
{
|
|
||||||
double vref = DoubleFromString( m_textCtrlVref->GetValue() );
|
|
||||||
double iadj = DoubleFromString( m_RegulIadjValue->GetValue() );
|
|
||||||
int type = m_choiceRegType->GetSelection();
|
|
||||||
|
|
||||||
if( type != 1 )
|
|
||||||
iadj = 0.0;
|
|
||||||
|
|
||||||
REGULATOR_DATA * item = new REGULATOR_DATA( m_textCtrlName->GetValue(),
|
|
||||||
vref, type, iadj );
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnRegulatorCalcButtonClick( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnRegulatorCalcButtonClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
RegulatorsSolve();
|
RegulatorsSolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnRegulatorResetButtonClick( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnRegulatorResetButtonClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
m_RegulR1Value->SetValue( wxT( "10" ) );
|
m_RegulR1Value->SetValue( wxT( "10" ) );
|
||||||
|
@ -170,6 +55,7 @@ void PCB_CALCULATOR_FRAME::OnRegulatorResetButtonClick( wxCommandEvent& event )
|
||||||
RegulatorPageUpdate();
|
RegulatorPageUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::RegulatorPageUpdate()
|
void PCB_CALCULATOR_FRAME::RegulatorPageUpdate()
|
||||||
{
|
{
|
||||||
switch( m_choiceRegType->GetSelection() )
|
switch( m_choiceRegType->GetSelection() )
|
||||||
|
@ -200,11 +86,13 @@ void PCB_CALCULATOR_FRAME::RegulatorPageUpdate()
|
||||||
m_panelRegulators->Refresh();
|
m_panelRegulators->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnRegulTypeSelection( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnRegulTypeSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
RegulatorPageUpdate();
|
RegulatorPageUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnRegulatorSelection( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnRegulatorSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
||||||
|
@ -225,6 +113,7 @@ void PCB_CALCULATOR_FRAME::OnRegulatorSelection( wxCommandEvent& event )
|
||||||
RegulatorPageUpdate();
|
RegulatorPageUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called when ckicking on button Browse:
|
* Called when ckicking on button Browse:
|
||||||
* Select a new data file, and load it on request
|
* Select a new data file, and load it on request
|
||||||
|
@ -274,9 +163,10 @@ void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnAddRegulator( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnAddRegulator( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DIALOG_EDITOR_DATA dlg( this, wxEmptyString );
|
DIALOG_REGULATOR_FORM dlg( this, wxEmptyString );
|
||||||
if( dlg.ShowModal() != wxID_OK )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
return;
|
return;
|
||||||
if( !dlg.IsOK() )
|
if( !dlg.IsOK() )
|
||||||
|
@ -305,6 +195,7 @@ void PCB_CALCULATOR_FRAME::OnAddRegulator( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnEditRegulator( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnEditRegulator( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
||||||
|
@ -312,7 +203,7 @@ void PCB_CALCULATOR_FRAME::OnEditRegulator( wxCommandEvent& event )
|
||||||
if( item == NULL )
|
if( item == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DIALOG_EDITOR_DATA dlg( this, name );
|
DIALOG_REGULATOR_FORM dlg( this, name );
|
||||||
|
|
||||||
dlg.CopyRegulatorDataToDialog( item );
|
dlg.CopyRegulatorDataToDialog( item );
|
||||||
if( dlg.ShowModal() != wxID_OK )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
|
@ -326,6 +217,7 @@ void PCB_CALCULATOR_FRAME::OnEditRegulator( wxCommandEvent& event )
|
||||||
SelectLastSelectedRegulator();
|
SelectLastSelectedRegulator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::OnRemoveRegulator( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnRemoveRegulator( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString name = wxGetSingleChoice( _("Remove Regulator"), wxEmptyString,
|
wxString name = wxGetSingleChoice( _("Remove Regulator"), wxEmptyString,
|
||||||
|
@ -343,6 +235,7 @@ void PCB_CALCULATOR_FRAME::OnRemoveRegulator( wxCommandEvent& event )
|
||||||
SelectLastSelectedRegulator();
|
SelectLastSelectedRegulator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::SelectLastSelectedRegulator()
|
void PCB_CALCULATOR_FRAME::SelectLastSelectedRegulator()
|
||||||
{
|
{
|
||||||
// Find last selected in regulator list:
|
// Find last selected in regulator list:
|
||||||
|
@ -362,6 +255,7 @@ void PCB_CALCULATOR_FRAME::SelectLastSelectedRegulator()
|
||||||
OnRegulatorSelection( event );
|
OnRegulatorSelection( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Calculate a value from the 3 other values
|
// Calculate a value from the 3 other values
|
||||||
// Vref is given by the regulator properties, so
|
// Vref is given by the regulator properties, so
|
||||||
// we can calculate only R1, R2 or Vout
|
// we can calculate only R1, R2 or Vout
|
||||||
|
|
Loading…
Reference in New Issue