KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
3d_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) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
5 * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
6 * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
7 * Copyright (C) 2023 CERN
8 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, you may find one here:
22 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23 * or you may search the http://www.gnu.org website for the version 2 license,
24 * or you may write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26 */
27
28#include <bitmaps.h>
30#include <eda_3d_viewer_frame.h>
31#include <3d_viewer_id.h>
33#include <tool/tool_manager.h>
34#include <tool/common_control.h>
35#include <widgets/wx_menubar.h>
36
37
39{
40 wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::CreateMenuBar" ) );
41
43 wxMenuBar* oldMenuBar = GetMenuBar();
44 WX_MENUBAR* menuBar = new WX_MENUBAR();
45
46
47 //-- File menu -----------------------------------------------------------
48 //
49 ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
50
53
54 fileMenu->AppendSeparator();
55 fileMenu->AddClose( _( "3D Viewer" ) );
56
57
58 //-- Edit menu -------------------------------------------------------
59 // Avoid to translate hotkey modifiers like Ctrl and Shift.
60 // The translated modifiers do not always work
61 ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
62
64
65
66 //-- View menu -------------------------------------------------------
67 //
68 ACTION_MENU* viewMenu = new ACTION_MENU( false, tool );
69
70 viewMenu->Add( ACTIONS::zoomInCenter );
71 viewMenu->Add( ACTIONS::zoomOutCenter );
72 viewMenu->Add( ACTIONS::zoomFitScreen );
73 viewMenu->Add( ACTIONS::zoomRedraw );
74
75 // Grid submenu
76 ACTION_MENU* gridSubmenu = new ACTION_MENU( false, tool );
77 gridSubmenu->SetTitle( _( "3D Grid" ) );
78 gridSubmenu->SetIcon( BITMAPS::grid );
79
85
86 viewMenu->AppendSeparator();
87 viewMenu->Add( gridSubmenu );
88
89 viewMenu->AppendSeparator();
90 viewMenu->Add( EDA_3D_ACTIONS::rotateXCW );
92
93 viewMenu->AppendSeparator();
94 viewMenu->Add( EDA_3D_ACTIONS::rotateYCW );
96
97 viewMenu->AppendSeparator();
98 viewMenu->Add( EDA_3D_ACTIONS::rotateZCW );
100
101 viewMenu->AppendSeparator();
102 viewMenu->Add( EDA_3D_ACTIONS::moveLeft );
103 viewMenu->Add( EDA_3D_ACTIONS::moveRight );
104 viewMenu->Add( EDA_3D_ACTIONS::moveUp );
105 viewMenu->Add( EDA_3D_ACTIONS::moveDown );
106
107 viewMenu->AppendSeparator();
109
110
111 //-- Preferences menu -----------------------------------------------
112 //
113 ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
114
116
117 prefsMenu->Add( ACTIONS::openPreferences );
118
119 prefsMenu->Add( _( "Reset to Default Settings" ), ID_MENU3D_RESET_DEFAULTS, BITMAPS::tools );
120
121 prefsMenu->AppendSeparator();
122 AddMenuLanguageList( prefsMenu, tool );
123
124 //-- Menubar -------------------------------------------------------------
125 //
126 menuBar->Append( fileMenu, _( "&File" ) );
127 menuBar->Append( editMenu, _( "&Edit" ) );
128 menuBar->Append( viewMenu, _( "&View" ) );
129 menuBar->Append( prefsMenu, _( "&Preferences" ) );
130 AddStandardHelpMenu( menuBar );
131
132 SetMenuBar( menuBar );
133 delete oldMenuBar;
134}
@ ID_MENU3D_RESET_DEFAULTS
Definition: 3d_viewer_id.h:38
static TOOL_ACTION zoomRedraw
Definition: actions.h:124
static TOOL_ACTION zoomOutCenter
Definition: actions.h:128
static TOOL_ACTION openPreferences
Definition: actions.h:231
static TOOL_ACTION zoomFitScreen
Definition: actions.h:134
static TOOL_ACTION zoomInCenter
Definition: actions.h:127
Define the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
static constexpr bool CHECK
Definition: action_menu.h:201
void AddClose(const wxString &aAppname="")
Add a standard close item to the menu with the accelerator key CTRL-W.
void SetTitle(const wxString &aTitle) override
Set title for the menu.
Definition: action_menu.cpp:92
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
Definition: action_menu.cpp:78
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 showLayersManager
static TOOL_ACTION rotateXCCW
static TOOL_ACTION noGrid
static TOOL_ACTION show2_5mmGrid
static TOOL_ACTION rotateZCCW
static TOOL_ACTION exportAsPNG
static TOOL_ACTION rotateZCW
static TOOL_ACTION rotateYCCW
static TOOL_ACTION rotateXCW
static TOOL_ACTION show1mmGrid
static TOOL_ACTION moveLeft
static TOOL_ACTION show10mmGrid
static TOOL_ACTION toggleRaytacing
static TOOL_ACTION show5mmGrid
static TOOL_ACTION exportAsJPEG
static TOOL_ACTION moveUp
static TOOL_ACTION moveDown
static TOOL_ACTION copyToClipboard
static TOOL_ACTION moveRight
static TOOL_ACTION rotateYCW
void doReCreateMenuBar() override
Definition: 3d_menubar.cpp:38
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:171
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition: wx_menubar.h:47
#define _(s)
Declaration of the eda_3d_viewer class.
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.