40 m_editFrame( aParent ),
84 std::vector<LIB_FIELD*> libFields;
85 std::set<wxString> fieldNames;
86 std::unique_ptr<LIB_SYMBOL> flattenedParent =
m_symbol->
GetParent().lock()->Flatten();
88 flattenedParent->GetFields( libFields );
91 fieldNames.insert( libFields[i]->GetName() );
99 fieldNames.insert( libFields[i]->GetName() );
107 for(
const wxString& fieldName : fieldNames )
117 for(
unsigned i = 0; i <
m_fieldsBox->GetCount(); ++i )
131 for(
unsigned i = 0; i <
m_fieldsBox->GetCount(); ++i )
137 std::unique_ptr<LIB_SYMBOL> flattenedParent =
m_symbol->
GetParent().lock()->Flatten();
144 std::vector<LIB_FIELD> fields;
145 std::vector<LIB_FIELD> result;
155 parentField = flattenedParent->FindField( field.GetName() );
163 field.SetText( parentField->
GetText() );
167 field.SetVisible( parentField->
IsVisible() );
174 bool visible = field.IsVisible();
177 field.SetAttributes( *parentField );
179 field.SetVisible( visible );
180 field.SetPosition( pos );
184 field.SetTextPos( parentField->
GetTextPos() );
186 else if( removeExtras )
193 result.emplace_back( std::move( field ) );
196 std::vector<LIB_FIELD*> parentFields;
197 int idx = result.size();
199 flattenedParent->GetFields( parentFields );
201 for(
LIB_FIELD* parentField : parentFields )
208 result.emplace_back(
m_symbol, idx++ );
211 newField->
SetName( parentField->GetCanonicalName() );
212 newField->
SetText( parentField->GetText() );
221 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
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...
Class DIALOG_UPDATE_SYMBOL_FIELDS_BASE.
wxCheckBox * m_resetFieldText
wxCheckBox * m_resetFieldEffects
wxCheckBox * m_resetFieldPositions
wxTextCtrl * m_parentSymbolReadOnly
wxCheckBox * m_resetEmptyFields
wxCheckBox * m_resetFieldVisibilities
wxCheckListBox * m_fieldsBox
wxCheckBox * m_removeExtraBox
~DIALOG_UPDATE_SYMBOL_FIELDS() override
void checkAll(bool aCheck)
void onOkButtonClicked(wxCommandEvent &aEvent) override
DIALOG_UPDATE_SYMBOL_FIELDS(SYMBOL_EDIT_FRAME *aParent, LIB_SYMBOL *aSymbol)
LIB_SYMBOL * m_symbol
Set of field names that should have values updated.
std::set< wxString > m_updateFields
SYMBOL_EDIT_FRAME * m_editFrame
const VECTOR2I & GetTextPos() const
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetAttributes(const EDA_TEXT &aSrc)
Set the text attributes from another instance.
virtual bool IsVisible() const
virtual void SetText(const wxString &aText)
Field object used in symbol libraries.
void SetName(const wxString &aName)
Set a user definable field name to aName.
Define a library symbol object.
void GetFields(std::vector< LIB_FIELD * > &aList)
Return a list of fields within this symbol.
LIB_FIELD * FindField(const wxString &aFieldName)
Find a field within this symbol matching aFieldName and returns it or NULL if not found.
LIB_SYMBOL_REF & GetParent()
void SetFields(const std::vector< LIB_FIELD > &aFieldsList)
Overwrite all the existing fields in this symbol with fields supplied in aFieldsList.
The symbol library editor main window.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
void SaveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT, bool aAppend=false)
Create a copy of the current symbol, and save it in the undo list.
bool g_removeExtraLibFields
bool g_resetLibFieldEffects
bool g_resetLibFieldVisibilities
bool g_resetLibFieldPositions
bool g_resetEmptyLibFields
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslateForHI=false)
Return a default symbol field name for field aFieldNdx for all components.
@ MANDATORY_FIELDS
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.