Spice simulator settings dialog improvements.

The dialog can now be closed even if it is not on a simulation type tab
which is an improvement but it still doesn't flow very well.  Maybe a
drop down list control to select the desired simulation type would make
for a better user experience.
This commit is contained in:
Wayne Stambaugh 2021-03-20 11:19:20 -04:00
parent 917e368db3
commit 80cb1db2e6
1 changed files with 32 additions and 26 deletions

View File

@ -182,10 +182,10 @@ bool DIALOG_SIM_SETTINGS::TransferDataFromWindow()
ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::HSPICE ); ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::HSPICE );
} }
wxString previousSimCommand = m_simCommand;
wxWindow* page = m_simPages->GetCurrentPage(); wxWindow* page = m_simPages->GetCurrentPage();
// AC analysis if( page == m_pgAC ) // AC analysis
if( page == m_pgAC )
{ {
if( !m_pgAC->Validate() ) if( !m_pgAC->Validate() )
return false; return false;
@ -196,10 +196,7 @@ bool DIALOG_SIM_SETTINGS::TransferDataFromWindow()
SPICE_VALUE( m_acFreqStart->GetValue() ).ToSpiceString(), SPICE_VALUE( m_acFreqStart->GetValue() ).ToSpiceString(),
SPICE_VALUE( m_acFreqStop->GetValue() ).ToSpiceString() ); SPICE_VALUE( m_acFreqStop->GetValue() ).ToSpiceString() );
} }
else if( page == m_pgDC ) // DC transfer analysis
// DC transfer analysis
else if( page == m_pgDC )
{ {
wxString simCmd = wxString( ".dc " ); wxString simCmd = wxString( ".dc " );
@ -228,10 +225,7 @@ bool DIALOG_SIM_SETTINGS::TransferDataFromWindow()
m_simCommand = simCmd; m_simCommand = simCmd;
} }
else if( page == m_pgNoise ) // Noise analysis
// Noise analysis
else if( page == m_pgNoise )
{ {
const NETLIST_EXPORTER_PSPICE::NET_INDEX_MAP& netMap = m_exporter->GetNetIndexMap(); const NETLIST_EXPORTER_PSPICE::NET_INDEX_MAP& netMap = m_exporter->GetNetIndexMap();
@ -259,17 +253,11 @@ bool DIALOG_SIM_SETTINGS::TransferDataFromWindow()
SPICE_VALUE( m_noiseFreqStart->GetValue() ).ToSpiceString(), SPICE_VALUE( m_noiseFreqStart->GetValue() ).ToSpiceString(),
SPICE_VALUE( m_noiseFreqStop->GetValue() ).ToSpiceString() ); SPICE_VALUE( m_noiseFreqStop->GetValue() ).ToSpiceString() );
} }
else if( page == m_pgOP ) // DC operating point analysis
// DC operating point analysis
else if( page == m_pgOP )
{ {
m_simCommand = wxString( ".op" ); m_simCommand = wxString( ".op" );
} }
else if( page == m_pgTransient ) // Transient analysis
// Transient analysis
else if( page == m_pgTransient )
{ {
if( !m_pgTransient->Validate() ) if( !m_pgTransient->Validate() )
return false; return false;
@ -284,21 +272,39 @@ bool DIALOG_SIM_SETTINGS::TransferDataFromWindow()
SPICE_VALUE( m_transFinal->GetValue() ).ToSpiceString(), SPICE_VALUE( m_transFinal->GetValue() ).ToSpiceString(),
initial ); initial );
} }
else if( page == m_pgCustom ) // Custom directives
// Custom directives
else if( page == m_pgCustom )
{ {
m_simCommand = m_customTxt->GetValue(); m_simCommand = m_customTxt->GetValue();
} }
else else
{ {
wxString extendedMsg;
if( m_simCommand.IsEmpty() )
{
KIDIALOG dlg( this, _( "No valid simulation is configured." ), _( "Warning" ),
wxOK | wxCANCEL | wxICON_EXCLAMATION | wxCENTER );
dlg.SetExtendedMessage( _( "A valid simulation can be configured by selecting a "
"simulation tab, setting the simulation parameters and "
"clicking the OK button with the tab selected." ) );
dlg.SetOKCancelLabels(
wxMessageDialog::ButtonLabel( _( "Exit Without Valid Simulation" ) ),
wxMessageDialog::ButtonLabel( _( "Configure Valid Simulation" ) ) );
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
if( dlg.ShowModal() == wxID_OK )
return true;
}
return false; return false;
} }
m_simCommand.Trim(); if( previousSimCommand != m_simCommand )
updateNetlistOpts(); {
m_simCommand.Trim();
updateNetlistOpts();
}
return true; return true;
} }
@ -342,7 +348,7 @@ bool DIALOG_SIM_SETTINGS::TransferDataToWindow()
break; break;
default: default:
wxFAIL_MSG( wxString::Format( "Unkown NGSPICE_MODEL_MODE %d.", wxFAIL_MSG( wxString::Format( "Unknown NGSPICE_MODEL_MODE %d.",
ngspiceSettings->GetModelMode() ) ); ngspiceSettings->GetModelMode() ) );
break; break;
} }