Handle single-source DC analyses correctly.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17119
This commit is contained in:
parent
23169ca1a7
commit
d16b5fb810
|
@ -51,7 +51,10 @@ static void setStringSelection( wxChoice* aCtrl, const wxString& aStr )
|
|||
|
||||
static wxString getStringSelection( const wxChoice* aCtrl )
|
||||
{
|
||||
if( aCtrl->GetSelection() >= 0 )
|
||||
return aCtrl->GetString( aCtrl->GetSelection() );
|
||||
else
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
|
||||
|
@ -915,7 +918,15 @@ void DIALOG_SIM_COMMAND::onDCSource2Selected( wxCommandEvent& event )
|
|||
void DIALOG_SIM_COMMAND::onDCEnableSecondSource( wxCommandEvent& event )
|
||||
{
|
||||
bool is2ndSrcEnabled = m_dcEnable2->IsChecked();
|
||||
wxChar type = getStringSelection( m_dcSourceType2 ).Upper().GetChar( 0 );
|
||||
wxChar type = '?';
|
||||
|
||||
if( is2ndSrcEnabled )
|
||||
{
|
||||
wxString fullType = getStringSelection( m_dcSourceType2 ).Upper();
|
||||
|
||||
if( fullType.Length() > 0 )
|
||||
type = fullType.GetChar( 0 );
|
||||
}
|
||||
|
||||
m_dcSourceType2->Enable( is2ndSrcEnabled );
|
||||
m_dcSource2->Enable( is2ndSrcEnabled && type != 'T' );
|
||||
|
|
|
@ -131,10 +131,13 @@ bool SPICE_CIRCUIT_MODEL::ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAMS*
|
|||
aSource1->m_vend = SPICE_VALUE( tokens.GetNextToken() );
|
||||
aSource1->m_vincrement = SPICE_VALUE( tokens.GetNextToken() );
|
||||
|
||||
if( tokens.HasMoreTokens() )
|
||||
{
|
||||
aSource2->m_source = tokens.GetNextToken();
|
||||
aSource2->m_vstart = SPICE_VALUE( tokens.GetNextToken() );
|
||||
aSource2->m_vend = SPICE_VALUE( tokens.GetNextToken() );
|
||||
aSource2->m_vincrement = SPICE_VALUE( tokens.GetNextToken() );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue