73 void setter(
void* obj, wxAny& v )
override
77 if( !v.GetAs( &value ) )
95 newField.
SetText( value, sheetPath, variantName );
100 field->
SetText( value, sheetPath, variantName );
104 wxAny
getter(
const void* obj )
const override
111 wxString variantName;
122 if( !variantName.IsEmpty() && sheetPath )
127 return wxAny(
text );
154 void setter(
void* obj, wxAny& v )
override
158 if( !v.GetAs( &value ) )
164 wxString variantName;
176 newField.
SetText( value, sheetPath, variantName );
181 field->
SetText( value, sheetPath, variantName );
185 wxAny
getter(
const void* obj )
const override
192 wxString variantName;
203 if( !variantName.IsEmpty() && sheetPath )
208 return wxAny(
text );
235 const std::unique_ptr<LIB_SYMBOL>& libSymbol = aSymbol->
GetLibSymbolRef();
240 const std::vector<ASSOCIATED_FOOTPRINT>& assoc = libSymbol->GetEffectiveAssociatedFootprints();
248 fpId.
Parse( fpField->GetText() );
252 if( candidate.m_FootprintLibId == fpId )
256 return &assoc.front();
285 void setter(
void* obj, wxAny& v )
override {}
287 wxAny
getter(
const void* obj )
const override
292 return wxAny( active->m_FootprintLibId.Format().wx_str() );
294 return wxAny( wxEmptyString );
328 void setter(
void* obj, wxAny& v )
override
332 if( !v.GetAs( &value ) )
338 wxString variantName;
355 override.m_ActiveMapName = active->m_MapName;
361 wxAny
getter(
const void* obj )
const override
366 wxString variantName;
378 switch(
override.m_Mode )
404 std::vector<wxString> names;
408 for(
const PIN_MAP& map : lib->GetEffectivePinMaps().GetAll() )
409 names.push_back( map.GetName() );
418 const std::vector<wxString> names =
MapNames( aSymbol );
420 for(
size_t ii = 0; ii < names.size(); ++ii )
421 choices.Add( names[ii], (
int) ii );
426 void setter(
void* obj, wxAny& v )
override
430 if( !v.GetAs( &value ) )
434 const std::vector<wxString> names =
MapNames( symbol );
436 if( value < 0 || value >= (
int) names.size() )
440 wxString variantName;
450 override.m_ActiveMapName = names[value];
454 wxAny
getter(
const void* obj )
const override
459 wxString variantName;
474 const std::vector<wxString> names =
MapNames( symbol );
477 if( std::find( names.begin(), names.end(), active ) == names.end() )
480 active = fp->m_MapName;
483 for(
size_t ii = 0; ii < names.size(); ++ii )
485 if( names[ii] == active )
486 return wxAny( (
int) ii );
526 void setter(
void* obj, wxAny& v )
override {}
528 wxAny
getter(
const void* obj )
const override
533 wxString variantName;
546 std::vector<wxString> logical =
pin->GetStackedPinNumbers();
548 if( std::find( logical.begin(), logical.end(),
m_pinNumber ) == logical.end() )
551 wxString
pad =
pin->GetEffectivePadNumber( *sheetPath, variantName );
554 return wxAny( wxString::Format(
_(
"%s (identity)" ),
pad ) );
635 auto netlistCallback = [
this]()
649 return std::string(
"" );
654 return std::string(
"" );
656 wxString symbolNetlist;
660 pins.push_back(
pin->GetNumber() +
' ' +
pin->GetShownName() );
662 if( !pins.IsEmpty() )
665 symbolNetlist << wxS(
"\r" );
669 if( !fpFilters.IsEmpty() )
672 symbolNetlist << wxS(
"\r" );
674 return symbolNetlist.ToStdString();
725 aFallbackSelection.
Clear();
727 return aFallbackSelection;
740 return selection.
Empty() ? nullptr : selection.
Front();
773 const SCH_SHEET_PATH* sheetPath = pinMapped->Schematic() ? &pinMapped->Schematic()->CurrentSheet() :
nullptr;
778 for(
const SCH_PIN*
pin : pinMapped->GetPins( sheetPath ) )
780 for(
const wxString& number :
pin->GetStackedPinNumbers() )
782 if( !number.IsEmpty() )
797 if( field.IsPrivate() )
809 if( field.IsPrivate() )
817 const wxString groupFields =
_HKI(
"Fields" );
883 return wxPGChoices();
964 colorProp->SetBackgroundColor( bg );
985 wxCHECK_MSG( firstItem,
nullptr, wxT(
"getPropertyFromEvent for a property with nothing selected!") );
988 wxCHECK_MSG( property,
nullptr, wxT(
"getPropertyFromEvent for a property not found on the selected item!" ) );
1006 wxVariant newValue = aEvent.GetPropertyValue();
1008 if(
VALIDATOR_RESULT validationFailure = property->Validate( newValue.GetAny(), frontItem ) )
1010 wxString errorMsg = wxString::Format( wxS(
"%s: %s" ), wxGetTranslation( property->Name() ),
1011 validationFailure->get()->Format(
m_frame ) );
1012 m_frame->ShowInfoBarError( errorMsg );
1032 wxVariant newValue = aEvent.GetPropertyValue();
1038 for(
EDA_ITEM* edaItem : selection )
1040 if( !edaItem->IsSCH_ITEM() )
1045 wxCHECK2( property,
continue );
1051 && property->Name() == wxT(
"Text" ) )
1054 wxCHECK2( symbol,
continue );
1066 && property->Name() == wxT(
"Text" ) )
1075 if( !variantName.IsEmpty() )
1089 && property->Name() == wxT(
"Text" ) )
1113 item->
Set( property, newValue );
1117 symbol->SyncOtherUnits( symbol->Schematic()->CurrentSheet(), changes, property,
1118 symbol->Schematic()->GetCurrentVariant() );
1122 changes.
Push(
_(
"Edit Properties" ) );
1126 for(
EDA_ITEM* edaItem : selection )
1127 m_frame->UpdateItem( edaItem );
1138 const wxString& aNewFilename )
1144 DisplayError( aFrame,
_(
"A sheet must have a valid file name." ) );
1149 newFilename.Replace( wxT(
"\\" ), wxT(
"/" ) );
1152 oldFilename.Replace( wxT(
"\\" ), wxT(
"/" ) );
1154 if( newFilename == oldFilename )
1181 && aProperty->
Name() == wxT(
"Text" ) )
1190 if( !variantName.IsEmpty() )
1193 aValue = wxVariant(
text );
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Dialog used to edit SCH_SYMBOL objects in a schematic.
void SelectPinMapPage()
Select the Pin Map page so the dialog opens directly on the pin-to-pad mapping editor (issue #2282).
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
EDA_ITEM * GetParent() const
Class that other classes need to inherit from, in order to be inspectable.
bool Set(PROPERTY_BASE *aProperty, wxAny &aValue, bool aNotify=true)
A color representation with 4 components: red, green, blue, alpha.
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Define a library symbol object.
std::vector< const SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
wxArrayString GetFPFilters() const
static const wxString EDITOR_NAME
static const wxString EDITOR_NAME
static wxString BuildEditorName(EDA_DRAW_FRAME *aFrame)
static wxString BuildEditorName(EDA_DRAW_FRAME *aFrame)
static wxString BuildEditorName(EDA_DRAW_FRAME *aFrame)
PROPERTIES_PANEL(wxWindow *aParent, EDA_BASE_FRAME *aFrame)
int m_SuppressGridChangeEvents
virtual void OnLanguageChanged(wxCommandEvent &aEvent)
virtual bool getItemValue(EDA_ITEM *aItem, PROPERTY_BASE *aProperty, wxVariant &aValue)
Utility to fetch a property value and convert to wxVariant Precondition: aItem is known to have prope...
virtual void rebuildProperties(const SELECTION &aSelection)
Generates the property grid for a given selection of items.
PROPERTY_BASE(const wxString &aName, PROPERTY_DISPLAY aDisplay=PT_DEFAULT, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType=ORIGIN_TRANSFORMS::NOT_A_COORD)
< Used to generate unique IDs. Must come up front so it's initialized before ctor.
virtual bool Writeable(INSPECTABLE *aObject) const
const wxString & Name() const
Provide class metadata.Helper macro to map type hashes to names.
wxString GetCurrentVariant() const
Return the current variant being edited.
SCH_SHEET_PATH & CurrentSheet() const
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
Schematic editor (Eeschema) main window.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
SCH_SHEET_PATH & GetCurrentSheet() const
bool ChangeSheetFile(SCH_SHEET *aSheet, const wxString &aNewFilename, bool *aClearAnnotationNewItems=nullptr, bool *aIsUndoable=nullptr, const wxString *aSourceSheetFilename=nullptr)
Change the file backing a schematic sheet.
virtual const wxString & GetText() const override
Return the string associated with the text object.
void SetText(const wxString &aText) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
const SYMBOL * GetParentSymbol() const
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
bool getItemValue(EDA_ITEM *aItem, PROPERTY_BASE *aProperty, wxVariant &aValue) override
Utility to fetch a property value and convert to wxVariant Precondition: aItem is known to have prope...
static std::set< wxString > m_currentSymbolFieldNames
wxPGProperty * createPGProperty(const PROPERTY_BASE *aProperty) const override
PROPERTY_MANAGER & m_propMgr
PG_CHECKBOX_EDITOR * m_checkboxEditorInstance
void onEditPinMap(wxCommandEvent &aEvent)
Open the symbol properties dialog on its Pin Map page for the single selected symbol (issue #2282).
PG_FPID_EDITOR * m_fpEditorInstance
const SELECTION & getSelection(SELECTION &aFallbackSelection)
Get the current selection from the selection tool.
void UpdateData() override
static std::set< wxString > m_currentPinMapPinNumbers
Distinct pin numbers of the selected pin-mapped symbol, gating the per-pin table rows.
void valueChanging(wxPropertyGridEvent &aEvent) override
static std::set< wxString > m_currentSheetFieldNames
PG_UNIT_EDITOR * m_unitEditorInstance
void AfterCommit() override
void valueChanged(wxPropertyGridEvent &aEvent) override
SCH_PROPERTIES_PANEL(wxWindow *aParent, SCH_BASE_FRAME *aFrame)
PG_COLOR_EDITOR * m_colorEditorInstance
EDA_ITEM * getFrontItem()
Get the front item of the current selection.
PROPERTY_BASE * getPropertyFromEvent(const wxPropertyGridEvent &aEvent) const
void OnLanguageChanged(wxCommandEvent &aEvent) override
virtual ~SCH_PROPERTIES_PANEL()
bool handleSheetFilenameChange(SCH_EDIT_FRAME *aFrame, SCH_SHEET *aSheet, SCH_COMMIT &aChanges, const wxString &aNewFilename)
void rebuildProperties(const SELECTION &aSelection) override
Generates the property grid for a given selection of items.
PG_URL_EDITOR * m_urlEditorInstance
SCH_SYMBOL * getSinglePinMappedSymbol()
wxButton * m_editPinMapButton
size_t BaseHash() const override
Return type-id of the Base class.
bool Writeable(INSPECTABLE *aObject) const override
SCH_SHEET_FIELD_PROPERTY(const wxString &aName)
wxAny getter(const void *obj) const override
void setter(void *obj, wxAny &v) override
size_t OwnerHash() const override
Return type-id of the Owner class.
size_t TypeHash() const override
Return type-id of the property type.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetFileName(const wxString &aFilename)
wxString GetFileName() const
Return the filename corresponding to this sheet.
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the sheet's fields.
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this sheet.
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a @aField to the list of fields.
size_t BaseHash() const override
Return type-id of the Base class.
size_t OwnerHash() const override
Return type-id of the Owner class.
size_t TypeHash() const override
Return type-id of the property type.
wxAny getter(const void *obj) const override
SCH_SYMBOL_FIELD_PROPERTY(const wxString &aName)
bool Writeable(INSPECTABLE *aObject) const override
void setter(void *obj, wxAny &v) override
Read-only per-pin row of the effective pin->pad table (issue #2282).
size_t TypeHash() const override
Return type-id of the property type.
size_t BaseHash() const override
Return type-id of the Base class.
SCH_SYMBOL_PIN_MAP_ENTRY_PROPERTY(const wxString &aName, const wxString &aPinNumber)
bool Writeable(INSPECTABLE *aObject) const override
wxAny getter(const void *obj) const override
size_t OwnerHash() const override
Return type-id of the Owner class.
void setter(void *obj, wxAny &v) override
Override-mode selector for a symbol's per-instance pin map (issue #2282).
wxAny getter(const void *obj) const override
SCH_SYMBOL_PIN_MAP_MODE_PROPERTY()
void setter(void *obj, wxAny &v) override
size_t TypeHash() const override
Return type-id of the property type.
size_t OwnerHash() const override
Return type-id of the Owner class.
static wxPGChoices BuildChoices()
size_t BaseHash() const override
Return type-id of the Base class.
wxAny getter(const void *obj) const override
SCH_SYMBOL_PIN_MAP_NAME_PROPERTY()
size_t TypeHash() const override
Return type-id of the property type.
static wxPGChoices BuildChoices(const SCH_SYMBOL *aSymbol)
static std::vector< wxString > MapNames(const SCH_SYMBOL *aSymbol)
size_t OwnerHash() const override
Return type-id of the Owner class.
void setter(void *obj, wxAny &v) override
size_t BaseHash() const override
Return type-id of the Base class.
void SetRefProp(const wxString &aRef)
PIN_MAP_INSTANCE_OVERRIDE GetPinMapOverride(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
void SetPinMapOverride(const PIN_MAP_INSTANCE_OVERRIDE &aOverride, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Set the per-instance pin-to-pad map override (issue #2282).
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
void SyncOtherUnits(const SCH_SHEET_PATH &aSourceSheet, SCH_COMMIT &aCommit, PROPERTY_BASE *aProperty, const wxString &aVariantName=wxEmptyString)
Keep fields other than the reference, include/exclude flags, and alternate pin assignments in sync in...
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
virtual void Add(EDA_ITEM *aItem)
virtual void Clear() override
Remove all the stored items from the group.
int Size() const
Returns the number of selected parts.
bool Empty() const
Checks if there is anything selected.
The symbol library editor main window.
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
@ FRAME_SCH_SYMBOL_EDITOR
static const std::string KiCadSchematicFileExtension
@ LAYER_SCHEMATIC_BACKGROUND
wxPGProperty * PGPropertyFactory(const PROPERTY_BASE *aProperty, EDA_DRAW_FRAME *aFrame)
Customized abstract wxPGProperty class to handle coordinate/size units.
PIN_MAP_OVERRIDE_MODE
Override mode stored on a SCH_SYMBOL_INSTANCE.
APIIMPORT wxPGGlobalVarsClass * wxPGGlobalVars
std::optional< std::unique_ptr< VALIDATION_ERROR > > VALIDATOR_RESULT
Null optional means validation succeeded.
static const wxString PIN_MAP_GROUP
static const wxString PIN_MAP_MODE_PROP
static const wxString MISSING_FIELD_SENTINEL
static const wxString PIN_MAP_FOOTPRINT_PROP
static const ASSOCIATED_FOOTPRINT * activeAssociatedFootprint(const SCH_SYMBOL *aSymbol)
static const wxString PIN_MAP_ENTRY_PREFIX
static bool symbolHasAssociatedFootprint(INSPECTABLE *aObject)
static const wxString PIN_MAP_NAME_PROP
static const wxString PIN_MAP_TABLE_GROUP
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
bool IsFullFileNameValid(const wxString &aFullFilename)
Checks if a full filename is valid, i.e.
Per-instance override of the active pin map and a sparse delta on top.
PIN_MAP_OVERRIDE_MODE m_Mode
@ USER
The field ID hasn't been set yet; field is invalid.
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
wxString GetCanonicalFieldName(FIELD_T aFieldType)
Definition of file extensions used in Kicad.