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:
parent
e47c9ccc0b
commit
8493daf9ff
|
@ -54,8 +54,7 @@ void EDA_3D_VIEWER::CreateMenuBar()
|
|||
export_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close\tCTRL+W" ), "",
|
||||
exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddClose( _( "3D Viewer" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
|
||||
fileMenu->AddItem( CVPCB_ACTIONS::saveAssociations, SELECTION_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddClose( _( "Assign Footprints" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AddMenu( submenuExport, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close\tCTRL+W" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddClose( _( "Library Editor" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AddItem( ACTIONS::plot, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddQuitOrClose( &Kiface() );
|
||||
fileMenu->AddQuitOrClose( &Kiface(), _( "Eeschema" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -102,8 +102,7 @@ void LIB_VIEW_FRAME::ReCreateMenuBar()
|
|||
//
|
||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, libControl );
|
||||
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close" ), _( "Close footprint viewer" ), exit_xpm,
|
||||
EE_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddClose( _( "Footprint Viewer" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AddItem( ACTIONS::print, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddQuitOrClose( &Kiface() );
|
||||
fileMenu->AddQuitOrClose( &Kiface(), _( "GerbView" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -100,13 +100,25 @@ public:
|
|||
*/
|
||||
void AddSeparator( int aOrder = ANY_ORDER );
|
||||
|
||||
/**
|
||||
* Function AddClose()
|
||||
*
|
||||
* Add a standard close item to the menu with the accelerator key CTRL-W.
|
||||
* Emits the wxID_CLOSE event.
|
||||
*
|
||||
* @param aAppname is the application name to append to the tooltip
|
||||
*/
|
||||
void AddClose( wxString aAppname = "" );
|
||||
|
||||
/**
|
||||
* Functions AddQuitOrClose()
|
||||
*
|
||||
* Adds either a standard Quit or Close item to the menu (depending on whether or not the
|
||||
* app was launched stand-alone).
|
||||
* Adds either a standard Quit or Close item to the menu. If aKiface is NULL or in
|
||||
* single-instance then Quite (wxID_QUIT) is used, otherwise Close (wxID_CLOSE) is used.
|
||||
*
|
||||
* @param aAppname is the application name to append to the tooltip
|
||||
*/
|
||||
void AddQuitOrClose( KIFACE_I* aKiface );
|
||||
void AddQuitOrClose( KIFACE_I* aKiface, wxString aAppname = "" );
|
||||
|
||||
/**
|
||||
* Function Evaluate()
|
||||
|
|
|
@ -84,7 +84,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
|||
unzip_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddQuitOrClose( nullptr );
|
||||
fileMenu->AddQuitOrClose( nullptr, _( "KiCad" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AddItem( ACTIONS::print, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddQuitOrClose( &Kiface() );
|
||||
fileMenu->AddQuitOrClose( &Kiface(), _( "Page Layout Editor" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -105,8 +105,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AddItem( ACTIONS::print, haveFootprintCondition );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close\tCTRL+W" ), "",
|
||||
exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddClose( _( "Footprint Editor" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AddMenu( submenuArchive, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddQuitOrClose( &Kiface() );
|
||||
fileMenu->AddQuitOrClose( &Kiface(), _( "Pcbnew" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -123,8 +123,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar()
|
|||
//
|
||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close" ), _( "Close footprint viewer" ), exit_xpm,
|
||||
SELECTION_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddClose( _( "Footprint Viewer" ) );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
Loading…
Reference in New Issue