KiCad PCB EDA Suite
3d_actions.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) 2017 Jon Evans <jon@craftyjon.com>
5  * Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <tool/tool_manager.h>
22 #include <bitmaps.h>
23 #include <3d_viewer_id.h>
24 #include <3d_enums.h>
25 #include "3d_actions.h"
26 
27 
28 // Actions, being statically-defined, require specialized I18N handling. We continue to
29 // use the _() macro so that string harvesting by the I18N framework doesn't have to be
30 // specialized, but we don't translate on initialization and instead do it in the getters.
31 
32 #undef _
33 #define _(s) s
34 
35 
37  0, "", "", "",
38  NULL, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
39 
40 TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( "3DViewer.Control.pivotCenter",
41  AS_ACTIVE,
42  ' ', "",
43  _( "Center pivot rotation" ), _( "Center pivot rotation (middle mouse click)" ),
44  nullptr, AF_NONE, (void*) WXK_SPACE );
45 
46 TOOL_ACTION EDA_3D_ACTIONS::rotateXCW( "3DViewer.Control.rotateXclockwise",
47  AS_GLOBAL, 0, "",
48  _( "Rotate X Clockwise" ), _( "Rotate X Clockwise" ),
50 
51 TOOL_ACTION EDA_3D_ACTIONS::rotateXCCW( "3DViewer.Control.rotateXcounterclockwise",
52  AS_GLOBAL, 0, "",
53  _( "Rotate X Counterclockwise" ), _( "Rotate X Counterclockwise" ),
55 
56 TOOL_ACTION EDA_3D_ACTIONS::rotateYCW( "3DViewer.Control.rotateYclockwise",
57  AS_GLOBAL, 0, "",
58  _( "Rotate Y Clockwise" ), _( "Rotate Y Clockwise" ),
60 
61 TOOL_ACTION EDA_3D_ACTIONS::rotateYCCW( "3DViewer.Control.rotateYcounterclockwise",
62  AS_GLOBAL, 0, "",
63  _( "Rotate Y Counterclockwise" ), _( "Rotate Y Counterclockwise" ),
65 
66 TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( "3DViewer.Control.rotateZclockwise",
67  AS_GLOBAL, 0, "",
68  _( "Rotate Z Clockwise" ), _( "Rotate Z Clockwise" ),
70 
71 TOOL_ACTION EDA_3D_ACTIONS::rotateZCCW( "3DViewer.Control.rotateZcounterclockwise",
72  AS_GLOBAL, 0, "",
73  _( "Rotate Z Counterclockwise" ), _( "Rotate Z Counterclockwise" ),
75 
76 TOOL_ACTION EDA_3D_ACTIONS::moveLeft( "3DViewer.Control.moveLeft",
77  AS_ACTIVE,
78  WXK_LEFT, "",
79  _( "Move board Left" ), _( "Move board Left" ),
80  left_xpm, AF_NONE, (void*) CURSOR_LEFT );
81 
82 TOOL_ACTION EDA_3D_ACTIONS::moveRight( "3DViewer.Control.moveRight",
83  AS_ACTIVE,
84  WXK_RIGHT, "",
85  _( "Move board Right" ), _( "Move board Right" ),
86  right_xpm, AF_NONE, (void*) CURSOR_RIGHT );
87 
88 TOOL_ACTION EDA_3D_ACTIONS::moveUp( "3DViewer.Control.moveUp",
89  AS_ACTIVE,
90  WXK_UP, "",
91  _( "Move board Up" ), _( "Move board Up" ),
92  up_xpm, AF_NONE, (void*) CURSOR_UP );
93 
94 TOOL_ACTION EDA_3D_ACTIONS::moveDown( "3DViewer.Control.moveDown",
95  AS_ACTIVE,
96  WXK_DOWN, "",
97  _( "Move board Down" ), _( "Move board Down" ),
98  down_xpm, AF_NONE, (void*) CURSOR_DOWN );
99 
100 TOOL_ACTION EDA_3D_ACTIONS::homeView( "3DViewer.Control.homeView",
101  AS_ACTIVE,
102  WXK_HOME, "",
103  _( "Home view" ), _( "Home view" ),
104  nullptr, AF_NONE, (void*) WXK_HOME );
105 
106 TOOL_ACTION EDA_3D_ACTIONS::resetView( "3DViewer.Control.resetView",
107  AS_ACTIVE,
108  'R', "",
109  _( "Reset view" ), _( "Reset view" ),
110  nullptr, AF_NONE, (void*) ID_VIEW3D_RESET );
111 
112 TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( "3DViewer.Control.toggleOrtho",
113  AS_GLOBAL, 0, "",
114  _( "Toggle orthographic projection" ), _( "Enable/disable orthographic projection" ),
115  ortho_xpm );
116 
117 TOOL_ACTION EDA_3D_ACTIONS::viewFront( "3DViewer.Control.viewFront",
118  AS_ACTIVE,
119  'Y', "",
120  _( "View Front" ), _( "View Front" ),
122 
123 TOOL_ACTION EDA_3D_ACTIONS::viewBack( "3DViewer.Control.viewBack",
124  AS_ACTIVE,
125  MD_SHIFT + 'Y', "",
126  _( "View Back" ), _( "View Back" ),
128 
129 TOOL_ACTION EDA_3D_ACTIONS::viewLeft( "3DViewer.Control.viewLeft",
130  AS_ACTIVE,
131  MD_SHIFT + 'X', "",
132  _( "View Left" ), _( "View Left" ),
134 
135 TOOL_ACTION EDA_3D_ACTIONS::viewRight( "3DViewer.Control.viewRight",
136  AS_ACTIVE,
137  'X', "",
138  _( "View Right" ), _( "View Right" ),
140 
141 TOOL_ACTION EDA_3D_ACTIONS::viewTop( "3DViewer.Control.viewTop",
142  AS_ACTIVE,
143  'Z', "",
144  _( "View Top" ), _( "View Top" ),
146 
147 TOOL_ACTION EDA_3D_ACTIONS::viewBottom( "3DViewer.Control.viewBottom",
148  AS_ACTIVE,
149  MD_SHIFT + 'Z', "",
150  _( "View Bottom" ), _( "View Bottom" ),
152 
153 TOOL_ACTION EDA_3D_ACTIONS::noGrid( "3DViewer.Control.noGrid",
154  AS_GLOBAL, 0, "",
155  _( "No 3D Grid" ), _( "No 3D Grid" ),
156  nullptr, AF_NONE, (void*) GRID3D_TYPE::NONE );
157 
158 TOOL_ACTION EDA_3D_ACTIONS::show10mmGrid( "3DViewer.Control.show10mmGrid",
159  AS_GLOBAL, 0, "",
160  _( "3D Grid 10mm" ), _( "3D Grid 10mm" ),
161  nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_10MM );
162 
163 TOOL_ACTION EDA_3D_ACTIONS::show5mmGrid( "3DViewer.Control.show5mmGrid",
164  AS_GLOBAL, 0, "",
165  _( "3D Grid 5mm" ), _( "3D Grid 5mm" ),
166  nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_5MM );
167 
168 TOOL_ACTION EDA_3D_ACTIONS::show2_5mmGrid( "3DViewer.Control.show2_5mmGrid",
169  AS_GLOBAL, 0, "",
170  _( "3D Grid 2.5mm" ), _( "3D Grid 2.5mm" ),
171  nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_2P5MM );
172 
173 TOOL_ACTION EDA_3D_ACTIONS::show1mmGrid( "3DViewer.Control.show1mmGrid",
174  AS_GLOBAL, 0, "",
175  _( "3D Grid 1mm" ), _( "3D Grid 1mm" ),
176  nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_1MM );
177 
178 TOOL_ACTION EDA_3D_ACTIONS::rotate45axisZ( "3DViewer.Control.rotate45axisZ",
179  AS_ACTIVE,
180  WXK_TAB, "",
181  "Rotate 45 degrees over Z axis" );
182 
183 TOOL_ACTION EDA_3D_ACTIONS::attributesTHT( "3DViewer.Control.attributesTHT",
184  AS_ACTIVE,
185  'T', "",
186  _( "Toggle Through Hole 3D models" ), _( "Toggle 3D models with 'Through hole' attribute" ),
187  nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_NORMAL );
188 
189 TOOL_ACTION EDA_3D_ACTIONS::attributesSMD( "3DViewer.Control.attributesSMD",
190  AS_ACTIVE,
191  'S', "",
192  _( "Toggle SMD 3D models" ), _( "Toggle 3D models with 'Surface mount' attribute" ),
193  nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_NORMAL_INSERT );
194 
195 TOOL_ACTION EDA_3D_ACTIONS::attributesVirtual( "3DViewer.Control.attributesVirtual",
196  AS_ACTIVE,
197  'V', "",
198  _( "Toggle Virtual 3D models" ), _( "Toggle 3D models with 'Virtual' attribute" ),
199  nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_VIRTUAL );
200 
201 TOOL_ACTION EDA_3D_ACTIONS::showBoundingBoxes( "3DViewer.Control.showBoundingBoxes",
202  AS_GLOBAL, 0, "",
203  _( "Show Model Bounding Boxes" ), _( "Show Model Bounding Boxes" ),
205 
206 TOOL_ACTION EDA_3D_ACTIONS::renderShadows( "3DViewer.Control.renderShadows",
207  AS_GLOBAL, 0, "",
208  _( "Render Shadows" ), _( "Render Shadows" ),
209  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_SHADOWS );
210 
211 TOOL_ACTION EDA_3D_ACTIONS::proceduralTextures( "3DViewer.Control.proceduralTextures",
212  AS_GLOBAL, 0, "",
213  _( "Procedural Textures" ), _( "Apply procedural textures to materials (slow)" ),
215 
216 TOOL_ACTION EDA_3D_ACTIONS::addFloor( "3DViewer.Control.addFloor",
217  AS_GLOBAL, 0, "",
218  _( "Add Floor" ), _( "Adds a floor plane below the board (slow)"),
219  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_BACKFLOOR );
220 
221 TOOL_ACTION EDA_3D_ACTIONS::showRefractions( "3DViewer.Control.showRefractions",
222  AS_GLOBAL, 0, "",
223  _( "Refractions" ), _( "Render materials with refractive properties on final render (slow)" ),
224  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_REFRACTIONS );
225 
226 TOOL_ACTION EDA_3D_ACTIONS::showReflections( "3DViewer.Control.showReflections",
227  AS_GLOBAL, 0, "",
228  _( "Reflections" ), _( "Render materials with reflective properties on final render (slow)" ),
229  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_REFLECTIONS );
230 
231 TOOL_ACTION EDA_3D_ACTIONS::antiAliasing( "3DViewer.Control.antiAliasing",
232  AS_GLOBAL, 0, "",
233  _( "Anti-aliasing" ), _( "Render with improved quality on final render (slow)" ),
234  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_ANTI_ALIASING );
235 
236 TOOL_ACTION EDA_3D_ACTIONS::postProcessing( "3DViewer.Control.postProcessing",
237  AS_GLOBAL, 0, "",
238  _( "Post-processing" ),
239  _( "Apply Screen Space Ambient Occlusion and Global Illumination reflections on final render (slow)"),
240  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_POST_PROCESSING );
241 
242 TOOL_ACTION EDA_3D_ACTIONS::toggleRealisticMode( "3DViewer.Control.toggleRealisticMode",
243  AS_GLOBAL, 0, "",
244  _( "Toggle realistic mode" ), _( "Toggle realistic mode" ),
245  nullptr, AF_NONE, (void*) FL_USE_REALISTIC_MODE );
246 
247 TOOL_ACTION EDA_3D_ACTIONS::toggleBoardBody( "3DViewer.Control.toggleBoardBody",
248  AS_GLOBAL, 0, "",
249  _( "Toggle board body display" ), _( "Toggle board body display" ),
250  nullptr, AF_NONE, (void*) FL_SHOW_BOARD_BODY );
251 
252 TOOL_ACTION EDA_3D_ACTIONS::showAxis( "3DViewer.Control.showAxis",
253  AS_GLOBAL, 0, "",
254  _( "Show 3D Axis" ), _( "Show 3D Axis" ),
255  axis3d_front_xpm, AF_NONE, (void*) FL_AXIS );
256 
257 TOOL_ACTION EDA_3D_ACTIONS::toggleZones( "3DViewer.Control.toggleZones",
258  AS_GLOBAL, 0, "",
259  _( "Toggle zone display" ), _( "Toggle zone display" ),
260  nullptr, AF_NONE, (void*) FL_ZONE );
261 
262 TOOL_ACTION EDA_3D_ACTIONS::toggleAdhesive( "3DViewer.Control.toggleAdhesive",
263  AS_GLOBAL, 0, "",
264  _( "Toggle adhesive display" ), _( "Toggle display of adhesive layers" ),
265  nullptr, AF_NONE, (void*) FL_ADHESIVE );
266 
267 TOOL_ACTION EDA_3D_ACTIONS::toggleSilk( "3DViewer.Control.toggleSilk",
268  AS_GLOBAL, 0, "",
269  _( "Toggle silkscreen display" ), _( "Toggle display of silkscreen layers" ),
270  nullptr, AF_NONE, (void*) FL_SILKSCREEN );
271 
272 TOOL_ACTION EDA_3D_ACTIONS::toggleSolderMask( "3DViewer.Control.toggleSolderMask",
273  AS_GLOBAL, 0, "",
274  _( "Toggle solder mask display" ), _( "Toggle display of solder mask layers" ),
275  nullptr, AF_NONE, (void*) FL_SOLDERMASK );
276 
277 TOOL_ACTION EDA_3D_ACTIONS::toggleSolderPaste( "3DViewer.Control.toggleSolderPaste",
278  AS_GLOBAL, 0, "",
279  _( "Toggle solder paste display" ), _( "Toggle display of solder paste layers" ),
280  nullptr, AF_NONE, (void*) FL_SOLDERPASTE );
281 
282 TOOL_ACTION EDA_3D_ACTIONS::toggleComments( "3DViewer.Control.toggleComments",
283  AS_GLOBAL, 0, "",
284  _( "Toggle comments display" ), _( "Toggle display of comments and drawings layers" ),
285  nullptr, AF_NONE, (void*) FL_COMMENTS );
286 
287 TOOL_ACTION EDA_3D_ACTIONS::toggleECO( "3DViewer.Control.toggleECO",
288  AS_GLOBAL, 0, "",
289  _( "Toggle ECO display" ), _( "Toggle display of ECO layers" ),
290  nullptr, AF_NONE, (void*) FL_ECO );
291 
static TOOL_ACTION rotateXCW
Definition: 3d_actions.h:47
const BITMAP_OPAQUE right_xpm[1]
Definition: right.cpp:49
const BITMAP_OPAQUE down_xpm[1]
Definition: down.cpp:47
static TOOL_ACTION homeView
Definition: 3d_actions.h:57
const BITMAP_OPAQUE axis3d_front_xpm[1]
static TOOL_ACTION show10mmGrid
Definition: 3d_actions.h:69
static TOOL_ACTION pivotCenter
Definition: 3d_actions.h:46
static TOOL_ACTION showBoundingBoxes
Definition: 3d_actions.h:78
static TOOL_ACTION toggleAdhesive
Definition: 3d_actions.h:90
const BITMAP_OPAQUE rotate_neg_z_xpm[1]
const BITMAP_OPAQUE ortho_xpm[1]
Definition: ortho.cpp:55
static TOOL_ACTION attributesVirtual
Definition: 3d_actions.h:77
static TOOL_ACTION toggleSilk
Definition: 3d_actions.h:91
static TOOL_ACTION toggleSolderMask
Definition: 3d_actions.h:92
static TOOL_ACTION showRefractions
Definition: 3d_actions.h:82
const BITMAP_OPAQUE left_xpm[1]
Definition: left.cpp:48
const BITMAP_OPAQUE rotate_pos_z_xpm[1]
const BITMAP_OPAQUE rotate_pos_y_xpm[1]
static TOOL_ACTION resetView
Definition: 3d_actions.h:58
static TOOL_ACTION controlActivate
Definition: 3d_actions.h:44
declared enumerations and flags
const BITMAP_OPAQUE rotate_pos_x_xpm[1]
static TOOL_ACTION toggleZones
Definition: 3d_actions.h:89
static TOOL_ACTION viewRight
Definition: 3d_actions.h:64
static TOOL_ACTION viewLeft
Definition: 3d_actions.h:63
static TOOL_ACTION toggleECO
Definition: 3d_actions.h:95
static TOOL_ACTION antiAliasing
Definition: 3d_actions.h:84
static TOOL_ACTION rotate45axisZ
Definition: 3d_actions.h:74
Action belongs to a particular tool (i.e. a part of a pop-up menu)
Definition: tool_event.h:146
static TOOL_ACTION moveLeft
Definition: 3d_actions.h:53
static TOOL_ACTION toggleComments
Definition: 3d_actions.h:94
static TOOL_ACTION show5mmGrid
Definition: 3d_actions.h:70
#define NULL
static TOOL_ACTION toggleSolderPaste
Definition: 3d_actions.h:93
static TOOL_ACTION rotateYCW
Definition: 3d_actions.h:49
const BITMAP_OPAQUE axis3d_left_xpm[1]
Definition: axis3d_left.cpp:98
const BITMAP_OPAQUE up_xpm[1]
Definition: up.cpp:47
const BITMAP_OPAQUE axis3d_bottom_xpm[1]
static TOOL_ACTION rotateXCCW
Definition: 3d_actions.h:48
static TOOL_ACTION viewBottom
Definition: 3d_actions.h:66
static TOOL_ACTION rotateZCCW
Definition: 3d_actions.h:52
static TOOL_ACTION addFloor
Definition: 3d_actions.h:81
All active tools
Definition: tool_event.h:147
static TOOL_ACTION showAxis
Definition: 3d_actions.h:88
static TOOL_ACTION rotateZCW
Definition: 3d_actions.h:51
static TOOL_ACTION viewTop
Definition: 3d_actions.h:65
static TOOL_ACTION viewBack
Definition: 3d_actions.h:62
static TOOL_ACTION attributesSMD
Definition: 3d_actions.h:76
static TOOL_ACTION toggleRealisticMode
Definition: 3d_actions.h:86
const BITMAP_OPAQUE axis3d_top_xpm[1]
Definition: axis3d_top.cpp:94
static TOOL_ACTION moveDown
Definition: 3d_actions.h:56
const BITMAP_OPAQUE rotate_neg_x_xpm[1]
static TOOL_ACTION proceduralTextures
Definition: 3d_actions.h:80
static TOOL_ACTION show2_5mmGrid
Definition: 3d_actions.h:71
static TOOL_ACTION show1mmGrid
Definition: 3d_actions.h:72
const BITMAP_OPAQUE rotate_neg_y_xpm[1]
static TOOL_ACTION attributesTHT
Definition: 3d_actions.h:75
static TOOL_ACTION viewFront
Definition: 3d_actions.h:61
static TOOL_ACTION rotateYCCW
Definition: 3d_actions.h:50
#define _(s)
Definition: 3d_actions.cpp:33
TOOL_ACTION.
Definition: tool_action.h:46
static TOOL_ACTION postProcessing
Definition: 3d_actions.h:85
static TOOL_ACTION moveUp
Definition: 3d_actions.h:55
static TOOL_ACTION noGrid
Definition: 3d_actions.h:68
static TOOL_ACTION showReflections
Definition: 3d_actions.h:83
const BITMAP_OPAQUE axis3d_right_xpm[1]
static TOOL_ACTION toggleOrtho
Definition: 3d_actions.h:59
static TOOL_ACTION renderShadows
Definition: 3d_actions.h:79
static TOOL_ACTION moveRight
Definition: 3d_actions.h:54
const BITMAP_OPAQUE axis3d_back_xpm[1]
Definition: axis3d_back.cpp:97
static TOOL_ACTION toggleBoardBody
Definition: 3d_actions.h:87