diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index e9eee6d441..298de8eea3 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -181,6 +181,10 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow() m_AsConvertButt->SetValue( m_Parent->GetShowDeMorgan() ); m_OptionPower->SetValue( m_libEntry->IsPower() ); + + LIB_FIELD* simEnableField = m_libEntry->FindField( SIM_MODEL::ENABLE_FIELD ); + m_excludeFromSim->SetValue( simEnableField && simEnableField->GetText() == wxT( "0" ) ); + m_excludeFromBomCheckBox->SetValue( !m_libEntry->GetIncludeInBom() ); m_excludeFromBoardCheckBox->SetValue( !m_libEntry->GetIncludeOnBoard() ); @@ -223,6 +227,43 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow() } +void DIALOG_LIB_SYMBOL_PROPERTIES::OnExcludeFromSimulation( wxCommandEvent& event ) +{ + int simEnableFieldRow = -1; + + for( int ii = MANDATORY_FIELDS; ii < m_grid->GetNumberRows(); ++ii ) + { + if( m_grid->GetCellValue( ii, FDC_NAME ) == SIM_MODEL::ENABLE_FIELD ) + simEnableFieldRow = ii; + } + + if( event.IsChecked() ) + { + if( simEnableFieldRow == -1 ) + { + simEnableFieldRow = (int) m_fields->size(); + m_fields->emplace_back( m_libEntry, simEnableFieldRow ); + + // notify the grid + wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 ); + m_grid->ProcessTableMessage( msg ); + } + + m_grid->SetCellValue( simEnableFieldRow, FDC_VALUE, wxT( "0" ) ); + } + else if( simEnableFieldRow >= 0 ) + { + m_fields->erase( m_fields->begin() + simEnableFieldRow ); + + // notify the grid + wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, simEnableFieldRow, 1 ); + m_grid->ProcessTableMessage( msg ); + } + + OnModify(); +} + + bool DIALOG_LIB_SYMBOL_PROPERTIES::Validate() { if( !m_grid->CommitPendingChanges() ) @@ -245,9 +286,9 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::Validate() } // Check for missing field names. - for( size_t i = MANDATORY_FIELDS; i < m_fields->size(); ++i ) + for( int ii = MANDATORY_FIELDS; ii < (int) m_fields->size(); ++ii ) { - LIB_FIELD& field = m_fields->at( i ); + LIB_FIELD& field = m_fields->at( ii ); wxString fieldName = field.GetName( false ); if( fieldName.IsEmpty() ) @@ -258,7 +299,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::Validate() m_delayedErrorMessage = _( "Fields must have a name." ); m_delayedFocusGrid = m_grid; m_delayedFocusColumn = FDC_NAME; - m_delayedFocusRow = i; + m_delayedFocusRow = ii; m_delayedFocusPage = 0; return false; @@ -333,12 +374,12 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow() // The Y axis for components in lib is from bottom to top while the screen axis is top // to bottom: we must change the y coord sign when writing back to the library - for( size_t i = 0; i < m_fields->size(); ++i ) + for( int ii = 0; ii < (int) m_fields->size(); ++ii ) { - VECTOR2I pos = m_fields->at( i ).GetPosition(); + VECTOR2I pos = m_fields->at( ii ).GetPosition(); pos.y = -pos.y; - m_fields->at( i ).SetPosition( pos ); - m_fields->at( i ).SetId( i ); + m_fields->at( ii ).SetPosition( pos ); + m_fields->at( ii ).SetId( ii ); } m_libEntry->SetFields( *m_fields ); @@ -486,7 +527,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event ) return; SYMBOL_EDITOR_SETTINGS* settings = m_Parent->GetSettings(); - int fieldID = m_fields->size(); + int fieldID = (int) m_fields->size(); LIB_FIELD newField( m_libEntry, fieldID ); newField.SetTextSize( wxSize( schIUScale.MilsToIU( settings->m_Defaults.text_size ), diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.h b/eeschema/dialogs/dialog_lib_symbol_properties.h index 20c1865ba9..d59bcb3a62 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.h +++ b/eeschema/dialogs/dialog_lib_symbol_properties.h @@ -70,6 +70,7 @@ private: void OnUpdateUI( wxUpdateUIEvent& event ) override; void OnFilterDClick( wxMouseEvent& event ) override; void OnCancelButtonClick( wxCommandEvent& event ) override; + void OnExcludeFromSimulation( wxCommandEvent& event ) override; void adjustGridColumns(); void syncControlStates( bool aIsAlias ); diff --git a/eeschema/dialogs/dialog_lib_symbol_properties_base.cpp b/eeschema/dialogs/dialog_lib_symbol_properties_base.cpp index 1e1d2bb18a..e6ea98394c 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties_base.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties_base.cpp @@ -127,34 +127,34 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow* wxStaticText* staticNameLabel; staticNameLabel = new wxStaticText( m_PanelBasic, wxID_ANY, _("Symbol name:"), wxDefaultPosition, wxDefaultSize, 0 ); staticNameLabel->Wrap( -1 ); - fgSizerFPID->Add( staticNameLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + fgSizerFPID->Add( staticNameLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 8 ); m_SymbolNameCtrl = new wxTextCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerFPID->Add( m_SymbolNameCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + fgSizerFPID->Add( m_SymbolNameCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 8 ); wxStaticText* staticDescriptionLabel; staticDescriptionLabel = new wxStaticText( m_PanelBasic, wxID_ANY, _("Description:"), wxDefaultPosition, wxDefaultSize, 0 ); staticDescriptionLabel->Wrap( -1 ); - fgSizerFPID->Add( staticDescriptionLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizerFPID->Add( staticDescriptionLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 8 ); m_DescCtrl = new wxTextCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerFPID->Add( m_DescCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + fgSizerFPID->Add( m_DescCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 8 ); staticKeywordsLabel = new wxStaticText( m_PanelBasic, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 ); staticKeywordsLabel->Wrap( -1 ); - fgSizerFPID->Add( staticKeywordsLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizerFPID->Add( staticKeywordsLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 8 ); m_KeywordCtrl = new wxTextCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerFPID->Add( m_KeywordCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + fgSizerFPID->Add( m_KeywordCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 8 ); m_inheritsStaticText = new wxStaticText( m_PanelBasic, wxID_ANY, _("Derive from symbol:"), wxDefaultPosition, wxDefaultSize, 0 ); m_inheritsStaticText->Wrap( -1 ); - fgSizerFPID->Add( m_inheritsStaticText, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + fgSizerFPID->Add( m_inheritsStaticText, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 8 ); m_inheritanceSelectCombo = new wxComboBox( m_PanelBasic, wxID_ANY, _(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY ); m_inheritanceSelectCombo->SetToolTip( _("Select symbol to derive this symbol from or select\n for root symbol.\n\nDerived symbols were formerly referred to as aliases.\nThis is no longer the case and all symbols are either\nderived from another symbols or they stand alone as\nroot symbols.") ); - fgSizerFPID->Add( m_inheritanceSelectCombo, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + fgSizerFPID->Add( m_inheritanceSelectCombo, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 7 ); bSizerMidBasicPanel->Add( fgSizerFPID, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); @@ -168,23 +168,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow* bSizerLeftCol = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* sbSizerSymbol; - sbSizerSymbol = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("Symbol") ), wxVERTICAL ); - - m_AsConvertButt = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Has alternate body style (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 ); - m_AsConvertButt->SetToolTip( _("Check this option if the symbol has an alternate body style (De Morgan)") ); - - sbSizerSymbol->Add( m_AsConvertButt, 0, wxRIGHT|wxLEFT, 5 ); - - m_OptionPower = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Define as power symbol"), wxDefaultPosition, wxDefaultSize, 0 ); - m_OptionPower->SetToolTip( _("Setting this option makes the symbol in question appear in the\n\"add power symbol\" dialog. It will lock the value text to protect it\nfrom editing in the schematic. The symbol will not be included in\nthe BOM and cannot be assigned a footprint.") ); - - sbSizerSymbol->Add( m_OptionPower, 0, wxALL, 5 ); - - m_excludeFromBomCheckBox = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Exclude from schematic bill of materials"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerSymbol->Add( m_excludeFromBomCheckBox, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_excludeFromBoardCheckBox = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Exclude from board"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerSymbol->Add( m_excludeFromBoardCheckBox, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + sbSizerSymbol = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("General") ), wxVERTICAL ); wxBoxSizer* bSizerUnitCount; bSizerUnitCount = new wxBoxSizer( wxHORIZONTAL ); @@ -193,18 +177,34 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow* m_staticTextNbUnits->Wrap( -1 ); m_staticTextNbUnits->SetToolTip( _("Enter the number of units for a symbol that contains more than one unit") ); - bSizerUnitCount->Add( m_staticTextNbUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + bSizerUnitCount->Add( m_staticTextNbUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); m_SelNumberOfUnits = new wxSpinCtrl( sbSizerSymbol->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 64, 1 ); bSizerUnitCount->Add( m_SelNumberOfUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - sbSizerSymbol->Add( bSizerUnitCount, 1, wxEXPAND|wxLEFT|wxTOP, 5 ); + sbSizerSymbol->Add( bSizerUnitCount, 1, wxEXPAND|wxLEFT, 4 ); m_OptionPartsInterchangeable = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("All units are interchangeable"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptionPartsInterchangeable->SetToolTip( _("Check this option when all symbol units are identical except\nfor pin numbers.") ); - sbSizerSymbol->Add( m_OptionPartsInterchangeable, 0, wxALL, 5 ); + sbSizerSymbol->Add( m_OptionPartsInterchangeable, 0, wxALL, 4 ); + + + sbSizerSymbol->Add( 0, 8, 0, wxEXPAND, 5 ); + + m_AsConvertButt = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Has alternate body style (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_AsConvertButt->SetToolTip( _("Check this option if the symbol has an alternate body style (De Morgan)") ); + + sbSizerSymbol->Add( m_AsConvertButt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 ); + + + sbSizerSymbol->Add( 0, 7, 0, wxEXPAND, 5 ); + + m_OptionPower = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Define as power symbol"), wxDefaultPosition, wxDefaultSize, 0 ); + m_OptionPower->SetToolTip( _("Setting this option makes the symbol in question appear in the\n\"add power symbol\" dialog. It will lock the value text to protect it\nfrom editing in the schematic. The symbol will not be included in\nthe BOM and cannot be assigned a footprint.") ); + + sbSizerSymbol->Add( m_OptionPower, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 ); bSizerLeftCol->Add( sbSizerSymbol, 0, wxEXPAND|wxALL, 5 ); @@ -212,8 +212,8 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow* bSizerLowerBasicPanel->Add( bSizerLeftCol, 1, wxEXPAND, 5 ); - wxBoxSizer* bSizerRightCol; - bSizerRightCol = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizerMiddleCol; + bSizerMiddleCol = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* sbSizerPinTextOpts; sbSizerPinTextOpts = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("Pin Text Options") ), wxVERTICAL ); @@ -231,7 +231,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow* sbSizerPinTextOpts->Add( m_ShowPinNameButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - sbSizerPinTextOpts->Add( 0, 0, 1, wxEXPAND, 5 ); + sbSizerPinTextOpts->Add( 0, 12, 0, wxEXPAND, 5 ); m_PinsNameInsideButt = new wxCheckBox( sbSizerPinTextOpts->GetStaticBox(), wxID_ANY, _("Place pin names inside"), wxDefaultPosition, wxDefaultSize, 0 ); m_PinsNameInsideButt->SetValue(true); @@ -256,13 +256,37 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow* bSizerNameOffset->Add( m_nameOffsetUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - sbSizerPinTextOpts->Add( bSizerNameOffset, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); + sbSizerPinTextOpts->Add( bSizerNameOffset, 0, wxBOTTOM|wxEXPAND|wxTOP, 4 ); sbSizerPinTextOpts->Add( 0, 0, 0, wxEXPAND, 5 ); - bSizerRightCol->Add( sbSizerPinTextOpts, 1, wxALL|wxEXPAND, 5 ); + bSizerMiddleCol->Add( sbSizerPinTextOpts, 1, wxALL|wxEXPAND, 5 ); + + + bSizerLowerBasicPanel->Add( bSizerMiddleCol, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizerRightCol; + bSizerRightCol = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizerAttributes; + sbSizerAttributes = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("Attributes") ), wxVERTICAL ); + + m_excludeFromSim = new wxCheckBox( sbSizerAttributes->GetStaticBox(), wxID_ANY, _("Exclude from simulation"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerAttributes->Add( m_excludeFromSim, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + sbSizerAttributes->Add( 0, 10, 0, wxEXPAND, 5 ); + + m_excludeFromBomCheckBox = new wxCheckBox( sbSizerAttributes->GetStaticBox(), wxID_ANY, _("Exclude from schematic bill of materials"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerAttributes->Add( m_excludeFromBomCheckBox, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + m_excludeFromBoardCheckBox = new wxCheckBox( sbSizerAttributes->GetStaticBox(), wxID_ANY, _("Exclude from board"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerAttributes->Add( m_excludeFromBoardCheckBox, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + + bSizerRightCol->Add( sbSizerAttributes, 1, wxEXPAND|wxALL, 5 ); bSizerLowerBasicPanel->Add( bSizerRightCol, 1, wxEXPAND, 5 ); @@ -371,17 +395,18 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow* m_KeywordCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this ); m_inheritanceSelectCombo->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCombobox ), NULL, this ); m_inheritanceSelectCombo->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this ); - m_AsConvertButt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); - m_OptionPower->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::onPowerCheckBox ), NULL, this ); - m_excludeFromBomCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); - m_excludeFromBoardCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_SelNumberOfUnits->Connect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSpinCtrl ), NULL, this ); m_SelNumberOfUnits->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSpinCtrlText ), NULL, this ); m_OptionPartsInterchangeable->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); + m_AsConvertButt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); + m_OptionPower->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::onPowerCheckBox ), NULL, this ); m_ShowPinNumButt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_ShowPinNameButt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_PinsNameInsideButt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_nameOffsetCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this ); + m_excludeFromSim->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnExcludeFromSimulation ), NULL, this ); + m_excludeFromBomCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); + m_excludeFromBoardCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_FootprintFilterListBox->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnFilterDClick ), NULL, this ); m_FootprintFilterListBox->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnEditFootprintFilter ), NULL, this ); m_addFilterButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnAddFootprintFilter ), NULL, this ); @@ -406,17 +431,18 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::~DIALOG_LIB_SYMBOL_PROPERTIES_BASE() m_KeywordCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this ); m_inheritanceSelectCombo->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCombobox ), NULL, this ); m_inheritanceSelectCombo->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this ); - m_AsConvertButt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); - m_OptionPower->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::onPowerCheckBox ), NULL, this ); - m_excludeFromBomCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); - m_excludeFromBoardCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_SelNumberOfUnits->Disconnect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSpinCtrl ), NULL, this ); m_SelNumberOfUnits->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSpinCtrlText ), NULL, this ); m_OptionPartsInterchangeable->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); + m_AsConvertButt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); + m_OptionPower->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::onPowerCheckBox ), NULL, this ); m_ShowPinNumButt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_ShowPinNameButt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_PinsNameInsideButt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_nameOffsetCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this ); + m_excludeFromSim->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnExcludeFromSimulation ), NULL, this ); + m_excludeFromBomCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); + m_excludeFromBoardCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_FootprintFilterListBox->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnFilterDClick ), NULL, this ); m_FootprintFilterListBox->Disconnect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnEditFootprintFilter ), NULL, this ); m_addFilterButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnAddFootprintFilter ), NULL, this ); diff --git a/eeschema/dialogs/dialog_lib_symbol_properties_base.fbp b/eeschema/dialogs/dialog_lib_symbol_properties_base.fbp index 18256abfcc..0b89c7ac4a 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties_base.fbp +++ b/eeschema/dialogs/dialog_lib_symbol_properties_base.fbp @@ -634,7 +634,7 @@ 4 3 - 5 + 8 wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT 0 @@ -695,8 +695,8 @@ - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT + 8 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT 0 1 @@ -761,7 +761,7 @@ - 5 + 8 wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 @@ -822,8 +822,8 @@ - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT + 8 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT 0 1 @@ -887,7 +887,7 @@ - 5 + 8 wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 @@ -948,8 +948,8 @@ - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT + 8 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT 0 1 @@ -1013,7 +1013,7 @@ - 5 + 8 wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT 0 @@ -1074,8 +1074,8 @@ - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT + 7 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT 0 1 @@ -1168,275 +1168,15 @@ 0 wxID_ANY - Symbol + General sbSizerSymbol wxVERTICAL 1 none - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Has alternate body style (De Morgan) - - 0 - - - 0 - - 1 - m_AsConvertButt - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Check this option if the symbol has an alternate body style (De Morgan) - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCheckBox - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Define as power symbol - - 0 - - - 0 - - 1 - m_OptionPower - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Setting this option makes the symbol in question appear in the "add power symbol" dialog. It will lock the value text to protect it from editing in the schematic. The symbol will not be included in the BOM and cannot be assigned a footprint. - - wxFILTER_NONE - wxDefaultValidator - - - - - onPowerCheckBox - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Exclude from schematic bill of materials - - 0 - - - 0 - - 1 - m_excludeFromBomCheckBox - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCheckBox - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Exclude from board - - 0 - - - 0 - - 1 - m_excludeFromBoardCheckBox - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCheckBox - - - - 5 - wxEXPAND|wxLEFT|wxTOP + 4 + wxEXPAND|wxLEFT 1 @@ -1445,7 +1185,7 @@ none 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -1571,7 +1311,7 @@ - 5 + 4 wxALL 0 @@ -1635,6 +1375,156 @@ OnCheckBox + + 5 + wxEXPAND + 0 + + 8 + protected + 0 + + + + 4 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Has alternate body style (De Morgan) + + 0 + + + 0 + + 1 + m_AsConvertButt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Check this option if the symbol has an alternate body style (De Morgan) + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCheckBox + + + + 5 + wxEXPAND + 0 + + 7 + protected + 0 + + + + 4 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Define as power symbol + + 0 + + + 0 + + 1 + m_OptionPower + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Setting this option makes the symbol in question appear in the "add power symbol" dialog. It will lock the value text to protect it from editing in the schematic. The symbol will not be included in the BOM and cannot be assigned a footprint. + + wxFILTER_NONE + wxDefaultValidator + + + + + onPowerCheckBox + + @@ -1645,7 +1535,7 @@ 1 - bSizerRightCol + bSizerMiddleCol wxVERTICAL none @@ -1793,9 +1683,9 @@ 5 wxEXPAND - 1 + 0 - 0 + 12 protected 0 @@ -1866,7 +1756,7 @@ - 5 + 4 wxBOTTOM|wxEXPAND|wxTOP 0 @@ -2077,6 +1967,236 @@ + + 5 + wxEXPAND + 1 + + + bSizerRightCol + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Attributes + + sbSizerAttributes + wxVERTICAL + 1 + none + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exclude from simulation + + 0 + + + 0 + + 1 + m_excludeFromSim + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnExcludeFromSimulation + + + + 5 + wxEXPAND + 0 + + 10 + protected + 0 + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exclude from schematic bill of materials + + 0 + + + 0 + + 1 + m_excludeFromBomCheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCheckBox + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exclude from board + + 0 + + + 0 + + 1 + m_excludeFromBoardCheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCheckBox + + + + + + diff --git a/eeschema/dialogs/dialog_lib_symbol_properties_base.h b/eeschema/dialogs/dialog_lib_symbol_properties_base.h index 706b96d598..0f89facf78 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties_base.h +++ b/eeschema/dialogs/dialog_lib_symbol_properties_base.h @@ -30,8 +30,8 @@ class WX_GRID; #include #include #include -#include #include +#include #include #include #include @@ -64,19 +64,20 @@ class DIALOG_LIB_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM wxStaticText* m_inheritsStaticText; wxComboBox* m_inheritanceSelectCombo; wxBoxSizer* bSizerLowerBasicPanel; - wxCheckBox* m_AsConvertButt; - wxCheckBox* m_OptionPower; - wxCheckBox* m_excludeFromBomCheckBox; - wxCheckBox* m_excludeFromBoardCheckBox; wxStaticText* m_staticTextNbUnits; wxSpinCtrl* m_SelNumberOfUnits; wxCheckBox* m_OptionPartsInterchangeable; + wxCheckBox* m_AsConvertButt; + wxCheckBox* m_OptionPower; wxCheckBox* m_ShowPinNumButt; wxCheckBox* m_ShowPinNameButt; wxCheckBox* m_PinsNameInsideButt; wxStaticText* m_nameOffsetLabel; wxTextCtrl* m_nameOffsetCtrl; wxStaticText* m_nameOffsetUnits; + wxCheckBox* m_excludeFromSim; + wxCheckBox* m_excludeFromBomCheckBox; + wxCheckBox* m_excludeFromBoardCheckBox; wxPanel* m_PanelFootprintFilter; wxStaticText* m_staticTextFootprints; wxListBox* m_FootprintFilterListBox; @@ -99,10 +100,11 @@ class DIALOG_LIB_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM virtual void OnSymbolNameText( wxCommandEvent& event ) { event.Skip(); } virtual void OnText( wxCommandEvent& event ) { event.Skip(); } virtual void OnCombobox( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCheckBox( wxCommandEvent& event ) { event.Skip(); } - virtual void onPowerCheckBox( wxCommandEvent& event ) { event.Skip(); } virtual void OnSpinCtrl( wxSpinEvent& event ) { event.Skip(); } virtual void OnSpinCtrlText( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCheckBox( wxCommandEvent& event ) { event.Skip(); } + virtual void onPowerCheckBox( wxCommandEvent& event ) { event.Skip(); } + virtual void OnExcludeFromSimulation( wxCommandEvent& event ) { event.Skip(); } virtual void OnFilterDClick( wxMouseEvent& event ) { event.Skip(); } virtual void OnEditFootprintFilter( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddFootprintFilter( wxCommandEvent& event ) { event.Skip(); } diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index 4de3c9ceec..b70c8c9775 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -277,7 +277,6 @@ bool DIALOG_SIM_MODEL::TransferDataToWindow() curModel().SetIsStoredInValue( storeInValue ); m_saveInValueCheckbox->SetValue( curModel().IsStoredInValue() ); - m_excludeCheckbox->SetValue( !curModel().IsEnabled() ); onRadioButton( dummyEvent ); return DIALOG_SIM_MODEL_BASE::TransferDataToWindow(); @@ -350,8 +349,6 @@ void DIALOG_SIM_MODEL::updateWidgets() updateModelCodeTab(); updatePinAssignments(); - m_excludeCheckbox->SetValue( !curModel().IsEnabled() ); - std::string ref = SIM_MODEL::GetFieldValue( &m_fields, SIM_MODEL::REFERENCE_FIELD ); m_modelPanel->Layout(); @@ -1273,13 +1270,6 @@ void DIALOG_SIM_MODEL::onSaveInValueCheckbox( wxCommandEvent& } -template -void DIALOG_SIM_MODEL::onExcludeCheckbox( wxCommandEvent& aEvent ) -{ - curModel().SetIsEnabled( !m_excludeCheckbox->GetValue() ); -} - - template void DIALOG_SIM_MODEL::onParamGridSetFocus( wxFocusEvent& aEvent ) { diff --git a/eeschema/dialogs/dialog_sim_model.h b/eeschema/dialogs/dialog_sim_model.h index bf24dd5fb5..f4c69f5cb5 100644 --- a/eeschema/dialogs/dialog_sim_model.h +++ b/eeschema/dialogs/dialog_sim_model.h @@ -107,7 +107,6 @@ private: void onPinAssignmentsGridCellChange( wxGridEvent& aEvent ) override; void onPinAssignmentsGridSize( wxSizeEvent& aEvent ) override; void onSaveInValueCheckbox( wxCommandEvent& aEvent ) override; - void onExcludeCheckbox( wxCommandEvent& aEvent ) override; void onDifferentialCheckbox( wxCommandEvent& event ) override; void onSizeParamGrid( wxSizeEvent& event ) override; diff --git a/eeschema/dialogs/dialog_sim_model_base.cpp b/eeschema/dialogs/dialog_sim_model_base.cpp index e78013fbeb..ac94e97495 100644 --- a/eeschema/dialogs/dialog_sim_model_base.cpp +++ b/eeschema/dialogs/dialog_sim_model_base.cpp @@ -260,9 +260,6 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c wxBoxSizer* bSizer81; bSizer81 = new wxBoxSizer( wxHORIZONTAL ); - m_excludeCheckbox = new wxCheckBox( this, wxID_ANY, _("Exclude from simulation"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer81->Add( m_excludeCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - bSizer81->Add( 30, 0, 1, wxEXPAND, 5 ); @@ -317,7 +314,6 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c m_saveInValueCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onSaveInValueCheckbox ), NULL, this ); m_pinAssignmentsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridCellChange ), NULL, this ); m_pinAssignmentsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridSize ), NULL, this ); - m_excludeCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onExcludeCheckbox ), NULL, this ); } DIALOG_SIM_MODEL_BASE::~DIALOG_SIM_MODEL_BASE() @@ -354,6 +350,5 @@ DIALOG_SIM_MODEL_BASE::~DIALOG_SIM_MODEL_BASE() m_saveInValueCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onSaveInValueCheckbox ), NULL, this ); m_pinAssignmentsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridCellChange ), NULL, this ); m_pinAssignmentsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridSize ), NULL, this ); - m_excludeCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onExcludeCheckbox ), NULL, this ); } diff --git a/eeschema/dialogs/dialog_sim_model_base.fbp b/eeschema/dialogs/dialog_sim_model_base.fbp index 0879970615..55a07d930b 100644 --- a/eeschema/dialogs/dialog_sim_model_base.fbp +++ b/eeschema/dialogs/dialog_sim_model_base.fbp @@ -1900,71 +1900,6 @@ bSizer81 wxHORIZONTAL none - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Exclude from simulation - - 0 - - - 0 - - 1 - m_excludeCheckbox - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - onExcludeCheckbox - - 5 wxEXPAND diff --git a/eeschema/dialogs/dialog_sim_model_base.h b/eeschema/dialogs/dialog_sim_model_base.h index 17092513ed..67ed3542d4 100644 --- a/eeschema/dialogs/dialog_sim_model_base.h +++ b/eeschema/dialogs/dialog_sim_model_base.h @@ -79,7 +79,6 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM wxCheckBox* m_saveInValueCheckbox; wxPanel* m_pinAssignmentsPanel; WX_GRID* m_pinAssignmentsGrid; - wxCheckBox* m_excludeCheckbox; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; @@ -113,7 +112,6 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM virtual void onSaveInValueCheckbox( wxCommandEvent& event ) { event.Skip(); } virtual void onPinAssignmentsGridCellChange( wxGridEvent& event ) { event.Skip(); } virtual void onPinAssignmentsGridSize( wxSizeEvent& event ) { event.Skip(); } - virtual void onExcludeCheckbox( wxCommandEvent& event ) { event.Skip(); } public: diff --git a/eeschema/dialogs/dialog_symbol_properties.cpp b/eeschema/dialogs/dialog_symbol_properties.cpp index 524ded950f..624478d57e 100644 --- a/eeschema/dialogs/dialog_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_symbol_properties.cpp @@ -522,6 +522,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow() case SYM_MIRROR_Y: m_mirrorCtrl->SetSelection( 2 ); break; } + m_cbExcludeFromSim->SetValue( m_symbol->GetFieldText( SIM_MODEL::ENABLE_FIELD ) == "0" ); m_cbExcludeFromBom->SetValue( !m_symbol->GetIncludeInBom() ); m_cbExcludeFromBoard->SetValue( !m_symbol->GetIncludeOnBoard() ); m_cbDNP->SetValue( m_symbol->GetDNP() ); @@ -543,6 +544,44 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow() } +void DIALOG_SYMBOL_PROPERTIES::OnExcludeFromSimulation( wxCommandEvent& event ) +{ + int simEnableFieldRow = -1; + + for( int ii = MANDATORY_FIELDS; ii < m_fieldsGrid->GetNumberRows(); ++ii ) + { + if( m_fieldsGrid->GetCellValue( ii, FDC_NAME ) == SIM_MODEL::ENABLE_FIELD ) + simEnableFieldRow = ii; + } + + if( event.IsChecked() ) + { + if( simEnableFieldRow == -1 ) + { + simEnableFieldRow = (int) m_fields->size(); + m_fields->emplace_back( VECTOR2I( 0, 0 ), simEnableFieldRow, m_symbol, + SIM_MODEL::ENABLE_FIELD ); + + // notify the grid + wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 ); + m_fieldsGrid->ProcessTableMessage( msg ); + } + + m_fieldsGrid->SetCellValue( simEnableFieldRow, FDC_VALUE, wxT( "0" ) ); + } + else if( simEnableFieldRow >= 0 ) + { + m_fields->erase( m_fields->begin() + simEnableFieldRow ); + + // notify the grid + wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, simEnableFieldRow, 1 ); + m_fieldsGrid->ProcessTableMessage( msg ); + } + + OnModify(); +} + + void DIALOG_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event ) { #ifdef KICAD_SPICE @@ -901,7 +940,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event ) return; SCHEMATIC_SETTINGS& settings = m_symbol->Schematic()->Settings(); - int fieldID = m_fields->size(); + int fieldID = (int) m_fields->size(); SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_symbol, TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID, DO_TRANSLATE ) ); diff --git a/eeschema/dialogs/dialog_symbol_properties.h b/eeschema/dialogs/dialog_symbol_properties.h index 165ba0a46a..316d38b23e 100644 --- a/eeschema/dialogs/dialog_symbol_properties.h +++ b/eeschema/dialogs/dialog_symbol_properties.h @@ -84,6 +84,7 @@ private: void OnGridEditorHidden( wxGridEvent& event ) override; void OnUnitChoice( wxCommandEvent& event ) override; void OnCheckBox( wxCommandEvent& event ) override; + void OnExcludeFromSimulation( wxCommandEvent& event ) override; void OnEditSymbol( wxCommandEvent& ) override; void OnEditLibrarySymbol( wxCommandEvent& ) override; diff --git a/eeschema/dialogs/dialog_symbol_properties_base.cpp b/eeschema/dialogs/dialog_symbol_properties_base.cpp index 379bc9fbae..fb48771976 100644 --- a/eeschema/dialogs/dialog_symbol_properties_base.cpp +++ b/eeschema/dialogs/dialog_symbol_properties_base.cpp @@ -111,7 +111,7 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent, bButtonSize->Add( 0, 0, 1, wxEXPAND, 5 ); - sbFields->Add( bButtonSize, 0, wxALL|wxEXPAND, 5 ); + sbFields->Add( bButtonSize, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); generalPageSizer->Add( sbFields, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -120,13 +120,13 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent, bLowerSizer = new wxBoxSizer( wxHORIZONTAL ); wxStaticBoxSizer* sbGeneralProps; - sbGeneralProps = new wxStaticBoxSizer( new wxStaticBox( generalPage, wxID_ANY, _("General") ), wxHORIZONTAL ); + sbGeneralProps = new wxStaticBoxSizer( new wxStaticBox( generalPage, wxID_ANY, _("General") ), wxVERTICAL ); wxGridBagSizer* gbSizer1; gbSizer1 = new wxGridBagSizer( 3, 3 ); gbSizer1->SetFlexibleDirection( wxBOTH ); gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - gbSizer1->SetEmptyCellSize( wxSize( -1,10 ) ); + gbSizer1->SetEmptyCellSize( wxSize( -1,12 ) ); m_unitLabel = new wxStaticText( sbGeneralProps->GetStaticBox(), wxID_ANY, _("Unit:"), wxDefaultPosition, wxDefaultSize, 0 ); m_unitLabel->Wrap( -1 ); @@ -142,7 +142,7 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent, m_cbAlternateSymbol = new wxCheckBox( sbGeneralProps->GetStaticBox(), wxID_ANY, _("Alternate symbol (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbAlternateSymbol->SetToolTip( _("Use the alternate shape of this symbol.\nFor gates, this is the \"De Morgan\" conversion") ); - gbSizer1->Add( m_cbAlternateSymbol, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + gbSizer1->Add( m_cbAlternateSymbol, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 4 ); m_orientationLabel = new wxStaticText( sbGeneralProps->GetStaticBox(), wxID_ANY, _("Angle:"), wxDefaultPosition, wxDefaultSize, 0 ); m_orientationLabel->Wrap( -1 ); @@ -169,51 +169,58 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent, sbGeneralProps->Add( gbSizer1, 1, wxEXPAND, 5 ); + wxBoxSizer* bSizer11; + bSizer11 = new wxBoxSizer( wxHORIZONTAL ); - bLowerSizer->Add( sbGeneralProps, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + m_ShowPinNumButt = new wxCheckBox( sbGeneralProps->GetStaticBox(), wxID_ANY, _("Show pin numbers"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ShowPinNumButt->SetValue(true); + m_ShowPinNumButt->SetToolTip( _("Show or hide pin numbers") ); + + bSizer11->Add( m_ShowPinNumButt, 1, wxALL, 3 ); + + m_ShowPinNameButt = new wxCheckBox( sbGeneralProps->GetStaticBox(), wxID_ANY, _("Show pin names"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ShowPinNameButt->SetValue(true); + m_ShowPinNameButt->SetToolTip( _("Show or hide pin names") ); + + bSizer11->Add( m_ShowPinNameButt, 1, wxALL, 3 ); + + + sbGeneralProps->Add( bSizer11, 0, wxEXPAND|wxTOP, 13 ); + + + bLowerSizer->Add( sbGeneralProps, 4, wxEXPAND|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bMiddleCol; bMiddleCol = new wxBoxSizer( wxVERTICAL ); - wxStaticBoxSizer* sbSizerPinTextOpts; - sbSizerPinTextOpts = new wxStaticBoxSizer( new wxStaticBox( generalPage, wxID_ANY, _("Pin Text") ), wxVERTICAL ); - - m_ShowPinNumButt = new wxCheckBox( sbSizerPinTextOpts->GetStaticBox(), wxID_ANY, _("Show pin numbers"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ShowPinNumButt->SetValue(true); - m_ShowPinNumButt->SetToolTip( _("Show or hide pin numbers") ); - - sbSizerPinTextOpts->Add( m_ShowPinNumButt, 0, wxRIGHT|wxLEFT, 4 ); - - m_ShowPinNameButt = new wxCheckBox( sbSizerPinTextOpts->GetStaticBox(), wxID_ANY, _("Show pin names"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ShowPinNameButt->SetValue(true); - m_ShowPinNameButt->SetToolTip( _("Show or hide pin names") ); - - sbSizerPinTextOpts->Add( m_ShowPinNameButt, 0, wxALL, 4 ); - - - bMiddleCol->Add( sbSizerPinTextOpts, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - wxStaticBoxSizer* sbAttributes; sbAttributes = new wxStaticBoxSizer( new wxStaticBox( generalPage, wxID_ANY, _("Attributes") ), wxVERTICAL ); + m_cbExcludeFromSim = new wxCheckBox( sbAttributes->GetStaticBox(), wxID_ANY, _("Exclude from simulation"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cbExcludeFromSim->SetValue(true); + sbAttributes->Add( m_cbExcludeFromSim, 0, wxRIGHT|wxLEFT, 5 ); + + + sbAttributes->Add( 0, 10, 0, wxEXPAND, 5 ); + m_cbExcludeFromBom = new wxCheckBox( sbAttributes->GetStaticBox(), wxID_ANY, _("Exclude from bill of materials"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbExcludeFromBom->SetToolTip( _("This is useful for adding symbols for board footprints such as fiducials\nand logos that you do not want to appear in the bill of materials export") ); - sbAttributes->Add( m_cbExcludeFromBom, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 ); + sbAttributes->Add( m_cbExcludeFromBom, 0, wxALL, 5 ); m_cbExcludeFromBoard = new wxCheckBox( sbAttributes->GetStaticBox(), wxID_ANY, _("Exclude from board"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbExcludeFromBoard->SetToolTip( _("This is useful for adding symbols that only get exported to the bill of materials but\nnot required to layout the board such as mechanical fasteners and enclosures") ); - sbAttributes->Add( m_cbExcludeFromBoard, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 ); + sbAttributes->Add( m_cbExcludeFromBoard, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_cbDNP = new wxCheckBox( sbAttributes->GetStaticBox(), wxID_ANY, _("Do not populate"), wxDefaultPosition, wxDefaultSize, 0 ); - sbAttributes->Add( m_cbDNP, 0, wxBOTTOM|wxLEFT|wxRIGHT, 4 ); + sbAttributes->Add( m_cbDNP, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - bMiddleCol->Add( sbAttributes, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + bMiddleCol->Add( sbAttributes, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - bLowerSizer->Add( bMiddleCol, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bLowerSizer->Add( bMiddleCol, 3, wxEXPAND|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* buttonsSizer; buttonsSizer = new wxBoxSizer( wxVERTICAL ); @@ -234,7 +241,7 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent, buttonsSizer->Add( m_editLibrarySymbolBtn, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - bLowerSizer->Add( buttonsSizer, 1, wxEXPAND|wxALL, 5 ); + bLowerSizer->Add( buttonsSizer, 3, wxEXPAND|wxALL, 5 ); generalPageSizer->Add( bLowerSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); @@ -357,6 +364,7 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent, m_mirrorCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnChoice ), NULL, this ); m_ShowPinNumButt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_ShowPinNameButt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); + m_cbExcludeFromSim->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnExcludeFromSimulation ), NULL, this ); m_cbExcludeFromBom->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_cbExcludeFromBoard->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_updateSymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnUpdateSymbol ), NULL, this ); @@ -389,6 +397,7 @@ DIALOG_SYMBOL_PROPERTIES_BASE::~DIALOG_SYMBOL_PROPERTIES_BASE() m_mirrorCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnChoice ), NULL, this ); m_ShowPinNumButt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_ShowPinNameButt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); + m_cbExcludeFromSim->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnExcludeFromSimulation ), NULL, this ); m_cbExcludeFromBom->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_cbExcludeFromBoard->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this ); m_updateSymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnUpdateSymbol ), NULL, this ); diff --git a/eeschema/dialogs/dialog_symbol_properties_base.fbp b/eeschema/dialogs/dialog_symbol_properties_base.fbp index 1356b48b61..9b50caa964 100644 --- a/eeschema/dialogs/dialog_symbol_properties_base.fbp +++ b/eeschema/dialogs/dialog_symbol_properties_base.fbp @@ -285,7 +285,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 @@ -624,13 +624,13 @@ 5 wxEXPAND|wxRIGHT|wxLEFT - 1 + 4 wxID_ANY General sbGeneralProps - wxHORIZONTAL + wxVERTICAL 1 none @@ -638,7 +638,7 @@ wxEXPAND 1 - -1,10 + -1,12 wxBOTH 1 @@ -781,7 +781,7 @@ - 5 + 4 2 0 wxEXPAND|wxLEFT|wxRIGHT|wxTOP @@ -1114,33 +1114,19 @@ - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 1 - - - bMiddleCol - wxVERTICAL - none - 5 - wxEXPAND|wxRIGHT|wxLEFT - 1 - - wxID_ANY - Pin Text + 13 + wxEXPAND|wxTOP + 0 + - sbSizerPinTextOpts - wxVERTICAL - 1 + bSizer11 + wxHORIZONTAL none - 4 - wxRIGHT|wxLEFT - 0 + 3 + wxALL + 1 1 1 @@ -1203,9 +1189,9 @@ - 4 + 3 wxALL - 0 + 1 1 1 @@ -1269,10 +1255,21 @@ + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 3 + + + bMiddleCol + wxVERTICAL + none 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 + wxEXPAND|wxRIGHT|wxLEFT + 1 wxID_ANY Attributes @@ -1282,8 +1279,83 @@ 1 none - 4 - wxBOTTOM|wxRIGHT|wxLEFT + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exclude from simulation + + 0 + + + 0 + + 1 + m_cbExcludeFromSim + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnExcludeFromSimulation + + + + 5 + wxEXPAND + 0 + + 10 + protected + 0 + + + + 5 + wxALL 0 1 @@ -1347,7 +1419,7 @@ - 4 + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 @@ -1412,7 +1484,7 @@ - 4 + 5 wxBOTTOM|wxLEFT|wxRIGHT 0 @@ -1482,7 +1554,7 @@ 5 wxEXPAND|wxALL - 1 + 3 buttonsSizer diff --git a/eeschema/dialogs/dialog_symbol_properties_base.h b/eeschema/dialogs/dialog_symbol_properties_base.h index e5cdeb6749..2864ddd5e9 100644 --- a/eeschema/dialogs/dialog_symbol_properties_base.h +++ b/eeschema/dialogs/dialog_symbol_properties_base.h @@ -63,6 +63,7 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM wxChoice* m_mirrorCtrl; wxCheckBox* m_ShowPinNumButt; wxCheckBox* m_ShowPinNameButt; + wxCheckBox* m_cbExcludeFromSim; wxCheckBox* m_cbExcludeFromBom; wxCheckBox* m_cbExcludeFromBoard; wxCheckBox* m_cbDNP; @@ -92,6 +93,7 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM virtual void OnUnitChoice( wxCommandEvent& event ) { event.Skip(); } virtual void OnCheckBox( wxCommandEvent& event ) { event.Skip(); } virtual void OnChoice( wxCommandEvent& event ) { event.Skip(); } + virtual void OnExcludeFromSimulation( wxCommandEvent& event ) { event.Skip(); } virtual void OnUpdateSymbol( wxCommandEvent& event ) { event.Skip(); } virtual void OnExchangeSymbol( wxCommandEvent& event ) { event.Skip(); } virtual void OnEditSymbol( wxCommandEvent& event ) { event.Skip(); }