From 8dfd297ee2ce42ae40055fddc3a9dd2778c2c03e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 25 Jan 2021 00:55:01 +0000 Subject: [PATCH] Show all pages for intersheet refs, and use IDs in hypertext menu. Fixes https://gitlab.com/kicad/code/kicad/issues/7253 --- eeschema/sch_field.cpp | 16 ++++++++-------- eeschema/sch_text.cpp | 5 ----- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 803888bf56..abd162d8a0 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -477,22 +477,22 @@ void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) sheetNames[ sheet.GetPageNumber() ] = sheet.Last()->GetName(); } - for( const wxString& pageNo : pageListCopy ) + for( int i = 0; i < (int) pageListCopy.size(); ++i ) { - menu.Append( -1, wxString::Format( _( "Go to Page %s (%s)" ), - pageNo, - sheetNames[ pageNo ] ) ); + menu.Append( i, wxString::Format( _( "Go to Page %s (%s)" ), + pageListCopy[i], + sheetNames[ pageListCopy[i] ] ) ); } menu.AppendSeparator(); - menu.Append( -1, _( "Back" ) ); + menu.Append( 999, _( "Back" ) ); int sel = aFrame->GetPopupMenuSelectionFromUser( menu ); void* param = nullptr; - if( sel >= 1 && sel <= (int) pageListCopy.size() ) - param = (void*) &pageListCopy[ sel - 1 ]; - else if( sel == (int) pageListCopy.size() ) + if( sel >= 0 && sel < (int) pageListCopy.size() ) + param = (void*) &pageListCopy[ sel ]; + else if( sel == 999 ) param = (void*) &back; if( param ) diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 206da69370..8d36137cb6 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -1126,11 +1126,6 @@ bool SCH_GLOBALLABEL::ResolveTextVar( wxString* token, int aDepth ) const pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() ); std::sort( pageListCopy.begin(), pageListCopy.end() ); - wxString currentPage = Schematic()->CurrentSheet().GetPageNumber(); - pageListCopy.erase( std::remove( pageListCopy.begin(), - pageListCopy.end(), - currentPage ), pageListCopy.end() ); - token->Printf( "%s", settings.m_IntersheetRefsPrefix ); if( ( settings.m_IntersheetRefsFormatShort ) && ( pageListCopy.size() > 2 ) )