Unify menu item creation for closing a window

* Push a function into CONDITIONAL_MENU that adds the item
* Modify the tooltip for close and exit items to have the
  program name

Fixes: lp:1835454
* https://bugs.launchpad.net/kicad/+bug/1835454
This commit is contained in:
Ian McInerney
2019-08-14 09:35:15 +01:00
committed by Jeff Young
parent e47c9ccc0b
commit 8493daf9ff
13 changed files with 37 additions and 21 deletions
+11 -3
View File
@@ -99,17 +99,25 @@ void CONDITIONAL_MENU::AddSeparator( int aOrder )
}
void CONDITIONAL_MENU::AddQuitOrClose( KIFACE_I* aKiface )
void CONDITIONAL_MENU::AddClose( wxString aAppname )
{
AddItem( wxID_CLOSE, _( "Close\tCTRL+W" ), wxString::Format( "Close %s", aAppname ), exit_xpm,
SELECTION_CONDITIONS::ShowAlways );
}
void CONDITIONAL_MENU::AddQuitOrClose( KIFACE_I* aKiface, wxString aAppname )
{
if( !aKiface || aKiface->IsSingle() ) // not when under a project mgr
{
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via
// wxID_EXIT
AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
AddItem( wxID_EXIT, _( "Quit" ), wxString::Format( "Quit %s", aAppname ), exit_xpm,
SELECTION_CONDITIONS::ShowAlways );
}
else
{
AddItem( wxID_CLOSE, _( "Close\tCTRL+W" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
AddClose( aAppname );
}
}