66 m_matchAll->SetLabel(
_(
"Change all symbols in schematic" ) );
67 SetTitle(
_(
"Change Symbols" ) );
95 m_matchById->SetLabel(
_(
"Change symbols matching library identifier:" ) );
242 wxString newName =
m_newId->GetValue();
258 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
265 std::vector<SCH_FIELD*> fields;
266 std::vector<LIB_FIELD*> libFields;
267 std::set<wxString> fieldNames;
273 wxCHECK2( screen,
continue );
277 SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( item );
279 wxCHECK2( symbol,
continue );
281 if( !
isMatch( symbol, &instance ) )
288 fieldNames.insert( fields[i]->GetName() );
296 std::unique_ptr<LIB_PART> flattenedPart = libSymbol->
Flatten();
298 flattenedPart->GetFields( libFields );
301 fieldNames.insert( libFields[i]->GetName() );
322 std::unique_ptr<LIB_PART> flattenedPart = libSymbol->
Flatten();
324 flattenedPart->GetFields( libFields );
327 fieldNames.insert( libFields[i]->GetName() );
338 for(
const wxString& fieldName : fieldNames )
348 for(
unsigned i = 0; i <
m_fieldsBox->GetCount(); ++i )
356 SCH_EDIT_FRAME* parent = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
366 for(
unsigned i = 0; i <
m_fieldsBox->GetCount(); ++i )
386 wxCHECK( aSymbol,
false );
388 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
390 wxCHECK( frame,
false );
403 aSymbol->
GetRef( aInstance,
false ), false );
408 aSymbol->
GetValue( aInstance,
false ), false );
422 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
424 wxCHECK( frame,
false );
427 bool appendToUndo =
false;
428 bool changed =
false;
443 wxCHECK2( screen,
continue );
445 std::vector<SCH_COMPONENT*> components;
448 components.push_back( static_cast<SCH_COMPONENT*>( item ) );
452 if( !
isMatch( symbol, &instance ) )
457 if(
processSymbol( symbol, &instance, symbol->GetLibId(), appendToUndo ) )
462 if(
processSymbol( symbol, &instance, newId, appendToUndo ) )
478 const LIB_ID& aNewId,
bool aAppendToUndo )
480 wxCHECK( aSymbol,
false );
481 wxCHECK( aNewId.
IsValid(), false );
483 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
486 wxCHECK( frame,
false );
494 if( references.IsEmpty() )
495 references = instance.m_Reference;
497 references +=
" " + instance.m_Reference;
504 msg.Printf(
_(
"Update symbol %s from '%s' to '%s'" ),
511 msg.Printf(
_(
"Update symbols %s from '%s' to '%s'" ),
521 msg.Printf(
_(
"Change symbol %s from '%s' to '%s'" ),
528 msg.Printf(
_(
"Change symbols %s from '%s' to '%s'" ),
535 LIB_PART* libSymbol = frame->GetLibPart( aNewId );
539 msg <<
": " <<
_(
"*** symbol not found ***" );
544 std::unique_ptr<LIB_PART> flattenedSymbol = libSymbol->
Flatten();
546 if( flattenedSymbol->GetUnitCount() < aSymbol->
GetUnit() )
548 msg <<
": " <<
_(
"*** new symbol has too few units ***" );
555 screen->
Remove( aSymbol );
574 for(
unsigned i = 0; i < aSymbol->
GetFields().size(); ++i )
629 std::vector<LIB_FIELD*> libFields;
634 const LIB_FIELD& libField = *libFields[i];
646 schField->SetText( libField.
GetText() );
652 screen->
Append( aSymbol );
653 frame->GetCanvas()->GetView()->Update( aSymbol );
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.
EE_TYPE OfType(KICAD_T aType) const
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
void SetLazyUpdate(bool aLazyUpdate)
Forces updating the HTML page, after the report is built in lazy mode If aSort = true,...
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
bool g_resetAttributes[2]
bool Remove(SCH_ITEM *aItem)
Remove aItem from the schematic associated with this screen.
void SetLibSymbol(LIB_PART *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
void SetLibId(const LIB_ID &aName)
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
wxCheckBox * m_resetEmptyFields
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
void onMatchByReference(wxCommandEvent &aEvent) override
void SetIncludeInBom(bool aIncludeInBom)
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 Flush(bool aSort=false)
Set the visible severity filter.
void checkAll(bool aCheck)
wxRadioButton * m_matchByReference
wxBitmapButton * m_matchIdBrowserButton
void SetTextPos(const wxPoint &aPoint)
void SetVisible(bool aVisible)
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
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.
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
wxRadioButton * m_matchBySelection
wxStaticBoxSizer * m_updateFieldsSizer
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
void SetIncludeOnBoard(bool aIncludeOnBoard)
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.
wxCheckBox * m_resetFieldEffects
wxButton * m_sdbSizerCancel
wxString GetName(bool aUseDefaultName=true) const
Returns the field name.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populates a std::vector with SCH_FIELDs.
const char * c_str() const
void onMatchByAll(wxCommandEvent &aEvent) override
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]
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
wxBitmapButton * m_newIdBrowserButton
wxTextCtrl * m_specifiedReference
wxCheckBox * m_resetFieldPositions
bool g_resetFieldEffects[2]
LIB_FIELD * FindField(const wxString &aFieldName)
Find a field within this part matching aFieldName and returns it or NULL if not found.
Field Value of part, i.e. "3.3K".
virtual void SetText(const wxString &aText)
const wxString GetValue(const SCH_SHEET_PATH *sheet, bool aResolve) const
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Class DIALOG_CHANGE_SYMBOLS_BASE.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
DIALOG_CHANGE_SYMBOLS(SCH_EDIT_FRAME *aParent, SCH_COMPONENT *aSymbol, MODE aMode=MODE::UPDATE)
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.
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
SCHEMATIC & Schematic() const
Define a library symbol object.
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
A simple container for schematic symbol instance information.
void GetFields(std::vector< LIB_FIELD * > &aList)
Return a list of fields within this part.
~DIALOG_CHANGE_SYMBOLS() override
void onMatchBySelected(wxCommandEvent &aEvent) override
wxRadioButton * m_matchByValue
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslate=true)
Return a default symbol field name for field aFieldNdx for all components.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
const BITMAP_OPAQUE small_library_xpm[1]
std::unique_ptr< LIB_PART > Flatten() const
Return a flattened symbol inheritance to the caller.
void launchMatchIdSymbolBrowser(wxCommandEvent &aEvent) override
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
int GetFieldCount() const
Return the number of fields in this symbol.
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
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
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.
wxCheckBox * m_resetAttributes
wxCheckBox * m_resetFieldText
wxCheckListBox * m_fieldsBox
void launchNewIdSymbolBrowser(wxCommandEvent &aEvent) override
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
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
bool isMatch(SCH_COMPONENT *aSymbol, SCH_SHEET_PATH *aInstance)
wxPoint GetPosition() const override
bool GetIncludeOnBoard() const
void RemoveField(const wxString &aFieldName)
Removes a user field from the symbol.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
wxTextCtrl * m_specifiedValue
const wxPoint & GetTextPos() const
SCH_SHEET_PATH & GetCurrentSheet() const
bool g_resetFieldPositions[2]
void onMatchTextKillFocus(wxFocusEvent &event) override
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
bool processSymbol(SCH_COMPONENT *aSymbol, const SCH_SHEET_PATH *aInstance, const LIB_ID &aNewId, bool aAppendToUndo)
SCH_SHEET_PATH & CurrentSheet() const override
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
void SetFileName(const wxString &aReportFileName)
const std::vector< SYMBOL_INSTANCE_REFERENCE > & GetInstanceReferences()
bool GetIncludeInBom() const
void onOkButtonClicked(wxCommandEvent &aEvent) override
const LIB_ID & GetLibId() const
void SetPosition(const wxPoint &aPosition) override
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.
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Field Name Module PCB, i.e. "16DIP300".