KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_properties_panel.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KICAD, a free EDA CAD application.
3 *
4 * Copyright (C) 2020-2023 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Maciej Suminski <[email protected]>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 3
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
23
24#include <font/fontconfig.h>
26#include <pgm_base.h>
27#include <pcb_base_edit_frame.h>
28#include <tool/tool_manager.h>
29#include <tools/pcb_actions.h>
33#include <board_commit.h>
35#include <board.h>
37#include <pcb_shape.h>
38#include <pcb_text.h>
39#include <pcb_track.h>
40#include <pcb_generator.h>
42#include <pad.h>
43#include <footprint.h>
44#include <pcb_field.h>
45#include <template_fieldnames.h>
47#include <string_utils.h>
49#include <widgets/ui_common.h>
50
51static const wxString MISSING_FIELD_SENTINEL = wxS( "\uE000" );
52
54{
55public:
56 PCB_FOOTPRINT_FIELD_PROPERTY( const wxString& aName ) :
57 PROPERTY_BASE( aName ),
58 m_name( aName )
59 {
60 }
61
62 size_t OwnerHash() const override { return TYPE_HASH( FOOTPRINT ); }
63 size_t BaseHash() const override { return TYPE_HASH( FOOTPRINT ); }
64 size_t TypeHash() const override { return TYPE_HASH( wxString ); }
65
66 bool Writeable( INSPECTABLE* aObject ) const override
67 {
68 return PROPERTY_BASE::Writeable( aObject );
69 }
70
71 void setter( void* obj, wxAny& v ) override
72 {
73 wxString value;
74
75 if( !v.GetAs( &value ) )
76 return;
77
78 FOOTPRINT* footprint = reinterpret_cast<FOOTPRINT*>( obj );
79 PCB_FIELD* field = footprint->GetField( m_name );
80
81 if( !field )
82 {
83 PCB_FIELD* newField = new PCB_FIELD( footprint, FIELD_T::USER, m_name );
84 newField->SetText( value );
85 footprint->Add( newField );
86 }
87 else
88 {
89 field->SetText( value );
90 }
91 }
92
93 wxAny getter( const void* obj ) const override
94 {
95 const FOOTPRINT* footprint = reinterpret_cast<const FOOTPRINT*>( obj );
96 PCB_FIELD* field = footprint->GetField( m_name );
97
98 if( field )
99 return wxAny( field->GetText() );
100 else
101 return wxAny( MISSING_FIELD_SENTINEL );
102 }
103
104private:
105 wxString m_name;
106};
107
109
110
111class PG_NET_SELECTOR_EDITOR : public wxPGEditor
112{
113public:
114 static const wxString EDITOR_NAME;
115
117 {
118 }
119
120 wxString GetName() const override { return EDITOR_NAME; }
121
122 wxPGWindowList CreateControls( wxPropertyGrid* aGrid, wxPGProperty* aProperty,
123 const wxPoint& aPos, const wxSize& aSize ) const override
124 {
125 NET_SELECTOR* editor = new NET_SELECTOR( aGrid->GetPanel(), wxID_ANY, aPos, aSize, 0 );
126
127 if( BOARD* board = m_frame->GetBoard() )
128 editor->SetNetInfo( &board->GetNetInfo() );
129
130 editor->SetIndeterminateString( INDETERMINATE_STATE );
131 UpdateControl( aProperty, editor );
132
133 editor->Bind( FILTERED_ITEM_SELECTED,
134 [=]( wxCommandEvent& aEvt )
135 {
136 auto& choices = const_cast<wxPGChoices&>( aProperty->GetChoices() );
137 wxString netname = editor->GetSelectedNetname();
138
139 if( choices.Index( netname ) == wxNOT_FOUND )
140 choices.Add( netname, editor->GetSelectedNetcode() );
141
142 wxVariant val( editor->GetSelectedNetcode() );
143 aGrid->ChangePropertyValue( aProperty, val );
144 } );
145
146 return editor;
147 }
148
149 void UpdateControl( wxPGProperty* aProperty, wxWindow* aCtrl ) const override
150 {
151 if( NET_SELECTOR* editor = dynamic_cast<NET_SELECTOR*>( aCtrl ) )
152 {
153 if( aProperty->IsValueUnspecified() )
154 editor->SetIndeterminate();
155 else
156 editor->SetSelectedNetcode( (int) aProperty->GetValue().GetLong() );
157 }
158 }
159
160 bool GetValueFromControl( wxVariant& aVariant, wxPGProperty* aProperty,
161 wxWindow* aCtrl ) const override
162 {
163 NET_SELECTOR* editor = dynamic_cast<NET_SELECTOR*>( aCtrl );
164
165 if( !editor )
166 return false;
167
168 aVariant = static_cast<long>( editor->GetSelectedNetcode() );
169 return true;
170 }
171
172 bool OnEvent( wxPropertyGrid* aGrid, wxPGProperty* aProperty, wxWindow* aWindow,
173 wxEvent& aEvent ) const override
174 {
175 return false;
176 }
177
178private:
180};
181
182const wxString PG_NET_SELECTOR_EDITOR::EDITOR_NAME = wxS( "PG_NET_SELECTOR_EDITOR" );
183
184
185
187 PROPERTIES_PANEL( aParent, aFrame ),
188 m_frame( aFrame ),
189 m_propMgr( PROPERTY_MANAGER::Instance() )
190{
191 m_propMgr.Rebuild();
192 bool found = false;
193
194 wxASSERT( wxPGGlobalVars );
195
196 wxString editorKey = PG_UNIT_EDITOR::BuildEditorName( m_frame );
197
198 auto it = wxPGGlobalVars->m_mapEditorClasses.find( editorKey );
199
200 if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
201 {
202 m_unitEditorInstance = static_cast<PG_UNIT_EDITOR*>( it->second );
203 m_unitEditorInstance->UpdateFrame( m_frame );
204 found = true;
205 }
206
207 if( !found )
208 {
209 PG_UNIT_EDITOR* new_editor = new PG_UNIT_EDITOR( m_frame );
210 m_unitEditorInstance = static_cast<PG_UNIT_EDITOR*>( wxPropertyGrid::RegisterEditorClass( new_editor ) );
211 }
212
213 it = wxPGGlobalVars->m_mapEditorClasses.find( PG_CHECKBOX_EDITOR::EDITOR_NAME );
214
215 if( it == wxPGGlobalVars->m_mapEditorClasses.end() )
216 {
217 PG_CHECKBOX_EDITOR* cbEditor = new PG_CHECKBOX_EDITOR();
218 m_checkboxEditorInstance = static_cast<PG_CHECKBOX_EDITOR*>( wxPropertyGrid::RegisterEditorClass( cbEditor ) );
219 }
220 else
221 {
222 m_checkboxEditorInstance = static_cast<PG_CHECKBOX_EDITOR*>( it->second );
223 }
224
225 it = wxPGGlobalVars->m_mapEditorClasses.find( PG_RATIO_EDITOR::EDITOR_NAME );
226
227 if( it == wxPGGlobalVars->m_mapEditorClasses.end() )
228 {
229 PG_RATIO_EDITOR* ratioEditor = new PG_RATIO_EDITOR();
230 m_ratioEditorInstance = static_cast<PG_RATIO_EDITOR*>( wxPropertyGrid::RegisterEditorClass( ratioEditor ) );
231 }
232 else
233 {
234 m_ratioEditorInstance = static_cast<PG_RATIO_EDITOR*>( it->second );
235 }
236
237 it = wxPGGlobalVars->m_mapEditorClasses.find( PG_NET_SELECTOR_EDITOR::EDITOR_NAME );
238
239 if( it == wxPGGlobalVars->m_mapEditorClasses.end() )
240 {
242 m_netSelectorEditorInstance = static_cast<PG_NET_SELECTOR_EDITOR*>( wxPropertyGrid::RegisterEditorClass( netEditor ) );
243 }
244 else
245 {
246 m_netSelectorEditorInstance = static_cast<PG_NET_SELECTOR_EDITOR*>( it->second );
247 }
248
249 it = wxPGGlobalVars->m_mapEditorClasses.find( PG_FPID_EDITOR::BuildEditorName( m_frame ) );
250
251 if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
252 {
253 m_fpEditorInstance = static_cast<PG_FPID_EDITOR*>( it->second );
254 m_fpEditorInstance->UpdateFrame( m_frame );
255 }
256 else
257 {
258 PG_FPID_EDITOR* fpEditor = new PG_FPID_EDITOR( m_frame );
259 m_fpEditorInstance = static_cast<PG_FPID_EDITOR*>( wxPropertyGrid::RegisterEditorClass( fpEditor ) );
260 }
261
262 it = wxPGGlobalVars->m_mapEditorClasses.find( PG_URL_EDITOR::BuildEditorName( m_frame ) );
263
264 if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
265 {
266 m_urlEditorInstance = static_cast<PG_URL_EDITOR*>( it->second );
267 m_urlEditorInstance->UpdateFrame( m_frame );
268 }
269 else
270 {
271 PG_URL_EDITOR* urlEditor = new PG_URL_EDITOR( m_frame );
272 m_urlEditorInstance = static_cast<PG_URL_EDITOR*>( wxPropertyGrid::RegisterEditorClass( urlEditor ) );
273 }
274}
275
276
278{
279 m_unitEditorInstance->UpdateFrame( nullptr );
280 m_fpEditorInstance->UpdateFrame( nullptr );
281 m_urlEditorInstance->UpdateFrame( nullptr );
282}
283
284
286{
287 PCB_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
288 const SELECTION& selection = selectionTool->GetSelection();
289
290 // TODO perhaps it could be called less often? use PROPERTIES_TOOL and catch MODEL_RELOAD?
291 updateLists( static_cast<PCB_EDIT_FRAME*>( m_frame )->GetBoard() );
292
293 // Will actually just be updatePropertyValues() if selection hasn't changed
294 rebuildProperties( selection );
295}
296
297
299{
300 PCB_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
301 const SELECTION& selection = selectionTool->GetSelection();
302
303 rebuildProperties( selection );
304}
305
306
308{
309 m_currentFieldNames.clear();
310
311 for( EDA_ITEM* item : aSelection )
312 {
313 if( item->Type() != PCB_FOOTPRINT_T )
314 continue;
315
316 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
317
318 for( PCB_FIELD* field : footprint->GetFields() )
319 m_currentFieldNames.insert( field->GetCanonicalName() );
320 }
321
322 const wxString groupFields = _HKI( "Fields" );
323
324 for( const wxString& name : m_currentFieldNames )
325 {
326 if( !m_propMgr.GetProperty( TYPE_HASH( FOOTPRINT ), name ) )
327 {
328 m_propMgr.AddProperty( new PCB_FOOTPRINT_FIELD_PROPERTY( name ), groupFields )
329 .SetAvailableFunc( [name]( INSPECTABLE* )
330 {
332 } );
333 }
334 }
335
337}
338
339
340wxPGProperty* PCB_PROPERTIES_PANEL::createPGProperty( const PROPERTY_BASE* aProperty ) const
341{
342 if( aProperty->TypeHash() == TYPE_HASH( PCB_LAYER_ID ) )
343 {
344 wxASSERT( aProperty->HasChoices() );
345
346 const wxPGChoices& canonicalLayers = aProperty->Choices();
347 wxArrayString boardLayerNames;
348 wxArrayInt boardLayerIDs;
349
350 for( int ii = 0; ii < (int) aProperty->Choices().GetCount(); ++ii )
351 {
352 int layer = canonicalLayers.GetValue( ii );
353
354 boardLayerNames.push_back( m_frame->GetBoard()->GetLayerName( ToLAYER_ID( layer ) ) );
355 boardLayerIDs.push_back( canonicalLayers.GetValue( ii ) );
356 }
357
358 auto ret = new PGPROPERTY_COLORENUM( new wxPGChoices( boardLayerNames, boardLayerIDs ) );
359
360 ret->SetColorFunc(
361 [&]( int aValue ) -> wxColour
362 {
363 return m_frame->GetColorSettings()->GetColor( ToLAYER_ID( aValue ) ).ToColour();
364 } );
365
366 ret->SetLabel( wxGetTranslation( aProperty->Name() ) );
367 ret->SetName( aProperty->Name() );
368 ret->SetHelpString( wxGetTranslation( aProperty->Name() ) );
369 ret->SetClientData( const_cast<PROPERTY_BASE*>( aProperty ) );
370
371 return ret;
372 }
373
374 wxPGProperty* prop = PGPropertyFactory( aProperty, m_frame );
375
376 if( aProperty->Name() == GetCanonicalFieldName( FIELD_T::FOOTPRINT ) )
377 prop->SetEditor( PG_FPID_EDITOR::BuildEditorName( m_frame ) );
378 else if( aProperty->Name() == GetCanonicalFieldName( FIELD_T::DATASHEET ) )
379 prop->SetEditor( PG_URL_EDITOR::BuildEditorName( m_frame ) );
380
381 return prop;
382}
383
384
385PROPERTY_BASE* PCB_PROPERTIES_PANEL::getPropertyFromEvent( const wxPropertyGridEvent& aEvent ) const
386{
387 PCB_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
388 const SELECTION& selection = selectionTool->GetSelection();
389
390 if( !selection.Front()->IsBOARD_ITEM() )
391 return nullptr;
392
393 BOARD_ITEM* firstItem = static_cast<BOARD_ITEM*>( selection.Front() );
394
395 wxCHECK_MSG( firstItem, nullptr,
396 wxT( "getPropertyFromEvent for a property with nothing selected!") );
397
398 PROPERTY_BASE* property = m_propMgr.GetProperty( TYPE_HASH( *firstItem ),
399 aEvent.GetPropertyName() );
400 wxCHECK_MSG( property, nullptr,
401 wxT( "getPropertyFromEvent for a property not found on the selected item!" ) );
402
403 return property;
404}
405
406
407void PCB_PROPERTIES_PANEL::valueChanging( wxPropertyGridEvent& aEvent )
408{
410 return;
411
412 PCB_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
413 const SELECTION& selection = selectionTool->GetSelection();
414 EDA_ITEM* item = selection.Front();
415
416 PROPERTY_BASE* property = getPropertyFromEvent( aEvent );
417 wxCHECK( property, /* void */ );
418 wxCHECK( item, /* void */ );
419
420 wxVariant newValue = aEvent.GetPropertyValue();
421
422 if( VALIDATOR_RESULT validationFailure = property->Validate( newValue.GetAny(), item ) )
423 {
424 wxString errorMsg = wxString::Format( wxS( "%s: %s" ), wxGetTranslation( property->Name() ),
425 validationFailure->get()->Format( m_frame ) );
426 m_frame->ShowInfoBarError( errorMsg );
427 aEvent.Veto();
428 return;
429 }
430
431 aEvent.Skip();
432}
433
434
435void PCB_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
436{
438 return;
439
440 PCB_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
441 const SELECTION& selection = selectionTool->GetSelection();
442
443 wxCHECK( getPropertyFromEvent( aEvent ), /* void */ );
444
445 wxVariant newValue = aEvent.GetPropertyValue();
446 BOARD_COMMIT changes( m_frame );
447
448 PROPERTY_COMMIT_HANDLER handler( &changes );
449
450 for( EDA_ITEM* edaItem : selection )
451 {
452 if( !edaItem->IsBOARD_ITEM() )
453 continue;
454
455 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( edaItem );
456 PROPERTY_BASE* property = m_propMgr.GetProperty( TYPE_HASH( *item ), aEvent.GetPropertyName() );
457 wxCHECK( property, /* void */ );
458
459 if( item->Type() == PCB_TABLECELL_T )
460 changes.Modify( item->GetParent(), nullptr, RECURSE_MODE::NO_RECURSE );
461 else if( item->Type() == PCB_GENERATOR_T )
462 changes.Modify( item, nullptr, RECURSE_MODE::RECURSE );
463 else
464 changes.Modify( item, nullptr, RECURSE_MODE::NO_RECURSE );
465
466 // In the PCB Editor, we generally restrict pad movement to the footprint (like dragging)
467 if( item->Type() == PCB_PAD_T && m_frame
468 && m_frame->IsType( FRAME_PCB_EDITOR )
469 && !m_frame->GetPcbNewSettings()->m_AllowFreePads
470 && ( aEvent.GetPropertyName() == _HKI( "Position X" )
471 || aEvent.GetPropertyName() == _HKI( "Position Y" ) ) )
472 {
473 PAD* pad = static_cast<PAD*>( item );
474 FOOTPRINT* fp = pad->GetParentFootprint();
475
476 if( fp )
477 {
478 VECTOR2I oldPos = pad->GetPosition();
479 VECTOR2I newPos = oldPos;
480
481 if( aEvent.GetPropertyName() == _HKI( "Position X" ) )
482 newPos.x = (int) newValue.GetLong();
483 else
484 newPos.y = (int) newValue.GetLong();
485
486 VECTOR2I delta = newPos - oldPos;
487
488 if( delta.x != 0 || delta.y != 0 )
489 {
490 changes.Modify( fp );
491 fp->Move( delta );
492 }
493 }
494
495 continue;
496 }
497
498 item->Set( property, newValue );
499 }
500
501 changes.Push( _( "Edit Properties" ) );
502
503 m_frame->Refresh();
504
505 // Perform grid updates as necessary based on value change
506 AfterCommit();
507
508 // PointEditor may need to update if locked/unlocked
509 if( aEvent.GetPropertyName() == _HKI( "Locked" ) )
510 m_frame->GetToolManager()->ProcessEvent( EVENTS::SelectedEvent );
511
512 aEvent.Skip();
513}
514
515
517{
518 wxPGChoices layersAll;
519 wxPGChoices layersCu;
520 wxPGChoices nets;
521 wxPGChoices fonts;
522
523 // Regenerate all layers
524 for( PCB_LAYER_ID layer : aBoard->GetEnabledLayers().UIOrder() )
525 layersAll.Add( LSET::Name( layer ), layer );
526
527 for( PCB_LAYER_ID layer : LSET( aBoard->GetEnabledLayers() & LSET::AllCuMask() ).UIOrder() )
528 layersCu.Add( LSET::Name( layer ), layer );
529
530 m_propMgr.GetProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ) )->SetChoices( layersAll );
531 m_propMgr.GetProperty( TYPE_HASH( PCB_SHAPE ), _HKI( "Layer" ) )->SetChoices( layersAll );
532
533 // Copper only properties
534 m_propMgr.GetProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Layer" ) )->SetChoices( layersCu );
535 m_propMgr.GetProperty( TYPE_HASH( PCB_VIA ), _HKI( "Layer Top" ) )->SetChoices( layersCu );
536 m_propMgr.GetProperty( TYPE_HASH( PCB_VIA ), _HKI( "Layer Bottom" ) )->SetChoices( layersCu );
537 m_propMgr.GetProperty( TYPE_HASH( PCB_TUNING_PATTERN ), _HKI( "Layer" ) )->SetChoices( layersCu );
538
539 // Regenerate nets
540
541 std::vector<std::pair<wxString, int>> netNames;
542 netNames.reserve( aBoard->GetNetInfo().NetsByNetcode().size() );
543
544 for( const auto& [ netCode, netInfo ] : aBoard->GetNetInfo().NetsByNetcode() )
545 netNames.emplace_back( UnescapeString( netInfo->GetNetname() ), netCode );
546
547 std::sort( netNames.begin(), netNames.end(), []( const auto& a, const auto& b )
548 {
549 return a.first.CmpNoCase( b.first ) < 0;
550 } );
551
552 for( const auto& [ netName, netCode ] : netNames )
553 nets.Add( netName, netCode );
554
555 auto netProperty = m_propMgr.GetProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Net" ) );
556 netProperty->SetChoices( nets );
557
558 auto tuningNet = m_propMgr.GetProperty( TYPE_HASH( PCB_TUNING_PATTERN ), _HKI( "Net" ) );
559 tuningNet->SetChoices( nets );
560}
const char * name
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...
Definition board_item.h:79
BOARD_ITEM_CONTAINER * GetParent() const
Definition board_item.h:210
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:317
const NETINFO_LIST & GetNetInfo() const
Definition board.h:933
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:923
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition commit.h:106
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:97
virtual void SetText(const wxString &aText)
Definition eda_text.cpp:271
static const TOOL_EVENT SelectedEvent
Definition actions.h:346
PCB_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this footprint.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void GetFields(std::vector< PCB_FIELD * > &aVector, bool aVisibleOnly) const
Populate a std::vector with PCB_TEXTs.
Class that other classes need to inherit from, in order to be inspectable.
Definition inspectable.h:37
bool Set(PROPERTY_BASE *aProperty, wxAny &aValue, bool aNotify=true)
Definition inspectable.h:43
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
Definition lset.cpp:726
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition lset.cpp:582
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition lset.cpp:188
const NETCODES_MAP & NetsByNetcode() const
Return the netcode map, at least for python.
Definition netinfo.h:359
Definition pad.h:54
Common, abstract interface for edit frames.
The main frame for Pcbnew.
size_t OwnerHash() const override
Return type-id of the Owner class.
size_t TypeHash() const override
Return type-id of the property type.
void setter(void *obj, wxAny &v) override
size_t BaseHash() const override
Return type-id of the Base class.
PCB_FOOTPRINT_FIELD_PROPERTY(const wxString &aName)
bool Writeable(INSPECTABLE *aObject) const override
wxAny getter(const void *obj) const override
PCB_BASE_EDIT_FRAME * m_frame
PG_NET_SELECTOR_EDITOR * m_netSelectorEditorInstance
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 rebuildProperties(const SELECTION &aSelection) override
Generates the property grid for a given selection of items.
PCB_PROPERTIES_PANEL(wxWindow *aParent, PCB_BASE_EDIT_FRAME *aFrame)
static std::set< wxString > m_currentFieldNames
PROPERTY_BASE * getPropertyFromEvent(const wxPropertyGridEvent &aEvent) const
PROPERTY_MANAGER & m_propMgr
PG_URL_EDITOR * m_urlEditorInstance
PG_CHECKBOX_EDITOR * m_checkboxEditorInstance
void updateLists(const BOARD *aBoard)
void valueChanging(wxPropertyGridEvent &aEvent) override
PG_FPID_EDITOR * m_fpEditorInstance
The selection tool: currently supports:
PCB_SELECTION & GetSelection()
static const wxString EDITOR_NAME
Definition pg_editors.h:75
static wxString BuildEditorName(EDA_DRAW_FRAME *aFrame)
wxPGWindowList CreateControls(wxPropertyGrid *aGrid, wxPGProperty *aProperty, const wxPoint &aPos, const wxSize &aSize) const override
bool OnEvent(wxPropertyGrid *aGrid, wxPGProperty *aProperty, wxWindow *aWindow, wxEvent &aEvent) const override
void UpdateControl(wxPGProperty *aProperty, wxWindow *aCtrl) const override
PCB_BASE_EDIT_FRAME * m_frame
wxString GetName() const override
bool GetValueFromControl(wxVariant &aVariant, wxPGProperty *aProperty, wxWindow *aCtrl) const override
static const wxString EDITOR_NAME
PG_NET_SELECTOR_EDITOR(PCB_BASE_EDIT_FRAME *aFrame)
static const wxString EDITOR_NAME
Definition pg_editors.h:117
static wxString BuildEditorName(EDA_DRAW_FRAME *aFrame)
static wxString BuildEditorName(EDA_DRAW_FRAME *aFrame)
PROPERTIES_PANEL(wxWindow *aParent, EDA_BASE_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.
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.
Definition property.h:200
virtual bool HasChoices() const
Return true if this PROPERTY has a limited set of possible values.
Definition property.h:243
virtual bool Writeable(INSPECTABLE *aObject) const
Definition property.h:279
friend class INSPECTABLE
Definition property.h:456
const wxString & Name() const
Definition property.h:219
virtual const wxPGChoices & Choices() const
Return a limited set of possible values (e.g.
Definition property.h:225
Provide class metadata.Helper macro to map type hashes to names.
#define _(s)
@ RECURSE
Definition eda_item.h:51
@ NO_RECURSE
Definition eda_item.h:52
@ FRAME_PCB_EDITOR
Definition frame_type.h:42
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition lset.cpp:737
#define _HKI(x)
Definition page_info.cpp:44
static const wxString MISSING_FIELD_SENTINEL
BOARD * GetBoard()
wxPGProperty * PGPropertyFactory(const PROPERTY_BASE *aProperty, EDA_DRAW_FRAME *aFrame)
Customized abstract wxPGProperty class to handle coordinate/size units.
see class PGM_BASE
APIIMPORT wxPGGlobalVarsClass * wxPGGlobalVars
#define TYPE_HASH(x)
Definition property.h:73
std::optional< std::unique_ptr< VALIDATION_ERROR > > VALIDATOR_RESULT
Null optional means validation succeeded.
static const wxString MISSING_FIELD_SENTINEL
wxString UnescapeString(const wxString &aSource)
@ USER
The field ID hasn't been set yet; field is invalid.
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ DATASHEET
name of datasheet
wxString GetCanonicalFieldName(FIELD_T aFieldType)
int delta
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:91
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
Definition typeinfo.h:95
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:86
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:87
Functions to provide common constants and other functions to assist in making a consistent UI.
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
Definition ui_common.h:46
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695