Add control over updating of symbol attributes.
ADDED Update Symbol from Library and Change Symbol can now specify whether or not to update attributes (include in BOM and include on board). Fixes https://gitlab.com/kicad/code/kicad/issues/7123
This commit is contained in:
parent
bd786b578a
commit
e27bd5cf15
|
@ -39,12 +39,13 @@
|
|||
|
||||
bool g_selectRefDes = false;
|
||||
bool g_selectValue = false;
|
||||
|
||||
bool g_removeExtraFields = false;
|
||||
bool g_resetEmptyFields = false;
|
||||
bool g_resetFieldVisibilities = false;
|
||||
bool g_resetFieldEffects = false;
|
||||
bool g_resetFieldPositions = false;
|
||||
// { change, update }
|
||||
bool g_removeExtraFields[2] = { false, false };
|
||||
bool g_resetEmptyFields[2] = { false, false };
|
||||
bool g_resetFieldVisibilities[2] = { true, false };
|
||||
bool g_resetFieldEffects[2] = { true, false };
|
||||
bool g_resetFieldPositions[2] = { true, false };
|
||||
bool g_resetAttributes[2] = { true, false };
|
||||
|
||||
|
||||
DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aSymbol,
|
||||
|
@ -134,11 +135,12 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_COMPO
|
|||
m_resetFieldPositions->SetLabel( _( "Update field positions" ) );
|
||||
}
|
||||
|
||||
m_removeExtraBox->SetValue( g_removeExtraFields );
|
||||
m_resetEmptyFields->SetValue( g_resetEmptyFields );
|
||||
m_resetFieldVisibilities->SetValue( g_resetFieldVisibilities );
|
||||
m_resetFieldEffects->SetValue( g_resetFieldEffects );
|
||||
m_resetFieldPositions->SetValue( g_resetFieldPositions );
|
||||
m_removeExtraBox->SetValue( g_removeExtraFields[ (int) m_mode ] );
|
||||
m_resetEmptyFields->SetValue( g_resetEmptyFields[ (int) m_mode ] );
|
||||
m_resetFieldVisibilities->SetValue( g_resetFieldVisibilities[ (int) m_mode ] );
|
||||
m_resetFieldEffects->SetValue( g_resetFieldEffects[ (int) m_mode ] );
|
||||
m_resetFieldPositions->SetValue( g_resetFieldPositions[ (int) m_mode ] );
|
||||
m_resetAttributes->SetValue( g_resetAttributes[ (int) m_mode ] );
|
||||
|
||||
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
|
||||
// because the update and change versions of this dialog have different controls.
|
||||
|
@ -204,11 +206,12 @@ DIALOG_CHANGE_SYMBOLS::~DIALOG_CHANGE_SYMBOLS()
|
|||
g_selectRefDes = m_fieldsBox->IsChecked( REFERENCE_FIELD );
|
||||
g_selectValue = m_fieldsBox->IsChecked( VALUE_FIELD );
|
||||
|
||||
g_removeExtraFields = m_removeExtraBox->GetValue();
|
||||
g_resetEmptyFields = m_resetEmptyFields->GetValue();
|
||||
g_resetFieldVisibilities = m_resetFieldVisibilities->GetValue();
|
||||
g_resetFieldEffects = m_resetFieldEffects->GetValue();
|
||||
g_resetFieldPositions = m_resetFieldPositions->GetValue();
|
||||
g_removeExtraFields[ (int) m_mode ] = m_removeExtraBox->GetValue();
|
||||
g_resetEmptyFields[ (int) m_mode ] = m_resetEmptyFields->GetValue();
|
||||
g_resetFieldVisibilities[ (int) m_mode ] = m_resetFieldVisibilities->GetValue();
|
||||
g_resetFieldEffects[ (int) m_mode ] = m_resetFieldEffects->GetValue();
|
||||
g_resetFieldPositions[ (int) m_mode ] = m_resetFieldPositions->GetValue();
|
||||
g_resetAttributes[ (int) m_mode ] = m_resetAttributes->GetValue();
|
||||
}
|
||||
|
||||
|
||||
|
@ -546,6 +549,12 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_COMPONENT* aSymbol, const SCH_SHE
|
|||
|
||||
aSymbol->SetLibSymbol( flattenedSymbol.release() );
|
||||
|
||||
if( m_resetAttributes )
|
||||
{
|
||||
aSymbol->SetIncludeInBom( libSymbol->GetIncludeInBom() );
|
||||
aSymbol->SetIncludeOnBoard( libSymbol->GetIncludeOnBoard() );
|
||||
}
|
||||
|
||||
bool removeExtras = m_removeExtraBox->GetValue();
|
||||
bool resetEmpty = m_resetEmptyFields->GetValue();
|
||||
bool resetVis = m_resetFieldVisibilities->GetValue();
|
||||
|
|
|
@ -36,7 +36,7 @@ class SCH_SHEET_PATH;
|
|||
class DIALOG_CHANGE_SYMBOLS : public DIALOG_CHANGE_SYMBOLS_BASE
|
||||
{
|
||||
public:
|
||||
enum class MODE { CHANGE, UPDATE };
|
||||
enum class MODE { CHANGE = 0, UPDATE };
|
||||
|
||||
DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aSymbol,
|
||||
MODE aMode = MODE::UPDATE );
|
||||
|
|
|
@ -137,6 +137,12 @@ DIALOG_CHANGE_SYMBOLS_BASE::DIALOG_CHANGE_SYMBOLS_BASE( wxWindow* parent, wxWind
|
|||
m_updateOptionsSizer->Add( m_resetFieldPositions, 0, wxBOTTOM|wxRIGHT, 4 );
|
||||
|
||||
|
||||
m_updateOptionsSizer->Add( 0, 15, 1, wxEXPAND, 5 );
|
||||
|
||||
m_resetAttributes = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset symbol attributes"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_updateOptionsSizer->Add( m_resetAttributes, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizerUpdate->Add( m_updateOptionsSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
|
||||
|
||||
|
||||
|
|
|
@ -1579,6 +1579,80 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">15</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|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">Update/reset symbol attributes</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_resetAttributes</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>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -71,6 +71,7 @@ class DIALOG_CHANGE_SYMBOLS_BASE : public DIALOG_SHIM
|
|||
wxCheckBox* m_resetFieldVisibilities;
|
||||
wxCheckBox* m_resetFieldEffects;
|
||||
wxCheckBox* m_resetFieldPositions;
|
||||
wxCheckBox* m_resetAttributes;
|
||||
WX_HTML_REPORT_PANEL* m_messagePanel;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
|
|
Loading…
Reference in New Issue