Eeschema: Add protections to eeschema rtree
Prevents items from being mistakenly added to the tree that should not be tracked in the tree.
This commit is contained in:
parent
84a697060f
commit
b8920a9f5a
|
@ -174,8 +174,11 @@ void SCH_SCREEN::DecRefCount()
|
||||||
|
|
||||||
void SCH_SCREEN::Append( SCH_ITEM* aItem )
|
void SCH_SCREEN::Append( SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
m_rtree.insert( aItem );
|
if( aItem->Type() != SCH_SHEET_PIN_T && aItem->Type() != SCH_FIELD_T )
|
||||||
--m_modification_sync;
|
{
|
||||||
|
m_rtree.insert( aItem );
|
||||||
|
--m_modification_sync;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,9 +189,8 @@ void SCH_SCREEN::Append( SCH_SCREEN* aScreen )
|
||||||
// No need to descend the hierarchy. Once the top level screen is copied, all of it's
|
// No need to descend the hierarchy. Once the top level screen is copied, all of it's
|
||||||
// children are copied as well.
|
// children are copied as well.
|
||||||
for( auto aItem : aScreen->m_rtree )
|
for( auto aItem : aScreen->m_rtree )
|
||||||
m_rtree.insert( aItem );
|
Append( aItem );
|
||||||
|
|
||||||
--m_modification_sync;
|
|
||||||
aScreen->Clear( false );
|
aScreen->Clear( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,14 +229,14 @@ void SCH_SCREEN::FreeDrawList()
|
||||||
|
|
||||||
void SCH_SCREEN::Update( SCH_ITEM* aItem )
|
void SCH_SCREEN::Update( SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
Remove( aItem );
|
if( Remove( aItem ) )
|
||||||
Append( aItem );
|
Append( aItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SCREEN::Remove( SCH_ITEM* aItem )
|
bool SCH_SCREEN::Remove( SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
m_rtree.remove( aItem );
|
return m_rtree.remove( aItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -260,8 +260,9 @@ public:
|
||||||
*
|
*
|
||||||
* @note The removed item is not deleted. It is only unlinked from the item list.
|
* @note The removed item is not deleted. It is only unlinked from the item list.
|
||||||
* @param aItem Item to be removed from schematic.
|
* @param aItem Item to be removed from schematic.
|
||||||
|
* @return True if we successfully removed the item
|
||||||
*/
|
*/
|
||||||
void Remove( SCH_ITEM* aItem );
|
bool Remove( SCH_ITEM* aItem );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates \a aItem's bounding box in the tree
|
* Updates \a aItem's bounding box in the tree
|
||||||
|
|
Loading…
Reference in New Issue