Intersheet refs don't go in the view themselves.

(Their parents draw them.)

Also simplifies a couple of loops by using OfType().

Fixes https://gitlab.com/kicad/code/kicad/issues/7805
This commit is contained in:
Jeff Young 2021-03-19 16:13:22 +00:00
parent 6c3b02aabe
commit e560de496c
1 changed files with 10 additions and 20 deletions

View File

@ -1343,9 +1343,7 @@ void SCH_EDIT_FRAME::RecomputeIntersheetRefs()
bool show = Schematic().Settings().m_IntersheetRefsShow;
/* Refresh all global labels */
for( EDA_ITEM* item : GetScreen()->Items() )
{
if( item->Type() == SCH_GLOBAL_LABEL_T )
for( EDA_ITEM* item : GetScreen()->Items().OfType( SCH_GLOBAL_LABEL_T ) )
{
SCH_GLOBALLABEL* global = static_cast<SCH_GLOBALLABEL*>( item );
@ -1354,7 +1352,6 @@ void SCH_EDIT_FRAME::RecomputeIntersheetRefs()
if( show )
GetCanvas()->GetView()->Update( global );
}
}
}
@ -1367,20 +1364,13 @@ void SCH_EDIT_FRAME::ShowAllIntersheetRefs( bool aShow )
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
for( SCH_ITEM* item : screen->Items() )
{
if( item->Type() == SCH_GLOBAL_LABEL_T )
for( SCH_ITEM* item : screen->Items().OfType( SCH_GLOBAL_LABEL_T ) )
{
SCH_GLOBALLABEL* gLabel = (SCH_GLOBALLABEL*)( item );
SCH_FIELD* intersheetRef = gLabel->GetIntersheetRefs();
intersheetRef->SetVisible( aShow );
if( aShow )
AddToScreen( intersheetRef, screen );
else
RemoveFromScreen( intersheetRef, screen );
}
UpdateItem( intersheetRef, true );
}
}
}