KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_item.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) 2015 Jean-Pierre Charras, [email protected]
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <algorithm>
22
23#include <bitmaps.h>
24#include <eda_item.h>
25#include <eda_group.h>
26#include <trace_helpers.h>
27#include <trigo.h>
28#include <i18n_utility.h>
29#include <wx/log.h>
30
31#include <wx/fdrepdlg.h>
32#include <wx/regex.h>
33#include <eda_pattern_match.h>
34#include <properties/property.h>
36#include <ranges>
37
38
40{
41public:
42 EDA_CUSTOM_PROPERTY( const wxString& aKey, size_t aOwnerHash ) :
43 PROPERTY_BASE( aKey ),
44 m_key( aKey ),
45 m_ownerHash( aOwnerHash )
46 {
47 SetGroup( _HKI( "Custom Properties" ) );
48 }
49
50 size_t OwnerHash() const override { return m_ownerHash; }
51 size_t BaseHash() const override { return m_ownerHash; }
52 size_t TypeHash() const override { return TYPE_HASH( wxString ); }
53
54private:
55 void setter( void* obj, wxAny& v ) override
56 {
57 wxString value;
58
59 if( !v.GetAs( &value ) )
60 return;
61
62 EDA_ITEM* item = static_cast<EDA_ITEM*>( obj );
63 item->SetCustomProperty( m_key, value );
64 }
65
66 wxAny getter( const void* aObj ) const override
67 {
68 const EDA_ITEM* item = static_cast<const EDA_ITEM*>( aObj );
69
70 wxString value;
71
72 if( !item->GetCustomProperty( m_key, value ) )
73 return wxAny();
74
75 return wxAny( value );
76 }
77
78private:
79 wxString m_key;
81};
82
83
84EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType, bool isSCH_ITEM, bool isBOARD_ITEM ) :
85 KIGFX::VIEW_ITEM( isSCH_ITEM, isBOARD_ITEM ),
86 m_structType( idType ),
87 m_flags( 0 ),
88 m_parent( parent ),
89 m_group( nullptr ),
90 m_isRollover( false ),
91 m_forceVisible( false )
92{ }
93
94
95EDA_ITEM::EDA_ITEM( KICAD_T idType, bool isSCH_ITEM, bool isBOARD_ITEM ) :
96 KIGFX::VIEW_ITEM( isSCH_ITEM, isBOARD_ITEM ),
97 m_structType( idType ),
98 m_flags( 0 ),
99 m_parent( nullptr ),
100 m_group( nullptr ),
101 m_isRollover( false ),
102 m_forceVisible( false )
103{ }
104
105
107 KIGFX::VIEW_ITEM( base.IsSCH_ITEM(), base.IsBOARD_ITEM() ),
108 m_Uuid( base.m_Uuid ),
110 m_flags( base.m_flags ),
111 m_parent( base.m_parent ),
112 m_group( base.m_group ),
113 m_isRollover( false ),
117{
119}
120
121
122EDA_ITEM::~EDA_ITEM() = default;
123
124
126{
127 return m_netHighlighted;
128}
129
130
131void EDA_ITEM::SetNetHighlighted( bool aHighlighted )
132{
133 m_netHighlighted = aHighlighted;
134}
135
136
138{
139 EDA_ITEM* parent = GetParent();
140
141 while( parent )
142 {
143 if( parent->Type() == aType )
144 return parent;
145 else
146 parent = parent->GetParent();
147 }
148
149 return nullptr;
150}
151
152
154{
155 wxCHECK( aParent != this, /* void */ );
156
157 m_parent = aParent;
158}
159
160
161void EDA_ITEM::RemoveCustomProperty( const wxString& aKey )
162{
163 m_customProperties.erase( aKey );
164 m_dynamicCustomPropsCache.erase( aKey );
165}
166
167
169{
170 std::vector<wxString> toRemove;
171
172 for( const wxString& key : m_customProperties | std::views::keys )
173 {
174 if( PROPERTY_BASE* prop = PROPERTY_MANAGER::Instance().GetProperty( this, key ) )
175 {
176 if( prop->Group() != _HKI( "Custom Properties" ) )
177 toRemove.push_back( key );
178 }
179 }
180
181 for( const wxString& key : toRemove )
183
184 return toRemove;
185}
186
187
188bool EDA_ITEM::GetCustomProperty( const wxString& aKey, wxString& aValue ) const
189{
190 auto it = m_customProperties.find( aKey );
191
192 if( it == m_customProperties.end() )
193 return false;
194
195 aValue = it->second;
196 return true;
197}
198
199
200std::vector<PROPERTY_BASE*> EDA_ITEM::GetCustomPropertiesAsInspectables() const
201{
202 std::vector<PROPERTY_BASE*> props;
203 props.reserve( m_customProperties.size() );
204
205 const size_t ownerHash = TYPE_HASH( *this );
206
207 for( const auto& [ key, value ] : m_customProperties )
208 {
209 (void) value;
210
211 auto it = m_dynamicCustomPropsCache.find( key );
212
213 if( it == m_dynamicCustomPropsCache.end() )
214 {
215 it = m_dynamicCustomPropsCache.emplace(
216 key, std::make_unique<EDA_CUSTOM_PROPERTY>( key, ownerHash ) ).first;
217 }
218
219 props.push_back( it->second.get() );
220 }
221
222 return props;
223}
224
225
226std::vector<PROPERTY_BASE*> EDA_ITEM::GetDynamicProperties() const
227{
229}
230
231
233{
235 return group->AsEdaItem()->m_Uuid;
236 else
237 return niluuid;
238}
239
240
242{
243 // Walk up via both the parent-item and parent-group chains so that child items (sheet pins,
244 // symbol pins, fields) whose logical owner is in a selected group are also recognised as
245 // moving with that group.
246 for( const EDA_ITEM* item = this; item; item = item->GetParent() )
247 {
248 for( EDA_GROUP* group = item->GetParentGroup(); group;
249 group = group->AsEdaItem()->GetParentGroup() )
250 {
251 if( group->AsEdaItem()->IsSelected() )
252 return true;
253 }
254 }
255
256 return false;
257}
258
259
261{
263
264 // If this a child object, then the parent modification state also needs to be set.
265 if( m_parent )
266 m_parent->SetModified();
267}
268
269
271{
272 // return a zero-sized box per default. derived classes should override
273 // this
274 return BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( 0, 0 ) );
275}
276
277
279{
280 wxCHECK_MSG( false, nullptr, wxT( "Clone not implemented in derived class " ) + GetClass() +
281 wxT( ". Bad programmer!" ) );
282}
283
284
285// see base_struct.h
286// many classes inherit this method, be careful:
287INSPECT_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData,
288 const std::vector<KICAD_T>& aScanTypes )
289{
290#if 0 && defined(DEBUG)
291 std::cout << GetClass().mb_str() << ' ';
292#endif
293
294 if( IsType( aScanTypes ) )
295 {
296 if( INSPECT_RESULT::QUIT == inspector( this, testData ) )
298 }
299
301}
302
303
304wxString EDA_ITEM::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
305{
306 wxFAIL_MSG( wxT( "GetItemDescription() was not overridden for item type " ) + GetClass() );
307
308 return wxString( wxT( "Undefined item description for " ) + GetClass() );
309}
310
311
312bool isWordChar( const wxUniChar& c )
313{
314 return wxIsalnum( c ) || c == '_';
315}
316
317
318bool EDA_ITEM::Matches( const wxString& aText, const EDA_SEARCH_DATA& aSearchData ) const
319{
320 wxString text = aText;
321 wxString searchText = aSearchData.findString;
322
323 // Don't match if searching for replaceable item and the item doesn't support text replace.
324 if( aSearchData.searchAndReplace && !IsReplaceable() )
325 return false;
326
327 if( !aSearchData.matchCase )
328 {
329 text.MakeUpper();
330 searchText.MakeUpper();
331 }
332
333 auto isWordChar =
334 []( const wxUniChar& c )
335 {
336 return wxIsalnum( c ) || c == '_';
337 };
338
340 {
341 EDA_COMBINED_MATCHER matcher( searchText, CTX_SEARCH );
342
343 return matcher.Find( text );
344 }
345 else if( aSearchData.matchMode == EDA_SEARCH_MATCH_MODE::WHOLEWORD )
346 {
347 int ii = 0;
348
349 while( ii < (int) text.length() )
350 {
351 int next = text.find( searchText, ii );
352
353 if( next == wxNOT_FOUND )
354 return false;
355
356 ii = next;
357 next += searchText.length();
358
359 bool startOK = ( ii == 0 || !isWordChar( text.GetChar( ii - 1 ) ) );
360 bool endOK = ( next == (int) text.length() || !isWordChar( text.GetChar( next ) ) );
361
362 if( startOK && endOK )
363 return true;
364 else
365 ii++;
366 }
367
368 return false;
369 }
370 else if( aSearchData.matchMode == EDA_SEARCH_MATCH_MODE::WILDCARD )
371 {
372 return text.Matches( searchText );
373 }
374 else if( aSearchData.matchMode == EDA_SEARCH_MATCH_MODE::REGEX )
375 {
376 if( aSearchData.regex_string != searchText || !aSearchData.regex.IsValid() )
377 {
378 int flag = aSearchData.matchCase ? 0 : wxRE_ICASE;
379 wxLogNull noLogs;
380
381 if( !aSearchData.regex.Compile( searchText, flag ) )
382 return false;
383
384 aSearchData.regex_string = searchText;
385 }
386
387 return aSearchData.regex.Matches( text );
388 }
389 else
390 {
391 return text.Find( searchText ) != wxNOT_FOUND;
392 }
393}
394
395
396bool EDA_ITEM::Replace( const EDA_SEARCH_DATA& aSearchData, wxString& aText )
397{
398 wxString text = aText;
399 wxString searchText = aSearchData.findString;
400 wxString result;
401 bool replaced = false;
402
403 if( aSearchData.matchMode == EDA_SEARCH_MATCH_MODE::REGEX )
404 {
405 if( aSearchData.regex_string != searchText || !aSearchData.regex.IsValid() )
406 {
407 int flag = aSearchData.matchCase ? 0 : wxRE_ICASE;
408 wxLogNull noLogs;
409
410 if( !aSearchData.regex.Compile( searchText, flag ) )
411 return false;
412
413 aSearchData.regex_string = searchText;
414 }
415
416 if( !aSearchData.regex.Replace( &text, aSearchData.replaceString ) )
417 return false;
418
419 aText = text;
420 return true;
421 }
422
423 if( !aSearchData.matchCase )
424 {
425 text = text.Upper();
426 searchText = searchText.Upper();
427 }
428
429 int ii = 0;
430
431 while( ii < (int) text.length() )
432 {
433 int next = text.find( searchText, ii );
434
435 if( next == wxNOT_FOUND )
436 {
437 result += aText.Mid( ii, wxString::npos );
438 break;
439 }
440
441 if( next > ii )
442 result += aText.Mid( ii, next - ii );
443
444 ii = next;
445 next += searchText.length();
446
447 bool startOK;
448 bool endOK;
449
451 {
452 startOK = ( ii == 0 || !isWordChar( text.GetChar( ii - 1 ) ) );
453 endOK = ( next == (int) text.length() || !isWordChar( text.GetChar( next ) ) );
454 }
455 else
456 {
457 startOK = true;
458 endOK = true;
459 }
460
461 if( startOK && endOK )
462 {
463 result += aSearchData.replaceString;
464 replaced = true;
465 ii = next;
466 }
467 else
468 {
469 result += aText.GetChar( ii );
470 ii++;
471 }
472 }
473
474 aText = result;
475 return replaced;
476}
477
478
479bool EDA_ITEM::operator<( const EDA_ITEM& aItem ) const
480{
481 wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
482 GetClass() ) );
483
484 return false;
485}
486
487
489{
490 // do not call initVars()
491
492 // m_structType is set by the constructor and must never be assigned; copying it leaves a
493 // derived object reporting its base type while keeping its own vtable
494
495 m_flags = aItem.m_flags;
496 m_parent = aItem.m_parent;
497 m_group = aItem.m_group;
502
504
505 return *this;
506}
507
508
510{
511 // Basic fallback
512 return GetBoundingBox();
513}
514
515
516std::vector<int> EDA_ITEM::ViewGetLayers() const
517{
518 // Basic fallback
519 std::vector<int> layers{ 1 };
520 return layers;
521}
522
523
528
529
530#if defined( DEBUG )
531
532void EDA_ITEM::ShowDummy( std::ostream& os ) const
533{
534 // XML output:
535 wxString s = GetClass();
536
537 os << '<' << s.Lower().mb_str() << ">"
538 << " Need ::Show() override for this class "
539 << "</" << s.Lower().mb_str() << ">\n";
540}
541
542
543std::ostream& EDA_ITEM::NestedSpace( int nestLevel, std::ostream& os )
544{
545 for( int i = 0; i<nestLevel; ++i )
546 os << " ";
547
548 // number of spaces here controls indent per nest level
549
550 return os;
551}
552
553#endif
554
555
556wxString EDA_ITEM::GetTypeDesc() const
557{
558 //@see EDA_ITEM_DESC for definition of ENUM_MAP<KICAD_T>
559 wxString typeDescr = ENUM_MAP<KICAD_T>::Instance().ToString( Type() );
560
561 return wxGetTranslation( typeDescr );
562}
563
564
566{
567 return GetTypeDesc();
568}
569
570
571static struct EDA_ITEM_DESC
572{
574 {
576 .Undefined( TYPE_NOT_INIT )
577 .Map( NOT_USED, wxT( "<not used>" ) )
578 .Map( SCREEN_T, _HKI( "Screen" ) )
579 .Map( SCHEMATIC_T, _HKI( "Schematic" ) )
580
581 .Map( PCB_FOOTPRINT_T, _HKI( "Footprint" ) )
582 .Map( PCB_PAD_T, _HKI( "Pad" ) )
583 .Map( PCB_SHAPE_T, _HKI( "Graphic" ) )
584 .Map( PCB_REFERENCE_IMAGE_T, _HKI( "Reference Image" ) )
585 .Map( PCB_GENERATOR_T, _HKI( "Generator" ) )
586 .Map( PCB_FIELD_T, _HKI( "Text" ) )
587 .Map( PCB_TEXT_T, _HKI( "Text" ) )
588 .Map( PCB_TEXTBOX_T, _HKI( "Text Box" ) )
589 .Map( PCB_TABLE_T, _HKI( "Table" ) )
590 .Map( PCB_DRILL_CHART_T, _HKI( "Drill Chart" ) )
591 .Map( PCB_DRILL_MAP_T, _HKI( "Drill Map" ) )
592 .Map( PCB_TABLECELL_T, _HKI( "Table Cell" ) )
593 .Map( PCB_TRACE_T, _HKI( "Track" ) )
594 .Map( PCB_ARC_T, _HKI( "Track" ) )
595 .Map( PCB_VIA_T, _HKI( "Via" ) )
596 .Map( PCB_MARKER_T, _HKI( "Marker" ) )
597 .Map( PCB_DIM_ALIGNED_T, _HKI( "Dimension" ) )
598 .Map( PCB_DIM_ORTHOGONAL_T, _HKI( "Dimension" ) )
599 .Map( PCB_DIM_CENTER_T, _HKI( "Dimension" ) )
600 .Map( PCB_DIM_RADIAL_T, _HKI( "Dimension" ) )
601 .Map( PCB_DIM_LEADER_T, _HKI( "Leader" ) )
602 .Map( PCB_TARGET_T, _HKI( "Target" ) )
603 .Map( PCB_POINT_T, _HKI( "Point" ) )
604 .Map( PCB_ZONE_T, _HKI( "Zone" ) )
605 .Map( PCB_ITEM_LIST_T, _HKI( "ItemList" ) )
606 .Map( PCB_NETINFO_T, _HKI( "NetInfo" ) )
607 .Map( PCB_GROUP_T, _HKI( "Group" ) )
608 .Map( PCB_BARCODE_T, _HKI( "Barcode" ) )
609 .Map( PCB_GRID_ITEM_T, _HKI( "Grid" ) )
610
611 .Map( SCH_MARKER_T, _HKI( "Marker" ) )
612 .Map( SCH_JUNCTION_T, _HKI( "Junction" ) )
613 .Map( SCH_NO_CONNECT_T, _HKI( "No-Connect Flag" ) )
614 .Map( SCH_BUS_WIRE_ENTRY_T, _HKI( "Wire Entry" ) )
615 .Map( SCH_BUS_BUS_ENTRY_T, _HKI( "Bus Entry" ) )
616 .Map( SCH_LINE_T, _HKI( "Line" ) )
617 .Map( SCH_BITMAP_T, _HKI( "Bitmap" ) )
618 .Map( SCH_SHAPE_T, _HKI( "Graphic" ) )
619 .Map( SCH_RULE_AREA_T, _HKI( "Rule Area" ) )
620 .Map( SCH_TEXT_T, _HKI( "Text" ) )
621 .Map( SCH_TEXTBOX_T, _HKI( "Text Box" ) )
622 .Map( SCH_TABLE_T, _HKI( "Table" ) )
623 .Map( SCH_TABLECELL_T, _HKI( "Table Cell" ) )
624 .Map( SCH_LABEL_T, _HKI( "Net Label" ) )
625 .Map( SCH_DIRECTIVE_LABEL_T, _HKI( "Directive Label" ) )
626 .Map( SCH_GLOBAL_LABEL_T, _HKI( "Global Label" ) )
627 .Map( SCH_HIER_LABEL_T, _HKI( "Hierarchical Label" ) )
628 .Map( SCH_FIELD_T, _HKI( "Field" ) )
629 .Map( SCH_SYMBOL_T, _HKI( "Symbol" ) )
630 .Map( SCH_PIN_T, _HKI( "Pin" ) )
631 .Map( SCH_SHEET_PIN_T, _HKI( "Sheet Pin" ) )
632 .Map( SCH_SHEET_T, _HKI( "Sheet" ) )
633 .Map( SCH_GROUP_T, _HKI( "Group" ) )
634
635 // Synthetic search tokens don't need to be included...
636 //.Map( SCH_FIELD_LOCATE_REFERENCE_T, _HKI( "Field Locate Reference" ) )
637 //.Map( SCH_FIELD_LOCATE_VALUE_T, _HKI( "Field Locate Value" ) )
638 //.Map( SCH_FIELD_LOCATE_FOOTPRINT_T, _HKI( "Field Locate Footprint" ) )
639
640 .Map( SCH_SCREEN_T, _HKI( "SCH Screen" ) )
641
642 .Map( LIB_SYMBOL_T, _HKI( "Symbol" ) )
643
644 .Map( GERBER_LAYOUT_T, _HKI( "Gerber Layout" ) )
645 .Map( GERBER_DRAW_ITEM_T, _HKI( "Draw Item" ) )
646 .Map( GERBER_IMAGE_T, _HKI( "Image" ) );
647
650
651 propMgr.AddProperty( new PROPERTY_ENUM<EDA_ITEM, KICAD_T>( wxS( "Type" ),
654 }
656
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:927
bool Find(const wxString &aTerm, int &aMatchersTriggered, int &aPosition)
Look in all existing matchers, return the earliest match of any of the existing.
void setter(void *obj, wxAny &v) override
Definition eda_item.cpp:55
wxAny getter(const void *aObj) const override
Definition eda_item.cpp:66
size_t BaseHash() const override
Return type-id of the Base class.
Definition eda_item.cpp:51
EDA_CUSTOM_PROPERTY(const wxString &aKey, size_t aOwnerHash)
Definition eda_item.cpp:42
size_t TypeHash() const override
Return type-id of the property type.
Definition eda_item.cpp:52
size_t OwnerHash() const override
Return type-id of the Owner class.
Definition eda_item.cpp:50
A set of EDA_ITEMs (i.e., without duplicates).
Definition eda_group.h:43
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
Definition eda_item.cpp:488
std::vector< wxString > RemoveConflictingCustomProperties()
Remove custom properties whose keys collide with an existing field or built-in property name (matched...
Definition eda_item.cpp:168
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition eda_item.cpp:270
wxString GetTypeDesc() const
Return a translated description of the type for this EDA_ITEM for display in user facing messages.
Definition eda_item.cpp:556
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition eda_item.h:158
std::vector< PROPERTY_BASE * > GetCustomPropertiesAsInspectables() const
Definition eda_item.cpp:200
bool GetCustomProperty(const wxString &aKey, wxString &aValue) const
Definition eda_item.cpp:188
virtual wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const
Return a user-visible description string of this item.
Definition eda_item.cpp:304
void SetModified()
Definition eda_item.cpp:260
const KIID m_Uuid
Definition eda_item.h:597
bool m_forceVisible
Definition eda_item.h:612
void RemoveCustomProperty(const wxString &aKey)
Definition eda_item.cpp:161
virtual EDA_GROUP * GetParentGroup() const
Definition eda_item.h:116
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
bool operator<(const EDA_ITEM &aItem) const
Test if another item is less than this object.
Definition eda_item.cpp:479
EDA_ITEM_FLAGS m_flags
Definition eda_item.h:606
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition eda_item.cpp:516
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition eda_item.h:482
EDA_GROUP * m_group
The group this item belongs to, if any. No ownership implied.
Definition eda_item.h:608
KIID GetParentGroupId() const
Definition eda_item.cpp:232
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition eda_item.h:214
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition eda_item.cpp:287
std::map< wxString, wxString > m_customProperties
Definition eda_item.h:615
void SetNetHighlighted(bool aHighlighted)
Definition eda_item.cpp:131
virtual wxString GetFriendlyName() const
Definition eda_item.cpp:565
EDA_ITEM * GetParent() const
Definition eda_item.h:112
bool HasSelectedAncestorGroup() const
Definition eda_item.cpp:241
bool m_isRollover
Definition eda_item.h:611
virtual ~EDA_ITEM()
void SetCustomProperty(const wxString &aKey, const wxString &aValue)
Definition eda_item.h:255
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition eda_item.cpp:278
std::map< wxString, std::unique_ptr< PROPERTY_BASE > > m_dynamicCustomPropsCache
Per-key cache of dynamic property descriptors for m_customProperties, owned by this object.
Definition eda_item.h:621
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition eda_item.cpp:509
bool m_netHighlighted
Definition eda_item.h:613
bool IsNetHighlighted() const
Net highlighting must not clear brightening owned by find or picker tools.
Definition eda_item.cpp:125
std::vector< PROPERTY_BASE * > GetDynamicProperties() const override
Return dynamically-computed properties specific to this object instance (e.g.
Definition eda_item.cpp:226
virtual void SetParent(EDA_ITEM *aParent)
Definition eda_item.cpp:153
EDA_ITEM * m_parent
Owner.
Definition eda_item.h:607
static bool Replace(const EDA_SEARCH_DATA &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
Definition eda_item.cpp:396
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition eda_item.h:603
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition eda_item.h:520
EDA_ITEM * findParent(KICAD_T aType) const
Definition eda_item.cpp:137
virtual BITMAPS GetMenuImage() const
Return a pointer to an image to be used in menus.
Definition eda_item.cpp:524
static ENUM_MAP< T > & Instance()
Definition property.h:770
VIEW_ITEM(bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition view_item.h:84
bool IsSCH_ITEM() const
Definition view_item.h:97
void SetForcedTransparency(double aForcedTransparency)
Definition view_item.h:162
bool IsBOARD_ITEM() const
Definition view_item.h:98
virtual wxString GetClass() const =0
Return the class name.
double GetForcedTransparency() const
Definition view_item.h:167
Definition kiid.h:46
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
PROPERTY_BASE & SetGroup(const wxString &aGroup)
Definition property.h:366
PROPERTY_BASE & SetIsHiddenFromPropertiesManager(bool aHide=true)
Definition property.h:325
Provide class metadata.Helper macro to map type hashes to names.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
static struct EDA_ITEM_DESC _EDA_ITEM_DESC
bool isWordChar(const wxUniChar &c)
Definition eda_item.cpp:312
INSPECT_RESULT
Definition eda_item.h:44
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition eda_item.h:91
#define IS_CHANGED
Item was edited, and modified.
Abstract pattern-matching tool and implementations.
@ CTX_SEARCH
Some functions to handle hotkeys in KiCad.
KIID niluuid(0)
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30
#define _HKI(x)
Definition page_info.cpp:40
#define TYPE_HASH(x)
Definition property.h:74
#define NO_SETTER(owner, type)
Definition property.h:882
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
Definition property.h:877
#define REGISTER_TYPE(x)
CITER next(CITER it)
Definition ptree.cpp:120
EDA_SEARCH_MATCH_MODE matchMode
wxString result
Test unit parsing edge cases and error handling.
wxLogTrace helper definitions.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:70
@ SCH_GROUP_T
Definition typeinfo.h:169
@ SCH_TABLE_T
Definition typeinfo.h:161
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:80
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition typeinfo.h:98
@ SCH_LINE_T
Definition typeinfo.h:159
@ LIB_SYMBOL_T
Definition typeinfo.h:144
@ SCH_NO_CONNECT_T
Definition typeinfo.h:156
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition typeinfo.h:95
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:83
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition typeinfo.h:89
@ TYPE_NOT_INIT
Definition typeinfo.h:73
@ SCH_SYMBOL_T
Definition typeinfo.h:168
@ PCB_DRILL_MAP_T
class PCB_DRILL_MAP, drill symbols drawn at the holes
Definition typeinfo.h:240
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition typeinfo.h:96
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:103
@ SCH_TABLECELL_T
Definition typeinfo.h:162
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition typeinfo.h:85
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition typeinfo.h:100
@ SCH_FIELD_T
Definition typeinfo.h:146
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:84
@ SCH_DIRECTIVE_LABEL_T
Definition typeinfo.h:167
@ SCH_LABEL_T
Definition typeinfo.h:163
@ SCH_SHEET_T
Definition typeinfo.h:171
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
Definition typeinfo.h:81
@ SCH_MARKER_T
Definition typeinfo.h:154
@ PCB_ITEM_LIST_T
class BOARD_ITEM_LIST, a list of board items
Definition typeinfo.h:101
@ SCH_SHAPE_T
Definition typeinfo.h:145
@ SCH_RULE_AREA_T
Definition typeinfo.h:166
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition typeinfo.h:82
@ GERBER_DRAW_ITEM_T
Definition typeinfo.h:206
@ SCH_HIER_LABEL_T
Definition typeinfo.h:165
@ NOT_USED
the 3d code uses this value
Definition typeinfo.h:71
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition typeinfo.h:91
@ SCH_BUS_BUS_ENTRY_T
Definition typeinfo.h:158
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
Definition typeinfo.h:93
@ SCH_SCREEN_T
Definition typeinfo.h:198
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
Definition typeinfo.h:99
@ SCHEMATIC_T
Definition typeinfo.h:200
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
Definition typeinfo.h:87
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:78
@ SCH_SHEET_PIN_T
Definition typeinfo.h:170
@ PCB_GRID_ITEM_T
a subgrid placed on a board
Definition typeinfo.h:238
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition typeinfo.h:94
@ SCH_TEXT_T
Definition typeinfo.h:147
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:79
@ GERBER_IMAGE_T
Definition typeinfo.h:207
@ SCH_BUS_WIRE_ENTRY_T
Definition typeinfo.h:157
@ GERBER_LAYOUT_T
Definition typeinfo.h:205
@ SCREEN_T
not really an item, used to identify a screen
Definition typeinfo.h:75
@ SCH_BITMAP_T
Definition typeinfo.h:160
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition typeinfo.h:90
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition typeinfo.h:86
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
Definition typeinfo.h:102
@ SCH_TEXTBOX_T
Definition typeinfo.h:148
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
Definition typeinfo.h:105
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition typeinfo.h:88
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition typeinfo.h:97
@ PCB_DRILL_CHART_T
class PCB_DRILL_CHART, a live drill chart derived from PCB_TABLE
Definition typeinfo.h:239
@ SCH_GLOBAL_LABEL_T
Definition typeinfo.h:164
@ SCH_JUNCTION_T
Definition typeinfo.h:155
@ SCH_PIN_T
Definition typeinfo.h:149
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683