69 void setter(
void* obj, wxAny& v )
override
73 if( !v.GetAs( &value ) )
91 newField.
SetText( value, sheetPath, variantName );
96 field->
SetText( value, sheetPath, variantName );
100 wxAny
getter(
const void* obj )
const override
107 wxString variantName;
118 if( !variantName.IsEmpty() && sheetPath )
123 return wxAny(
text );
217 return std::string(
"" );
222 return std::string(
"" );
224 wxString symbolNetlist;
228 pins.push_back(
pin->GetNumber() +
' ' +
pin->GetShownName() );
230 if( !pins.IsEmpty() )
233 symbolNetlist << wxS(
"\r" );
237 if( !fpFilters.IsEmpty() )
240 symbolNetlist << wxS(
"\r" );
242 return symbolNetlist.ToStdString();
281 aFallbackSelection.
Clear();
283 return aFallbackSelection;
296 return selection.
Empty() ? nullptr : selection.
Front();
332 if( field.IsPrivate() )
339 const wxString groupFields =
_HKI(
"Fields" );
364 colorProp->SetBackgroundColor( bg );
385 wxCHECK_MSG( firstItem,
nullptr, wxT(
"getPropertyFromEvent for a property with nothing selected!") );
388 wxCHECK_MSG( property,
nullptr, wxT(
"getPropertyFromEvent for a property not found on the selected item!" ) );
406 wxVariant newValue = aEvent.GetPropertyValue();
408 if(
VALIDATOR_RESULT validationFailure = property->Validate( newValue.GetAny(), frontItem ) )
410 wxString errorMsg = wxString::Format( wxS(
"%s: %s" ), wxGetTranslation( property->Name() ),
411 validationFailure->get()->Format(
m_frame ) );
412 m_frame->ShowInfoBarError( errorMsg );
432 wxVariant newValue = aEvent.GetPropertyValue();
438 for(
EDA_ITEM* edaItem : selection )
440 if( !edaItem->IsSCH_ITEM() )
445 wxCHECK2( property,
continue );
451 && property->Name() == wxT(
"Text" ) )
454 wxCHECK2( symbol,
continue );
466 && property->Name() == wxT(
"Text" ) )
475 if( !variantName.IsEmpty() )
489 && property->Name() == wxT(
"Text" ) )
513 item->
Set( property, newValue );
517 symbol->SyncOtherUnits( symbol->Schematic()->CurrentSheet(), changes, property,
518 symbol->Schematic()->GetCurrentVariant() );
522 changes.
Push(
_(
"Edit Properties" ) );
526 for(
EDA_ITEM* edaItem : selection )
527 m_frame->UpdateItem( edaItem );
538 const wxString& aNewFilename )
544 DisplayError( aFrame,
_(
"A sheet must have a valid file name." ) );
549 newFilename.Replace( wxT(
"\\" ), wxT(
"/" ) );
552 oldFilename.Replace( wxT(
"\\" ), wxT(
"/" ) );
554 if( newFilename == oldFilename )
581 && aProperty->
Name() == wxT(
"Text" ) )
590 if( !variantName.IsEmpty() )
593 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.
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.
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.
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...
wxPGProperty * createPGProperty(const PROPERTY_BASE *aProperty) const override
PROPERTY_MANAGER & m_propMgr
PG_CHECKBOX_EDITOR * m_checkboxEditorInstance
PG_FPID_EDITOR * m_fpEditorInstance
const SELECTION & getSelection(SELECTION &aFallbackSelection)
Get the current selection from the selection tool.
void UpdateData() override
void valueChanging(wxPropertyGridEvent &aEvent) override
PG_UNIT_EDITOR * m_unitEditorInstance
static std::set< wxString > m_currentFieldNames
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
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.
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
void SetRefProp(const wxString &aRef)
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.
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.
APIIMPORT wxPGGlobalVarsClass * wxPGGlobalVars
std::optional< std::unique_ptr< VALIDATION_ERROR > > VALIDATOR_RESULT
Null optional means validation succeeded.
static const wxString MISSING_FIELD_SENTINEL
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.
@ 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.