Exclude from bill of materials and board netlist to library symbols.

ADDED: Support for exclude from bill of materials and board netlist to
library symbols.

Fixes https://gitlab.com/kicad/code/kicad/issues/4915
This commit is contained in:
Wayne Stambaugh 2020-09-09 09:03:37 -04:00
parent 59c6635286
commit d45c11b4b5
19 changed files with 430 additions and 16 deletions

View File

@ -87,7 +87,9 @@ struct null_deleter
LIB_PART::LIB_PART( const wxString& aName, LIB_PART* aParent, PART_LIB* aLibrary ) :
EDA_ITEM( LIB_PART_T ),
m_me( this, null_deleter() )
m_me( this, null_deleter() ),
m_includeInBom( true ),
m_includeOnBoard( true )
{
m_dateLastEdition = 0;
m_unitCount = 1;
@ -127,6 +129,8 @@ LIB_PART::LIB_PART( const LIB_PART& aPart, PART_LIB* aLibrary ) :
m_unitsLocked = aPart.m_unitsLocked;
m_pinNameOffset = aPart.m_pinNameOffset;
m_showPinNumbers = aPart.m_showPinNumbers;
m_includeInBom = aPart.m_includeInBom;
m_includeOnBoard = aPart.m_includeOnBoard;
m_showPinNames = aPart.m_showPinNames;
m_dateLastEdition = aPart.m_dateLastEdition;
m_options = aPart.m_options;
@ -181,6 +185,8 @@ const LIB_PART& LIB_PART::operator=( const LIB_PART& aPart )
m_pinNameOffset = aPart.m_pinNameOffset;
m_showPinNumbers = aPart.m_showPinNumbers;
m_showPinNames = aPart.m_showPinNames;
m_includeInBom = aPart.m_includeInBom;
m_includeOnBoard = aPart.m_includeOnBoard;
m_dateLastEdition = aPart.m_dateLastEdition;
m_options = aPart.m_options;
m_libId = aPart.m_libId;
@ -288,6 +294,12 @@ int LIB_PART::Compare( const LIB_PART& aRhs ) const
if( m_showPinNumbers != aRhs.m_showPinNumbers )
return ( m_showPinNumbers ) ? 1 : -1;
if( m_includeInBom != aRhs.m_includeInBom )
return ( m_includeInBom ) ? 1 : -1;
if( m_includeOnBoard != aRhs.m_includeOnBoard )
return ( m_includeOnBoard ) ? 1 : -1;
return 0;
}

View File

@ -108,6 +108,10 @@ class LIB_PART : public EDA_ITEM, public LIB_TREE_ITEM
///< one unit does not automatically change another unit.
bool m_showPinNames; ///< Determines if part pin names are visible.
bool m_showPinNumbers; ///< Determines if part pin numbers are visible.
bool m_includeInBom; ///< Determines if symbol should be included in
///< schematic BOM.
bool m_includeOnBoard; ///< Determines if symbol should be excluded from
///< netlist when updating board.
timestamp_t m_dateLastEdition; ///< Date of the last modification.
LIBRENTRYOPTIONS m_options; ///< Special part features such as POWER or NORMAL.)
int m_unitCount; ///< Number of units (parts) per package.
@ -572,6 +576,22 @@ public:
void SetShowPinNumbers( bool aShow ) { m_showPinNumbers = aShow; }
bool ShowPinNumbers() { return m_showPinNumbers; }
/**
* Set or clear the include in schematic bill of materials flag.
*
* @param aIncludeInBom true to include symbol in schematic bill of material
*/
void SetIncludeInBom( bool aIncludeInBom ) { m_includeInBom = aIncludeInBom; }
bool GetIncludeInBom() const { return m_includeInBom; }
/**
* Set or clear include in board netlist flag.
*
* @param aIncludeOnBoard true to include symbol in the board netlist
*/
void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_includeOnBoard = aIncludeOnBoard; }
bool GetIncludeOnBoard() const { return m_includeOnBoard; }
/**
* Comparison test that can be used for operators.
*

View File

@ -167,6 +167,8 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow()
m_OptionPartsLocked->SetValue( m_libEntry->UnitsLocked() && m_libEntry->GetUnitCount() > 1 );
m_AsConvertButt->SetValue( m_libEntry->HasConversion() );
m_OptionPower->SetValue( m_libEntry->IsPower() );
m_excludeFromBomCheckBox->SetValue( !m_libEntry->GetIncludeInBom() );
m_excludeFromBoardCheckBox->SetValue( !m_libEntry->GetIncludeOnBoard() );
m_ShowPinNumButt->SetValue( m_libEntry->ShowPinNumbers() );
m_ShowPinNameButt->SetValue( m_libEntry->ShowPinNames() );
@ -357,6 +359,9 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow()
else
m_libEntry->SetNormal();
m_libEntry->SetIncludeInBom( !m_excludeFromBomCheckBox->GetValue() );
m_libEntry->SetIncludeOnBoard( !m_excludeFromBoardCheckBox->GetValue() );
m_libEntry->SetShowPinNumbers( m_ShowPinNumButt->GetValue() );
m_libEntry->SetShowPinNames( m_ShowPinNameButt->GetValue() );
@ -768,3 +773,20 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::syncControlStates( bool aIsAlias )
m_inheritsStaticText->Enable( aIsAlias );
m_grid->ForceRefresh();
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::onPowerCheckBox( wxCommandEvent& aEvent )
{
if( m_OptionPower->IsChecked() )
{
m_excludeFromBomCheckBox->SetValue( true );
m_excludeFromBoardCheckBox->SetValue( true );
m_excludeFromBomCheckBox->Enable( false );
m_excludeFromBoardCheckBox->Enable( false );
}
else
{
m_excludeFromBomCheckBox->Enable( true );
m_excludeFromBoardCheckBox->Enable( true );
}
}

View File

@ -75,6 +75,9 @@ public:
DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRAME* parent, LIB_PART* aLibEntry );
~DIALOG_EDIT_COMPONENT_IN_LIBRARY();
protected:
virtual void onPowerCheckBox( wxCommandEvent& aEvent ) override;
private:
void transferAliasDataToBuffer();

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -165,7 +165,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
wxStaticBoxSizer* sbSizerSymbol;
sbSizerSymbol = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("Symbol") ), wxVERTICAL );
m_AsConvertButt = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Has alternate symbol (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
m_AsConvertButt = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Has alternate body style (DeMorgan)"), 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 );
@ -175,6 +175,12 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
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 );
wxBoxSizer* bSizerUnitCount;
bSizerUnitCount = new wxBoxSizer( wxHORIZONTAL );
@ -188,7 +194,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
bSizerUnitCount->Add( m_SelNumberOfUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
sbSizerSymbol->Add( bSizerUnitCount, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
sbSizerSymbol->Add( bSizerUnitCount, 1, wxEXPAND|wxLEFT|wxTOP, 5 );
m_OptionPartsLocked = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("All units are not interchangeable"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptionPartsLocked->SetToolTip( _("Check this option when creating multiple unit symbols and all units are not interchangeable") );
@ -356,6 +362,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnDeleteField ), NULL, this );
m_SymbolNameCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnSymbolNameKillFocus ), NULL, this );
m_SymbolNameCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnSymbolNameText ), NULL, this );
m_OptionPower->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::onPowerCheckBox ), NULL, this );
m_FootprintFilterListBox->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnFilterDClick ), NULL, this );
m_FootprintFilterListBox->Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnEditFootprintFilter ), NULL, this );
m_addFilterButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAddFootprintFilter ), NULL, this );
@ -376,6 +383,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE()
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnDeleteField ), NULL, this );
m_SymbolNameCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnSymbolNameKillFocus ), NULL, this );
m_SymbolNameCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnSymbolNameText ), NULL, this );
m_OptionPower->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::onPowerCheckBox ), NULL, this );
m_FootprintFilterListBox->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnFilterDClick ), NULL, this );
m_FootprintFilterListBox->Disconnect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnEditFootprintFilter ), NULL, this );
m_addFilterButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAddFootprintFilter ), NULL, this );

View File

@ -14,6 +14,7 @@
<property name="file">dialog_edit_component_in_lib_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">DIALOG_EDIT_COMPONENT_IN_LIBRARY_FBP</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -308,6 +310,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -381,6 +384,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -454,6 +458,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -537,6 +542,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -1196,7 +1202,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Has alternate symbol (DeMorgan)</property>
<property name="label">Has alternate body style (DeMorgan)</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1289,13 +1295,142 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onPowerCheckBox</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" 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="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</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">Exclude from schematic bill of materials</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">m_excludeFromBomCheckBox</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">; ; forward_declare</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>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" 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="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</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">Exclude from board</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">m_excludeFromBoardCheckBox</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">; ; forward_declare</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>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerUnitCount</property>
<property name="orient">wxHORIZONTAL</property>
@ -2149,6 +2284,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -2222,6 +2358,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -2305,6 +2442,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -2408,6 +2546,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -65,6 +65,8 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM
wxBoxSizer* bSizerLowerBasicPanel;
wxCheckBox* m_AsConvertButt;
wxCheckBox* m_OptionPower;
wxCheckBox* m_excludeFromBomCheckBox;
wxCheckBox* m_excludeFromBoardCheckBox;
wxStaticText* m_staticTextNbUnits;
wxSpinCtrl* m_SelNumberOfUnits;
wxCheckBox* m_OptionPartsLocked;
@ -94,6 +96,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSymbolNameKillFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void OnSymbolNameText( wxCommandEvent& event ) { event.Skip(); }
virtual void onPowerCheckBox( 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(); }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -53,7 +53,7 @@ DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT( EDA_DRAW_FRAME* aParent,
}
void DIALOG_LIB_NEW_COMPONENT::OnParentSymbolSelect( wxCommandEvent& event )
void DIALOG_LIB_NEW_COMPONENT::OnParentSymbolSelect( wxCommandEvent& aEvent )
{
syncControls( !m_comboInheritanceSelect->GetValue().IsEmpty() );
}
@ -68,6 +68,8 @@ void DIALOG_LIB_NEW_COMPONENT::syncControls( bool aIsDerivedPart )
m_checkLockItems->Enable( !aIsDerivedPart );
m_checkHasConversion->Enable( !aIsDerivedPart );
m_checkIsPowerSymbol->Enable( !aIsDerivedPart );
m_excludeFromBomCheckBox->Enable( !aIsDerivedPart );
m_excludeFromBoardCheckBox->Enable( !aIsDerivedPart );
m_staticPinTextPositionLabel->Enable( !aIsDerivedPart );
m_textPinTextPosition->Enable( !aIsDerivedPart );
m_staticPinTextPositionUnits->Enable( !aIsDerivedPart );
@ -75,3 +77,21 @@ void DIALOG_LIB_NEW_COMPONENT::syncControls( bool aIsDerivedPart )
m_checkShowPinName->Enable( !aIsDerivedPart );
m_checkShowPinNameInside->Enable( !aIsDerivedPart );
}
void DIALOG_LIB_NEW_COMPONENT::onPowerCheckBox( wxCommandEvent& aEvent )
{
if( m_checkIsPowerSymbol->IsChecked() )
{
m_excludeFromBomCheckBox->SetValue( true );
m_excludeFromBoardCheckBox->SetValue( true );
m_excludeFromBomCheckBox->Enable( false );
m_excludeFromBoardCheckBox->Enable( false );
}
else
{
m_excludeFromBomCheckBox->Enable( true );
m_excludeFromBoardCheckBox->Enable( true );
}
}

View File

@ -77,6 +77,12 @@ public:
void SetLockItems( bool enable ) { m_checkLockItems->SetValue( enable ); }
bool GetLockItems( void ) { return m_checkLockItems->GetValue(); }
void SetIncludeInBom( bool aInclude ) { m_excludeFromBomCheckBox->SetValue( !aInclude ); }
bool GetIncludeInBom() const { return !m_excludeFromBomCheckBox->GetValue(); }
void SetIncludeOnBoard( bool aInclude ) { m_excludeFromBoardCheckBox->SetValue( !aInclude ); }
bool GetIncludeOnBoard() const { return !m_excludeFromBoardCheckBox->GetValue(); }
void SetPinTextPosition( int position )
{
m_pinTextPosition.SetValue( position );
@ -102,7 +108,8 @@ public:
bool GetPinNameInside( void ) { return m_checkShowPinNameInside->GetValue(); }
protected:
virtual void OnParentSymbolSelect( wxCommandEvent& event ) override;
virtual void OnParentSymbolSelect( wxCommandEvent& aEvent ) override;
virtual void onPowerCheckBox( wxCommandEvent& aEvent ) override;
private:
void syncControls( bool aIsDerivedPart );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Jan 23 2020)
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -11,6 +11,7 @@
BEGIN_EVENT_TABLE( DIALOG_LIB_NEW_COMPONENT_BASE, DIALOG_SHIM )
EVT_COMBOBOX( wxID_ANY, DIALOG_LIB_NEW_COMPONENT_BASE::_wxFB_OnParentSymbolSelect )
EVT_CHECKBOX( wxID_ANY, DIALOG_LIB_NEW_COMPONENT_BASE::_wxFB_onPowerCheckBox )
END_EVENT_TABLE()
DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
@ -76,6 +77,12 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
m_checkIsPowerSymbol = new wxCheckBox( this, wxID_ANY, _("Create symbol as power symbol"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer17->Add( m_checkIsPowerSymbol, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_excludeFromBomCheckBox = new wxCheckBox( this, wxID_ANY, _("Exclude from schematic bill of materials"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer17->Add( m_excludeFromBomCheckBox, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_excludeFromBoardCheckBox = new wxCheckBox( this, wxID_ANY, _("Exclude from board"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer17->Add( m_excludeFromBoardCheckBox, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
bSizerTop->Add( bSizer17, 0, wxBOTTOM|wxEXPAND, 5 );

View File

@ -786,6 +786,135 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onPowerCheckBox</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxCheckBox" 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="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</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">Exclude from schematic bill of materials</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">m_excludeFromBomCheckBox</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">; ; forward_declare</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>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxCheckBox" 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="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</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">Exclude from board</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">m_excludeFromBoardCheckBox</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">; ; forward_declare</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>
</object>
</object>
</object>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Jan 23 2020)
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -37,6 +37,7 @@ class DIALOG_LIB_NEW_COMPONENT_BASE : public DIALOG_SHIM
// Private event handlers
void _wxFB_OnParentSymbolSelect( wxCommandEvent& event ){ OnParentSymbolSelect( event ); }
void _wxFB_onPowerCheckBox( wxCommandEvent& event ){ onPowerCheckBox( event ); }
protected:
@ -51,6 +52,8 @@ class DIALOG_LIB_NEW_COMPONENT_BASE : public DIALOG_SHIM
wxCheckBox* m_checkLockItems;
wxCheckBox* m_checkHasConversion;
wxCheckBox* m_checkIsPowerSymbol;
wxCheckBox* m_excludeFromBomCheckBox;
wxCheckBox* m_excludeFromBoardCheckBox;
wxStaticText* m_staticPinTextPositionLabel;
wxTextCtrl* m_textPinTextPosition;
wxStaticText* m_staticPinTextPositionUnits;
@ -63,6 +66,7 @@ class DIALOG_LIB_NEW_COMPONENT_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual void OnParentSymbolSelect( wxCommandEvent& event ) { event.Skip(); }
virtual void onPowerCheckBox( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -350,6 +350,8 @@ void LIB_EDIT_FRAME::CreateNewPart()
new_part.SetShowPinNumbers( dlg.GetShowPinNumber() );
new_part.SetShowPinNames( dlg.GetShowPinName() );
new_part.LockUnits( dlg.GetLockItems() );
new_part.SetIncludeInBom( dlg.GetIncludeInBom() );
new_part.SetIncludeOnBoard( dlg.GetIncludeOnBoard() );
if( dlg.GetUnitCount() < 2 )
new_part.LockUnits( false );

View File

@ -122,6 +122,10 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, LIB_ID aLibId, SCH_SHEET_PATH* sh
SetRef( sheet, m_part->GetReferenceField().GetText() + wxT( "?" ) );
else
m_prefix = m_part->GetReferenceField().GetText() + wxT( "?" );
// Inherit the include in bill of materials and board netlist settings from library symbol.
m_inBom = aPart.GetIncludeInBom();
m_onBoard = aPart.GetIncludeOnBoard();
}

View File

@ -37,7 +37,10 @@
//#define SEXPR_SYMBOL_LIB_FILE_VERSION 20200820
#define SEXPR_SYMBOL_LIB_FILE_VERSION 20200827 // Remove host tag
//#define SEXPR_SYMBOL_LIB_FILE_VERSION 20200827 // Remove host tag
#define SEXPR_SYMBOL_LIB_FILE_VERSION 20200908 // Add include in BOM and on board support.
/**
* Symbol library file version.

View File

@ -188,6 +188,16 @@ LIB_PART* SCH_SEXPR_PARSER::ParseSymbol( LIB_PART_MAP& aSymbolLibMap, int aFileV
NeedRIGHT();
break;
case T_in_bom:
symbol->SetIncludeInBom( parseBool() );
NeedRIGHT();
break;
case T_on_board:
symbol->SetIncludeOnBoard( parseBool() );
NeedRIGHT();
break;
case T_property:
parseProperty( symbol );
break;

View File

@ -1509,6 +1509,9 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFo
aFormatter.Print( 0, ")" );
}
aFormatter.Print( 0, " (in_bom %s)", ( aSymbol->GetIncludeInBom() ) ? "yes" : "no" );
aFormatter.Print( 0, " (on_board %s)", ( aSymbol->GetIncludeOnBoard() ) ? "yes" : "no" );
// TODO: add atomic token here.
// TODO: add required token here."
@ -1523,7 +1526,7 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFo
lastFieldId = fields.back().GetId() + 1;
// @todo At some point in the future the lock status (all units interchangeable) should
// be set deterministically. For now a custom lock properter is used to preserve the
// be set deterministically. For now a custom lock propertery is used to preserve the
// locked flag state.
if( aSymbol->UnitsLocked() )
{

View File

@ -26,6 +26,8 @@
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.25,
"via_diameter": 0.8,
"via_drill": 0.4,

View File

@ -338,6 +338,22 @@ BOOST_AUTO_TEST_CASE( Compare )
BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
m_part_no_data.LockUnits( false );
// Include in BOM support tests.
testPart.SetIncludeInBom( false );
BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
testPart.SetIncludeInBom( true );
m_part_no_data.SetIncludeInBom( false );
BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
m_part_no_data.SetIncludeInBom( true );
// Include on board support tests.
testPart.SetIncludeOnBoard( false );
BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
testPart.SetIncludeOnBoard( true );
m_part_no_data.SetIncludeOnBoard( false );
BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
m_part_no_data.SetIncludeOnBoard( true );
// Show pin names flag comparison tests.
m_part_no_data.SetShowPinNames( false );
BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );