Sub-menu "Preferences..." in main menu "Preferences": fix not working accelerator key.

Accelerator keys are disable in our WX_MENUBAR. A common ACTION_MENU is used and
"Preferences..." is now shown in Hotkeys list.
This commit is contained in:
jean-pierre charras 2021-05-29 18:09:49 +02:00
parent 37c31196f4
commit 81c7fb61f8
15 changed files with 40 additions and 47 deletions

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -91,7 +91,6 @@ static const wxSize defaultSize( FRAME_T aFrameType )
BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame ) BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::OnKicadAbout ) EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::OnKicadAbout )
EVT_MENU( wxID_PREFERENCES, EDA_BASE_FRAME::OnPreferences )
EVT_CHAR_HOOK( EDA_BASE_FRAME::OnCharHook ) EVT_CHAR_HOOK( EDA_BASE_FRAME::OnCharHook )
EVT_MENU_OPEN( EDA_BASE_FRAME::OnMenuEvent ) EVT_MENU_OPEN( EDA_BASE_FRAME::OnMenuEvent )
@ -900,7 +899,7 @@ void EDA_BASE_FRAME::OnKicadAbout( wxCommandEvent& event )
} }
void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event ) void EDA_BASE_FRAME::OnPreferences()
{ {
PAGED_DIALOG dlg( this, _( "Preferences" ), true ); PAGED_DIALOG dlg( this, _( "Preferences" ), true );
wxTreebook* book = dlg.GetTreebook(); wxTreebook* book = dlg.GetTreebook();

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 CERN * Copyright (C) 2019 CERN
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -584,6 +584,11 @@ TOOL_ACTION ACTIONS::updateSchematicFromPcb( "common.Control.updateSchematicFrom
_( "Update Schematic from PCB..." ), _( "Update schematic with changes made to PCB" ), _( "Update Schematic from PCB..." ), _( "Update schematic with changes made to PCB" ),
BITMAPS::update_sch_from_pcb ); BITMAPS::update_sch_from_pcb );
TOOL_ACTION ACTIONS::openPreferences( "common.SuiteControl.openPreferences",
AS_GLOBAL, MD_CTRL + ',', "",
_( "Preferences..." ), _( "Show preferences for all open tools" ),
BITMAPS::preference );
TOOL_ACTION ACTIONS::configurePaths( "common.SuiteControl.configurePaths", TOOL_ACTION ACTIONS::configurePaths( "common.SuiteControl.configurePaths",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "Configure Paths..." ), _( "Edit path configuration environment variables" ), _( "Configure Paths..." ), _( "Edit path configuration environment variables" ),

View File

@ -3,6 +3,7 @@
* *
* Copyright (C) 2014-2016 CERN * Copyright (C) 2014-2016 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -77,6 +78,13 @@ void COMMON_CONTROL::Reset( RESET_REASON aReason )
} }
int COMMON_CONTROL::OpenPreferences( const TOOL_EVENT& aEvent )
{
m_frame->OnPreferences();
return 0;
}
int COMMON_CONTROL::ConfigurePaths( const TOOL_EVENT& aEvent ) int COMMON_CONTROL::ConfigurePaths( const TOOL_EVENT& aEvent )
{ {
// If _pcbnew.kiface is running have it put up the dialog so the 3D paths can also // If _pcbnew.kiface is running have it put up the dialog so the 3D paths can also
@ -294,6 +302,7 @@ int COMMON_CONTROL::ReportBug( const TOOL_EVENT& aEvent )
void COMMON_CONTROL::setTransitions() void COMMON_CONTROL::setTransitions()
{ {
Go( &COMMON_CONTROL::OpenPreferences, ACTIONS::openPreferences.MakeEvent() );
Go( &COMMON_CONTROL::ConfigurePaths, ACTIONS::configurePaths.MakeEvent() ); Go( &COMMON_CONTROL::ConfigurePaths, ACTIONS::configurePaths.MakeEvent() );
Go( &COMMON_CONTROL::ShowLibraryTable, ACTIONS::showSymbolLibTable.MakeEvent() ); Go( &COMMON_CONTROL::ShowLibraryTable, ACTIONS::showSymbolLibTable.MakeEvent() );
Go( &COMMON_CONTROL::ShowLibraryTable, ACTIONS::showFootprintLibTable.MakeEvent() ); Go( &COMMON_CONTROL::ShowLibraryTable, ACTIONS::showFootprintLibTable.MakeEvent() );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -68,10 +68,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
prefsMenu->Add( ACTIONS::configurePaths ); prefsMenu->Add( ACTIONS::configurePaths );
prefsMenu->Add( ACTIONS::showFootprintLibTable ); prefsMenu->Add( ACTIONS::showFootprintLibTable );
prefsMenu->Add( _( "Preferences..." ) + "\tCtrl+,", prefsMenu->Add( ACTIONS::openPreferences );
_( "Show preferences for all open tools" ),
wxID_PREFERENCES,
BITMAPS::preference );
prefsMenu->AppendSeparator(); prefsMenu->AppendSeparator();
prefsMenu->Add( CVPCB_ACTIONS::showEquFileTable); prefsMenu->Add( CVPCB_ACTIONS::showEquFileTable);

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019 CERN * Copyright (C) 2019 CERN
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -261,15 +261,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
//-- Preferences menu ----------------------------------------------- //-- Preferences menu -----------------------------------------------
//
ACTION_MENU* prefsMenu = new ACTION_MENU( false, selTool ); ACTION_MENU* prefsMenu = new ACTION_MENU( false, selTool );
prefsMenu->Add( ACTIONS::configurePaths ); prefsMenu->Add( ACTIONS::configurePaths );
prefsMenu->Add( ACTIONS::showSymbolLibTable ); prefsMenu->Add( ACTIONS::showSymbolLibTable );
prefsMenu->Add( _( "Preferences..." ) + "\tCtrl+,", prefsMenu->Add( ACTIONS::openPreferences );
_( "Show preferences for all open tools" ),
wxID_PREFERENCES,
BITMAPS::preference );
prefsMenu->AppendSeparator(); prefsMenu->AppendSeparator();
AddMenuLanguageList( prefsMenu, selTool ); AddMenuLanguageList( prefsMenu, selTool );

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -160,10 +160,7 @@ void SYMBOL_EDIT_FRAME::ReCreateMenuBar()
prefsMenu->Add( ACTIONS::configurePaths ); prefsMenu->Add( ACTIONS::configurePaths );
prefsMenu->Add( ACTIONS::showSymbolLibTable ); prefsMenu->Add( ACTIONS::showSymbolLibTable );
prefsMenu->Add( _( "Preferences..." ) + "\tCtrl+,", prefsMenu->Add( ACTIONS::openPreferences );
_( "Show preferences for all open tools" ),
wxID_PREFERENCES,
BITMAPS::preference );
prefsMenu->AppendSeparator(); prefsMenu->AppendSeparator();
AddMenuLanguageList( prefsMenu, selTool ); AddMenuLanguageList( prefsMenu, selTool );

View File

@ -206,10 +206,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
// //
ACTION_MENU* preferencesMenu = new ACTION_MENU( false, selTool ); ACTION_MENU* preferencesMenu = new ACTION_MENU( false, selTool );
preferencesMenu->Add( _( "Preferences..." ) + "\tCtrl+,", preferencesMenu->Add( ACTIONS::openPreferences );
_( "Show preferences for all open tools" ),
wxID_PREFERENCES,
BITMAPS::preference );
preferencesMenu->AppendSeparator(); preferencesMenu->AppendSeparator();
AddMenuLanguageList( preferencesMenu, selTool ); AddMenuLanguageList( preferencesMenu, selTool );

View File

@ -202,7 +202,11 @@ public:
virtual wxString help_name(); virtual wxString help_name();
void OnKicadAbout( wxCommandEvent& event ); void OnKicadAbout( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event );
/**
* Displays the preferences and settings of all opened editors paged dialog
*/
void OnPreferences();
void PrintMsg( const wxString& text ); void PrintMsg( const wxString& text );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013-2016 CERN * Copyright (C) 2013-2016 CERN
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -172,6 +172,7 @@ public:
static TOOL_ACTION changeEditMethod; static TOOL_ACTION changeEditMethod;
// Suite // Suite
static TOOL_ACTION openPreferences;
static TOOL_ACTION configurePaths; static TOOL_ACTION configurePaths;
static TOOL_ACTION showSymbolLibTable; static TOOL_ACTION showSymbolLibTable;
static TOOL_ACTION showFootprintLibTable; static TOOL_ACTION showFootprintLibTable;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -45,6 +45,7 @@ public:
/// @copydoc TOOL_BASE::Reset() /// @copydoc TOOL_BASE::Reset()
void Reset( RESET_REASON aReason ) override; void Reset( RESET_REASON aReason ) override;
int OpenPreferences( const TOOL_EVENT& aEvent );
int ConfigurePaths( const TOOL_EVENT& aEvent ); int ConfigurePaths( const TOOL_EVENT& aEvent );
int ShowLibraryTable( const TOOL_EVENT& aEvent ); int ShowLibraryTable( const TOOL_EVENT& aEvent );

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019 CERN * Copyright (C) 2019 CERN
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -163,10 +163,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
prefsMenu->Add( ACTIONS::configurePaths ); prefsMenu->Add( ACTIONS::configurePaths );
prefsMenu->Add( ACTIONS::showSymbolLibTable ); prefsMenu->Add( ACTIONS::showSymbolLibTable );
prefsMenu->Add( ACTIONS::showFootprintLibTable ); prefsMenu->Add( ACTIONS::showFootprintLibTable );
prefsMenu->Add( _( "Preferences..." ) + "\tCtrl+,", prefsMenu->Add( ACTIONS::openPreferences );
_( "Show preferences for all open tools" ),
wxID_PREFERENCES,
BITMAPS::preference );
prefsMenu->AppendSeparator(); prefsMenu->AppendSeparator();
AddMenuLanguageList( prefsMenu, controlTool ); AddMenuLanguageList( prefsMenu, controlTool );

View File

@ -151,10 +151,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
// //
ACTION_MENU* preferencesMenu = new ACTION_MENU( false, selTool ); ACTION_MENU* preferencesMenu = new ACTION_MENU( false, selTool );
preferencesMenu->Add( _( "Preferences..." ) + "\tCtrl+,", preferencesMenu->Add( ACTIONS::openPreferences );
_( "Show preferences for all open tools" ),
wxID_PREFERENCES,
BITMAPS::preference );
// Language submenu // Language submenu
AddMenuLanguageList( preferencesMenu, selTool ); AddMenuLanguageList( preferencesMenu, selTool );

View File

@ -4,7 +4,7 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -228,10 +228,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
prefsMenu->Add( ACTIONS::configurePaths ); prefsMenu->Add( ACTIONS::configurePaths );
prefsMenu->Add( ACTIONS::showFootprintLibTable ); prefsMenu->Add( ACTIONS::showFootprintLibTable );
prefsMenu->Add( _( "Preferences..." ) + "\tCtrl+,", prefsMenu->Add( ACTIONS::openPreferences );
_( "Show preferences for all open tools" ),
wxID_PREFERENCES,
BITMAPS::preference );
prefsMenu->AppendSeparator(); prefsMenu->AppendSeparator();
AddMenuLanguageList( prefsMenu, selTool ); AddMenuLanguageList( prefsMenu, selTool );

View File

@ -449,10 +449,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
prefsMenu->Add( ACTIONS::configurePaths ); prefsMenu->Add( ACTIONS::configurePaths );
prefsMenu->Add( ACTIONS::showFootprintLibTable ); prefsMenu->Add( ACTIONS::showFootprintLibTable );
prefsMenu->Add( _( "Preferences..." ) + "\tCtrl+,", prefsMenu->Add( ACTIONS::openPreferences );
_( "Show preferences for all open tools" ),
wxID_PREFERENCES,
BITMAPS::preference );
prefsMenu->AppendSeparator(); prefsMenu->AppendSeparator();
AddMenuLanguageList( prefsMenu, selTool ); AddMenuLanguageList( prefsMenu, selTool );

View File

@ -2817,8 +2817,7 @@ void APPEARANCE_CONTROLS::onReadOnlySwatch()
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>( button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
[&]( wxHyperlinkEvent& aEvent ) [&]( wxHyperlinkEvent& aEvent )
{ {
wxCommandEvent dummy; m_frame->OnPreferences();
m_frame->OnPreferences( dummy );
} ) ); } ) );
infobar->RemoveAllButtons(); infobar->RemoveAllButtons();