From 2502bce9873b3c964d99ed2e8b98c83040f551d9 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 26 May 2019 23:22:03 +0100 Subject: [PATCH] Move quit back to wxIDs. wxWidgets like to muck around with the location on OSX. --- eeschema/menubar.cpp | 6 +++--- eeschema/sch_edit_frame.cpp | 7 +++++++ eeschema/sch_edit_frame.h | 3 ++- pagelayout_editor/menubar.cpp | 3 ++- pcbnew/menubar_pcb_editor.cpp | 4 ++-- pcbnew/pcb_edit_frame.cpp | 8 ++++++++ pcbnew/pcb_edit_frame.h | 7 +++---- 7 files changed, 27 insertions(+), 11 deletions(-) diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index f4dcc40556..13835e56ec 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -133,13 +133,13 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() fileMenu->AddMenu( submenuExport, EE_CONDITIONS::ShowAlways ); fileMenu->AddSeparator(); - fileMenu->AddItem( ACTIONS::pageSettings, EE_CONDITIONS::ShowAlways ); + fileMenu->AddItem( ACTIONS::pageSettings, EE_CONDITIONS::ShowAlways ); fileMenu->AddItem( ACTIONS::print, EE_CONDITIONS::ShowAlways ); fileMenu->AddItem( ACTIONS::plot, EE_CONDITIONS::ShowAlways ); - // Quit fileMenu->AddSeparator(); - fileMenu->AddItem( ACTIONS::quit, EE_CONDITIONS::ShowAlways ); + // 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 ); // // Menu Edit: diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 7d5682aaa5..0b19a93cf1 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -222,6 +222,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU( ID_IMPORT_NON_KICAD_SCH, SCH_EDIT_FRAME::OnImportProject ) EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, EDA_DRAW_FRAME::CopyToClipboard ) + EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit ) EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config ) EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config ) @@ -1067,6 +1068,12 @@ void SCH_EDIT_FRAME::OnEditComponentSymbolsId( wxCommandEvent& event ) } +void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event ) +{ + Close( false ); +} + + void SCH_EDIT_FRAME::Print() { InvokeDialogPrintUsingPrinter( this ); diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index fca3beb964..6646256770 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -751,6 +751,7 @@ private: // Sets up the tool framework void setupTools(); + void OnExit( wxCommandEvent& event ); void OnAnnotate( wxCommandEvent& event ); void OnErc( wxCommandEvent& event ); void OnCreateNetlist( wxCommandEvent& event ); diff --git a/pagelayout_editor/menubar.cpp b/pagelayout_editor/menubar.cpp index 4cc4f38cb4..81dc6ad43f 100644 --- a/pagelayout_editor/menubar.cpp +++ b/pagelayout_editor/menubar.cpp @@ -83,7 +83,8 @@ void PL_EDITOR_FRAME::ReCreateMenuBar() fileMenu->AddItem( ACTIONS::print, SELECTION_CONDITIONS::ShowAlways ); fileMenu->AppendSeparator(); - fileMenu->AddItem( ACTIONS::quit, SELECTION_CONDITIONS::ShowAlways ); + // 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 ); // // Edit Menu: diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index aa788ae31d..0749bb212c 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -236,9 +236,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() fileMenu->AddSeparator(); fileMenu->AddMenu( submenuArchive, SELECTION_CONDITIONS::ShowAlways ); - // Quit fileMenu->AddSeparator(); - fileMenu->AddItem( ACTIONS::quit, SELECTION_CONDITIONS::ShowAlways ); + // 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 ); //----- Edit menu ----------------------------------------------------------- CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool ); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index e57f39813e..4a1a3f8425 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -152,6 +152,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( ID_MENU_ARCHIVE_MODULES_IN_LIBRARY, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES, PCB_EDIT_FRAME::Process_Special_Functions ) + EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit ) + // menu Config EVT_MENU( ID_PCB_LIB_TABLE_EDIT, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_PCB_3DSHAPELIB_WIZARD, PCB_EDIT_FRAME::Process_Config ) @@ -560,6 +562,12 @@ void PCB_EDIT_FRAME::ReFillLayerWidget() } +void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event ) +{ + Close( false ); +} + + void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) { m_canvas->SetAbortRequest( true ); diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 12b900ab13..9fff4135ce 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010 Jean-Pierre Charras, jp.charras@wanadoo.fr - * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -17,9 +17,6 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ -/** - * @file wxPcbStruct.h - */ #ifndef WXPCB_STRUCT_H_ #define WXPCB_STRUCT_H_ @@ -300,6 +297,8 @@ public: */ void LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter ); + void OnQuit( wxCommandEvent& event ); + /** * Reload the Python plugins if they are newer than * the already loaded, and load new plugins if any