132 const wxPGChoices& canonicalLayers = aProperty->
Choices();
133 wxArrayString boardLayerNames;
134 wxArrayInt boardLayerIDs;
136 for(
int ii = 0; ii < (int) aProperty->
Choices().GetCount(); ++ii )
138 int layer = canonicalLayers.GetValue( ii );
141 boardLayerIDs.push_back( canonicalLayers.GetValue( ii ) );
147 [&](
int aValue ) -> wxColour
152 ret->SetLabel( wxGetTranslation( aProperty->
Name() ) );
153 ret->SetName( aProperty->
Name() );
154 ret->SetHelpString( wxGetTranslation( aProperty->
Name() ) );
155 ret->SetClientData(
const_cast<PROPERTY_BASE*
>( aProperty ) );
170 wxCHECK_MSG( firstItem,
nullptr,
171 wxT(
"getPropertyFromEvent for a property with nothing selected!") );
174 aEvent.GetPropertyName() );
175 wxCHECK_MSG( property,
nullptr,
176 wxT(
"getPropertyFromEvent for a property not found on the selected item!" ) );
189 wxCHECK( property, );
192 wxVariant newValue = aEvent.GetPropertyValue();
194 if(
VALIDATOR_RESULT validationFailure = property->Validate( newValue.GetAny(), item ) )
196 wxString errorMsg = wxString::Format( wxS(
"%s: %s" ), wxGetTranslation( property->Name() ),
197 validationFailure->get()->Format(
m_frame ) );
211 wxCHECK( property, );
213 wxVariant newValue = aEvent.GetPropertyValue();
218 for(
EDA_ITEM* edaItem : selection )
222 item->
Set( property, newValue );
225 changes.
Push(
_(
"Edit Properties" ) );
236 wxPGChoices layersAll;
237 wxPGChoices layersCu;
259 std::vector<std::pair<wxString, int>> netNames;
263 netNames.emplace_back(
UnescapeString( netInfo->GetNetname() ), netCode );
265 std::sort( netNames.begin(), netNames.end(), [](
const auto& a,
const auto& b )
267 return a.first.CmpNoCase( b.first ) < 0;
270 for(
const auto& [ netName, netCode ] : netNames )
271 nets.Add( netName, netCode );
277 std::vector<std::string> fontNames;
278 Fontconfig()->ListFonts( fontNames, std::string(
Pgm().GetLanguageTag().utf8_str() ),
283 for(
int ii = 0; ii < (int) fontNames.size(); ++ii )
284 fonts.Add( wxString( fontNames[ii] ), ii );
virtual void Push(const wxString &aMessage=wxEmptyString, 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.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const std::vector< wxString > * GetFontFiles() const
If we just need the cached version of the font files, we can use this function which is const and wil...
bool Set(PROPERTY_BASE *aProperty, wxAny &aValue, bool aNotify=true)
LSET is a set of PCB_LAYER_IDs.
LSEQ UIOrder() const
Returns the copper, technical and user layers in the order shown in layer widget.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static wxString 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
PG_RATIO_EDITOR * m_ratioEditorInstance
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
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.
FONTCONFIG * Fontconfig()
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.
PGM_BASE & Pgm()
The global Program "get" accessor.
APIIMPORT wxPGGlobalVarsClass * wxPGGlobalVars
std::optional< std::unique_ptr< VALIDATION_ERROR > > VALIDATOR_RESULT
Null optional means validation succeeded.
wxString UnescapeString(const wxString &aSource)