From f9b3f14dfaf49a17cdef13f9fad4e8a99d4fd74f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 3 Dec 2022 14:17:15 +0000 Subject: [PATCH] Bring intersheet refs in line with schematic setting when changing sheets. Fixes https://gitlab.com/kicad/code/kicad/issues/13061 --- eeschema/sch_sheet_path.cpp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 16c65e614b..84186f346a 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -323,22 +324,33 @@ wxString SCH_SHEET_PATH::PathHumanReadable( bool aUseShortRootName ) const void SCH_SHEET_PATH::UpdateAllScreenReferences() const { - std::vector symbols; + std::vector items; - std::copy_if( LastScreen()->Items().begin(), - LastScreen()->Items().end(), - std::back_inserter( symbols ), + std::copy_if( LastScreen()->Items().begin(), LastScreen()->Items().end(), + std::back_inserter( items ), []( SCH_ITEM* aItem ) { - return ( aItem->Type() == SCH_SYMBOL_T ); + return ( aItem->Type() == SCH_SYMBOL_T || aItem->Type() == SCH_GLOBAL_LABEL_T ); } ); - for( SCH_ITEM* item : symbols ) + for( SCH_ITEM* item : items ) { - SCH_SYMBOL* symbol = static_cast( item ); - symbol->GetField( REFERENCE_FIELD )->SetText( symbol->GetRef( this ) ); - symbol->UpdateUnit( symbol->GetUnitSelection( this ) ); - LastScreen()->Update( item ); + if( item->Type() == SCH_SYMBOL_T ) + { + SCH_SYMBOL* symbol = static_cast( item ); + + symbol->GetField( REFERENCE_FIELD )->SetText( symbol->GetRef( this ) ); + symbol->UpdateUnit( symbol->GetUnitSelection( this ) ); + LastScreen()->Update( item ); + } + else if( item->Type() == SCH_GLOBAL_LABEL_T ) + { + SCH_GLOBALLABEL* label = static_cast( item ); + SCH_FIELD& intersheetRefs = label->GetFields()[0]; + + intersheetRefs.SetVisible( label->Schematic()->Settings().m_IntersheetRefsShow ); + LastScreen()->Update( &intersheetRefs ); + } } }