Fix logic error in parsing sim command, and DC source types in dialog.
Fixes https://gitlab.com/kicad/code/kicad/issues/9064
This commit is contained in:
parent
b2498f5673
commit
419fe236ad
|
@ -105,9 +105,12 @@ DIALOG_SIM_COMMAND::DIALOG_SIM_COMMAND( wxWindow* aParent,
|
|||
wxString DIALOG_SIM_COMMAND::evaluateDCControls( wxChoice* aDcSource, wxTextCtrl* aDcStart,
|
||||
wxTextCtrl* aDcStop, wxTextCtrl* aDcIncr )
|
||||
{
|
||||
wxString dcSource = aDcSource->GetString( aDcSource->GetSelection() );
|
||||
wxString dcSource;
|
||||
wxWindow* ctrlWithError = nullptr;
|
||||
|
||||
if( aDcSource->GetSelection() >= 0 )
|
||||
dcSource = aDcSource->GetString( aDcSource->GetSelection() );
|
||||
|
||||
if( dcSource.IsEmpty() )
|
||||
{
|
||||
DisplayError( this, _( "You need to select DC source" ) );
|
||||
|
@ -393,13 +396,12 @@ void DIALOG_SIM_COMMAND::updateDCSources( wxChar aType, wxChoice* aSource )
|
|||
|
||||
if( aType != 'T' )
|
||||
{
|
||||
for( const auto& item : m_circuitModel->GetItems() )
|
||||
for( const SPICE_ITEM& item : m_circuitModel->GetItems() )
|
||||
{
|
||||
if( ( aType == 'R' && item.model->GetDeviceType() == SIM_MODEL::DEVICE_T::R )
|
||||
|| ( aType == 'C' && item.model->GetDeviceType() == SIM_MODEL::DEVICE_T::C )
|
||||
|| ( aType == 'L' && item.model->GetDeviceType() == SIM_MODEL::DEVICE_T::L ) )
|
||||
|| ( aType == 'V' && item.model->GetDeviceType() == SIM_MODEL::DEVICE_T::V )
|
||||
|| ( aType == 'I' && item.model->GetDeviceType() == SIM_MODEL::DEVICE_T::I ) )
|
||||
{
|
||||
// TODO: VSOURCE, ISOURCE.
|
||||
sourcesList.insert( item.refName );
|
||||
}
|
||||
}
|
||||
|
@ -444,9 +446,9 @@ bool DIALOG_SIM_COMMAND::parseCommand( const wxString& aCommand )
|
|||
|
||||
if( tkn == "dec" )
|
||||
m_acScale->SetSelection( 0 );
|
||||
if( tkn == "oct" )
|
||||
else if( tkn == "oct" )
|
||||
m_acScale->SetSelection( 1 );
|
||||
if( tkn == "lin" )
|
||||
else if( tkn == "lin" )
|
||||
m_acScale->SetSelection( 2 );
|
||||
else
|
||||
return false;
|
||||
|
@ -458,14 +460,14 @@ bool DIALOG_SIM_COMMAND::parseCommand( const wxString& aCommand )
|
|||
}
|
||||
else if( tkn == ".dc" )
|
||||
{
|
||||
m_simPages->SetSelection( m_simPages->FindPage( m_pgDC ) );
|
||||
|
||||
SPICE_DC_PARAMS src1, src2;
|
||||
src2.m_vincrement = SPICE_VALUE( -1 );
|
||||
|
||||
if( !m_circuitModel->ParseDCCommand( aCommand, &src1, &src2 ) )
|
||||
return false;
|
||||
|
||||
m_simPages->SetSelection( m_simPages->FindPage( m_pgDC ) );
|
||||
|
||||
if( src1.m_source.IsSameAs( wxT( "TEMP" ), false ) )
|
||||
setStringSelection( m_dcSourceType1, wxT( "TEMP" ) );
|
||||
else
|
||||
|
|
|
@ -40,7 +40,7 @@ class DIALOG_SIM_COMMAND : public DIALOG_SIM_COMMAND_BASE
|
|||
{
|
||||
public:
|
||||
DIALOG_SIM_COMMAND( wxWindow* aParent, std::shared_ptr<NGSPICE_CIRCUIT_MODEL> aCircuitModel,
|
||||
std::shared_ptr<SPICE_SIMULATOR_SETTINGS>& aSettings );
|
||||
std::shared_ptr<SPICE_SIMULATOR_SETTINGS>& aSettings );
|
||||
|
||||
const wxString& GetSimCommand() const
|
||||
{
|
||||
|
|
|
@ -134,6 +134,8 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
|
|||
gbSizer1->Add( m_staticText5, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_dcStart1 = new wxTextCtrl( m_pgDC, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_dcStart1->SetMinSize( wxSize( 100,-1 ) );
|
||||
|
||||
gbSizer1->Add( m_dcStart1, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_src1DCStartValUnit = new wxStaticText( m_pgDC, wxID_ANY, _("Volts"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -143,6 +145,8 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
|
|||
gbSizer1->Add( m_src1DCStartValUnit, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_dcStart2 = new wxTextCtrl( m_pgDC, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_dcStart2->SetMinSize( wxSize( 100,-1 ) );
|
||||
|
||||
gbSizer1->Add( m_dcStart2, wxGBPosition( 3, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_src2DCStartValUnit = new wxStaticText( m_pgDC, wxID_ANY, _("Volts"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
|
|
@ -1493,7 +1493,7 @@
|
|||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="minimum_size">100,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_dcStart1</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
@ -1624,7 +1624,7 @@
|
|||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="minimum_size">100,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_dcStart2</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
|
|
@ -1508,8 +1508,8 @@ void SIM_PLOT_FRAME::onSettings( wxCommandEvent& event )
|
|||
else
|
||||
oldCommand = wxString();
|
||||
|
||||
wxString newCommand = dlg.GetSimCommand();
|
||||
SIM_TYPE newSimType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( newCommand );
|
||||
const wxString& newCommand = dlg.GetSimCommand();
|
||||
SIM_TYPE newSimType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( newCommand );
|
||||
|
||||
// If it is a new simulation type, open a new plot
|
||||
// For the DC sim, check if sweep source type has changed (char 4 will contain 'v',
|
||||
|
|
Loading…
Reference in New Issue