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) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#include <bitmaps.h>
29#include <eda_3d_viewer_frame.h>
30#include <menus_helpers.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 WX_MENUBAR* menuBar = new WX_MENUBAR();
44
45
46 //-- File menu -----------------------------------------------------------
47 //
48 ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
49
50 fileMenu->Add( _( "Export Current View as PNG..." ),
51 wxEmptyString,
53 BITMAPS::export_png );
54
55 fileMenu->Add( _( "Export Current View as JPEG..." ),
56 wxEmptyString,
58 BITMAPS::export_file );
59
60 fileMenu->AppendSeparator();
61 fileMenu->AddClose( _( "3D Viewer" ) );
62
63
64 //-- Edit menu -------------------------------------------------------
65 // Avoid to translate hotkey modifiers like Ctrl and Shift.
66 // The translated modifiers do not always work
67 ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
68
69 editMenu->Add( _( "Copy 3D Image" ),
70 wxEmptyString,
72 BITMAPS::copy );
73
74
75 //-- View menu -------------------------------------------------------
76 //
77 ACTION_MENU* viewMenu = new ACTION_MENU( false, tool );
78
79 viewMenu->Add( ACTIONS::zoomInCenter );
80 viewMenu->Add( ACTIONS::zoomOutCenter );
81 viewMenu->Add( ACTIONS::zoomFitScreen );
82 viewMenu->Add( ACTIONS::zoomRedraw );
83
84 viewMenu->AppendSeparator();
85 viewMenu->Add( EDA_3D_ACTIONS::rotateXCW );
87
88 viewMenu->AppendSeparator();
89 viewMenu->Add( EDA_3D_ACTIONS::rotateYCW );
91
92 viewMenu->AppendSeparator();
93 viewMenu->Add( EDA_3D_ACTIONS::rotateZCW );
95
96 viewMenu->AppendSeparator();
97 viewMenu->Add( EDA_3D_ACTIONS::moveLeft );
98 viewMenu->Add( EDA_3D_ACTIONS::moveRight );
99 viewMenu->Add( EDA_3D_ACTIONS::moveUp );
100 viewMenu->Add( EDA_3D_ACTIONS::moveDown );
101
102
103 //-- Preferences menu -----------------------------------------------
104 //
105 ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
106
107 prefsMenu->Add( _( "Raytracing" ), "",
109 BITMAPS::tools,
111
112 prefsMenu->Add( _( "Preferences..." ) + wxT( "\tCtrl+," ),
113 _( "Show preferences for all open tools" ),
114 wxID_PREFERENCES,
115 BITMAPS::preference );
116
117 prefsMenu->Add( _( "Reset to Default Settings" ), ID_MENU3D_RESET_DEFAULTS, BITMAPS::tools );
118
119 prefsMenu->AppendSeparator();
120
126
127 prefsMenu->AppendSeparator();
128
131
132 // Grid submenu
133 ACTION_MENU* gridSubmenu = new ACTION_MENU( false, tool );
134 gridSubmenu->SetTitle( _( "3D Grid" ) );
135 gridSubmenu->SetIcon( BITMAPS::grid );
136
142
143 prefsMenu->Add( gridSubmenu );
144
145 //-- Menubar -------------------------------------------------------------
146 //
147 menuBar->Append( fileMenu, _( "&File" ) );
148 menuBar->Append( editMenu, _( "&Edit" ) );
149 menuBar->Append( viewMenu, _( "&View" ) );
150 menuBar->Append( prefsMenu, _( "&Preferences" ) );
151 AddStandardHelpMenu( menuBar );
152
153 SetMenuBar( menuBar );
154}
@ ID_MENU_SCREENCOPY_PNG
Definition: 3d_viewer_id.h:31
@ ID_TOOL_SCREENCOPY_TOCLIBBOARD
Definition: 3d_viewer_id.h:29
@ ID_MENU3D_RESET_DEFAULTS
Definition: 3d_viewer_id.h:35
@ ID_RENDER_CURRENT_VIEW
Definition: 3d_viewer_id.h:40
@ ID_MENU_SCREENCOPY_JPEG
Definition: 3d_viewer_id.h:32
static TOOL_ACTION zoomRedraw
Definition: actions.h:93
static TOOL_ACTION zoomOutCenter
Definition: actions.h:97
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
static TOOL_ACTION zoomInCenter
Definition: actions.h:96
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
static constexpr bool CHECK
Definition: action_menu.h:189
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:87
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
Definition: action_menu.cpp:73
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 rotateXCCW
static TOOL_ACTION showNotInPosFile
static TOOL_ACTION showTHT
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 showDNP
static TOOL_ACTION moveLeft
static TOOL_ACTION show10mmGrid
static TOOL_ACTION show5mmGrid
static TOOL_ACTION showSMD
static TOOL_ACTION moveUp
static TOOL_ACTION moveDown
static TOOL_ACTION moveRight
static TOOL_ACTION showVirtual
static TOOL_ACTION rotateYCW
static TOOL_ACTION showBBoxes
static TOOL_ACTION showAxis
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Adds the standard KiCad help menu to the menubar.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition: wx_menubar.h:46
#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.
Macros and inline functions to create menus items in menubars or popup menus.