KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
5 * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
6 * Copyright (C) 2013 Wayne Stambaugh <[email protected]>
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, see <https://www.gnu.org/licenses/>.
22 */
23
24#include <bitmaps.h>
26#include <eda_3d_viewer_frame.h>
27#include <3d_viewer_id.h>
29#include <tool/tool_manager.h>
30#include <tool/common_control.h>
31#include <widgets/wx_menubar.h>
32
33
35{
36 wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::CreateMenuBar" ) );
37
39 wxMenuBar* oldMenuBar = GetMenuBar();
40 WX_MENUBAR* menuBar = new WX_MENUBAR();
41
42
43 //-- File menu -----------------------------------------------------------
44 //
45 ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
46
48
49 fileMenu->AppendSeparator();
50 fileMenu->AddClose( _( "3D Viewer" ) );
51
52
53 //-- Edit menu -------------------------------------------------------
54 // Avoid to translate hotkey modifiers like Ctrl and Shift.
55 // The translated modifiers do not always work
56 ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
57
59
60
61 //-- View menu -------------------------------------------------------
62 //
63 ACTION_MENU* viewMenu = new ACTION_MENU( false, tool );
64
65 viewMenu->Add( ACTIONS::zoomInCenter );
66 viewMenu->Add( ACTIONS::zoomOutCenter );
67 viewMenu->Add( ACTIONS::zoomFitScreen );
68 viewMenu->Add( ACTIONS::zoomRedraw );
69
70 // Grid submenu
71 ACTION_MENU* gridSubmenu = new ACTION_MENU( false, tool );
72 gridSubmenu->SetTitle( _( "3D Grid" ) );
73 gridSubmenu->SetIcon( BITMAPS::grid );
74
80
81 viewMenu->AppendSeparator();
82 viewMenu->Add( gridSubmenu );
83
84 viewMenu->AppendSeparator();
85 viewMenu->Add( EDA_3D_ACTIONS::viewTop );
87 viewMenu->Add( EDA_3D_ACTIONS::viewRight );
88 viewMenu->Add( EDA_3D_ACTIONS::viewLeft );
89 viewMenu->Add( EDA_3D_ACTIONS::viewFront );
90 viewMenu->Add( EDA_3D_ACTIONS::viewBack );
91
92 ACTION_MENU* rotateSubmenu = new ACTION_MENU( false, tool );
93 rotateSubmenu->SetTitle( _( "Rotate Board" ) );
94 rotateSubmenu->SetIcon( BITMAPS::rotate_cw );
95
96 rotateSubmenu->Add( EDA_3D_ACTIONS::rotateXCW );
97 rotateSubmenu->Add( EDA_3D_ACTIONS::rotateXCCW );
98 rotateSubmenu->AppendSeparator();
99 rotateSubmenu->Add( EDA_3D_ACTIONS::rotateYCW );
100 rotateSubmenu->Add( EDA_3D_ACTIONS::rotateYCCW );
101 rotateSubmenu->AppendSeparator();
102 rotateSubmenu->Add( EDA_3D_ACTIONS::rotateZCW );
103 rotateSubmenu->Add( EDA_3D_ACTIONS::rotateZCCW );
104
105 ACTION_MENU* moveSubmenu = new ACTION_MENU( false, tool );
106 moveSubmenu->SetTitle( _( "Move Board" ) );
107 moveSubmenu->SetIcon( BITMAPS::move );
108
109 moveSubmenu->Add( EDA_3D_ACTIONS::moveLeft );
110 moveSubmenu->Add( EDA_3D_ACTIONS::moveRight );
111 moveSubmenu->Add( EDA_3D_ACTIONS::moveUp );
112 moveSubmenu->Add( EDA_3D_ACTIONS::moveDown );
113
114 viewMenu->AppendSeparator();
115 viewMenu->Add( rotateSubmenu );
116 viewMenu->Add( EDA_3D_ACTIONS::flipView );
117 viewMenu->Add( moveSubmenu );
118
119 viewMenu->AppendSeparator();
121
122
123 //-- Preferences menu -----------------------------------------------
124 //
125 ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
126
128
130
131 prefsMenu->Add( ACTIONS::openPreferences );
132
133 prefsMenu->Add( _( "Reset to Default Settings" ), ID_MENU3D_RESET_DEFAULTS, BITMAPS::tools );
134
135 prefsMenu->AppendSeparator();
136 AddMenuLanguageList( prefsMenu, tool );
137
138 //-- Menubar -------------------------------------------------------------
139 //
140 menuBar->Append( fileMenu, _( "&File" ) );
141 menuBar->Append( editMenu, _( "&Edit" ) );
142 menuBar->Append( viewMenu, _( "&View" ) );
143 menuBar->Append( prefsMenu, _( "&Preferences" ) );
144 AddStandardHelpMenu( menuBar );
145
146 SetMenuBar( menuBar );
147 delete oldMenuBar;
148}
@ ID_MENU3D_RESET_DEFAULTS
static TOOL_ACTION zoomRedraw
Definition actions.h:128
static TOOL_ACTION zoomOutCenter
Definition actions.h:132
static TOOL_ACTION openPreferences
Definition actions.h:276
static TOOL_ACTION zoomFitScreen
Definition actions.h:138
static TOOL_ACTION zoomInCenter
Definition actions.h:131
Define the structure of a menu based on ACTIONs.
Definition action_menu.h:43
static constexpr bool CHECK
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.
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
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 exportImage
static TOOL_ACTION noGrid
static TOOL_ACTION show2_5mmGrid
static TOOL_ACTION rotateZCCW
static TOOL_ACTION rotateZCW
static TOOL_ACTION rotateYCCW
static TOOL_ACTION rotateXCW
static TOOL_ACTION viewTop
static TOOL_ACTION show1mmGrid
static TOOL_ACTION moveLeft
static TOOL_ACTION toggleShowMissingModels
static TOOL_ACTION viewLeft
static TOOL_ACTION show10mmGrid
static TOOL_ACTION toggleRaytacing
static TOOL_ACTION viewBack
static TOOL_ACTION show5mmGrid
static TOOL_ACTION viewRight
static TOOL_ACTION moveUp
static TOOL_ACTION flipView
static TOOL_ACTION moveDown
static TOOL_ACTION viewBottom
static TOOL_ACTION copyToClipboard
static TOOL_ACTION moveRight
static TOOL_ACTION rotateYCW
static TOOL_ACTION viewFront
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)
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.