37 if( std::shared_ptr<LIB_SYMBOL> parent =
m_symbol->GetParent().lock() )
59 std::vector<SCH_FIELD*> libFields;
60 std::set<wxString> fieldNames;
61 std::unique_ptr<LIB_SYMBOL> flattenedParent =
m_symbol->GetParent().lock()->Flatten();
63 flattenedParent->GetFields( libFields );
67 if( !libField->IsMandatory() )
68 fieldNames.insert( libField->GetName() );
78 if( !libField->IsMandatory() )
79 fieldNames.insert( libField->GetName() );
82 auto isMandatoryField =
83 [&](
int listbox_idx )
97 for(
int i = (
int)
m_fieldsBox->GetCount() - 1; i >= 0; --i )
99 if( !isMandatoryField( i ) )
103 for(
const wxString& fieldName : fieldNames )
106 for(
int i = 0; i < (int)
m_fieldsBox->GetCount(); ++i )
108 if( !isMandatoryField( i ) )
116 for(
unsigned i = 0; i <
m_fieldsBox->GetCount(); ++i )
133 for(
unsigned i = 0; i <
m_fieldsBox->GetCount(); ++i )
154 m_symbol->SyncFieldsFromParent( options );
156 commit.
Push(
_(
"Update Symbol Fields" ) );
159 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
wxCheckBox * m_resetFieldText
wxCheckBox * m_resetFieldEffects
wxCheckBox * m_resetFieldPositions
wxTextCtrl * m_parentSymbolReadOnly
DIALOG_UPDATE_SYMBOL_FIELDS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Update Symbol Fields"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxCheckBox * m_resetEmptyFields
wxCheckBox * m_resetFieldVisibilities
wxCheckListBox * m_fieldsBox
wxCheckBox * m_removeExtraBox
void checkAll(bool aCheck)
Select or deselect all fields in the listbox widget.
void onOkButtonClicked(wxCommandEvent &aEvent) override
DIALOG_UPDATE_SYMBOL_FIELDS(SYMBOL_EDIT_FRAME *aParent, LIB_SYMBOL *aSymbol)
SYMBOL_EDIT_FRAME * m_editFrame
std::map< FIELD_T, int > m_mandatoryFieldListIndexes
Index in the list control for each MANDATORY_FIELD type.
Define a library symbol object.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
The symbol library editor main window.
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
Options controlling how a derived symbol's fields are reconciled with its parent.
bool m_removeExtraFields
Drop fields not present in the parent.
bool m_resetPositions
Copy parent field positions.
bool m_resetVisibility
Copy parent visibility and name-shown flags.
bool m_updateAllFields
Reconcile every field. When false only the names in m_updateFields are touched.
std::set< wxString > m_updateFields
Field names to reconcile when m_updateAllFields is false.
bool m_resetEffects
Copy parent text effects (font, justification, etc.) but keep local visibility/position.
bool m_resetEmptyText
Copy parent text even when the parent value is empty.
bool m_resetText
Copy parent text when the parent value is non-empty.
wxString GetDefaultFieldName(FIELD_T aFieldId, bool aTranslateForHI)
Return a default symbol field name for a mandatory field type.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
wxString GetCanonicalFieldName(FIELD_T aFieldType)