KiCad PCB EDA Suite
cvpcb/menubar.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <bitmaps.h>
26#include <menus_helpers.h>
27#include <tool/actions.h>
28#include <tool/common_control.h>
30#include <tool/tool_manager.h>
31
32#include <cvpcb_mainframe.h>
33#include <tools/cvpcb_actions.h>
34#include <widgets/wx_menubar.h>
35
36
38{
40 // wxWidgets handles the Mac Application menu behind the scenes, but that means
41 // we always have to start from scratch with a new wxMenuBar.
42 wxMenuBar* oldMenuBar = GetMenuBar();
43 WX_MENUBAR* menuBar = new WX_MENUBAR();
44
45 //-- File menu -----------------------------------------------------------
46 //
47 ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
48
50 fileMenu->AppendSeparator();
51 fileMenu->AddClose( _( "Assign Footprints" ) );
52
53 //-- Edit menu -----------------------------------------------------------
54 //
55 ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
56
57 editMenu->Add( ACTIONS::undo );
58 editMenu->Add( ACTIONS::redo );
59
60 editMenu->AppendSeparator();
61 editMenu->Add( ACTIONS::cut );
62 editMenu->Add( ACTIONS::copy );
63 editMenu->Add( ACTIONS::paste );
64
65 //-- Preferences menu ----------------------------------------------------
66 //
67 ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
68
69 prefsMenu->Add( ACTIONS::configurePaths );
71
72 // We can't use ACTIONS::showPreferences yet because wxWidgets moves this on
73 // Mac, and it needs the wxID_PREFERENCES id to find it.
74 prefsMenu->Add( _( "Preferences..." ) + wxS( "\tCtrl+," ),
75 _( "Show preferences for all open tools" ),
76 wxID_PREFERENCES,
78
79 prefsMenu->AppendSeparator();
81
82 prefsMenu->AppendSeparator();
83 AddMenuLanguageList( prefsMenu, tool );
84
85 //-- Menubar -------------------------------------------------------------
86 //
87 menuBar->Append( fileMenu, _( "&File" ) );
88 menuBar->Append( editMenu, _( "&Edit" ) );
89 menuBar->Append( prefsMenu, _( "&Preferences" ) );
90 AddStandardHelpMenu( menuBar );
91
92 SetMenuBar( menuBar );
93 delete oldMenuBar;
94}
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION copy
Definition: actions.h:68
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:181
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION cut
Definition: actions.h:67
static TOOL_ACTION configurePaths
Definition: actions.h:179
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
void AddClose(const wxString &aAppname="")
Add a standard close item to the menu with the accelerator key CTRL-W.
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
Handle actions that are shared between different applications.
static TOOL_ACTION showEquFileTable
Definition: cvpcb_actions.h:58
static TOOL_ACTION saveAssociationsToSchematic
Management actions.
Definition: cvpcb_actions.h:56
void doReCreateMenuBar() override
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Adds the standard KiCad help menu to the menubar.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition: wx_menubar.h:46
#define _(s)
void AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to Master...
Macros and inline functions to create menus items in menubars or popup menus.