diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 25470bc795..b7ac4769f7 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -467,7 +467,7 @@ set( PCB_COMMON_SRCS ${CMAKE_SOURCE_DIR}/pcbnew/class_dimension.cpp ${CMAKE_SOURCE_DIR}/pcbnew/class_drawsegment.cpp ${CMAKE_SOURCE_DIR}/pcbnew/class_edge_mod.cpp - ${CMAKE_SOURCE_DIR}/pcbnew/class_group.cpp + ${CMAKE_SOURCE_DIR}/pcbnew/class_pcb_group.cpp ${CMAKE_SOURCE_DIR}/pcbnew/class_marker_pcb.cpp ${CMAKE_SOURCE_DIR}/pcbnew/class_module.cpp ${CMAKE_SOURCE_DIR}/pcbnew/netinfo_item.cpp diff --git a/include/class_group.h b/include/class_pcb_group.h similarity index 94% rename from include/class_group.h rename to include/class_pcb_group.h index 751d99af6c..e9af797ce7 100644 --- a/include/class_group.h +++ b/include/class_pcb_group.h @@ -23,7 +23,7 @@ */ /** - * @file class_group.h + * @file class_pcb_group.h * @brief Class to handle a set of BOARD_ITEMs. * Group parent is always board, not logical parent group. * Group is transparent container - e.g., its position is derived from the position @@ -32,8 +32,8 @@ * on sets of items, like committing, updating the view, etc the set is explicit. */ -#ifndef CLASS_GROUP_H_ -#define CLASS_GROUP_H_ +#ifndef CLASS_PCB_GROUP_H_ +#define CLASS_PCB_GROUP_H_ #include #include @@ -47,12 +47,12 @@ class VIEW; typedef std::unordered_set ITEM_SET; /** - * GROUP is a set of BOARD_ITEMs (i.e., without duplicates) + * PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates) */ -class GROUP : public BOARD_ITEM +class PCB_GROUP : public BOARD_ITEM { public: - GROUP( BOARD* parent ); + PCB_GROUP( BOARD* parent ); static inline bool ClassOf( const EDA_ITEM* aItem ) { @@ -88,7 +88,7 @@ public: wxString GetClass() const override { - return wxT( "GROUP" ); + return wxT( "PCB_GROUP" ); } #if defined( DEBUG ) @@ -119,12 +119,12 @@ public: /* * Clone() this and all descendents */ - GROUP* DeepClone() const; + PCB_GROUP* DeepClone() const; /* * Duplicate() this and all descendents */ - GROUP* DeepDuplicate() const; + PCB_GROUP* DeepDuplicate() const; ///> @copydoc BOARD_ITEM::SwapData void SwapData( BOARD_ITEM* aImage ) override; @@ -195,4 +195,4 @@ private: wxString m_name; }; -#endif // CLASS_GROUP_H_ +#endif // CLASS_PCB_GROUP_H_ diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h index e40afdcdf9..e2493c4a74 100644 --- a/include/core/typeinfo.h +++ b/include/core/typeinfo.h @@ -102,7 +102,7 @@ enum KICAD_T PCB_ZONE_AREA_T, ///< class ZONE_CONTAINER, a zone area PCB_ITEM_LIST_T, ///< class BOARD_ITEM_LIST, a list of board items PCB_NETINFO_T, ///< class NETINFO_ITEM, a description of a net - PCB_GROUP_T, ///< class GROUP, a set of BOARD_ITEMs + PCB_GROUP_T, ///< class PCB_GROUP, a set of BOARD_ITEMs PCB_LOCATE_STDVIA_T, PCB_LOCATE_UVIA_T, diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 39a2e7a448..1650b2ad3c 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -563,7 +563,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) // this one uses a vector case PCB_GROUP_T: - m_groups.push_back( (GROUP*) aBoardItem ); + m_groups.push_back( (PCB_GROUP*) aBoardItem ); break; // this one uses a vector @@ -803,7 +803,7 @@ BOARD_ITEM* BOARD::GetItem( const KIID& aID ) if( marker->m_Uuid == aID ) return marker; - for( GROUP* group : m_groups ) + for( PCB_GROUP* group : m_groups ) if( group->m_Uuid == aID ) return group; @@ -843,7 +843,7 @@ void BOARD::FillItemMap( std::map& aMap ) for( MARKER_PCB* marker : m_markers ) aMap[ marker->m_Uuid ] = marker; - for( GROUP* group : m_groups ) + for( PCB_GROUP* group : m_groups ) aMap[ group->m_Uuid ] = group; } @@ -1132,7 +1132,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s break; case PCB_GROUP_T: - result = IterateForward( m_groups, inspector, testData, p ); + result = IterateForward( m_groups, inspector, testData, p ); ++p; break; @@ -1988,15 +1988,15 @@ void BOARD::HighLightON( bool aValue ) } } -GROUP* BOARD::TopLevelGroup( BOARD_ITEM* item, GROUP* scope ) +PCB_GROUP* BOARD::TopLevelGroup( BOARD_ITEM* item, PCB_GROUP* scope ) { - GROUP* candidate = NULL; + PCB_GROUP* candidate = NULL; bool foundParent; do { foundParent = false; - for( GROUP* group : m_groups ) + for( PCB_GROUP* group : m_groups ) { BOARD_ITEM* toFind = ( candidate == NULL ) ? item : candidate; if( group->GetItems().find( toFind ) != group->GetItems().end() ) @@ -2022,9 +2022,9 @@ GROUP* BOARD::TopLevelGroup( BOARD_ITEM* item, GROUP* scope ) } -GROUP* BOARD::ParentGroup( BOARD_ITEM* item ) +PCB_GROUP* BOARD::ParentGroup( BOARD_ITEM* item ) { - for( GROUP* group : m_groups ) + for( PCB_GROUP* group : m_groups ) { if( group->GetItems().find( item ) != group->GetItems().end() ) return group; @@ -2057,7 +2057,7 @@ wxString BOARD::GroupsSanityCheckInternal( bool repair ) for( size_t idx = 0; idx < groups.size(); idx++ ) { - GROUP& group = *( groups[idx] ); + PCB_GROUP& group = *( groups[idx] ); BOARD_ITEM* testItem = board.GetItem( group.m_Uuid ); if( testItem != groups[idx] ) @@ -2212,7 +2212,7 @@ BOARD::GroupLegalOpsField BOARD::GroupLegalOps( const PCBNEW_SELECTION& selectio GroupLegalOpsField legalOps = { false, false, false, false, false, false }; std::unordered_set allMembers; - for( const GROUP* grp : m_groups ) + for( const PCB_GROUP* grp : m_groups ) { for( const BOARD_ITEM* member : grp->GetItems() ) { @@ -2238,21 +2238,21 @@ BOARD::GroupLegalOpsField BOARD::GroupLegalOps( const PCBNEW_SELECTION& selectio // Check that no groups are descendant subgroups of another group in the selection for( EDA_ITEM* item : selection ) { - const GROUP* group = static_cast( item ); - std::unordered_set subgroupos; - std::queue toCheck; + const PCB_GROUP* group = static_cast( item ); + std::unordered_set subgroupos; + std::queue toCheck; toCheck.push( group ); while( !toCheck.empty() ) { - const GROUP* candidate = toCheck.front(); + const PCB_GROUP* candidate = toCheck.front(); toCheck.pop(); for( const BOARD_ITEM* aChild : candidate->GetItems() ) { if( aChild->Type() == PCB_GROUP_T ) { - const GROUP* childGroup = static_cast( aChild ); + const PCB_GROUP* childGroup = static_cast( aChild ); subgroupos.insert( childGroup ); toCheck.push( childGroup ); } @@ -2262,7 +2262,7 @@ BOARD::GroupLegalOpsField BOARD::GroupLegalOps( const PCBNEW_SELECTION& selectio for( EDA_ITEM* otherItem : selection ) { if( otherItem != item - && subgroupos.find( static_cast( otherItem ) ) != subgroupos.end() ) + && subgroupos.find( static_cast( otherItem ) ) != subgroupos.end() ) { // otherItem is a descendant subgroup of item onlyGroups = false; @@ -2308,10 +2308,10 @@ BOARD::GroupLegalOpsField BOARD::GroupLegalOps( const PCBNEW_SELECTION& selectio void BOARD::GroupRemoveItems( const PCBNEW_SELECTION& selection, BOARD_COMMIT* commit ) { std::unordered_set emptyGroups; - std::unordered_set emptyGroupParents; + std::unordered_set emptyGroupParents; // groups who have had children removed, either items or empty groups. - std::unordered_set itemParents; + std::unordered_set itemParents; std::unordered_set itemsToRemove; for( EDA_ITEM* item : selection ) @@ -2322,7 +2322,7 @@ void BOARD::GroupRemoveItems( const PCBNEW_SELECTION& selection, BOARD_COMMIT* c for( BOARD_ITEM* item : itemsToRemove ) { - GROUP* parentGroup = ParentGroup( item ); + PCB_GROUP* parentGroup = ParentGroup( item ); itemParents.insert( parentGroup ); while( parentGroup != nullptr ) @@ -2354,7 +2354,7 @@ void BOARD::GroupRemoveItems( const PCBNEW_SELECTION& selection, BOARD_COMMIT* c // Items themselves are removed outside the context of this function // First let's check the parents of items that are no empty - for( GROUP* grp : itemParents ) + for( PCB_GROUP* grp : itemParents ) { if( emptyGroups.find( grp ) == emptyGroups.end() ) { diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index be477bb595..d230e3b2fd 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include // PAGE_INFO @@ -175,7 +175,7 @@ DECL_VEC_FOR_SWIG( MARKERS, MARKER_PCB* ) DECL_VEC_FOR_SWIG( ZONE_CONTAINERS, ZONE_CONTAINER* ) DECL_DEQ_FOR_SWIG( TRACKS, TRACK* ) // Dequeue rather than Vector just so we can use moveUnflaggedItems in pcbnew_control.cpp -DECL_DEQ_FOR_SWIG( GROUPS, GROUP* ) +DECL_DEQ_FOR_SWIG( GROUPS, PCB_GROUP* ) /** * BOARD @@ -1234,14 +1234,14 @@ public: * @param scope restricts the search to groups within the group scope. * @return group containing item, if it exists, otherwise, NULL */ - GROUP* TopLevelGroup( BOARD_ITEM* item, GROUP* scope ); + PCB_GROUP* TopLevelGroup( BOARD_ITEM* item, PCB_GROUP* scope ); /* * @return The group containing item as a child, or NULL if there is no * such group. */ - GROUP* ParentGroup( BOARD_ITEM* item ); + PCB_GROUP* ParentGroup( BOARD_ITEM* item ); /* * Given a selection of items, remove them from their groups and also diff --git a/pcbnew/class_group.cpp b/pcbnew/class_pcb_group.cpp similarity index 70% rename from pcbnew/class_group.cpp rename to pcbnew/class_pcb_group.cpp index 689b2d21dd..9d662001ac 100644 --- a/pcbnew/class_group.cpp +++ b/pcbnew/class_pcb_group.cpp @@ -22,32 +22,32 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include -#include +#include #include #include #include -GROUP::GROUP( BOARD* parent ) : BOARD_ITEM( (BOARD_ITEM*) parent, PCB_GROUP_T ) +PCB_GROUP::PCB_GROUP( BOARD* parent ) : BOARD_ITEM( (BOARD_ITEM*) parent, PCB_GROUP_T ) { } -bool GROUP::AddItem( BOARD_ITEM* item ) +bool PCB_GROUP::AddItem( BOARD_ITEM* item ) { return m_items.insert( item ).second; } -bool GROUP::RemoveItem( const BOARD_ITEM* item ) +bool PCB_GROUP::RemoveItem( const BOARD_ITEM* item ) { return m_items.erase( const_cast( item ) ) == 1; } -wxPoint GROUP::GetPosition() const +wxPoint PCB_GROUP::GetPosition() const { return GetBoundingBox().Centre(); } -void GROUP::SetPosition( const wxPoint& newpos ) +void PCB_GROUP::SetPosition( const wxPoint& newpos ) { wxPoint delta = newpos - GetPosition(); @@ -57,24 +57,24 @@ void GROUP::SetPosition( const wxPoint& newpos ) } } -EDA_ITEM* GROUP::Clone() const +EDA_ITEM* PCB_GROUP::Clone() const { // Use copy constructor to get the same uuid and other fields - GROUP* newGroup = new GROUP( *this ); + PCB_GROUP* newGroup = new PCB_GROUP( *this ); return newGroup; } -GROUP* GROUP::DeepClone() const +PCB_GROUP* PCB_GROUP::DeepClone() const { // Use copy constructor to get the same uuid and other fields - GROUP* newGroup = new GROUP( *this ); + PCB_GROUP* newGroup = new PCB_GROUP( *this ); newGroup->m_items.clear(); for( auto member : m_items ) { if( member->Type() == PCB_GROUP_T ) { - newGroup->AddItem( static_cast( member )->DeepClone() ); + newGroup->AddItem( static_cast( member )->DeepClone() ); } else { @@ -86,16 +86,16 @@ GROUP* GROUP::DeepClone() const } -GROUP* GROUP::DeepDuplicate() const +PCB_GROUP* PCB_GROUP::DeepDuplicate() const { - GROUP* newGroup = static_cast( this->Duplicate() ); + PCB_GROUP* newGroup = static_cast( this->Duplicate() ); newGroup->m_items.clear(); for( auto member : m_items ) { if( member->Type() == PCB_GROUP_T ) { - newGroup->AddItem( static_cast( member )->DeepDuplicate() ); + newGroup->AddItem( static_cast( member )->DeepDuplicate() ); } else { @@ -107,32 +107,32 @@ GROUP* GROUP::DeepDuplicate() const } -void GROUP::SwapData( BOARD_ITEM* aImage ) +void PCB_GROUP::SwapData( BOARD_ITEM* aImage ) { assert( aImage->Type() == PCB_GROUP_T ); - std::swap( *( (GROUP*) this ), *( (GROUP*) aImage ) ); + std::swap( *( (PCB_GROUP*) this ), *( (PCB_GROUP*) aImage ) ); } #if 0 -void GROUP::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, +void PCB_GROUP::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue, int aError = ARC_LOW_DEF, bool ignoreLineWidth = false ) const { } -const BOX2I GROUP::ViewBBox() const +const BOX2I PCB_GROUP::ViewBBox() const { return GetBoundingBox(); } #endif -bool GROUP::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool PCB_GROUP::HitTest( const wxPoint& aPosition, int aAccuracy ) const { EDA_RECT rect = GetBoundingBox(); return rect.Inflate( aAccuracy ).Contains( aPosition ); } -bool GROUP::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const +bool PCB_GROUP::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const { EDA_RECT arect = aRect; arect.Inflate( aAccuracy ); @@ -158,7 +158,7 @@ bool GROUP::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) con } } -const EDA_RECT GROUP::GetBoundingBox() const +const EDA_RECT PCB_GROUP::GetBoundingBox() const { EDA_RECT area; bool isFirst = true; @@ -180,7 +180,7 @@ const EDA_RECT GROUP::GetBoundingBox() const return area; } -SEARCH_RESULT GROUP::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) +SEARCH_RESULT PCB_GROUP::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) { for( const KICAD_T* stype = scanTypes; *stype != EOT; ++stype ) { @@ -195,7 +195,7 @@ SEARCH_RESULT GROUP::Visit( INSPECTOR inspector, void* testData, const KICAD_T s return SEARCH_RESULT::CONTINUE; } -LSET GROUP::GetLayerSet() const +LSET PCB_GROUP::GetLayerSet() const { LSET aSet; @@ -206,9 +206,9 @@ LSET GROUP::GetLayerSet() const return aSet; } -void GROUP::ViewGetLayers( int aLayers[], int& aCount ) const +void PCB_GROUP::ViewGetLayers( int aLayers[], int& aCount ) const { - // What layer to put bounding box on? change in class_group.cpp + // What layer to put bounding box on? change in class_pcb_group.cpp std::unordered_set layers = { LAYER_ANCHOR }; // for bounding box for( BOARD_ITEM* item : m_items ) @@ -227,7 +227,7 @@ void GROUP::ViewGetLayers( int aLayers[], int& aCount ) const aLayers[i++] = layer; } -unsigned int GROUP::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const +unsigned int PCB_GROUP::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const { if( aView->IsLayerVisible( LAYER_ANCHOR ) ) return 0; @@ -235,13 +235,13 @@ unsigned int GROUP::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const return std::numeric_limits::max(); } -void GROUP::Move( const wxPoint& aMoveVector ) +void PCB_GROUP::Move( const wxPoint& aMoveVector ) { wxPoint newpos = GetPosition() + aMoveVector; SetPosition( newpos ); } -void GROUP::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PCB_GROUP::Rotate( const wxPoint& aRotCentre, double aAngle ) { for( BOARD_ITEM* item : m_items ) { @@ -249,7 +249,7 @@ void GROUP::Rotate( const wxPoint& aRotCentre, double aAngle ) } } -void GROUP::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void PCB_GROUP::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) { for( BOARD_ITEM* item : m_items ) { @@ -257,7 +257,7 @@ void GROUP::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) } } -wxString GROUP::GetSelectMenuText( EDA_UNITS aUnits ) const +wxString PCB_GROUP::GetSelectMenuText( EDA_UNITS aUnits ) const { if( m_name.empty() ) { @@ -266,19 +266,19 @@ wxString GROUP::GetSelectMenuText( EDA_UNITS aUnits ) const return wxString::Format( _( "Group \"%s\" with %ld members" ), m_name, m_items.size() ); } -BITMAP_DEF GROUP::GetMenuImage() const +BITMAP_DEF PCB_GROUP::GetMenuImage() const { return module_xpm; } -void GROUP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) +void PCB_GROUP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) { aList.emplace_back( _( "Group" ), m_name.empty() ? _( "Anonymous" ) : wxString::Format( _( "\"%s\"" ), m_name ), DARKCYAN ); aList.emplace_back( _( "Members" ), wxString::Format( _( "%ld" ), m_items.size() ), BROWN ); } -void GROUP::RunOnChildren( const std::function& aFunction ) +void PCB_GROUP::RunOnChildren( const std::function& aFunction ) { try { @@ -287,11 +287,11 @@ void GROUP::RunOnChildren( const std::function& aFunction ) } catch( std::bad_function_call& ) { - DisplayError( NULL, wxT( "Error running GROUP::RunOnChildren" ) ); + DisplayError( NULL, wxT( "Error running PCB_GROUP::RunOnChildren" ) ); } } -void GROUP::RunOnDescendants( const std::function& aFunction ) +void PCB_GROUP::RunOnDescendants( const std::function& aFunction ) { try { @@ -299,11 +299,11 @@ void GROUP::RunOnDescendants( const std::function& aFunctio { aFunction( item ); if( item->Type() == PCB_GROUP_T ) - static_cast( item )->RunOnDescendants( aFunction ); + static_cast( item )->RunOnDescendants( aFunction ); } } catch( std::bad_function_call& ) { - DisplayError( NULL, wxT( "Error running GROUP::RunOnDescendants" ) ); + DisplayError( NULL, wxT( "Error running PCB_GROUP::RunOnDescendants" ) ); } } diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index 515869300f..a113ad3555 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include // for KiROUND @@ -168,7 +168,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) { BOARD_ITEM* item = (BOARD_ITEM*) testItem; MODULE* module = nullptr; - GROUP* group = nullptr; + PCB_GROUP* group = nullptr; D_PAD* pad = nullptr; bool pad_through = false; VIA* via = nullptr; @@ -356,7 +356,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) break; case PCB_GROUP_T: - group = static_cast( item ); + group = static_cast( item ); break; case PCB_MARKER_T: diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index f9677a0f53..04479cdfb9 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -193,7 +193,7 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE } else if( item->Type() == PCB_GROUP_T ) { - copy = static_cast( item )->DeepClone(); + copy = static_cast( item )->DeepClone(); } else { @@ -219,8 +219,8 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE if( copy->Type() == PCB_GROUP_T ) { - static_cast( copy )->RunOnDescendants( prepItem ); - static_cast( copy )->RunOnDescendants( [&]( BOARD_ITEM* titem ) { + static_cast( copy )->RunOnDescendants( prepItem ); + static_cast( copy )->RunOnDescendants( [&]( BOARD_ITEM* titem ) { Format( titem, 1 ); } ); } diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 0900b775fc..7a54fdd067 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -456,7 +456,7 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const break; case PCB_GROUP_T: - format( static_cast( aItem ), aNestLevel ); + format( static_cast( aItem ), aNestLevel ); break; case PCB_TRACE_T: @@ -1517,7 +1517,7 @@ void PCB_IO::format( TEXTE_PCB* aText, int aNestLevel ) const } -void PCB_IO::format( GROUP* aGroup, int aNestLevel ) const +void PCB_IO::format( PCB_GROUP* aGroup, int aNestLevel ) const { m_out->Print( aNestLevel, "(group %s (id %s)\n", m_out->Quotew( aGroup->GetName() ).c_str(), TO_UTF8( aGroup->m_Uuid.AsString() ) ); diff --git a/pcbnew/kicad_plugin.h b/pcbnew/kicad_plugin.h index 9ba8ea7024..ce8f0e5afb 100644 --- a/pcbnew/kicad_plugin.h +++ b/pcbnew/kicad_plugin.h @@ -41,7 +41,7 @@ class DRAWSEGMENT; class PCB_TARGET; class D_PAD; class TEXTE_MODULE; -class GROUP; +class PCB_GROUP; class TRACK; class ZONE_CONTAINER; class TEXTE_PCB; @@ -244,7 +244,7 @@ private: void format( EDGE_MODULE* aModuleDrawing, int aNestLevel = 0 ) const; - void format( GROUP* aGroup, int aNestLevel = 0 ) const; + void format( PCB_GROUP* aGroup, int aNestLevel = 0 ) const; void format( DRAWSEGMENT* aSegment, int aNestLevel = 0 ) const; diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 93c66c785e..426a27dd2d 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -189,7 +189,7 @@ void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem ) } else if( lastItem->Type() == PCB_GROUP_T ) { - static_cast( lastItem )->RunOnChildren( [&] ( BOARD_ITEM* child ) + static_cast( lastItem )->RunOnChildren( [&] ( BOARD_ITEM* child ) { child->ClearBrightened(); }); @@ -213,7 +213,7 @@ void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem ) } else if( aItem->Type() == PCB_GROUP_T ) { - static_cast( aItem )->RunOnChildren( [&] ( BOARD_ITEM* child ) + static_cast( aItem )->RunOnChildren( [&] ( BOARD_ITEM* child ) { child->SetBrightened(); }); diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index d9cc95bcb6..ff85891780 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -414,7 +414,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) break; case PCB_GROUP_T: - draw( static_cast( item ), aLayer ); + draw( static_cast( item ), aLayer ); break; case PCB_ZONE_AREA_T: @@ -1156,7 +1156,7 @@ void PCB_PAINTER::draw( const MODULE* aModule, int aLayer ) } -void PCB_PAINTER::draw( const GROUP* aGroup, int aLayer ) +void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer ) { if( aLayer == LAYER_ANCHOR ) { diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index 9a4cde0843..114269cae3 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -42,7 +42,7 @@ class VIA; class TRACK; class D_PAD; class DRAWSEGMENT; -class GROUP; +class PCB_GROUP; class MODULE; class ZONE_CONTAINER; class TEXTE_PCB; @@ -304,7 +304,7 @@ protected: void draw( const TEXTE_PCB* aText, int aLayer ); void draw( const TEXTE_MODULE* aText, int aLayer ); void draw( const MODULE* aModule, int aLayer ); - void draw( const GROUP* aGroup, int aLayer ); + void draw( const PCB_GROUP* aGroup, int aLayer ); void draw( const ZONE_CONTAINER* aZone, int aLayer ); void draw( const DIMENSION* aDimension, int aLayer ); void draw( const PCB_TARGET* aTarget ); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 7c45a4d858..79383f16b7 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -723,7 +723,7 @@ BOARD* PCB_PARSER::parseBOARD_unchecked() for( size_t idx = 0; idx < m_groupInfos.size(); idx++ ) { auto& aGrp = m_groupInfos[idx]; - GROUP* group = new GROUP( m_board ); + PCB_GROUP* group = new PCB_GROUP( m_board ); group->SetName( aGrp.name ); const_cast( group->m_Uuid ) = aGrp.uuid; m_board->Add( group ); @@ -742,7 +742,7 @@ BOARD* PCB_PARSER::parseBOARD_unchecked() continue; } - GROUP* group = static_cast( bItem ); + PCB_GROUP* group = static_cast( bItem ); for( const auto& aUuid : aGrp.memberUuids ) { @@ -3664,7 +3664,7 @@ bool PCB_PARSER::parseD_PAD_option( D_PAD* aPad ) void PCB_PARSER::parseGROUP() { wxCHECK_RET( CurTok() == T_group, - wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as GROUP." ) ); + wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_GROUP." ) ); wxPoint pt; T token; diff --git a/pcbnew/pcb_parser.h b/pcbnew/pcb_parser.h index 0053f4dd2d..c8d0b7226d 100644 --- a/pcbnew/pcb_parser.h +++ b/pcbnew/pcb_parser.h @@ -53,7 +53,7 @@ class TEXTE_MODULE; class TEXTE_PCB; class TRACK; class MODULE; -class GROUP; +class PCB_GROUP; class PCB_TARGET; class VIA; class ZONE_CONTAINER; diff --git a/pcbnew/pcb_view.cpp b/pcbnew/pcb_view.cpp index 13413eb016..dcf04f16b5 100644 --- a/pcbnew/pcb_view.cpp +++ b/pcbnew/pcb_view.cpp @@ -31,7 +31,7 @@ using namespace std::placeholders; #include #include -#include +#include #include namespace KIGFX { diff --git a/pcbnew/swig/board_item.i b/pcbnew/swig/board_item.i index 37161fc852..39c0f8f020 100644 --- a/pcbnew/swig/board_item.i +++ b/pcbnew/swig/board_item.i @@ -50,7 +50,7 @@ class TEXTE_PCB; class DIMENSION; class MODULE; -class GROUP; +class PCB_GROUP; class TEXTE_MODULE; class DRAWSEGMENT; class MARKER_PCB; @@ -71,7 +71,7 @@ extern "C" { static TEXTE_PCB* Cast_to_TEXTE_PCB( BOARD_ITEM* ); static DIMENSION* Cast_to_DIMENSION( BOARD_ITEM* ); static MODULE* Cast_to_MODULE( BOARD_ITEM* ); -static GROUP* Cast_to_GROUP( BOARD_ITEM* ); +static PCB_GROUP* Cast_to_PCB_GROUP( BOARD_ITEM* ); static TEXTE_MODULE* Cast_to_TEXTE_MODULE( BOARD_ITEM* ); static DRAWSEGMENT* Cast_to_DRAWSEGMENT( BOARD_ITEM* ); static MARKER_PCB* Cast_to_MARKER_PCB( BOARD_ITEM* ); @@ -92,7 +92,7 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); static TEXTE_PCB* Cast_to_TEXTE_PCB( BOARD_ITEM* ); static DIMENSION* Cast_to_DIMENSION( BOARD_ITEM* ); static MODULE* Cast_to_MODULE( BOARD_ITEM* ); -static GROUP* Cast_to_GROUP( BOARD_ITEM* ); +static PCB_GROUP* Cast_to_PCB_GROUP( BOARD_ITEM* ); static TEXTE_MODULE* Cast_to_TEXTE_MODULE( BOARD_ITEM* ); static DRAWSEGMENT* Cast_to_DRAWSEGMENT( BOARD_ITEM* ); static MARKER_PCB* Cast_to_MARKER_PCB( BOARD_ITEM* ); @@ -125,8 +125,8 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); return Cast_to_EDGE_MODULE(self) elif ct=="MODULE": return Cast_to_MODULE(self) - elif ct=="GROUP": - return Cast_to_GROUP(self) + elif ct=="PCB_GROUP": + return Cast_to_PCB_GROUP(self) elif ct=="PAD": return Cast_to_D_PAD(self) elif ct=="MTEXT": @@ -170,7 +170,7 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); static TEXTE_PCB* Cast_to_TEXTE_PCB( BOARD_ITEM* self ) { return dynamic_cast(self); } static DIMENSION* Cast_to_DIMENSION( BOARD_ITEM* self ) { return dynamic_cast(self); } static MODULE* Cast_to_MODULE( BOARD_ITEM* self ) { return dynamic_cast(self); } -static GROUP* Cast_to_GROUP( BOARD_ITEM* self ) { return dynamic_cast(self); } +static PCB_GROUP* Cast_to_PCB_GROUP( BOARD_ITEM* self ) { return dynamic_cast(self); } static TEXTE_MODULE* Cast_to_TEXTE_MODULE( BOARD_ITEM* self ) { return dynamic_cast(self); } static DRAWSEGMENT* Cast_to_DRAWSEGMENT( BOARD_ITEM* self ) { return dynamic_cast(self); } static MARKER_PCB* Cast_to_MARKER_PCB( BOARD_ITEM* self ) { return dynamic_cast(self); } diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index a4464604f8..a09fed41e8 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -477,7 +477,7 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference ) // If moving a group, record position of all the descendants for undo if( item->Type() == PCB_GROUP_T ) { - static_cast( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { + static_cast( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { m_commit->Modify( bItem ); }); } @@ -770,7 +770,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) // If rotating a group, record position of all the descendants for undo if( item->Type() == PCB_GROUP_T ) { - static_cast( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { + static_cast( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { m_commit->Modify( bItem ); }); } @@ -973,7 +973,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent ) if( item->Type() == PCB_GROUP_T ) { - static_cast( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { + static_cast( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { m_commit->Modify( bItem ); }); } @@ -1160,7 +1160,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent ) m_commit->Remove( item ); removed.Add( item ); - static_cast( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { + static_cast( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { m_commit->Remove( bItem ); }); } @@ -1178,7 +1178,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent ) // removed in their entirety and so no empty group could remain. If entered // group is set, then we could be removing all items of the entered group, // in which case we need to remove the group itself. - GROUP* enteredGroup = m_selectionTool->GetEnteredGroup(); + PCB_GROUP* enteredGroup = m_selectionTool->GetEnteredGroup(); if( enteredGroup != nullptr ) { @@ -1280,7 +1280,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent ) if( item->Type() == PCB_GROUP_T ) { - static_cast( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { + static_cast( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { m_commit->Modify( bItem ); }); } @@ -1398,7 +1398,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) break; case PCB_GROUP_T: - dupe_item = static_cast( orig_item )->DeepDuplicate(); + dupe_item = static_cast( orig_item )->DeepDuplicate(); break; default: @@ -1411,7 +1411,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) { if( dupe_item->Type() == PCB_GROUP_T ) { - static_cast( dupe_item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { + static_cast( dupe_item )->RunOnDescendants( [&]( BOARD_ITEM* bItem ) { m_commit->Add( bItem ); }); } diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 033a0a332c..1620c49525 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -1031,7 +1031,7 @@ int PCB_EDITOR_CONTROL::GroupSelected( const TOOL_EVENT& aEvent ) m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true ); // why don't we have to update the selection after selectionCursor action? - GROUP* group = new GROUP( board ); + PCB_GROUP* group = new PCB_GROUP( board ); for( EDA_ITEM* item : selection ) { @@ -1071,7 +1071,7 @@ int PCB_EDITOR_CONTROL::GroupMergeSelected( const TOOL_EVENT& aEvent ) m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true ); // why don't we have to update the selection after selectionCursor action? - GROUP* firstGroup = NULL; + PCB_GROUP* firstGroup = NULL; for( EDA_ITEM* item : selection ) { @@ -1079,7 +1079,7 @@ int PCB_EDITOR_CONTROL::GroupMergeSelected( const TOOL_EVENT& aEvent ) if( firstGroup == NULL && board_item->Type() == PCB_GROUP_T ) { - firstGroup = static_cast( board_item ); + firstGroup = static_cast( board_item ); break; } } @@ -1139,7 +1139,7 @@ int PCB_EDITOR_CONTROL::UngroupSelected( const TOOL_EVENT& aEvent ) commit.Remove( board_item ); - for( BOARD_ITEM* bItem : static_cast( board_item )->GetItems() ) + for( BOARD_ITEM* bItem : static_cast( board_item )->GetItems() ) { ungroupedItems.insert( bItem ); } @@ -1213,22 +1213,22 @@ int PCB_EDITOR_CONTROL::GroupFlattenSelected( const TOOL_EVENT& aEvent ) BOARD_ITEM* board_item = static_cast( item ); wxCHECK_MSG( board_item->Type() == PCB_GROUP_T, 0, _( "Selection for ungroup should only have groups in it - was checked." ) ); - std::queue groupsToFlatten; - groupsToFlatten.push( static_cast( board_item ) ); - GROUP* topGroup = groupsToFlatten.front(); + std::queue groupsToFlatten; + groupsToFlatten.push( static_cast( board_item ) ); + PCB_GROUP* topGroup = groupsToFlatten.front(); commit.Modify( topGroup ); std::unordered_set topSubgroupsToRemove; while( !groupsToFlatten.empty() ) { - GROUP* grp = groupsToFlatten.front(); + PCB_GROUP* grp = groupsToFlatten.front(); groupsToFlatten.pop(); for( BOARD_ITEM* grpItem : grp->GetItems() ) { if( grpItem->Type() == PCB_GROUP_T ) { - groupsToFlatten.push( static_cast( grpItem ) ); + groupsToFlatten.push( static_cast( grpItem ) ); commit.Remove( grpItem ); if( grp == topGroup ) topSubgroupsToRemove.insert( grpItem ); diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index d7d17412b8..90adaa23aa 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -866,16 +866,16 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector& aItems, bool aIsN // Filter out from selection any items that are in groups that are also in the selection // For PCB_GROUP_T, a selection including the group should not include its descendants. - std::unordered_set groups; + std::unordered_set groups; for( BOARD_ITEM* item : aItems ) { if( item->Type() == PCB_GROUP_T ) - groups.insert( static_cast( item ) ); + groups.insert( static_cast( item ) ); } for( BOARD_ITEM* item : aItems ) { bool inGroup = false; - for( GROUP* grp : groups ) + for( PCB_GROUP* grp : groups ) { if( grp->GetItems().find( item ) != grp->GetItems().end() ) { diff --git a/pcbnew/tools/pcbnew_selection.cpp b/pcbnew/tools/pcbnew_selection.cpp index e854c8af95..d1e9f9dfdb 100644 --- a/pcbnew/tools/pcbnew_selection.cpp +++ b/pcbnew/tools/pcbnew_selection.cpp @@ -104,7 +104,7 @@ const KIGFX::VIEW_GROUP::ITEMS PCBNEW_SELECTION::updateDrawList() const } else if( item->Type() == PCB_GROUP_T ) { - GROUP* group = static_cast( item ); + PCB_GROUP* group = static_cast( item ); group->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { addItem( bitem ); } ); } }; @@ -125,7 +125,7 @@ const KIGFX::VIEW_GROUP::ITEMS PCBNEW_SELECTION::updateDrawList() const } else if( item->Type() == PCB_GROUP_T ) { - GROUP* group = static_cast( item ); + PCB_GROUP* group = static_cast( item ); group->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { items.push_back( bitem ); } ); } } diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index ffc63f9aa8..624f47e356 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -347,7 +347,7 @@ void SELECTION_TOOL::EnterGroup() { wxCHECK_RET( m_selection.GetSize() == 1 && m_selection[0]->Type() == PCB_GROUP_T, _( "EnterGroup called when selection is not a single group") ); - GROUP* aGroup = static_cast( m_selection[0] ); + PCB_GROUP* aGroup = static_cast( m_selection[0] ); if( m_enteredGroup != NULL ) { @@ -1938,7 +1938,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn case PCB_GROUP_T: { - GROUP* group = const_cast( static_cast( aItem ) ); + PCB_GROUP* group = const_cast( static_cast( aItem ) ); // Similar to logic for module, a group is selectable if any of its // members are. (This recurses) @@ -2035,7 +2035,7 @@ void SELECTION_TOOL::highlightInternal( BOARD_ITEM* aItem, int aMode, PCBNEW_SEL } else if( aItem->Type() == PCB_GROUP_T ) { - static_cast( aItem )->RunOnChildren( [&]( BOARD_ITEM* titem ) { + static_cast( aItem )->RunOnChildren( [&]( BOARD_ITEM* titem ) { highlightInternal( titem, aMode, aGroup, true ); } ); } } @@ -2085,7 +2085,7 @@ void SELECTION_TOOL::unhighlightInternal( BOARD_ITEM* aItem, int aMode, PCBNEW_S } else if( aItem->Type() == PCB_GROUP_T ) { - static_cast( aItem )->RunOnChildren( [&]( BOARD_ITEM* titem ) { + static_cast( aItem )->RunOnChildren( [&]( BOARD_ITEM* titem ) { unhighlightInternal( titem, aMode, aGroup, true ); } ); } } @@ -2536,7 +2536,7 @@ void SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) c // If any element is a member of a group, replace those elements with the top containing group. for( int j = 0; j < aCollector.GetCount(); ++j ) { - GROUP* aTop = board()->TopLevelGroup( aCollector[j], m_enteredGroup ); + PCB_GROUP* aTop = board()->TopLevelGroup( aCollector[j], m_enteredGroup ); if( aTop != NULL ) { diff --git a/pcbnew/tools/selection_tool.h b/pcbnew/tools/selection_tool.h index 27e9abf6a8..7dcc10ef60 100644 --- a/pcbnew/tools/selection_tool.h +++ b/pcbnew/tools/selection_tool.h @@ -185,7 +185,7 @@ public: void exitGroup(); void FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) const; - GROUP* GetEnteredGroup() { return m_enteredGroup; } + PCB_GROUP* GetEnteredGroup() { return m_enteredGroup; } private: /** @@ -370,7 +370,7 @@ private: bool m_multiple; // Multiple selection mode is active bool m_skip_heuristics; // Heuristics are not allowed when choosing item under cursor bool m_locked; // Other tools are not allowed to modify locked items - GROUP* m_enteredGroup; // If non-null, selections are limited to members of this group + PCB_GROUP* m_enteredGroup; // If non-null, selections are limited to members of this group /// Private state (opaque pointer/compilation firewall) class PRIV; diff --git a/qa/pcbnew/group_saveload.cpp b/qa/pcbnew/group_saveload.cpp index 440ac96264..41106b9816 100644 --- a/qa/pcbnew/group_saveload.cpp +++ b/qa/pcbnew/group_saveload.cpp @@ -66,13 +66,13 @@ enum ItemType BOARD* createBoard( const std::vector>& spec ) { BOARD* aBoard = new BOARD(); - std::vector groups; + std::vector groups; std::vector textItems; // Create groups for( int idx = 0; idx < 6; idx++ ) { - GROUP* gr = new GROUP( aBoard ); + PCB_GROUP* gr = new PCB_GROUP( aBoard ); if( idx >= ( NAME_GROUP3 - GROUP0 ) ) { wxString name = wxString::Format( @@ -99,7 +99,7 @@ BOARD* createBoard( const std::vector>& spec ) for( int groupIdx = 0; groupIdx < spec.size(); groupIdx++ ) { auto& groupSpec = spec[groupIdx]; - GROUP* group = groups[groupIdx]; + PCB_GROUP* group = groups[groupIdx]; int count = 0; for( ItemType item : groupSpec ) { @@ -123,7 +123,7 @@ BOARD* createBoard( const std::vector>& spec ) } // Check if two groups are identical by comparing the fields (by Uuid). -void testGroupEqual( const GROUP& group1, const GROUP& group2 ) +void testGroupEqual( const PCB_GROUP& group1, const PCB_GROUP& group2 ) { BOOST_CHECK_EQUAL( group1.m_Uuid.AsString(), group2.m_Uuid.AsString() ); BOOST_CHECK_EQUAL( group1.GetName(), group2.GetName() );