Added a button to add Spice fields to a schematic component
This commit is contained in:
parent
0d8c095215
commit
b6eab191d0
|
@ -46,6 +46,7 @@
|
|||
#include <sch_validators.h>
|
||||
|
||||
#include <dialog_edit_component_in_schematic_fbp.h>
|
||||
#include <netlist_exporter_pspice.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -126,7 +127,7 @@ private:
|
|||
void showButtonHandler( wxCommandEvent& event );
|
||||
void OnTestChipName( wxCommandEvent& event );
|
||||
void OnSelectChipName( wxCommandEvent& event );
|
||||
void OnInitDlg( wxInitDialogEvent& event )
|
||||
void OnInitDlg( wxInitDialogEvent& event )
|
||||
{
|
||||
TransferDataToWindow();
|
||||
|
||||
|
@ -134,6 +135,8 @@ private:
|
|||
FinishDialogSettings();
|
||||
}
|
||||
|
||||
void EditSpiceFields( wxCommandEvent& event );
|
||||
|
||||
SCH_FIELD* findField( const wxString& aFieldName );
|
||||
|
||||
/**
|
||||
|
@ -141,7 +144,7 @@ private:
|
|||
* update the listbox showing fields, according to the fields texts
|
||||
* must be called after a text change in fields, if this change is not an edition
|
||||
*/
|
||||
void updateDisplay( )
|
||||
void updateDisplay()
|
||||
{
|
||||
for( unsigned ii = FIELD1; ii<m_FieldsBuf.size(); ii++ )
|
||||
setRowItem( ii, m_FieldsBuf[ii] );
|
||||
|
@ -284,6 +287,33 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnSelectChipName( wxCommandEvent& event
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::EditSpiceFields( wxCommandEvent& event )
|
||||
{
|
||||
for( const auto& fieldName : NETLIST_EXPORTER_PSPICE::GetSpiceFields() )
|
||||
{
|
||||
SCH_FIELD* schField = findField( fieldName );
|
||||
// @todo move everything to the bottom, so the fields are grouped and in the same order?
|
||||
|
||||
// Do not modify the existing value, just add missing fields with default values
|
||||
if( schField == NULL )
|
||||
{
|
||||
unsigned fieldNdx = m_FieldsBuf.size();
|
||||
SCH_FIELD newField( wxPoint(), fieldNdx, m_cmp, fieldName );
|
||||
newField.SetOrientation( m_FieldsBuf[REFERENCE].GetOrientation() );
|
||||
m_FieldsBuf.push_back( newField );
|
||||
schField = &m_FieldsBuf.back();
|
||||
}
|
||||
|
||||
if( schField->GetText().IsEmpty() )
|
||||
{
|
||||
schField->SetText( NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( fieldName, m_cmp ) );
|
||||
}
|
||||
}
|
||||
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemSelected( wxListEvent& event )
|
||||
{
|
||||
DBG( printf( "OnListItemSelected()\n" ); )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version May 21 2016)
|
||||
// C++ code generated with wxFormBuilder (version Jun 24 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -101,6 +101,9 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
|
|||
m_staticline1 = new wxStaticLine( optionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
optionsSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
spiceFieldsButton = new wxButton( optionsSizer->GetStaticBox(), wxID_ANY, _("Add Spice fields"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
optionsSizer->Add( spiceFieldsButton, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
defaultsButton = new wxButton( optionsSizer->GetStaticBox(), wxID_ANY, _("Reset to Library Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
defaultsButton->SetToolTip( _("Set position and style of fields and component orientation to default lib value.\nFields texts are not modified.") );
|
||||
|
||||
|
@ -293,6 +296,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
|
|||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnInitDlg ) );
|
||||
m_buttonTestChipName->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnTestChipName ), NULL, this );
|
||||
m_buttonSelectChipName->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnSelectChipName ), NULL, this );
|
||||
spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::EditSpiceFields ), NULL, this );
|
||||
defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
|
||||
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
|
||||
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
|
||||
|
@ -311,6 +315,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
|
|||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnInitDlg ) );
|
||||
m_buttonTestChipName->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnTestChipName ), NULL, this );
|
||||
m_buttonSelectChipName->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnSelectChipName ), NULL, this );
|
||||
spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::EditSpiceFields ), NULL, this );
|
||||
defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
|
||||
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
|
||||
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">688,586</property>
|
||||
<property name="size">928,741</property>
|
||||
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Component Properties</property>
|
||||
|
@ -286,11 +286,11 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerUnitsInterchangeable</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
|
@ -378,11 +378,11 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -731,11 +731,11 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Chip Name</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -835,20 +835,20 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerChpinameButt</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<object class="wxButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -932,11 +932,11 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<object class="wxButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1024,11 +1024,11 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1107,11 +1107,11 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1198,11 +1198,11 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticLine" expanded="1">
|
||||
<object class="wxStaticLine" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1279,6 +1279,94 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Add Spice fields</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">spiceFieldsButton</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">EditSpiceFields</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
|
@ -1386,7 +1474,7 @@
|
|||
<property name="border">8</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">3</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label"></property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -1770,16 +1858,16 @@
|
|||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">2</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">fieldEditBoxSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerJustification</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
|
@ -1966,20 +2054,20 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerStyle</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Visibility</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -2258,11 +2346,11 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">fieldNameBoxSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version May 21 2016)
|
||||
// C++ code generated with wxFormBuilder (version Jun 24 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -55,6 +55,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
|
|||
wxStaticText* m_staticTextTimeStamp;
|
||||
wxTextCtrl* m_textCtrlTimeStamp;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxButton* spiceFieldsButton;
|
||||
wxButton* defaultsButton;
|
||||
wxListCtrl* fieldListCtrl;
|
||||
wxButton* addFieldButton;
|
||||
|
@ -88,6 +89,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
|
|||
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnTestChipName( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSelectChipName( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void EditSpiceFields( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
|
||||
|
@ -101,7 +103,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
|
|||
|
||||
public:
|
||||
|
||||
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 688,586 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
|
||||
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 928,741 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
|
||||
~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP();
|
||||
|
||||
};
|
||||
|
|
|
@ -49,7 +49,6 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* formatter, int aCtl )
|
|||
std::vector<int> pinSequence; // numeric indices into m_SortedComponentPinList
|
||||
wxArrayString stdPinNameArray; // Array containing Standard Pin Names
|
||||
const wxString delimiters( "{:,; }" );
|
||||
const wxString disableStr( "N" );
|
||||
|
||||
// Prepare list of nets generation (not used here, but...
|
||||
for( unsigned ii = 0; ii < m_masterList->size(); ii++ )
|
||||
|
@ -85,7 +84,6 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* formatter, int aCtl )
|
|||
while( tokenizer.HasMoreTokens() )
|
||||
{
|
||||
wxString directive( tokenizer.GetNextToken() );
|
||||
wxLogDebug( "Directive found: '%s'\n", (const char *) directive.c_str() );
|
||||
|
||||
// Fix paths for .include directives
|
||||
if( m_paths && directive.StartsWith( ".inc" ) )
|
||||
|
@ -122,56 +120,41 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* formatter, int aCtl )
|
|||
// Reset NodeSeqIndex Count:
|
||||
pinSequence.clear();
|
||||
|
||||
// Obtain Spice fields
|
||||
SCH_FIELD* spicePrimitiveType = comp->FindField( wxT( "Spice_Primitive" ) );
|
||||
SCH_FIELD* spiceModel = comp->FindField( wxT( "Spice_Model" ) );
|
||||
SCH_FIELD* netlistEnabledField = comp->FindField( wxT( "Spice_Netlist_Enabled" ) );
|
||||
SCH_FIELD* spiceSeqField = comp->FindField( wxT( "Spice_Node_Sequence" ) );
|
||||
|
||||
wxString RefName = comp->GetRef( &sheetList[sheet_idx] );
|
||||
wxString CompValue = comp->GetField( VALUE )->GetText();
|
||||
wxString model = spiceModel ? spiceModel->GetText()
|
||||
: GetSpiceFieldDefVal( "Spice_Model", comp );
|
||||
|
||||
wxString model( "" );
|
||||
wxString primType( "X" );
|
||||
wxString primType = spicePrimitiveType ? spicePrimitiveType->GetText()
|
||||
: GetSpiceFieldDefVal( "Spice_Primitive", comp );
|
||||
|
||||
if( spicePrimitiveType )
|
||||
{
|
||||
primType = spicePrimitiveType->GetText();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Convert ceratin modules to subcircuits
|
||||
if( RefName.StartsWith( "IC" ) || RefName.StartsWith( "U" ) )
|
||||
primType = "X";
|
||||
else
|
||||
primType = RefName.GetChar( 0 );
|
||||
}
|
||||
|
||||
if( spiceModel )
|
||||
model = spiceModel->GetText();
|
||||
else
|
||||
model = CompValue;
|
||||
const wxString& RefName = comp->GetRef( &sheetList[sheet_idx] );
|
||||
|
||||
// Check to see if component should be removed from Spice Netlist:
|
||||
SCH_FIELD* netlistEnabledField = comp->FindField( wxT( "Spice_Netlist_Enabled" ) );
|
||||
|
||||
if( netlistEnabledField )
|
||||
{
|
||||
wxString netlistEnabled = netlistEnabledField->GetText();
|
||||
|
||||
if( netlistEnabled.CmpNoCase( disableStr ) == 0 )
|
||||
if( netlistEnabled.CmpNoCase( "N" ) == 0
|
||||
|| netlistEnabled.CmpNoCase( "F" ) == 0
|
||||
|| netlistEnabled == "0" )
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if Alternative Pin Sequence is Available:
|
||||
SCH_FIELD* spiceSeqField = comp->FindField( wxT( "Spice_Node_Sequence" ) );
|
||||
|
||||
// Check if an alternative pin sequence is available:
|
||||
if( spiceSeqField )
|
||||
{
|
||||
// Get String containing the Sequence of Nodes:
|
||||
// Get the string containing the sequence of nodes:
|
||||
wxString nodeSeqIndexLineStr = spiceSeqField->GetText();
|
||||
|
||||
// Verify Field Exists and is not empty:
|
||||
// Verify field exists and is not empty:
|
||||
if( !nodeSeqIndexLineStr.IsEmpty() )
|
||||
{
|
||||
// Create an Array of Standard Pin Names from part definition:
|
||||
// Create an array of standard pin names from part definition:
|
||||
stdPinNameArray.Clear();
|
||||
|
||||
for( unsigned ii = 0; ii < m_SortedComponentPinList.size(); ii++ )
|
||||
|
@ -193,7 +176,7 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* formatter, int aCtl )
|
|||
int seq;
|
||||
|
||||
// Find PinName In Standard List assign Standard List Index to Name:
|
||||
seq = stdPinNameArray.Index(pinIndex);
|
||||
seq = stdPinNameArray.Index( pinIndex );
|
||||
|
||||
if( seq != wxNOT_FOUND )
|
||||
pinSequence.push_back( seq );
|
||||
|
@ -221,9 +204,6 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* formatter, int aCtl )
|
|||
}
|
||||
#endif
|
||||
|
||||
wxLogDebug( "Ref %s primType %s model/value '%s'\n",
|
||||
TO_UTF8( RefName ), (const char*) primType.c_str(), (const char*) model.c_str() );
|
||||
|
||||
int activePinIndex = 0;
|
||||
|
||||
formatter->Print( 0, "%s%s ", (const char*) primType.c_str(), (const char*) RefName.c_str() );
|
||||
|
@ -247,6 +227,7 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* formatter, int aCtl )
|
|||
{
|
||||
// Case of Alt Pin Sequence in control Bad Index or not using all
|
||||
// pins for simulation:
|
||||
wxASSERT_MSG( false, "Used an invalid pin number in node sequence" );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -328,3 +309,55 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* formatter, int aCtl )
|
|||
|
||||
return ret >= 0;
|
||||
}
|
||||
|
||||
|
||||
wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( const wxString& aField,
|
||||
SCH_COMPONENT* aComponent )
|
||||
{
|
||||
if( aField == "Spice_Primitive" )
|
||||
{
|
||||
wxString RefName = aComponent->GetField( REFERENCE )->GetText();
|
||||
|
||||
// Convert ICs to subcircuits
|
||||
if( RefName.StartsWith( "IC" ) || RefName.StartsWith( "U" ) )
|
||||
return wxString( "X" );
|
||||
else
|
||||
return RefName.GetChar( 0 );
|
||||
}
|
||||
|
||||
if( aField == "Spice_Model" )
|
||||
{
|
||||
return aComponent->GetField( VALUE )->GetText();
|
||||
}
|
||||
|
||||
if( aField == "Spice_Netlist_Enabled" )
|
||||
{
|
||||
return wxString( "Y" );
|
||||
}
|
||||
|
||||
if( aField == "Spice_Node_Sequence" )
|
||||
{
|
||||
wxString nodeSeq;
|
||||
std::vector<LIB_PIN*> pins;
|
||||
|
||||
aComponent->GetPins( pins );
|
||||
|
||||
for( auto pin : pins )
|
||||
nodeSeq += pin->GetNumberString() + " ";
|
||||
|
||||
nodeSeq.Trim();
|
||||
|
||||
return nodeSeq;
|
||||
}
|
||||
|
||||
wxASSERT_MSG( "Missing default value definition for a Spice field: %s" , aField );
|
||||
|
||||
return wxString( "<unknown>" );
|
||||
}
|
||||
|
||||
const std::vector<wxString> NETLIST_EXPORTER_PSPICE::m_spiceFields = {
|
||||
"Spice_Primitive",
|
||||
"Spice_Model",
|
||||
"Spice_Netlist_Enabled",
|
||||
"Spice_Node_Sequence"
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers
|
||||
* Copyright (C) 1992-2016 KiCad Developers
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -64,10 +64,20 @@ public:
|
|||
return m_probes;
|
||||
}
|
||||
|
||||
static const std::vector<wxString>& GetSpiceFields()
|
||||
{
|
||||
return m_spiceFields;
|
||||
}
|
||||
|
||||
static wxString GetSpiceFieldDefVal( const wxString& aField, SCH_COMPONENT* aComponent );
|
||||
|
||||
private:
|
||||
NET_INDEX_MAP m_netMap;
|
||||
PROBE_LIST m_probes;
|
||||
SEARCH_STACK* m_paths;
|
||||
|
||||
// Fields that are used during netlist export & simulation
|
||||
static const std::vector<wxString> m_spiceFields;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue