diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index c475f83b00..6e547832e6 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -118,6 +118,8 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, // hook wxEVT_CLOSE_WINDOW so we can call SaveSettings(). This function seems // to be called before any other hook for wxCloseEvent, which is necessary. Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_BASE_FRAME::windowClosing ) ); + + initExitKey(); } @@ -974,6 +976,15 @@ bool EDA_BASE_FRAME::IsContentModified() } +void EDA_BASE_FRAME::initExitKey() +{ + wxAcceleratorEntry entries[1]; + entries[0].Set( wxACCEL_CTRL, int( 'Q' ), wxID_EXIT ); + wxAcceleratorTable accel( 1, entries ); + SetAcceleratorTable( accel ); +} + + void EDA_BASE_FRAME::ClearUndoRedoList() { ClearUndoORRedoList( UNDO_LIST ); diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 905019a1a5..df3c4c4744 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -455,15 +455,6 @@ void EDA_DRAW_FRAME::AddStandardSubMenus( TOOL_MENU& aToolMenu ) } -void EDA_DRAW_FRAME::initExitKey() -{ - wxAcceleratorEntry entries[1]; - entries[0].Set( wxACCEL_CTRL, int( 'Q' ), wxID_EXIT ); - wxAcceleratorTable accel( 1, entries ); - SetAcceleratorTable( accel ); -} - - void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg ) { SetStatusText( msg, 6 ); @@ -1057,4 +1048,4 @@ void EDA_DRAW_FRAME::resolveCanvasType() m_firstRunDialogSetting = 1; SaveSettings( config() ); } -} \ No newline at end of file +} diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 2f546b50ba..f634da017e 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -288,7 +288,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : p->SetSchematic( m_schematic ); } - initExitKey(); setupUnits( eeconfig() ); // Net list generator diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index e66cb6174b..ce97a2bafd 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -147,7 +147,6 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : ReCreateHToolbar(); ReCreateVToolbar(); ReCreateOptToolbar(); - initExitKey(); updateTitle(); DisplaySymbolDatasheet(); diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index 3dc6806ec7..0bc1931334 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -618,6 +618,14 @@ protected: */ virtual void setupUIConditions(); + /** + * 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(); + DECLARE_EVENT_TABLE() private: diff --git a/include/eda_draw_frame.h b/include/eda_draw_frame.h index 99c445537b..b8fe5b8748 100644 --- a/include/eda_draw_frame.h +++ b/include/eda_draw_frame.h @@ -462,14 +462,6 @@ protected: */ bool saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ); - /** - * 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(); - wxSocketServer* m_socketServer; std::vector m_sockets; ///< interprocess communication diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index 51b63761f2..86c90ad2aa 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -189,7 +189,6 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SwitchCanvas( m_canvasType ); // Add the exit key handler - initExitKey(); setupUnits( config() ); wxPoint originCoord = ReturnCoordOriginCorner(); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 76f8ee9c33..5c54aa2440 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -285,7 +285,6 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false ); updateTitle(); - initExitKey(); setupUnits( GetSettings() ); // Default shutdown reason until a file is loaded diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 8d078d43bc..2498c5b138 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -266,7 +266,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom ); updateView(); - initExitKey(); setupUnits( config() ); if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 13cce90257..d5ce4bfb73 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -313,7 +313,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : resolveCanvasType(); - initExitKey(); setupUnits( config() ); // Ensure the Python interpreter is up to date with its environment variables