Update exit strategy to match UI guidelines
In singletop mode, all frames show the "Quit" option in the file menu and will quit on Ctrl-Q. When launched from the main KiCad interface, sub-programs show the "Close" option instead and will close with Ctrl-W. In this mode, Ctrl-Q will instruct the main program to exit. Fixes: lp:1779938 * https://bugs.launchpad.net/kicad/+bug/1779938
This commit is contained in:
parent
f9c476d851
commit
98124e68c7
|
@ -56,8 +56,7 @@ void EDA_3D_VIEWER::CreateMenuBar()
|
|||
export_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
|
|||
|
||||
EVT_TOOL( ID_TOOL_SET_VISIBLE_ITEMS, EDA_3D_VIEWER::Install3DViewOptionDialog )
|
||||
|
||||
EVT_MENU( wxID_EXIT, EDA_3D_VIEWER::Exit3DFrame )
|
||||
EVT_MENU( wxID_CLOSE, EDA_3D_VIEWER::Exit3DFrame )
|
||||
EVT_MENU( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER::OnRenderEngineSelection )
|
||||
EVT_MENU( ID_DISABLE_RAY_TRACING, EDA_3D_VIEWER::OnDisableRayTracing )
|
||||
|
||||
|
|
|
@ -305,6 +305,15 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::InitExitKey()
|
||||
{
|
||||
wxAcceleratorEntry entries[1];
|
||||
entries[0].Set( wxACCEL_CTRL, int( 'Q' ), wxID_EXIT );
|
||||
wxAcceleratorTable accel( 1, entries );
|
||||
SetAcceleratorTable( accel );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Respond to selections in the toolbar zoom popup
|
||||
*/
|
||||
|
|
|
@ -499,6 +499,21 @@ bool KIWAY::ProcessEvent( wxEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void KIWAY::OnKiCadExit()
|
||||
{
|
||||
if( m_ctl & KFCTL_CPP_PROJECT_SUITE )
|
||||
{
|
||||
// A dynamic_cast could be better, but creates link issues
|
||||
// (some basic_frame functions not found) on some platforms,
|
||||
// so a static_cast is used.
|
||||
EDA_BASE_FRAME* top = static_cast<EDA_BASE_FRAME*>( m_top );
|
||||
|
||||
if( top )
|
||||
top->Close( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KIWAY::OnKiwayEnd()
|
||||
{
|
||||
for( KIFACE* i : m_kiface )
|
||||
|
|
|
@ -90,7 +90,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_TOOL( ID_LIBEDIT_EXPORT_BODY_BUTT, LIB_EDIT_FRAME::OnExportBody )
|
||||
|
||||
// menubar commands
|
||||
EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::CloseWindow )
|
||||
EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::OnExitKiCad )
|
||||
EVT_MENU( wxID_CLOSE, LIB_EDIT_FRAME::CloseWindow )
|
||||
EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings )
|
||||
|
||||
// Update user interface elements.
|
||||
|
@ -152,6 +153,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
ReCreateHToolbar();
|
||||
ReCreateVToolbar();
|
||||
ReCreateOptToolbar();
|
||||
InitExitKey();
|
||||
|
||||
updateTitle();
|
||||
DisplayCmpDoc();
|
||||
|
@ -331,6 +333,12 @@ void LIB_EDIT_FRAME::ThawSearchTree()
|
|||
}
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
|
||||
{
|
||||
Kiway().OnKiCadExit();
|
||||
}
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event )
|
||||
{
|
||||
if( !m_unitSelectBox )
|
||||
|
|
|
@ -239,6 +239,7 @@ public:
|
|||
void RebuildSymbolUnitsList();
|
||||
|
||||
void OnCloseWindow( wxCloseEvent& Event );
|
||||
void OnExitKiCad( wxCommandEvent& event );
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateVToolbar() override;
|
||||
void ReCreateOptToolbar();
|
||||
|
|
|
@ -82,8 +82,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AddMenu( submenuExport, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -115,8 +115,16 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AddItem( ACTIONS::plot, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
|
||||
if( Kiface().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
|
||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||
}
|
||||
else
|
||||
{
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||
}
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -22,19 +22,20 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <kiface_i.h>
|
||||
#include <pgm_base.h>
|
||||
#include <gr_basic.h>
|
||||
#include <sch_draw_panel.h>
|
||||
#include <gestfich.h>
|
||||
#include <confirm.h>
|
||||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
#include <html_messagebox.h>
|
||||
#include <executable_names.h>
|
||||
#include <confirm.h>
|
||||
#include <eda_dockart.h>
|
||||
#include <executable_names.h>
|
||||
#include <fctsys.h>
|
||||
#include <gestfich.h>
|
||||
#include <gr_basic.h>
|
||||
#include <html_messagebox.h>
|
||||
#include <kiface_i.h>
|
||||
#include <kiway.h>
|
||||
#include <msgpanel.h>
|
||||
#include <pgm_base.h>
|
||||
#include <profile.h>
|
||||
#include <sch_draw_panel.h>
|
||||
|
||||
#include <advanced_config.h>
|
||||
#include <general.h>
|
||||
|
@ -222,6 +223,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU( ID_IMPORT_NON_KICAD_SCH, SCH_EDIT_FRAME::OnImportProject )
|
||||
|
||||
EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
|
||||
EVT_MENU( wxID_CLOSE, SCH_EDIT_FRAME::OnExit )
|
||||
|
||||
EVT_TOOL( ID_RESCUE_CACHED, SCH_EDIT_FRAME::OnRescueProject )
|
||||
EVT_MENU( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnRemapSymbols )
|
||||
|
@ -300,6 +302,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
if( GetCanvas() )
|
||||
GetCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
|
||||
|
||||
InitExitKey();
|
||||
|
||||
// Net list generator
|
||||
DefaultExecFlags();
|
||||
|
||||
|
@ -899,6 +903,10 @@ void SCH_EDIT_FRAME::OnRemapSymbols( wxCommandEvent& event )
|
|||
|
||||
void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
|
||||
{
|
||||
if( event.GetId() == wxID_EXIT )
|
||||
Kiway().OnKiCadExit();
|
||||
|
||||
if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
|
||||
Close( false );
|
||||
}
|
||||
|
||||
|
|
|
@ -102,8 +102,8 @@ void LIB_VIEW_FRAME::ReCreateMenuBar()
|
|||
//
|
||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, libControl );
|
||||
|
||||
fileMenu->AddItem( wxID_EXIT, _( "Close" ), _( "Close footprint viewer" ),
|
||||
exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close" ), _( "Close footprint viewer" ), exit_xpm,
|
||||
EE_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_LISTBOX_DCLICK( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::DClickOnCmpList )
|
||||
|
||||
// Menu (and/or hotkey) events
|
||||
EVT_MENU( wxID_EXIT, LIB_VIEW_FRAME::CloseLibraryViewer )
|
||||
EVT_MENU( wxID_CLOSE, LIB_VIEW_FRAME::CloseLibraryViewer )
|
||||
EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings )
|
||||
|
||||
EVT_UPDATE_UI( ID_LIBVIEW_SELECT_PART_NUMBER, LIB_VIEW_FRAME::onUpdateUnitChoice )
|
||||
|
|
|
@ -148,6 +148,13 @@ protected:
|
|||
|
||||
void CommonSettingsChanged() override;
|
||||
|
||||
/**
|
||||
* Sets the common key-pair for exiting the application (Ctrl-Q) and ties it
|
||||
* to the wxID_EXIT event id. This is useful in sub-applications to pass the event
|
||||
* up to a non-owning window
|
||||
*/
|
||||
void InitExitKey();
|
||||
|
||||
/**
|
||||
* @param doOpen if true runs an Open Library browser, otherwise New Library
|
||||
* @param aFilename for New may contain a default name; in both cases return the chosen
|
||||
|
|
|
@ -379,6 +379,8 @@ public:
|
|||
*/
|
||||
void SetTop( wxFrame* aTop );
|
||||
|
||||
void OnKiCadExit();
|
||||
|
||||
void OnKiwayEnd();
|
||||
|
||||
bool ProcessEvent( wxEvent& aEvent ) override;
|
||||
|
|
|
@ -23,22 +23,23 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "kicad_id.h"
|
||||
#include "pgm_kicad.h"
|
||||
#include "tree_project_frame.h"
|
||||
#include <bitmaps.h>
|
||||
#include <build_version.h>
|
||||
#include <executable_names.h>
|
||||
#include <gestfich.h>
|
||||
#include <kiway.h>
|
||||
#include <kiway_express.h>
|
||||
#include <kiway_player.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <bitmaps.h>
|
||||
#include <executable_names.h>
|
||||
#include <build_version.h>
|
||||
#include "pgm_kicad.h"
|
||||
#include <panel_hotkeys_editor.h>
|
||||
#include "tree_project_frame.h"
|
||||
#include "kicad_id.h"
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <tool/common_control.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/kicad_manager_actions.h>
|
||||
#include <tools/kicad_manager_control.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#ifdef __WXMAC__
|
||||
#include <MacTypes.h>
|
||||
|
|
|
@ -75,7 +75,8 @@
|
|||
|
||||
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||
EVT_CLOSE( FOOTPRINT_EDIT_FRAME::OnCloseWindow )
|
||||
EVT_MENU( wxID_EXIT, FOOTPRINT_EDIT_FRAME::CloseModuleEditor )
|
||||
EVT_MENU( wxID_CLOSE, FOOTPRINT_EDIT_FRAME::CloseModuleEditor )
|
||||
EVT_MENU( wxID_EXIT, FOOTPRINT_EDIT_FRAME::OnExitKiCad )
|
||||
|
||||
EVT_SIZE( FOOTPRINT_EDIT_FRAME::OnSize )
|
||||
|
||||
|
@ -219,6 +220,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
|||
GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId );
|
||||
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
|
||||
updateTitle();
|
||||
InitExitKey();
|
||||
|
||||
Raise(); // On some window managers, this is needed
|
||||
Show( true );
|
||||
|
@ -477,6 +479,12 @@ void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
|
||||
{
|
||||
Kiway().OnKiCadExit();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::CloseModuleEditor( wxCommandEvent& Event )
|
||||
{
|
||||
Close();
|
||||
|
|
|
@ -89,6 +89,7 @@ public:
|
|||
|
||||
void OnCloseWindow( wxCloseEvent& Event ) override;
|
||||
void CloseModuleEditor( wxCommandEvent& Event );
|
||||
void OnExitKiCad( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* switches currently used canvas (Cairo / OpenGL).
|
||||
|
|
|
@ -70,7 +70,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_SIZE( FOOTPRINT_VIEWER_FRAME::OnSize )
|
||||
EVT_ACTIVATE( FOOTPRINT_VIEWER_FRAME::OnActivate )
|
||||
|
||||
EVT_MENU( wxID_EXIT, FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer )
|
||||
EVT_MENU( wxID_EXIT, FOOTPRINT_VIEWER_FRAME::OnExitKiCad )
|
||||
EVT_MENU( wxID_CLOSE, FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer )
|
||||
|
||||
// Toolbar events
|
||||
EVT_TOOL( ID_MODVIEW_SELECT_PART, FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint )
|
||||
|
@ -228,6 +229,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
GetCanvas()->GetView()->SetScale( m_lastZoom );
|
||||
|
||||
updateView();
|
||||
InitExitKey();
|
||||
|
||||
if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
|
||||
{
|
||||
|
@ -772,7 +774,13 @@ void FOOTPRINT_VIEWER_FRAME::updateView()
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::OnExitKiCad( wxCommandEvent& event )
|
||||
{
|
||||
Kiway().OnKiCadExit();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer( wxCommandEvent& event )
|
||||
{
|
||||
Close();
|
||||
Close( false );
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ private:
|
|||
|
||||
void OnCloseWindow( wxCloseEvent& Event ) override;
|
||||
void CloseFootprintViewer( wxCommandEvent& event );
|
||||
void OnExitKiCad( wxCommandEvent& event );
|
||||
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateVToolbar() override;
|
||||
|
|
|
@ -105,8 +105,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AddItem( ACTIONS::print, haveFootprintCondition );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -193,8 +193,17 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
fileMenu->AddMenu( submenuArchive, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
|
||||
if( Kiface().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
|
||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
}
|
||||
else
|
||||
{
|
||||
fileMenu->AddItem(
|
||||
wxID_CLOSE, _( "Close" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
}
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
|
@ -137,6 +137,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_MENU( ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
|
||||
EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit )
|
||||
EVT_MENU( wxID_CLOSE, PCB_EDIT_FRAME::OnQuit )
|
||||
|
||||
// menu Config
|
||||
EVT_MENU( ID_PCB_3DSHAPELIB_WIZARD, PCB_EDIT_FRAME::On3DShapeLibWizard )
|
||||
|
@ -311,6 +312,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
SaveSettings( config() );
|
||||
}
|
||||
|
||||
InitExitKey();
|
||||
|
||||
GetCanvas()->SwitchBackend( m_canvasType );
|
||||
GetCanvas()->GetGAL()->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) );
|
||||
GetCanvas()->GetView()->SetScale( GetZoomLevelCoeff() / GetScreen()->GetZoom() );
|
||||
|
@ -455,6 +458,10 @@ void PCB_EDIT_FRAME::ReFillLayerWidget()
|
|||
|
||||
void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
|
||||
{
|
||||
if( event.GetId() == wxID_EXIT )
|
||||
Kiway().OnKiCadExit();
|
||||
|
||||
if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
|
||||
Close( false );
|
||||
}
|
||||
|
||||
|
|
|
@ -123,8 +123,8 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar()
|
|||
//
|
||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
fileMenu->AddItem( wxID_EXIT, _( "Close" ), _( "Close footprint viewer" ),
|
||||
exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddItem( wxID_CLOSE, _( "Close" ), _( "Close footprint viewer" ), exit_xpm,
|
||||
SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
|
|
Loading…
Reference in New Issue