From 51bcfaafd7da1f9e67c65f0de3705593c2956b76 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Fri, 22 Jul 2022 23:02:05 -0400 Subject: [PATCH] start moving to virtual page numbers --- eeschema/sch_edit_frame.cpp | 16 ++++++++-------- eeschema/sch_field.cpp | 8 ++++---- eeschema/schematic.h | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index d3f85c16f6..ef76f22109 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -1509,23 +1509,23 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags ) void SCH_EDIT_FRAME::RecomputeIntersheetRefs() { - std::map>& pageRefsMap = Schematic().GetPageRefsMap(); + std::map>& pageRefsMap = Schematic().GetPageRefsMap(); pageRefsMap.clear(); - SCH_SCREENS screens( Schematic().Root() ); - std::vector pageNumbers; + SCH_SCREENS screens( Schematic().Root() ); + std::vector virtualPageNumbers; /* Iterate over screens */ for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() ) { - pageNumbers.clear(); + virtualPageNumbers.clear(); /* Find in which sheets this screen is used */ for( const SCH_SHEET_PATH& sheet : Schematic().GetSheets() ) { if( sheet.LastScreen() == screen ) - pageNumbers.push_back( sheet.GetPageNumber() ); + virtualPageNumbers.push_back( sheet.GetVirtualPageNumber() ); } for( SCH_ITEM* item : screen->Items() ) @@ -1533,10 +1533,10 @@ void SCH_EDIT_FRAME::RecomputeIntersheetRefs() if( item->Type() == SCH_GLOBAL_LABEL_T ) { SCH_GLOBALLABEL* globalLabel = static_cast( item ); - std::set& pageList = pageRefsMap[ globalLabel->GetText() ]; + std::set& virtualpageList = pageRefsMap[ globalLabel->GetText() ]; - for( const wxString& pageNo : pageNumbers ) - pageList.insert( pageNo ); + for( const int& pageNo : virtualPageNumbers ) + virtualpageList.insert( pageNo ); } } } diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index b01c71d0eb..6049849f3f 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -750,8 +750,8 @@ void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) const if( it != Schematic()->GetPageRefsMap().end() ) { - std::map sheetNames; - std::vector pageListCopy; + std::map sheetNames; + std::vector pageListCopy; pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() ); if( !Schematic()->Settings().m_IntersheetRefsListOwnPage ) @@ -772,9 +772,9 @@ void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) const for( const SCH_SHEET_PATH& sheet : Schematic()->GetSheets() ) { if( sheet.size() == 1 ) - sheetNames[ sheet.GetPageNumber() ] = _( "" ); + sheetNames[ sheet.GetVirtualPageNumber() ] = _( "" ); else - sheetNames[ sheet.GetPageNumber() ] = sheet.Last()->GetName(); + sheetNames[sheet.GetVirtualPageNumber()] = sheet.Last()->GetName(); } for( int i = 0; i < (int) pageListCopy.size(); ++i ) diff --git a/eeschema/schematic.h b/eeschema/schematic.h index a76c59a523..7dde3d71e5 100644 --- a/eeschema/schematic.h +++ b/eeschema/schematic.h @@ -159,7 +159,7 @@ public: */ bool ResolveCrossReference( wxString* token, int aDepth ) const; - std::map>& GetPageRefsMap() { return m_labelToPageRefsMap; } + std::map>& GetPageRefsMap() { return m_labelToPageRefsMap; } wxString ConvertRefsToKIIDs( const wxString& aSource ) const; wxString ConvertKIIDsToRefs( const wxString& aSource ) const; @@ -202,10 +202,10 @@ private: CONNECTION_GRAPH* m_connectionGraph; /** - * Holds a map of labels to the page numbers that they appear on. Used to update global - * label intersheet references. + * Holds a map of labels to the page sequence (virtual page number) that they appear on. It is + * used for updating global label intersheet references. */ - std::map> m_labelToPageRefsMap; + std::map> m_labelToPageRefsMap; }; #endif