Mac doesn't like menus that start with ID 0.

Fixes https://gitlab.com/kicad/code/kicad/issues/7845
This commit is contained in:
Jeff Young 2021-03-09 11:16:47 +00:00
parent ae15098a5d
commit 3c8e35249c
1 changed files with 6 additions and 4 deletions

View File

@ -453,6 +453,8 @@ wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame )
{ {
constexpr int START_ID = 1;
static wxString back = "HYPERTEXT_BACK"; static wxString back = "HYPERTEXT_BACK";
wxMenu menu; wxMenu menu;
SCH_TEXT* label = dynamic_cast<SCH_TEXT*>( m_parent ); SCH_TEXT* label = dynamic_cast<SCH_TEXT*>( m_parent );
@ -490,15 +492,15 @@ void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame )
for( int i = 0; i < (int) pageListCopy.size(); ++i ) for( int i = 0; i < (int) pageListCopy.size(); ++i )
{ {
menu.Append( i, wxString::Format( _( "Go to Page %s (%s)" ), menu.Append( i + START_ID, wxString::Format( _( "Go to Page %s (%s)" ),
pageListCopy[i], pageListCopy[i],
sheetNames[ pageListCopy[i] ] ) ); sheetNames[ pageListCopy[i] ] ) );
} }
menu.AppendSeparator(); menu.AppendSeparator();
menu.Append( 999, _( "Back to Previous Selected Sheet" ) ); menu.Append( 999, _( "Back to Previous Selected Sheet" ) );
int sel = aFrame->GetPopupMenuSelectionFromUser( menu ); int sel = aFrame->GetPopupMenuSelectionFromUser( menu ) - START_ID;
void* param = nullptr; void* param = nullptr;
if( sel >= 0 && sel < (int) pageListCopy.size() ) if( sel >= 0 && sel < (int) pageListCopy.size() )