Enable tuner for RLC components only

This commit is contained in:
Maciej Suminski 2016-08-11 14:41:45 +02:00
parent 92a3e405c2
commit a717194b1e
4 changed files with 20 additions and 3 deletions

View File

@ -140,6 +140,14 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* aFormatter, unsigned aCtl
}
wxString NETLIST_EXPORTER_PSPICE::GetSpiceField( SPICE_FIELD aField,
SCH_COMPONENT* aComponent, unsigned aCtl )
{
SCH_FIELD* field = aComponent->FindField( GetSpiceFieldName( aField ) );
return field ? field->GetText() : GetSpiceFieldDefVal( SPICE_PRIMITIVE, aComponent, aCtl );
}
wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField,
SCH_COMPONENT* aComponent, unsigned aCtl )
{

View File

@ -130,6 +130,11 @@ public:
return m_spiceFields[(int) aField];
}
/**
* @brief Retrieves either the requested field value or the default value.
*/
static wxString GetSpiceField( SPICE_FIELD aField, SCH_COMPONENT* aComponent, unsigned aCtl );
static wxString GetSpiceFieldDefVal( SPICE_FIELD aField, SCH_COMPONENT* aComponent, unsigned aCtl );
void UpdateDirectives( unsigned aCtl );

View File

@ -184,6 +184,12 @@ void SIM_PLOT_FRAME::AddTuner( SCH_COMPONENT* aComponent )
if( !plotPanel )
return;
// For now limit the tuner tool to RLC components
char primitiveType = NETLIST_EXPORTER_PSPICE::GetSpiceField( SPICE_PRIMITIVE, aComponent, 0 )[0];
if( primitiveType != SP_RESISTOR && primitiveType != SP_CAPACITOR && primitiveType != SP_INDUCTOR )
return;
const wxString& componentName = aComponent->GetField( REFERENCE )->GetText();
auto& tunerList = m_tuners[plotPanel];

View File

@ -38,9 +38,7 @@ TUNER_SLIDER::TUNER_SLIDER( SIM_PLOT_FRAME* aParent, SCH_COMPONENT* aComponent )
m_value = SPICE_VALUE( aComponent->GetField( VALUE )->GetText() );
// Generate Spice component name
SCH_FIELD* fieldPrim = aComponent->FindField( NETLIST_EXPORTER_PSPICE::GetSpiceFieldName( SPICE_PRIMITIVE ) );
char prim = fieldPrim ? fieldPrim->GetText()[0]
: NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_PRIMITIVE, m_component, 0 )[0];
char prim = NETLIST_EXPORTER_PSPICE::GetSpiceField( SPICE_PRIMITIVE, aComponent, 0 )[0];
m_spiceName = wxString( prim + compName ).Lower();
// Call Set*() methods to update fields and slider