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 <frame_type.h>
27#include <pgm_base.h>
28#include <pcb_base_edit_frame.h>
29#include <tool/tool_manager.h>
30#include <tools/pcb_actions.h>
34#include <board_commit.h>
36#include <board.h>
38#include <pcb_shape.h>
39#include <pcb_text.h>
40#include <pcb_track.h>
41#include <pcb_generator.h>
43#include <pad.h>
44#include <footprint.h>
45#include <pcb_field.h>
46#include <template_fieldnames.h>
48#include <string_utils.h>
50#include <widgets/ui_common.h>
51
52static const wxString MISSING_FIELD_SENTINEL = wxS( "\uE000" );
53
55{
56public:
57 PCB_FOOTPRINT_FIELD_PROPERTY( const wxString& aName ) :
58 PROPERTY_BASE( aName ),
59 m_name( aName )
60 {
61 }
62
63 size_t OwnerHash() const override { return TYPE_HASH( FOOTPRINT ); }
64 size_t BaseHash() const override { return TYPE_HASH( FOOTPRINT ); }
65 size_t TypeHash() const override { return TYPE_HASH( wxString ); }
66
67 bool Writeable( INSPECTABLE* aObject ) const override
68 {
69 return PROPERTY_BASE::Writeable( aObject );
70 }
71
72 void setter( void* obj, wxAny& v ) override
73 {
74 wxString value;
75
76 if( !v.GetAs( &value ) )
77 return;
78
79 FOOTPRINT* footprint = reinterpret_cast<FOOTPRINT*>( obj );
80 PCB_FIELD* field = footprint->GetField( m_name );
81
82 if( !field )
83 {
84 PCB_FIELD* newField = new PCB_FIELD( footprint, FIELD_T::USER, m_name );
85 newField->SetText( value );
86 footprint->Add( newField );
87 }
88 else
89 {
90 field->SetText( value );
91 }
92 }
93
94 wxAny getter( const void* obj ) const override
95 {
96 const FOOTPRINT* footprint = reinterpret_cast<const FOOTPRINT*>( obj );
97 PCB_FIELD* field = footprint->GetField( m_name );
98
99 if( field )
100 return wxAny( field->GetText() );
101 else
102 return wxAny( MISSING_FIELD_SENTINEL );
103 }
104
105private:
106 wxString m_name;
107};
108
110
111
112class PG_NET_SELECTOR_EDITOR : public wxPGEditor
113{
114public:
115 static const wxString EDITOR_NAME;
116
118 {
119 }
120
121 wxString GetName() const override { return EDITOR_NAME; }
122
123 wxPGWindowList CreateControls( wxPropertyGrid* aGrid, wxPGProperty* aProperty,
124 const wxPoint& aPos, const wxSize& aSize ) const override
125 {
126 NET_SELECTOR* editor = new NET_SELECTOR( aGrid->GetPanel(), wxID_ANY, aPos, aSize, 0 );
127
128 if( BOARD* board = m_frame->GetBoard() )
129 editor->SetNetInfo( &board->GetNetInfo() );
130
131 editor->SetIndeterminateString( INDETERMINATE_STATE );
132 UpdateControl( aProperty, editor );
133
134 editor->Bind( FILTERED_ITEM_SELECTED,
135 [=]( wxCommandEvent& aEvt )
136 {
137 auto& choices = const_cast<wxPGChoices&>( aProperty->GetChoices() );
138 wxString netname = editor->GetSelectedNetname();
139
140 if( choices.Index( netname ) == wxNOT_FOUND )
141 choices.Add( netname, editor->GetSelectedNetcode() );
142
143 wxVariant val( editor->GetSelectedNetcode() );
144 aGrid->ChangePropertyValue( aProperty, val );
145 } );
146
147 return editor;
148 }
149
150 void UpdateControl( wxPGProperty* aProperty, wxWindow* aCtrl ) const override
151 {
152 if( NET_SELECTOR* editor = dynamic_cast<NET_SELECTOR*>( aCtrl ) )
153 {
154 if( aProperty->IsValueUnspecified() )
155 editor->SetIndeterminate();
156 else
157 editor->SetSelectedNetcode( (int) aProperty->GetValue().GetLong() );
158 }
159 }
160
161 bool GetValueFromControl( wxVariant& aVariant, wxPGProperty* aProperty,
162 wxWindow* aCtrl ) const override
163 {
164 NET_SELECTOR* editor = dynamic_cast<NET_SELECTOR*>( aCtrl );
165
166 if( !editor )
167 return false;
168
169 aVariant = static_cast<long>( editor->GetSelectedNetcode() );
170 return true;
171 }
172
173 bool OnEvent( wxPropertyGrid* aGrid, wxPGProperty* aProperty, wxWindow* aWindow,
174 wxEvent& aEvent ) const override
175 {
176 return false;
177 }
178
179private:
181};
182
183const wxString PG_NET_SELECTOR_EDITOR::EDITOR_NAME = wxS( "PG_NET_SELECTOR_EDITOR" );
184
185
186
188 PROPERTIES_PANEL( aParent, aFrame ),
189 m_frame( aFrame ),
190 m_propMgr( PROPERTY_MANAGER::Instance() )
191{
192 m_propMgr.Rebuild();
193 bool found = false;
194
195 wxASSERT( wxPGGlobalVars );
196
197 wxString editorKey = PG_UNIT_EDITOR::BuildEditorName( m_frame );
198
199 auto it = wxPGGlobalVars->m_mapEditorClasses.find( editorKey );
200
201 if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
202 {
203 m_unitEditorInstance = static_cast<PG_UNIT_EDITOR*>( it->second );
204 m_unitEditorInstance->UpdateFrame( m_frame );
205 found = true;
206 }
207
208 if( !found )
209 {
210 PG_UNIT_EDITOR* new_editor = new PG_UNIT_EDITOR( m_frame );
211 m_unitEditorInstance = static_cast<PG_UNIT_EDITOR*>( wxPropertyGrid::RegisterEditorClass( new_editor ) );
212 }
213
214 it = wxPGGlobalVars->m_mapEditorClasses.find( PG_CHECKBOX_EDITOR::EDITOR_NAME );
215
216 if( it == wxPGGlobalVars->m_mapEditorClasses.end() )
217 {
218 PG_CHECKBOX_EDITOR* cbEditor = new PG_CHECKBOX_EDITOR();
219 m_checkboxEditorInstance = static_cast<PG_CHECKBOX_EDITOR*>( wxPropertyGrid::RegisterEditorClass( cbEditor ) );
220 }
221 else
222 {
223 m_checkboxEditorInstance = static_cast<PG_CHECKBOX_EDITOR*>( it->second );
224 }
225
226 it = wxPGGlobalVars->m_mapEditorClasses.find( PG_RATIO_EDITOR::EDITOR_NAME );
227
228 if( it == wxPGGlobalVars->m_mapEditorClasses.end() )
229 {
230 PG_RATIO_EDITOR* ratioEditor = new PG_RATIO_EDITOR();
231 m_ratioEditorInstance = static_cast<PG_RATIO_EDITOR*>( wxPropertyGrid::RegisterEditorClass( ratioEditor ) );
232 }
233 else
234 {
235 m_ratioEditorInstance = static_cast<PG_RATIO_EDITOR*>( it->second );
236 }
237
238 it = wxPGGlobalVars->m_mapEditorClasses.find( PG_NET_SELECTOR_EDITOR::EDITOR_NAME );
239
240 if( it == wxPGGlobalVars->m_mapEditorClasses.end() )
241 {
243 m_netSelectorEditorInstance = static_cast<PG_NET_SELECTOR_EDITOR*>( wxPropertyGrid::RegisterEditorClass( netEditor ) );
244 }
245 else
246 {
247 m_netSelectorEditorInstance = static_cast<PG_NET_SELECTOR_EDITOR*>( it->second );
248 }
249
250 it = wxPGGlobalVars->m_mapEditorClasses.find( PG_FPID_EDITOR::BuildEditorName( m_frame ) );
251
252 if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
253 {
254 m_fpEditorInstance = static_cast<PG_FPID_EDITOR*>( it->second );
255 m_fpEditorInstance->UpdateFrame( m_frame );
256 }
257 else
258 {
259 PG_FPID_EDITOR* fpEditor = new PG_FPID_EDITOR( m_frame );
260 m_fpEditorInstance = static_cast<PG_FPID_EDITOR*>( wxPropertyGrid::RegisterEditorClass( fpEditor ) );
261 }
262
263 it = wxPGGlobalVars->m_mapEditorClasses.find( PG_URL_EDITOR::BuildEditorName( m_frame ) );
264
265 if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
266 {
267 m_urlEditorInstance = static_cast<PG_URL_EDITOR*>( it->second );
268 m_urlEditorInstance->UpdateFrame( m_frame );
269 }
270 else
271 {
272 PG_URL_EDITOR* urlEditor = new PG_URL_EDITOR( m_frame );
273 m_urlEditorInstance = static_cast<PG_URL_EDITOR*>( wxPropertyGrid::RegisterEditorClass( urlEditor ) );
274 }
275}
276
277
279{
280 m_unitEditorInstance->UpdateFrame( nullptr );
281 m_fpEditorInstance->UpdateFrame( nullptr );
282 m_urlEditorInstance->UpdateFrame( nullptr );
283}
284
285
287{
288 PCB_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
289 const SELECTION& selection = selectionTool->GetSelection();
290
291 if( selection.Empty() && m_frame->IsType( FRAME_FOOTPRINT_EDITOR ) )
292 {
293 if( BOARD* board = m_frame->GetBoard() )
294 {
295 if( FOOTPRINT* footprint = board->GetFirstFootprint() )
296 {
297 aFallbackSelection.Clear();
298 aFallbackSelection.Add( footprint );
299 return aFallbackSelection;
300 }
301 }
302 }
303
304 return selection;
305}
306
307
309{
310 SELECTION fallbackSelection;
311 const SELECTION& selection = getSelection( fallbackSelection );
312
313 return selection.Empty() ? nullptr : selection.Front();
314}
315
316
318{
319 SELECTION fallbackSelection;
320 const SELECTION& selection = getSelection( fallbackSelection );
321
322 // TODO perhaps it could be called less often? use PROPERTIES_TOOL and catch MODEL_RELOAD?
323 updateLists( static_cast<PCB_EDIT_FRAME*>( m_frame )->GetBoard() );
324
325 // Will actually just be updatePropertyValues() if selection hasn't changed
326 rebuildProperties( selection );
327}
328
329
331{
332 SELECTION fallbackSelection;
333 const SELECTION& selection = getSelection( fallbackSelection );
334
335 rebuildProperties( selection );
336}
337
338
340{
341 m_currentFieldNames.clear();
342
343 for( EDA_ITEM* item : aSelection )
344 {
345 if( item->Type() != PCB_FOOTPRINT_T )
346 continue;
347
348 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
349
350 for( PCB_FIELD* field : footprint->GetFields() )
351 m_currentFieldNames.insert( field->GetCanonicalName() );
352 }
353
354 const wxString groupFields = _HKI( "Fields" );
355
356 for( const wxString& name : m_currentFieldNames )
357 {
358 if( !m_propMgr.GetProperty( TYPE_HASH( FOOTPRINT ), name ) )
359 {
360 m_propMgr.AddProperty( new PCB_FOOTPRINT_FIELD_PROPERTY( name ), groupFields )
361 .SetAvailableFunc( [name]( INSPECTABLE* )
362 {
364 } );
365 }
366 }
367
369}
370
371
372wxPGProperty* PCB_PROPERTIES_PANEL::createPGProperty( const PROPERTY_BASE* aProperty ) const
373{
374 if( aProperty->TypeHash() == TYPE_HASH( PCB_LAYER_ID ) )
375 {
376 wxASSERT( aProperty->HasChoices() );
377
378 const wxPGChoices& canonicalLayers = aProperty->Choices();
379 wxArrayString boardLayerNames;
380 wxArrayInt boardLayerIDs;
381
382 for( int ii = 0; ii < (int) aProperty->Choices().GetCount(); ++ii )
383 {
384 int layer = canonicalLayers.GetValue( ii );
385
386 boardLayerNames.push_back( m_frame->GetBoard()->GetLayerName( ToLAYER_ID( layer ) ) );
387 boardLayerIDs.push_back( canonicalLayers.GetValue( ii ) );
388 }
389
390 auto ret = new PGPROPERTY_COLORENUM( new wxPGChoices( boardLayerNames, boardLayerIDs ) );
391
392 ret->SetColorFunc(
393 [&]( int aValue ) -> wxColour
394 {
395 return m_frame->GetColorSettings()->GetColor( ToLAYER_ID( aValue ) ).ToColour();
396 } );
397
398 ret->SetLabel( wxGetTranslation( aProperty->Name() ) );
399 ret->SetName( aProperty->Name() );
400 ret->SetHelpString( wxGetTranslation( aProperty->Name() ) );
401 ret->SetClientData( const_cast<PROPERTY_BASE*>( aProperty ) );
402
403 return ret;
404 }
405
406 wxPGProperty* prop = PGPropertyFactory( aProperty, m_frame );
407
408 if( aProperty->Name() == GetCanonicalFieldName( FIELD_T::FOOTPRINT ) )
409 prop->SetEditor( PG_FPID_EDITOR::BuildEditorName( m_frame ) );
410 else if( aProperty->Name() == GetCanonicalFieldName( FIELD_T::DATASHEET ) )
411 prop->SetEditor( PG_URL_EDITOR::BuildEditorName( m_frame ) );
412
413 return prop;
414}
415
416
417PROPERTY_BASE* PCB_PROPERTIES_PANEL::getPropertyFromEvent( const wxPropertyGridEvent& aEvent ) const
418{
419 EDA_ITEM* item = const_cast<PCB_PROPERTIES_PANEL*>( this )->getFrontItem();
420
421 if( !item || !item->IsBOARD_ITEM() )
422 return nullptr;
423
424 BOARD_ITEM* firstItem = static_cast<BOARD_ITEM*>( item );
425
426 wxCHECK_MSG( firstItem, nullptr,
427 wxT( "getPropertyFromEvent for a property with nothing selected!") );
428
429 PROPERTY_BASE* property = m_propMgr.GetProperty( TYPE_HASH( *firstItem ), aEvent.GetPropertyName() );
430 wxCHECK_MSG( property, nullptr,
431 wxT( "getPropertyFromEvent for a property not found on the selected item!" ) );
432
433 return property;
434}
435
436
437void PCB_PROPERTIES_PANEL::valueChanging( wxPropertyGridEvent& aEvent )
438{
440 return;
441
442 EDA_ITEM* item = getFrontItem();
443
444 PROPERTY_BASE* property = getPropertyFromEvent( aEvent );
445 wxCHECK( property, /* void */ );
446 wxCHECK( item, /* void */ );
447
448 wxVariant newValue = aEvent.GetPropertyValue();
449
450 if( VALIDATOR_RESULT validationFailure = property->Validate( newValue.GetAny(), item ) )
451 {
452 wxString errorMsg = wxString::Format( wxS( "%s: %s" ), wxGetTranslation( property->Name() ),
453 validationFailure->get()->Format( m_frame ) );
454 m_frame->ShowInfoBarError( errorMsg );
455 aEvent.Veto();
456 return;
457 }
458
459 aEvent.Skip();
460}
461
462
463void PCB_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
464{
466 return;
467
468 SELECTION fallbackSelection;
469 const SELECTION& selection = getSelection( fallbackSelection );
470
471 wxCHECK( getPropertyFromEvent( aEvent ), /* void */ );
472
473 wxVariant newValue = aEvent.GetPropertyValue();
474 BOARD_COMMIT changes( m_frame );
475
476 PROPERTY_COMMIT_HANDLER handler( &changes );
477
478 for( EDA_ITEM* edaItem : selection )
479 {
480 if( !edaItem->IsBOARD_ITEM() )
481 continue;
482
483 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( edaItem );
484 PROPERTY_BASE* property = m_propMgr.GetProperty( TYPE_HASH( *item ), aEvent.GetPropertyName() );
485 wxCHECK( property, /* void */ );
486
487 if( item->Type() == PCB_TABLECELL_T )
488 changes.Modify( item->GetParent(), nullptr, RECURSE_MODE::NO_RECURSE );
489 else if( item->Type() == PCB_GENERATOR_T )
490 changes.Modify( item, nullptr, RECURSE_MODE::RECURSE );
491 else
492 changes.Modify( item, nullptr, RECURSE_MODE::NO_RECURSE );
493
494 // In the PCB Editor, we generally restrict pad movement to the footprint (like dragging)
495 if( item->Type() == PCB_PAD_T && m_frame
496 && m_frame->IsType( FRAME_PCB_EDITOR )
497 && !m_frame->GetPcbNewSettings()->m_AllowFreePads
498 && ( aEvent.GetPropertyName() == _HKI( "Position X" )
499 || aEvent.GetPropertyName() == _HKI( "Position Y" ) ) )
500 {
501 PAD* pad = static_cast<PAD*>( item );
502 FOOTPRINT* fp = pad->GetParentFootprint();
503
504 if( fp )
505 {
506 VECTOR2I oldPos = pad->GetPosition();
507 VECTOR2I newPos = oldPos;
508
509 if( aEvent.GetPropertyName() == _HKI( "Position X" ) )
510 newPos.x = (int) newValue.GetLong();
511 else
512 newPos.y = (int) newValue.GetLong();
513
514 VECTOR2I delta = newPos - oldPos;
515
516 if( delta.x != 0 || delta.y != 0 )
517 {
518 changes.Modify( fp );
519 fp->Move( delta );
520 }
521 }
522
523 continue;
524 }
525
526 item->Set( property, newValue );
527 }
528
529 changes.Push( _( "Edit Properties" ) );
530
531 m_frame->Refresh();
532
533 // Perform grid updates as necessary based on value change
534 AfterCommit();
535
536 // PointEditor may need to update if locked/unlocked
537 if( aEvent.GetPropertyName() == _HKI( "Locked" ) )
538 m_frame->GetToolManager()->ProcessEvent( EVENTS::SelectedEvent );
539
540 aEvent.Skip();
541}
542
543
545{
546 wxPGChoices layersAll;
547 wxPGChoices layersCu;
548 wxPGChoices nets;
549 wxPGChoices fonts;
550
551 // Regenerate all layers
552 for( PCB_LAYER_ID layer : aBoard->GetEnabledLayers().UIOrder() )
553 layersAll.Add( LSET::Name( layer ), layer );
554
555 for( PCB_LAYER_ID layer : LSET( aBoard->GetEnabledLayers() & LSET::AllCuMask() ).UIOrder() )
556 layersCu.Add( LSET::Name( layer ), layer );
557
558 m_propMgr.GetProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ) )->SetChoices( layersAll );
559 m_propMgr.GetProperty( TYPE_HASH( PCB_SHAPE ), _HKI( "Layer" ) )->SetChoices( layersAll );
560
561 // Copper only properties
562 m_propMgr.GetProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Layer" ) )->SetChoices( layersCu );
563 m_propMgr.GetProperty( TYPE_HASH( PCB_VIA ), _HKI( "Layer Top" ) )->SetChoices( layersCu );
564 m_propMgr.GetProperty( TYPE_HASH( PCB_VIA ), _HKI( "Layer Bottom" ) )->SetChoices( layersCu );
565 m_propMgr.GetProperty( TYPE_HASH( PCB_TUNING_PATTERN ), _HKI( "Layer" ) )->SetChoices( layersCu );
566
567 // Regenerate nets
568
569 std::vector<std::pair<wxString, int>> netNames;
570 netNames.reserve( aBoard->GetNetInfo().NetsByNetcode().size() );
571
572 for( const auto& [ netCode, netInfo ] : aBoard->GetNetInfo().NetsByNetcode() )
573 netNames.emplace_back( UnescapeString( netInfo->GetNetname() ), netCode );
574
575 std::sort( netNames.begin(), netNames.end(),
576 []( const auto& a, const auto& b )
577 {
578 return a.first.CmpNoCase( b.first ) < 0;
579 } );
580
581 for( const auto& [ netName, netCode ] : netNames )
582 nets.Add( netName, netCode );
583
584 auto netProperty = m_propMgr.GetProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Net" ) );
585 netProperty->SetChoices( nets );
586
587 auto tuningNet = m_propMgr.GetProperty( TYPE_HASH( PCB_TUNING_PATTERN ), _HKI( "Net" ) );
588 tuningNet->SetChoices( nets );
589}
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:322
const NETINFO_LIST & GetNetInfo() const
Definition board.h:953
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:924
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:98
virtual void SetText(const wxString &aText)
Definition eda_text.cpp:281
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
bool IsBOARD_ITEM() const
Definition view_item.h:102
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)
const SELECTION & getSelection(SELECTION &aFallbackSelection)
Get the current selection from the selection tool.
EDA_ITEM * getFrontItem()
Get the front item of the current selection.
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:201
virtual bool HasChoices() const
Return true if this PROPERTY has a limited set of possible values.
Definition property.h:246
virtual bool Writeable(INSPECTABLE *aObject) const
Definition property.h:282
friend class INSPECTABLE
Definition property.h:459
const wxString & Name() const
Definition property.h:220
virtual const wxPGChoices & Choices() const
Return a limited set of possible values (e.g.
Definition property.h:226
Provide class metadata.Helper macro to map type hashes to names.
virtual void Add(EDA_ITEM *aItem)
Definition selection.cpp:42
EDA_ITEM * Front() const
Definition selection.h:177
virtual void Clear() override
Remove all the stored items from the group.
Definition selection.h:98
bool Empty() const
Checks if there is anything selected.
Definition selection.h:115
#define _(s)
@ RECURSE
Definition eda_item.h:51
@ NO_RECURSE
Definition eda_item.h:52
@ FRAME_PCB_EDITOR
Definition frame_type.h:42
@ FRAME_FOOTPRINT_EDITOR
Definition frame_type.h:43
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:74
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