Rename the ITEM_SET types to be descriptive of their contents
Now that we have one set type for BOARD_ITEMs and another for SCH_ITEMs it is better to explictly say if they are board or schematic sets.
This commit is contained in:
parent
abdd1906c2
commit
8bd77c4fe7
|
@ -175,7 +175,7 @@ NETCLASSPTR SCH_ITEM::NetClass() const
|
|||
}
|
||||
|
||||
|
||||
ITEM_SET& SCH_ITEM::ConnectedItems( const SCH_SHEET_PATH& aSheet )
|
||||
SCH_ITEM_SET& SCH_ITEM::ConnectedItems( const SCH_SHEET_PATH& aSheet )
|
||||
{
|
||||
return m_connected_items[ aSheet ];
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
typedef std::unordered_set<SCH_ITEM*> ITEM_SET;
|
||||
typedef std::unordered_set<SCH_ITEM*> SCH_ITEM_SET;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -203,7 +203,7 @@ protected:
|
|||
// to store a initial pos of the item or mouse cursor
|
||||
|
||||
/// Stores pointers to other items that are connected to this one, per sheet
|
||||
std::unordered_map<SCH_SHEET_PATH, ITEM_SET> m_connected_items;
|
||||
std::unordered_map<SCH_SHEET_PATH, SCH_ITEM_SET> m_connected_items;
|
||||
|
||||
/// Stores connectivity information, per sheet
|
||||
std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
|
||||
|
@ -411,7 +411,7 @@ public:
|
|||
/**
|
||||
* Retrieves the set of items connected to this item on the given sheet
|
||||
*/
|
||||
ITEM_SET& ConnectedItems( const SCH_SHEET_PATH& aPath );
|
||||
SCH_ITEM_SET& ConnectedItems( const SCH_SHEET_PATH& aPath );
|
||||
|
||||
/**
|
||||
* Adds a connection link between this item and another
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace KIGFX
|
|||
class VIEW;
|
||||
}
|
||||
|
||||
typedef std::unordered_set<BOARD_ITEM*> ITEM_SET;
|
||||
typedef std::unordered_set<BOARD_ITEM*> BOARD_ITEM_SET;
|
||||
|
||||
/**
|
||||
* PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
return m_name;
|
||||
}
|
||||
|
||||
const ITEM_SET& GetItems() const
|
||||
const BOARD_ITEM_SET& GetItems() const
|
||||
{
|
||||
return m_items;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ public:
|
|||
|
||||
private:
|
||||
// Members of the group
|
||||
ITEM_SET m_items;
|
||||
BOARD_ITEM_SET m_items;
|
||||
|
||||
// Optional group name
|
||||
wxString m_name;
|
||||
|
|
|
@ -2185,10 +2185,10 @@ BOARD::GroupLegalOpsField BOARD::GroupLegalOps( const PCBNEW_SELECTION& selectio
|
|||
void BOARD::GroupRemoveItems( const PCBNEW_SELECTION& selection, BOARD_COMMIT* commit )
|
||||
{
|
||||
std::unordered_set<BOARD_ITEM*> emptyGroups;
|
||||
std::unordered_set<PCB_GROUP*> emptyGroupParents;
|
||||
std::unordered_set<PCB_GROUP*> emptyGroupParents;
|
||||
|
||||
// groups who have had children removed, either items or empty groups.
|
||||
std::unordered_set<PCB_GROUP*> itemParents;
|
||||
std::unordered_set<PCB_GROUP*> itemParents;
|
||||
std::unordered_set<BOARD_ITEM*> itemsToRemove;
|
||||
|
||||
for( EDA_ITEM* item : selection )
|
||||
|
@ -2211,7 +2211,9 @@ void BOARD::GroupRemoveItems( const PCBNEW_SELECTION& selection, BOARD_COMMIT* c
|
|||
{
|
||||
if( ( itemsToRemove.find( grpItem ) == itemsToRemove.end() )
|
||||
&& ( emptyGroups.find( grpItem ) == emptyGroups.end() ) )
|
||||
{
|
||||
allRemoved = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( allRemoved )
|
||||
|
@ -2236,7 +2238,7 @@ void BOARD::GroupRemoveItems( const PCBNEW_SELECTION& selection, BOARD_COMMIT* c
|
|||
if( emptyGroups.find( grp ) == emptyGroups.end() )
|
||||
{
|
||||
commit->Modify( grp );
|
||||
ITEM_SET members = grp->GetItems();
|
||||
BOARD_ITEM_SET members = grp->GetItems();
|
||||
bool removedSomething = false;
|
||||
|
||||
for( BOARD_ITEM* member : members )
|
||||
|
@ -2248,13 +2250,11 @@ void BOARD::GroupRemoveItems( const PCBNEW_SELECTION& selection, BOARD_COMMIT* c
|
|||
removedSomething = true;
|
||||
}
|
||||
}
|
||||
|
||||
wxCHECK_RET( removedSomething, "Item to be removed not found in it's parent group" );
|
||||
}
|
||||
}
|
||||
|
||||
for( BOARD_ITEM* grp : emptyGroups )
|
||||
{
|
||||
commit->Remove( grp );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue