KiCad PCB EDA Suite
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) 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>
28 #include <tool/conditional_menu.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, "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  "",
54 
55  fileMenu->Add( _( "Export Current View as JPEG..." ),
56  "",
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  "",
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 );
86  viewMenu->Add( EDA_3D_ACTIONS::rotateXCCW );
87 
88  viewMenu->AppendSeparator();
89  viewMenu->Add( EDA_3D_ACTIONS::rotateYCW );
90  viewMenu->Add( EDA_3D_ACTIONS::rotateYCCW );
91 
92  viewMenu->AppendSeparator();
93  viewMenu->Add( EDA_3D_ACTIONS::rotateZCW );
94  viewMenu->Add( EDA_3D_ACTIONS::rotateZCCW );
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" ), "",
111 
112  prefsMenu->Add( _( "Preferences..." ) + "\tCtrl+,",
113  _( "Show preferences for all open tools" ),
114  wxID_PREFERENCES,
116 
117  prefsMenu->Add( _( "Reset to Default Settings" ), ID_MENU3D_RESET_DEFAULTS, BITMAPS::tools );
118 
119  prefsMenu->AppendSeparator();
120 
124 
125  prefsMenu->AppendSeparator();
126 
129 
130  // Grid submenu
131  ACTION_MENU* gridSubmenu = new ACTION_MENU( false, tool );
132  gridSubmenu->SetTitle( _( "3D Grid" ) );
133  gridSubmenu->SetIcon( BITMAPS::grid );
134 
140 
141  prefsMenu->Add( gridSubmenu );
142 
143  //-- Menubar -------------------------------------------------------------
144  //
145  menuBar->Append( fileMenu, _( "&File" ) );
146  menuBar->Append( editMenu, _( "&Edit" ) );
147  menuBar->Append( viewMenu, _( "&View" ) );
148  menuBar->Append( prefsMenu, _( "&Preferences" ) );
149  AddStandardHelpMenu( menuBar );
150 
151  SetMenuBar( menuBar );
152 }
static TOOL_ACTION rotateXCW
static TOOL_ACTION zoomInCenter
Definition: actions.h:93
static TOOL_ACTION show10mmGrid
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:48
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
Definition: action_menu.cpp:73
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
static TOOL_ACTION zoomFitScreen
Definition: actions.h:96
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition: wx_menubar.h:45
static TOOL_ACTION showBBoxes
static TOOL_ACTION zoomOutCenter
Definition: actions.h:94
static TOOL_ACTION showSMD
static TOOL_ACTION showVirtual
static TOOL_ACTION moveLeft
static TOOL_ACTION show5mmGrid
static TOOL_ACTION showTHT
static TOOL_ACTION rotateYCW
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Adds the standard KiCad help menu to the menubar.
static TOOL_ACTION rotateXCCW
#define _(s)
static TOOL_ACTION rotateZCCW
static TOOL_ACTION showAxis
Handle actions that are shared between different applications.
static TOOL_ACTION rotateZCW
static TOOL_ACTION moveDown
static constexpr bool CHECK
Definition: action_menu.h:183
static TOOL_ACTION show2_5mmGrid
static TOOL_ACTION show1mmGrid
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:158
void SetTitle(const wxString &aTitle) override
Set title for the menu.
Definition: action_menu.cpp:87
static TOOL_ACTION rotateYCCW
static TOOL_ACTION zoomRedraw
Definition: actions.h:90
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
static TOOL_ACTION moveUp
static TOOL_ACTION noGrid
static TOOL_ACTION moveRight
void AddClose(const wxString &aAppname="")
Add a standard close item to the menu with the accelerator key CTRL-W.