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, 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 <tool/actions.h>
27#include <tool/common_control.h>
29#include <tool/tool_manager.h>
30
31#include <cvpcb_mainframe.h>
32#include <tools/cvpcb_actions.h>
33#include <widgets/wx_menubar.h>
34
35
37{
39
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 );
72 prefsMenu->Add( ACTIONS::openPreferences);
73
74 prefsMenu->AppendSeparator();
75 AddMenuLanguageList( prefsMenu, tool );
76
77 //-- Menubar -------------------------------------------------------------
78 //
79 menuBar->Append( fileMenu, _( "&File" ) );
80 menuBar->Append( editMenu, _( "&Edit" ) );
81 menuBar->Append( prefsMenu, _( "&Preferences" ) );
82 AddStandardHelpMenu( menuBar );
83
84 SetMenuBar( menuBar );
85 delete oldMenuBar;
86}
static TOOL_ACTION paste
Definition: actions.h:73
static TOOL_ACTION copy
Definition: actions.h:71
static TOOL_ACTION openPreferences
Definition: actions.h:227
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:230
static TOOL_ACTION undo
Definition: actions.h:68
static TOOL_ACTION redo
Definition: actions.h:69
static TOOL_ACTION cut
Definition: actions.h:70
static TOOL_ACTION configurePaths
Definition: actions.h:228
Define 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 AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Create a menu list for language choice, and add it as submenu to MasterMenu.
void SetMenuBar(wxMenuBar *menu_bar) override
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Add the standard KiCad help menu to the menubar.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition: wx_menubar.h:47
#define _(s)