KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <bitmaps.h>
22#include <tool/actions.h>
23#include <tool/common_control.h>
25#include <tool/tool_manager.h>
26
27#include <cvpcb_mainframe.h>
28#include <tools/cvpcb_actions.h>
29#include <widgets/wx_menubar.h>
30
31
33{
35
36 // wxWidgets handles the Mac Application menu behind the scenes, but that means
37 // we always have to start from scratch with a new wxMenuBar.
38 wxMenuBar* oldMenuBar = GetMenuBar();
39 WX_MENUBAR* menuBar = new WX_MENUBAR();
40
41 //-- File menu -----------------------------------------------------------
42 //
43 ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
44
46 fileMenu->AppendSeparator();
47 fileMenu->AddClose( _( "Assign Footprints" ) );
48
49 //-- Edit menu -----------------------------------------------------------
50 //
51 ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
52
53 editMenu->Add( ACTIONS::undo );
54 editMenu->Add( ACTIONS::redo );
55
56 editMenu->AppendSeparator();
57 editMenu->Add( ACTIONS::cut );
58 editMenu->Add( ACTIONS::copy );
59 editMenu->Add( ACTIONS::paste );
60
61 //-- Preferences menu ----------------------------------------------------
62 //
63 ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
64
65 prefsMenu->Add( ACTIONS::configurePaths );
68 prefsMenu->Add( ACTIONS::openPreferences);
69
70 prefsMenu->AppendSeparator();
71 AddMenuLanguageList( prefsMenu, tool );
72
73 //-- Menubar -------------------------------------------------------------
74 //
75 menuBar->Append( fileMenu, _( "&File" ) );
76 menuBar->Append( editMenu, _( "&Edit" ) );
77 menuBar->Append( prefsMenu, _( "&Preferences" ) );
78 AddStandardHelpMenu( menuBar );
79
80 SetMenuBar( menuBar );
81 delete oldMenuBar;
82}
static TOOL_ACTION paste
Definition actions.h:76
static TOOL_ACTION copy
Definition actions.h:74
static TOOL_ACTION openPreferences
Definition actions.h:276
static TOOL_ACTION showFootprintLibTable
Definition actions.h:279
static TOOL_ACTION undo
Definition actions.h:71
static TOOL_ACTION redo
Definition actions.h:72
static TOOL_ACTION cut
Definition actions.h:73
static TOOL_ACTION configurePaths
Definition actions.h:277
Define the structure of a menu based on ACTIONs.
Definition action_menu.h:43
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
static TOOL_ACTION saveAssociationsToSchematic
Management actions.
void doReCreateMenuBar() override
void AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Create a menu list for language choice, and add it as submenu to MasterMenu.
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Add the standard KiCad help menu to the menubar.
TOOL_MANAGER * m_toolManager
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition wx_menubar.h:43
#define _(s)