121 const wxPGChoices& canonicalLayers = aProperty->
Choices();
122 wxArrayString boardLayerNames;
123 wxArrayInt boardLayerIDs;
125 for(
int ii = 0; ii < (int) aProperty->
Choices().GetCount(); ++ii )
127 int layer = canonicalLayers.GetValue( ii );
130 boardLayerIDs.push_back( canonicalLayers.GetValue( ii ) );
134 new wxPGChoices( boardLayerNames, boardLayerIDs ) );
137 [&](
int aValue ) -> wxColour
142 ret->SetLabel( wxGetTranslation( aProperty->
Name() ) );
143 ret->SetName( aProperty->
Name() );
144 ret->SetHelpString( wxGetTranslation( aProperty->
Name() ) );
145 ret->SetClientData(
const_cast<PROPERTY_BASE*
>( aProperty ) );
160 wxCHECK_MSG( firstItem,
nullptr,
161 wxT(
"getPropertyFromEvent for a property with nothing selected!") );
164 aEvent.GetPropertyName() );
165 wxCHECK_MSG( property,
nullptr,
166 wxT(
"getPropertyFromEvent for a property not found on the selected item!" ) );
179 wxCHECK( property, );
182 wxVariant newValue = aEvent.GetPropertyValue();
184 if(
VALIDATOR_RESULT validationFailure = property->Validate( newValue.GetAny(), item ) )
186 wxString errorMsg = wxString::Format( wxS(
"%s: %s" ), wxGetTranslation( property->Name() ),
187 validationFailure->get()->Format(
m_frame ) );
201 wxCHECK( property, );
203 wxVariant newValue = aEvent.GetPropertyValue();
206 for(
EDA_ITEM* edaItem : selection )
210 item->
Set( property, newValue );
213 changes.
Push(
_(
"Change property" ) );
223 wxPGChoices layersAll, layersCu, nets;
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
A base class for most all the KiCad significant classes used in schematics and boards.
bool Set(PROPERTY_BASE *aProperty, wxAny &aValue)
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
const NETCODES_MAP & NetsByNetcode() const
Return the netcode map, at least for python.
Common, abstract interface for edit frames.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
The main frame for Pcbnew.
PCB_BASE_EDIT_FRAME * m_frame
void valueChanged(wxPropertyGridEvent &aEvent) override
Regenerates caches storing layer and net names.
PG_UNIT_EDITOR * m_unitEditorInstance
wxPGProperty * createPGProperty(const PROPERTY_BASE *aProperty) const override
void UpdateData() override
PCB_PROPERTIES_PANEL(wxWindow *aParent, PCB_BASE_EDIT_FRAME *aFrame)
virtual ~PCB_PROPERTIES_PANEL()
PROPERTY_BASE * getPropertyFromEvent(const wxPropertyGridEvent &aEvent) const
PROPERTY_MANAGER & m_propMgr
void AfterCommit() override
PG_CHECKBOX_EDITOR * m_checkboxEditorInstance
void updateLists(const BOARD *aBoard)
void valueChanging(wxPropertyGridEvent &aEvent) override
static const wxString EDITOR_NAME
void UpdateFrame(EDA_DRAW_FRAME *aFrame)
When restarting an editor, the instance of PG_UNIT_EDITOR may be the same but the referenced frame is...
static wxString BuildEditorName(EDA_DRAW_FRAME *aFrame)
virtual void rebuildProperties(const SELECTION &aSelection)
Generates the property grid for a given selection of items.
virtual size_t TypeHash() const =0
Return type-id of the property type.
virtual bool HasChoices() const
Return true if this PROPERTY has a limited set of possible values.
const wxString & Name() const
virtual const wxPGChoices & Choices() const
Return a limited set of possible values (e.g.
virtual void SetChoices(const wxPGChoices &aChoices)
Set the possible values for for the property.
Provide class metadata.Helper macro to map type hashes to names.
void Rebuild()
Rebuild the list of all registered properties.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
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.
wxString UnescapeString(const wxString &aSource)