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 (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 <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 // wxWidgets handles the Mac Application menu behind the scenes, but that means
40 // we always have to start from scratch with a new wxMenuBar.
41 wxMenuBar* oldMenuBar = GetMenuBar();
42 WX_MENUBAR* menuBar = new WX_MENUBAR();
43
44 //-- File menu -----------------------------------------------------------
45 //
46 ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
47
49 fileMenu->AppendSeparator();
50 fileMenu->AddClose( _( "Assign Footprints" ) );
51
52 //-- Edit menu -----------------------------------------------------------
53 //
54 ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
55
56 editMenu->Add( ACTIONS::undo );
57 editMenu->Add( ACTIONS::redo );
58
59 editMenu->AppendSeparator();
60 editMenu->Add( ACTIONS::cut );
61 editMenu->Add( ACTIONS::copy );
62 editMenu->Add( ACTIONS::paste );
63
64 //-- Preferences menu ----------------------------------------------------
65 //
66 ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
67
68 prefsMenu->Add( ACTIONS::configurePaths );
71 prefsMenu->Add( ACTIONS::openPreferences);
72
73 prefsMenu->AppendSeparator();
74 AddMenuLanguageList( prefsMenu, tool );
75
76 //-- Menubar -------------------------------------------------------------
77 //
78 menuBar->Append( fileMenu, _( "&File" ) );
79 menuBar->Append( editMenu, _( "&Edit" ) );
80 menuBar->Append( prefsMenu, _( "&Preferences" ) );
81 AddStandardHelpMenu( menuBar );
82
83 SetMenuBar( menuBar );
84 delete oldMenuBar;
85}
static TOOL_ACTION paste
Definition: actions.h:73
static TOOL_ACTION copy
Definition: actions.h:71
static TOOL_ACTION openPreferences
Definition: actions.h:225
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:228
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:226
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 AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to Master...
void SetMenuBar(wxMenuBar *menu_bar) override
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Adds 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)