66 m_matchAll->SetLabel(
_(
"Change all symbols in schematic" ) );
67 SetTitle(
_(
"Change Symbols" ) );
95 m_matchById->SetLabel(
_(
"Change symbols matching library identifier:" ) );
241 wxString rawValue = aCtrl->GetValue();
243 wxString libName = rawValue.BeforeFirst(
':', &itemName );
283 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
290 std::vector<SCH_FIELD*> fields;
291 std::vector<LIB_FIELD*> libFields;
292 std::set<wxString> fieldNames;
298 wxCHECK2( screen,
continue );
302 SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
304 wxCHECK2( symbol,
continue );
306 if( !
isMatch( symbol, &instance ) )
313 fieldNames.insert( fields[i]->GetName() );
321 std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->
Flatten();
323 flattenedSymbol->GetFields( libFields );
326 fieldNames.insert( libFields[i]->GetName() );
347 std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->
Flatten();
349 flattenedSymbol->GetFields( libFields );
352 fieldNames.insert( libFields[i]->GetName() );
363 for(
const wxString& fieldName : fieldNames )
373 for(
unsigned i = 0; i <
m_fieldsBox->GetCount(); ++i )
381 SCH_EDIT_FRAME* parent = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
392 for(
unsigned i = 0; i <
m_fieldsBox->GetCount(); ++i )
420 wxCHECK( aSymbol,
false );
422 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
424 wxCHECK( frame,
false );
437 aSymbol->
GetRef( aInstance,
false ), false );
442 aSymbol->
GetValue( aInstance,
false ), false );
456 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
458 wxCHECK( frame,
false );
461 bool appendToUndo =
false;
462 bool changed =
false;
477 wxCHECK2( screen,
continue );
479 std::vector<SCH_SYMBOL*> symbols;
482 symbols.push_back( static_cast<SCH_SYMBOL*>( item ) );
486 if( !
isMatch( symbol, &instance ) )
491 if(
processSymbol( symbol, &instance, symbol->GetLibId(), appendToUndo ) )
496 if(
processSymbol( symbol, &instance, newId, appendToUndo ) )
512 const LIB_ID& aNewId,
bool aAppendToUndo )
514 wxCHECK( aSymbol,
false );
515 wxCHECK( aNewId.
IsValid(), false );
517 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
520 wxCHECK( frame,
false );
528 if( references.IsEmpty() )
529 references = instance.m_Reference;
531 references += wxT(
" " ) + instance.m_Reference;
538 msg.Printf(
_(
"Update symbol %s from '%s' to '%s'" ),
545 msg.Printf(
_(
"Update symbols %s from '%s' to '%s'" ),
555 msg.Printf(
_(
"Change symbol %s from '%s' to '%s'" ),
562 msg.Printf(
_(
"Change symbols %s from '%s' to '%s'" ),
569 LIB_SYMBOL* libSymbol = frame->GetLibSymbol( aNewId );
573 msg << wxT(
": " ) <<
_(
"*** symbol not found ***" );
578 std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->
Flatten();
580 if( flattenedSymbol->GetUnitCount() < aSymbol->
GetUnit() )
582 msg << wxT(
": " ) <<
_(
"*** new symbol has too few units ***" );
589 screen->
Remove( aSymbol );
608 for(
unsigned i = 0; i < aSymbol->
GetFields().size(); ++i )
665 std::vector<LIB_FIELD*> libFields;
670 const LIB_FIELD& libField = *libFields[i];
682 schField->SetText( libField.
GetText() );
688 screen->
Append( aSymbol );
689 frame->GetCanvas()->GetView()->Update( aSymbol );
691 msg += wxT(
": OK" );
Field Reference of part, i.e. "IC21".
virtual bool ShowModal(wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
Show this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until t...
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
LIB_FIELD * FindField(const wxString &aFieldName)
Find a field within this symbol matching aFieldName and returns it or NULL if not found.
EE_TYPE OfType(KICAD_T aType) const
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
void SetLazyUpdate(bool aLazyUpdate)
Forces updating the HTML page, after the report is built in lazy mode If aSort = true,...
wxString GetRefDesUnannotated(const wxString &aSource)
Return an unannotated refdes from either a prefix or an existing refdes.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
bool g_resetAttributes[2]
bool Remove(SCH_ITEM *aItem)
Remove aItem from the schematic associated with this screen.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
wxCheckBox * m_resetEmptyFields
void onMatchByReference(wxCommandEvent &aEvent) override
wxString getLibIdValue(const wxTextCtrl *aCtrl)
wxBoxSizer * m_newIdSizer
void SetEffects(const EDA_TEXT &aSrc)
Set the text effects from another instance.
bool processMatchingSymbols()
wxPoint GetPosition() const override
wxRadioButton * m_matchById
Field object used in symbol libraries.
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
void Flush(bool aSort=false)
Set the visible severity filter.
void checkAll(bool aCheck)
wxRadioButton * m_matchByReference
wxBitmapButton * m_matchIdBrowserButton
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
void SetTextPos(const wxPoint &aPoint)
Collection of utility functions for component reference designators (refdes)
bool GetIncludeOnBoard() const
void onNewLibIDKillFocus(wxFocusEvent &event) override
bool g_resetEmptyFields[2]
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
bool g_removeExtraFields[2]
Schematic editor (Eeschema) main window.
wxRadioButton * m_matchBySelection
void SetLibId(const LIB_ID &aName)
wxStaticBoxSizer * m_updateFieldsSizer
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
A logical library item identifier and consists of various portions much like a URI.
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
bool IsValid() const
Check if this LID_ID is valid.
Define a library symbol object.
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
wxCheckBox * m_resetFieldEffects
wxButton * m_sdbSizerCancel
wxString GetName(bool aUseDefaultName=true) const
Return the field name.
void GetFields(std::vector< LIB_FIELD * > &aList)
Return a list of fields within this symbol.
void onMatchByAll(wxCommandEvent &aEvent) override
const std::vector< SYMBOL_INSTANCE_REFERENCE > & GetInstanceReferences()
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
std::set< wxString > m_updateFields
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
bool g_resetFieldVisibilities[2]
wxBitmapButton * m_newIdBrowserButton
void SetIncludeInBom(bool aIncludeInBom)
virtual void SetVisible(bool aVisible)
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
wxTextCtrl * m_specifiedReference
wxCheckBox * m_resetFieldPositions
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
bool g_resetFieldEffects[2]
Field Value of part, i.e. "3.3K".
virtual void SetText(const wxString &aText)
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
virtual bool IsVisible() const
Class DIALOG_CHANGE_SYMBOLS_BASE.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
int GetFieldCount() const
Return the number of fields in this symbol.
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
SCHEMATIC & Schematic() const
A simple container for schematic symbol instance information.
~DIALOG_CHANGE_SYMBOLS() override
void onMatchBySelected(wxCommandEvent &aEvent) override
wxRadioButton * m_matchByValue
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslate=true)
Return a default symbol field name for field aFieldNdx for all components.
void onMatchIDKillFocus(wxFocusEvent &event) override
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void launchMatchIdSymbolBrowser(wxCommandEvent &aEvent) override
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
const wxString GetValue(const SCH_SHEET_PATH *sheet, bool aResolve) const
Return the instance-specific value for the given sheet path.
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
wxString UnescapeString(const wxString &aSource)
void Report(const wxString &aText, SEVERITY aSeverity, REPORTER::LOCATION aLocation=REPORTER::LOC_BODY)
Reports the string.
void onMatchByValue(wxCommandEvent &aEvent) override
wxTextCtrl * m_specifiedId
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
wxCheckBox * m_removeExtraBox
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
wxGridBagSizer * m_matchSizer
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
wxCheckBox * m_resetFieldVisibilities
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
void SetIncludeOnBoard(bool aIncludeOnBoard)
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
wxCheckBox * m_resetAttributes
wxCheckBox * m_resetFieldText
wxCheckListBox * m_fieldsBox
void launchNewIdSymbolBrowser(wxCommandEvent &aEvent) override
bool processSymbol(SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH *aInstance, const LIB_ID &aNewId, bool aAppendToUndo)
SCH_SCREEN * LastScreen()
void Clear()
return the number of messages matching the given severity mask.
void Append(SCH_ITEM *aItem)
WX_HTML_REPORT_PANEL * m_messagePanel
void onMatchById(wxCommandEvent &aEvent) override
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
wxString GetName(bool aUseDefaultName=true) const
Return the field name.
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
wxPoint GetPosition() const override
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
wxTextCtrl * m_specifiedValue
bool WildCompareString(const wxString &pattern, const wxString &string_to_tst, bool case_sensitive)
Compare a string against wild card (* and ?) pattern using the usual rules.
const wxPoint & GetTextPos() const
SCH_SHEET_PATH & GetCurrentSheet() const
bool g_resetFieldPositions[2]
void onMatchTextKillFocus(wxFocusEvent &event) override
LIB_SYMBOL * GetLibSymbol(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
MODE m_mode
Set of field names that should have values updated.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
wxRadioButton * m_matchAll
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
SCH_SHEET_PATH & CurrentSheet() const override
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
void SetFileName(const wxString &aReportFileName)
bool isMatch(SCH_SYMBOL *aSymbol, SCH_SHEET_PATH *aInstance)
void onOkButtonClicked(wxCommandEvent &aEvent) override
void SetPosition(const wxPoint &aPosition) override
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual const wxString & GetText() const
Return the string associated with the text object.
DIALOG_CHANGE_SYMBOLS(SCH_EDIT_FRAME *aParent, SCH_SYMBOL *aSymbol, MODE aMode=MODE::UPDATE)
bool GetIncludeInBom() const
const LIB_ID & GetLibId() const
Field Name Module PCB, i.e. "16DIP300".