KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_group.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19#include <bitmaps.h>
20#include <api/api_utils.h>
21#include <api/schematic/schematic_types.pb.h>
22#include <google/protobuf/any.pb.h>
23#include <eda_draw_frame.h>
24#include <eda_group.h>
26#include <sch_item.h>
27#include <sch_group.h>
28#include <sch_screen.h>
29#include <schematic.h>
30#include <sch_symbol.h>
31#include <symbol.h>
32#include <confirm.h>
33#include <widgets/msgpanel.h>
34#include <view/view.h>
35
36#include <wx/debug.h>
37#include <properties/property.h>
39
40
46
47
49 SCH_ITEM( aParent, SCH_GROUP_T )
50{
52}
53
54
56 SCH_ITEM( aParent, SCH_GROUP_T )
57{
59}
60
61
62void SCH_GROUP::Serialize( google::protobuf::Any& aContainer ) const
63{
64 using namespace kiapi::schematic::types;
65
66 Group group;
67 EDA_ITEM_SET sortedItems( m_items.begin(), m_items.end() );
68
69 group.mutable_id()->set_value( m_Uuid.AsStdString() );
70 group.set_name( GetName().ToUTF8() );
71 group.set_locked( IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
72 : kiapi::common::types::LockedState::LS_UNLOCKED );
73
74 for( EDA_ITEM* member : sortedItems )
75 group.add_items()->set_value( member->m_Uuid.AsStdString() );
76
77 kiapi::common::PackCustomProperties( group.mutable_custom_properties(), *this );
78
79 if( !aContainer.PackFrom( group ) )
80 wxFAIL_MSG( wxT( "Failed to pack SCH_GROUP" ) );
81}
82
83
84bool SCH_GROUP::Deserialize( const google::protobuf::Any& aContainer )
85{
86 return DeserializeGroup( aContainer, nullptr );
87}
88
89
90// Note: this only records the group members in m_deserializedItems. A proper AddItem() must
91// be done in a second pass (FinalizeGroupDeserialization()).
92bool SCH_GROUP::DeserializeGroup( const google::protobuf::Any& aContainer, COMMIT* aCommit )
93{
94 using namespace kiapi::schematic::types;
95
96 Group group;
97
98 if( !aContainer.UnpackTo( &group ) )
99 return false;
100
101 const_cast<KIID&>( m_Uuid ) = KIID( group.id().value() );
102 SetName( wxString::FromUTF8( group.name() ) );
103 SetLocked( group.locked() == kiapi::common::types::LockedState::LS_LOCKED );
104 kiapi::common::UnpackCustomProperties( group.custom_properties(), *this );
105
106 m_items.clear();
107 m_deserializedItems.clear();
108
110
111 if( !schematic )
112 return false;
113
114 for( const kiapi::common::types::KIID& memberId : group.items() )
115 {
116 KIID id( memberId.value() );
117 EDA_ITEM* item = schematic->ResolveItem( id, nullptr, true );
118
119 if( !item && aCommit )
120 item = aCommit->ResolveItem( id );
121
122 if( item )
123 m_deserializedItems.insert( item );
124 }
125
126 return true;
127}
128
129
130std::unordered_set<SCH_ITEM*> SCH_GROUP::GetSchItems() const
131{
132 std::unordered_set<SCH_ITEM*> items;
133
134 for( EDA_ITEM* item : m_items )
135 {
136 if( item->IsSCH_ITEM() )
137 items.insert( static_cast<SCH_ITEM*>( item ) );
138 }
139
140 return items;
141}
142
143
144/*
145 * @return if not in the symbol editor and aItem is in a symbol, returns the
146 * symbol's parent group. Otherwise, returns the aItem's parent group.
147 */
148static EDA_GROUP* getClosestGroup( const SCH_ITEM& aItem, bool isSymbolEditor )
149{
150 // In the schematic editor, items with either symbols or sheets as their parents (e.g., fields,
151 // pins, sheet pins, etc.) don't get their own groups and instead follow the group of their parent
152 // object.
153 if( !isSymbolEditor && aItem.GetParent() && aItem.GetParent()->Type() == SCH_SYMBOL_T )
154 return static_cast<SCH_SYMBOL*>( aItem.GetParent() )->GetParentGroup();
155 else if( aItem.GetParent() && aItem.GetParent()->Type() == SCH_SHEET_T )
156 return static_cast<SCH_SHEET*>( aItem.GetParent() )->GetParentGroup();
157 else
158 return aItem.GetParentGroup();
159}
160
161
163static EDA_GROUP* getNestedGroup( const SCH_ITEM& aItem, const EDA_GROUP* aScope, bool isSymbolEditor )
164{
165 EDA_GROUP* group = getClosestGroup( aItem, isSymbolEditor );
166
167 if( group == aScope )
168 return nullptr;
169
170 while( group && group->AsEdaItem()->GetParentGroup() && group->AsEdaItem()->GetParentGroup() != aScope )
171 {
172 if( group->AsEdaItem()->GetParent()->Type() == LIB_SYMBOL_T && isSymbolEditor )
173 break;
174
175 group = group->AsEdaItem()->GetParentGroup();
176 }
177
178 return group;
179}
180
181
182EDA_GROUP* SCH_GROUP::TopLevelGroup( const SCH_ITEM& aItem, const EDA_GROUP* aScope, bool isSymbolEditor )
183{
184 return getNestedGroup( aItem, aScope, isSymbolEditor );
185}
186
187
188bool SCH_GROUP::WithinScope( const SCH_ITEM& aItem, const SCH_GROUP* aScope, bool isSymbolEditor )
189{
190 EDA_GROUP* group = getClosestGroup( aItem, isSymbolEditor );
191
192 if( group && group == aScope )
193 return true;
194
195 EDA_GROUP* nested = getNestedGroup( aItem, aScope, isSymbolEditor );
196
197 return nested && nested->AsEdaItem()->GetParentGroup() && nested->AsEdaItem()->GetParentGroup() == aScope;
198}
199
200
202{
203 return GetBoundingBox().Centre();
204}
205
206
207void SCH_GROUP::SetPosition( const VECTOR2I& aNewpos )
208{
209 VECTOR2I delta = aNewpos - GetPosition();
210
211 Move( delta );
212}
213
214
216{
217 // Use copy constructor to get the same uuid and other fields
218 SCH_GROUP* newGroup = new SCH_GROUP( *this );
219 return newGroup;
220}
221
222
224{
225 // Use copy constructor to get the same uuid and other fields
226 SCH_GROUP* newGroup = new SCH_GROUP( *this );
227 newGroup->m_items.clear();
228
229 for( EDA_ITEM* member : m_items )
230 {
231 if( member->Type() == SCH_GROUP_T )
232 newGroup->AddItem( static_cast<SCH_GROUP*>( member )->DeepClone() );
233 else
234 newGroup->AddItem( static_cast<SCH_ITEM*>( member->Clone() ) );
235 }
236
237 return newGroup;
238}
239
240
241SCH_GROUP* SCH_GROUP::DeepDuplicate( bool addToParentGroup, SCH_COMMIT* aCommit ) const
242{
243 SCH_GROUP* newGroup = static_cast<SCH_GROUP*>( Duplicate( addToParentGroup, aCommit ) );
244 newGroup->m_items.clear();
245
246 for( EDA_ITEM* member : m_items )
247 {
248 if( member->Type() == SCH_GROUP_T )
249 newGroup->AddItem( static_cast<SCH_GROUP*>( member )->DeepDuplicate( IGNORE_PARENT_GROUP ) );
250 else
251 newGroup->AddItem( static_cast<SCH_ITEM*>( member )->Duplicate( IGNORE_PARENT_GROUP ) );
252 }
253
254 return newGroup;
255}
256
257
259{
260 assert( aImage->Type() == SCH_GROUP_T );
261 SCH_GROUP* image = static_cast<SCH_GROUP*>( aImage );
262
263 std::swap( m_items, image->m_items );
264 std::swap( m_name, image->m_name );
265 std::swap( m_designBlockLibId, image->m_designBlockLibId );
266
267 // A group doesn't own its children (they're owned by the schematic), so undo doesn't do a
268 // deep clone when making an image. However, it's still safest to update the parentGroup
269 // pointers of the group's children. We must do it in the right order in case any of the
270 // children are shared (ie: image first, "this" second so that any shared children end up
271 // with "this").
272 image->RunOnChildren(
273 [&]( SCH_ITEM* child )
274 {
275 child->SetParentGroup( image );
276 },
278
280 [&]( SCH_ITEM* child )
281 {
282 child->SetParentGroup( this );
283 },
285}
286
287
288bool SCH_GROUP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
289{
290 // Groups are selected by promoting a selection of one of their children
291 return false;
292}
293
294
295bool SCH_GROUP::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
296{
297 // Groups are selected by promoting a selection of one of their children
298 return false;
299}
300
301
303{
304 BOX2I bbox;
305
306 for( EDA_ITEM* item : m_items )
307 {
308 if( item->Type() == SCH_SYMBOL_T || item->Type() == LIB_SYMBOL_T )
309 bbox.Merge( static_cast<SYMBOL*>( item )->GetBoundingBox() );
310 else
311 bbox.Merge( item->GetBoundingBox() );
312 }
313
314 bbox.Inflate( schIUScale.MilsToIU( 10 ) );
315
316 return bbox;
317}
318
319
320INSPECT_RESULT SCH_GROUP::Visit( INSPECTOR aInspector, void* aTestData,
321 const std::vector<KICAD_T>& aScanTypes )
322{
323 for( KICAD_T scanType : aScanTypes )
324 {
325 if( scanType == Type() )
326 {
327 if( INSPECT_RESULT::QUIT == aInspector( this, aTestData ) )
329 }
330 }
331
333}
334
335
336std::vector<int> SCH_GROUP::ViewGetLayers() const
337{
338 return { LAYER_SCHEMATIC_ANCHOR };
339}
340
341
342double SCH_GROUP::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
343{
345 return LOD_SHOW;
346
347 return LOD_HIDE;
348}
349
350
351void SCH_GROUP::Move( const VECTOR2I& aMoveVector )
352{
353 for( EDA_ITEM* member : m_items )
354 {
355 EDA_ITEM_FLAGS flags = member->GetFlags();
356
357 if( member->Type() == SCH_LINE_T )
358 member->SetFlags( STARTPOINT | ENDPOINT );
359
360 static_cast<SCH_ITEM*>( member )->Move( aMoveVector );
361
362 member->SetFlags( flags );
363 }
364}
365
366
367void SCH_GROUP::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
368{
369 for( EDA_ITEM* member : m_items )
370 {
371 EDA_ITEM_FLAGS flags = member->GetFlags();
372
373 if( member->Type() == SCH_LINE_T )
374 member->SetFlags( STARTPOINT | ENDPOINT );
375
376 static_cast<SCH_ITEM*>( member )->Rotate( aCenter, aRotateCCW );
377
378 member->SetFlags( flags );
379 }
380}
381
382
384{
385 for( EDA_ITEM* member : m_items )
386 {
387 EDA_ITEM_FLAGS flags = member->GetFlags();
388
389 if( member->Type() == SCH_LINE_T )
390 member->SetFlags( STARTPOINT | ENDPOINT );
391
392 static_cast<SCH_ITEM*>( member )->MirrorHorizontally( aCenter );
393
394 member->SetFlags( flags );
395 }
396}
397
398
400{
401 for( EDA_ITEM* member : m_items )
402 {
403 EDA_ITEM_FLAGS flags = member->GetFlags();
404
405 if( member->Type() == SCH_LINE_T )
406 member->SetFlags( STARTPOINT | ENDPOINT );
407
408 static_cast<SCH_ITEM*>( member )->MirrorVertically( aCenter );
409
410 member->SetFlags( flags );
411 }
412}
413
414
415void SCH_GROUP::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
416 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
417{
418}
419
420
421wxString SCH_GROUP::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
422{
423 if( m_name.empty() )
424 return wxString::Format( _( "Unnamed Group, %zu members" ), m_items.size() );
425 else
426 return wxString::Format( _( "Group '%s', %zu members" ), m_name, m_items.size() );
427}
428
429
431{
432 return BITMAPS::module;
433}
434
435
436void SCH_GROUP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
437{
438 aList.emplace_back( _( "Group" ), m_name.empty() ? _( "<unnamed>" ) : m_name );
439 aList.emplace_back( _( "Members" ), wxString::Format( wxT( "%zu" ), m_items.size() ) );
440}
441
442
443bool SCH_GROUP::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
444{
445 return EDA_ITEM::Matches( UnescapeString( GetName() ), aSearchData );
446}
447
448
449void SCH_GROUP::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode )
450{
451 try
452 {
453 for( EDA_ITEM* item : m_items )
454 {
455 aFunction( static_cast<SCH_ITEM*>( item ) );
456
457 if( item->Type() == SCH_GROUP_T && aMode == RECURSE_MODE::RECURSE )
458 static_cast<SCH_GROUP*>( item )->RunOnChildren( aFunction, RECURSE_MODE::RECURSE );
459 }
460 }
461 catch( std::bad_function_call& )
462 {
463 wxFAIL_MSG( wxT( "Error calling function in SCH_GROUP::RunOnChildren" ) );
464 }
465}
466
467
468bool SCH_GROUP::operator==( const SCH_ITEM& aSchItem ) const
469{
470 if( aSchItem.Type() != Type() )
471 return false;
472
473 const SCH_GROUP& other = static_cast<const SCH_GROUP&>( aSchItem );
474
475 return *this == other;
476}
477
478
479bool SCH_GROUP::operator==( const SCH_GROUP& aOther ) const
480{
481 if( m_items.size() != aOther.m_items.size() )
482 return false;
483
484 // The items in groups are in unordered sets hashed by the pointer value, so we need to
485 // order them by UUID (EDA_ITEM_SET) to compare
486 EDA_ITEM_SET itemSet( m_items.begin(), m_items.end() );
487 EDA_ITEM_SET otherItemSet( aOther.m_items.begin(), aOther.m_items.end() );
488
489 for( auto it1 = itemSet.begin(), it2 = otherItemSet.begin(); it1 != itemSet.end(); ++it1, ++it2 )
490 {
491 // Compare UUID instead of the items themselves because we only care if the contents
492 // of the group has changed, not which elements in the group have changed
493 if( ( *it1 )->m_Uuid != ( *it2 )->m_Uuid )
494 return false;
495 }
496
497 return true;
498}
499
500
501double SCH_GROUP::Similarity( const SCH_ITEM& aOther ) const
502{
503 if( aOther.Type() != Type() )
504 return 0.0;
505
506 const SCH_GROUP& other = static_cast<const SCH_GROUP&>( aOther );
507
508 if( m_items.empty() )
509 return 0.0;
510
511 double similarity = 0.0;
512
513 for( EDA_ITEM* item : m_items )
514 {
515 double maxSimilarity = 0.0;
516
517 for( EDA_ITEM* otherItem : other.m_items )
518 {
519 double itemSimilarity = static_cast<SCH_ITEM*>( item )->Similarity( *static_cast<SCH_ITEM*>( otherItem ) );
520
521 maxSimilarity = std::max( maxSimilarity, itemSimilarity );
522
523 if( maxSimilarity == 1.0 )
524 break;
525 }
526
527 similarity += maxSimilarity;
528 }
529
530 return similarity / m_items.size();
531}
532
533
534static struct SCH_GROUP_DESC
535{
537 {
544
545 propMgr.Mask( TYPE_HASH( SCH_GROUP ), TYPE_HASH( SCH_ITEM ), _HKI( "Position X" ) );
546 propMgr.Mask( TYPE_HASH( SCH_GROUP ), TYPE_HASH( SCH_ITEM ), _HKI( "Position Y" ) );
547
548 const wxString groupTab = _HKI( "Group Properties" );
549
550 propMgr.AddProperty( new PROPERTY<EDA_GROUP, wxString>( _HKI( "Name" ),
552 groupTab );
553 }
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:130
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:556
constexpr Vec Centre() const
Definition box2.h:100
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition box2.h:597
Represent a set of changes (additions, deletions or modifications) of a data model (e....
Definition commit.h:68
virtual EDA_ITEM * ResolveItem(KIID &aID)=0
Search for an item in this commit that matches the provided KIID.
The base class for create windows for drawing purpose.
A set of EDA_ITEMs (i.e., without duplicates).
Definition eda_group.h:43
wxString m_name
Definition eda_group.h:106
std::unordered_set< EDA_ITEM * > m_items
Definition eda_group.h:105
wxString GetName() const
Definition eda_group.h:75
LIB_ID m_designBlockLibId
Definition eda_group.h:107
void AddItem(EDA_ITEM *aItem)
Add item to group.
Definition eda_group.cpp:58
virtual EDA_ITEM * AsEdaItem()=0
std::unordered_set< EDA_ITEM * > m_deserializedItems
Definition eda_group.h:109
void SetName(const wxString &aName)
Definition eda_group.h:76
const KIID m_Uuid
Definition eda_item.h:599
virtual EDA_GROUP * GetParentGroup() const
Definition eda_item.h:116
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition eda_item.h:484
virtual void SetParentGroup(EDA_GROUP *aGroup)
Definition eda_item.h:115
EDA_ITEM * GetParent() const
Definition eda_item.h:112
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
Definition view_item.h:176
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
Definition view_item.h:181
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:68
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition view.h:457
Definition kiid.h:46
Base plotter engine class.
Definition plotter.h:138
Provide class metadata.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Holds all the data relating to one schematic.
Definition schematic.h:155
Commit for the schematic and symbol editors.
Definition sch_commit.h:54
A set of SCH_ITEMs (i.e., without duplicates).
Definition sch_group.h:48
SCH_GROUP * DeepDuplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr) const
Duplicate this and all descendants.
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
bool DeserializeGroup(const google::protobuf::Any &aContainer, COMMIT *aCommit) override
Deserializes the given protobuf message into this group.
Definition sch_group.cpp:92
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition sch_group.cpp:84
static bool WithinScope(const SCH_ITEM &aItem, const SCH_GROUP *aScope, bool isSymbolEditor)
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
bool operator==(const SCH_GROUP &aOther) const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition sch_group.cpp:62
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
SCH_GROUP * DeepClone() const
Clone this and all descendants.
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
INSPECT_RESULT Visit(INSPECTOR aInspector, void *aTestData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
void SetPosition(const VECTOR2I &aNewpos) override
std::unordered_set< SCH_ITEM * > GetSchItems() const
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
static EDA_GROUP * TopLevelGroup(const SCH_ITEM &aItem, const EDA_GROUP *aScope, bool isSymbolEditor)
Search for highest level group inside of aScope, containing item.
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
VECTOR2I GetPosition() const override
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:170
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool aDoClone=false) const
Routine to create a new copy of given item.
Definition sch_item.cpp:191
void SetLocked(bool aLocked) override
Definition sch_item.h:262
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:302
bool IsLocked() const override
Definition sch_item.cpp:179
void SetLayer(SCH_LAYER_ID aLayer)
Definition sch_item.h:354
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:65
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:50
Schematic symbol object.
Definition sch_symbol.h:76
A base class for LIB_SYMBOL and SCH_SYMBOL.
Definition symbol.h:60
This file is part of the common library.
#define _(s)
RECURSE_MODE
Definition eda_item.h:50
@ RECURSE
Definition eda_item.h:51
@ NO_RECURSE
Definition eda_item.h:52
INSPECT_RESULT
Definition eda_item.h:44
std::set< EDA_ITEM *, CompareByUuid > EDA_ITEM_SET
Definition eda_item.h:659
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition eda_item.h:91
#define IGNORE_PARENT_GROUP
Definition eda_item.h:55
#define ENDPOINT
ends. (Used to support dragging.)
std::uint32_t EDA_ITEM_FLAGS
#define STARTPOINT
When a line is selected, these flags indicate which.
@ LAYER_SCHEMATIC_ANCHOR
Definition layer_ids.h:531
@ LAYER_GROUP
Definition layer_ids.h:534
Message panel definition file.
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
#define _HKI(x)
Definition page_info.cpp:40
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
Definition property.h:74
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
static struct SCH_GROUP_DESC _SCH_GROUP_DESC
static EDA_GROUP * getClosestGroup(const SCH_ITEM &aItem, bool isSymbolEditor)
static EDA_GROUP * getNestedGroup(const SCH_ITEM &aItem, const EDA_GROUP *aScope, bool isSymbolEditor)
Returns the top level group inside the aScope group, or nullptr.
Class to handle a set of SCH_ITEMs.
wxString UnescapeString(const wxString &aSource)
int delta
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_LINE_T
Definition typeinfo.h:159
@ LIB_SYMBOL_T
Definition typeinfo.h:144
@ SCH_SYMBOL_T
Definition typeinfo.h:168
@ SCH_SHEET_T
Definition typeinfo.h:171
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708