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 ) );
169 if( !selection.Front()->IsBOARD_ITEM() )
174 wxCHECK_MSG( firstItem,
nullptr,
175 wxT(
"getPropertyFromEvent for a property with nothing selected!") );
178 aEvent.GetPropertyName() );
179 wxCHECK_MSG( property,
nullptr,
180 wxT(
"getPropertyFromEvent for a property not found on the selected item!" ) );
196 wxCHECK( property, );
199 wxVariant newValue = aEvent.GetPropertyValue();
201 if(
VALIDATOR_RESULT validationFailure = property->Validate( newValue.GetAny(), item ) )
203 wxString errorMsg = wxString::Format( wxS(
"%s: %s" ), wxGetTranslation( property->Name() ),
204 validationFailure->get()->Format(
m_frame ) );
223 wxCHECK( property, );
225 wxVariant newValue = aEvent.GetPropertyValue();
230 for(
EDA_ITEM* edaItem : selection )
232 if( !edaItem->IsBOARD_ITEM() )
238 changes.
Modify( item->
GetParent(),
nullptr, RECURSE_MODE::NO_RECURSE );
240 changes.
Modify( item,
nullptr, RECURSE_MODE::NO_RECURSE );
242 item->
Set( property, newValue );
245 changes.
Push(
_(
"Edit Properties" ) );
258 wxPGChoices layersAll;
259 wxPGChoices layersCu;
280 std::vector<std::pair<wxString, int>> netNames;
284 netNames.emplace_back(
UnescapeString( netInfo->GetNetname() ), netCode );
286 std::sort( netNames.begin(), netNames.end(), [](
const auto& a,
const auto& b )
288 return a.first.CmpNoCase( b.first ) < 0;
291 for(
const auto& [ netName, netCode ] : netNames )
292 nets.Add( netName, netCode );
298 std::vector<std::string> fontNames;
299 Fontconfig()->ListFonts( fontNames, std::string(
Pgm().GetLanguageTag().utf8_str() ),
304 for(
int ii = 0; ii < (int) fontNames.size(); ++ii )
305 fonts.Add( wxString( fontNames[ii] ), ii );
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
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...
BOARD_ITEM_CONTAINER * GetParent() const
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
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.
KICAD_T Type() const
Returns the type of object.
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
Return the copper, technical and user layers in the order shown in layer widget.
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
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)
int m_SuppressGridChangeEvents
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)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables