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 (C) 1992-2023 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
51 fileMenu->Add( _( "Export Current View as PNG..." ),
52 wxEmptyString,
54 BITMAPS::export_png );
55
56 fileMenu->Add( _( "Export Current View as JPEG..." ),
57 wxEmptyString,
59 BITMAPS::export_file );
60
61 fileMenu->AppendSeparator();
62 fileMenu->AddClose( _( "3D Viewer" ) );
63
64
65 //-- Edit menu -------------------------------------------------------
66 // Avoid to translate hotkey modifiers like Ctrl and Shift.
67 // The translated modifiers do not always work
68 ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
69
70 editMenu->Add( _( "Copy 3D Image" ),
71 wxEmptyString,
73 BITMAPS::copy );
74
75
76 //-- View menu -------------------------------------------------------
77 //
78 ACTION_MENU* viewMenu = new ACTION_MENU( false, tool );
79
80 viewMenu->Add( ACTIONS::zoomInCenter );
81 viewMenu->Add( ACTIONS::zoomOutCenter );
82 viewMenu->Add( ACTIONS::zoomFitScreen );
83 viewMenu->Add( ACTIONS::zoomRedraw );
84
85 // Grid submenu
86 ACTION_MENU* gridSubmenu = new ACTION_MENU( false, tool );
87 gridSubmenu->SetTitle( _( "3D Grid" ) );
88 gridSubmenu->SetIcon( BITMAPS::grid );
89
95
96 viewMenu->AppendSeparator();
97 viewMenu->Add( gridSubmenu );
98
99 viewMenu->AppendSeparator();
100 viewMenu->Add( EDA_3D_ACTIONS::rotateXCW );
101 viewMenu->Add( EDA_3D_ACTIONS::rotateXCCW );
102
103 viewMenu->AppendSeparator();
104 viewMenu->Add( EDA_3D_ACTIONS::rotateYCW );
105 viewMenu->Add( EDA_3D_ACTIONS::rotateYCCW );
106
107 viewMenu->AppendSeparator();
108 viewMenu->Add( EDA_3D_ACTIONS::rotateZCW );
109 viewMenu->Add( EDA_3D_ACTIONS::rotateZCCW );
110
111 viewMenu->AppendSeparator();
112 viewMenu->Add( EDA_3D_ACTIONS::moveLeft );
113 viewMenu->Add( EDA_3D_ACTIONS::moveRight );
114 viewMenu->Add( EDA_3D_ACTIONS::moveUp );
115 viewMenu->Add( EDA_3D_ACTIONS::moveDown );
116
117 viewMenu->AppendSeparator();
119
120
121 //-- Preferences menu -----------------------------------------------
122 //
123 ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
124
125 prefsMenu->Add( _( "Raytracing" ), "",
127 BITMAPS::tools,
129
130 prefsMenu->Add( ACTIONS::openPreferences );
131
132 prefsMenu->Add( _( "Reset to Default Settings" ), ID_MENU3D_RESET_DEFAULTS, BITMAPS::tools );
133
134 prefsMenu->AppendSeparator();
135 AddMenuLanguageList( prefsMenu, tool );
136
137 //-- Menubar -------------------------------------------------------------
138 //
139 menuBar->Append( fileMenu, _( "&File" ) );
140 menuBar->Append( editMenu, _( "&Edit" ) );
141 menuBar->Append( viewMenu, _( "&View" ) );
142 menuBar->Append( prefsMenu, _( "&Preferences" ) );
143 AddStandardHelpMenu( menuBar );
144
145 SetMenuBar( menuBar );
146 delete oldMenuBar;
147}
@ ID_MENU_SCREENCOPY_PNG
Definition: 3d_viewer_id.h:40
@ ID_TOOL_SCREENCOPY_TOCLIBBOARD
Definition: 3d_viewer_id.h:38
@ ID_MENU3D_RESET_DEFAULTS
Definition: 3d_viewer_id.h:44
@ ID_RENDER_CURRENT_VIEW
Definition: 3d_viewer_id.h:49
@ ID_MENU_SCREENCOPY_JPEG
Definition: 3d_viewer_id.h:41
static TOOL_ACTION zoomRedraw
Definition: actions.h:124
static TOOL_ACTION zoomOutCenter
Definition: actions.h:128
static TOOL_ACTION openPreferences
Definition: actions.h:227
static TOOL_ACTION zoomFitScreen
Definition: actions.h:134
static TOOL_ACTION zoomInCenter
Definition: actions.h:127
Defines 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 rotateZCW
static TOOL_ACTION rotateYCCW
static TOOL_ACTION rotateXCW
static TOOL_ACTION show1mmGrid
static TOOL_ACTION moveLeft
static TOOL_ACTION show10mmGrid
static TOOL_ACTION show5mmGrid
static TOOL_ACTION moveUp
static TOOL_ACTION moveDown
static TOOL_ACTION moveRight
static TOOL_ACTION rotateYCW
void doReCreateMenuBar() override
Definition: 3d_menubar.cpp:38
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)
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.