Show all pages for intersheet refs, and use IDs in hypertext menu.

Fixes https://gitlab.com/kicad/code/kicad/issues/7253
This commit is contained in:
Jeff Young 2021-01-25 00:55:01 +00:00
parent 0a1a5ea669
commit 8dfd297ee2
2 changed files with 8 additions and 13 deletions

View File

@ -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 )

View File

@ -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 ) )