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::flipView( "3DViewer.Control.flipView",
113  AS_ACTIVE,
114  0, "",
115  _( "Flip Board" ), _( "Flip the board view" ),
116  reload2_xpm, AF_NONE, (void*) ID_VIEW3D_FLIP );
117 
118 TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( "3DViewer.Control.toggleOrtho",
119  AS_GLOBAL, 0, "",
120  _( "Toggle orthographic projection" ), _( "Enable/disable orthographic projection" ),
121  ortho_xpm );
122 
123 TOOL_ACTION EDA_3D_ACTIONS::viewFront( "3DViewer.Control.viewFront",
124  AS_ACTIVE,
125  'Y', "",
126  _( "View Front" ), _( "View Front" ),
128 
129 TOOL_ACTION EDA_3D_ACTIONS::viewBack( "3DViewer.Control.viewBack",
130  AS_ACTIVE,
131  MD_SHIFT + 'Y', "",
132  _( "View Back" ), _( "View Back" ),
134 
135 TOOL_ACTION EDA_3D_ACTIONS::viewLeft( "3DViewer.Control.viewLeft",
136  AS_ACTIVE,
137  MD_SHIFT + 'X', "",
138  _( "View Left" ), _( "View Left" ),
140 
141 TOOL_ACTION EDA_3D_ACTIONS::viewRight( "3DViewer.Control.viewRight",
142  AS_ACTIVE,
143  'X', "",
144  _( "View Right" ), _( "View Right" ),
146 
147 TOOL_ACTION EDA_3D_ACTIONS::viewTop( "3DViewer.Control.viewTop",
148  AS_ACTIVE,
149  'Z', "",
150  _( "View Top" ), _( "View Top" ),
152 
153 TOOL_ACTION EDA_3D_ACTIONS::viewBottom( "3DViewer.Control.viewBottom",
154  AS_ACTIVE,
155  MD_SHIFT + 'Z', "",
156  _( "View Bottom" ), _( "View Bottom" ),
158 
159 TOOL_ACTION EDA_3D_ACTIONS::noGrid( "3DViewer.Control.noGrid",
160  AS_GLOBAL, 0, "",
161  _( "No 3D Grid" ), _( "No 3D Grid" ),
162  nullptr, AF_NONE, (void*) GRID3D_TYPE::NONE );
163 
164 TOOL_ACTION EDA_3D_ACTIONS::show10mmGrid( "3DViewer.Control.show10mmGrid",
165  AS_GLOBAL, 0, "",
166  _( "3D Grid 10mm" ), _( "3D Grid 10mm" ),
167  nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_10MM );
168 
169 TOOL_ACTION EDA_3D_ACTIONS::show5mmGrid( "3DViewer.Control.show5mmGrid",
170  AS_GLOBAL, 0, "",
171  _( "3D Grid 5mm" ), _( "3D Grid 5mm" ),
172  nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_5MM );
173 
174 TOOL_ACTION EDA_3D_ACTIONS::show2_5mmGrid( "3DViewer.Control.show2_5mmGrid",
175  AS_GLOBAL, 0, "",
176  _( "3D Grid 2.5mm" ), _( "3D Grid 2.5mm" ),
177  nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_2P5MM );
178 
179 TOOL_ACTION EDA_3D_ACTIONS::show1mmGrid( "3DViewer.Control.show1mmGrid",
180  AS_GLOBAL, 0, "",
181  _( "3D Grid 1mm" ), _( "3D Grid 1mm" ),
182  nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_1MM );
183 
184 TOOL_ACTION EDA_3D_ACTIONS::rotate45axisZ( "3DViewer.Control.rotate45axisZ",
185  AS_ACTIVE,
186  WXK_TAB, "",
187  "Rotate 45 degrees over Z axis" );
188 
189 TOOL_ACTION EDA_3D_ACTIONS::attributesTHT( "3DViewer.Control.attributesTHT",
190  AS_ACTIVE,
191  'T', "",
192  _( "Toggle Through Hole 3D models" ), _( "Toggle 3D models with 'Through hole' attribute" ),
193  nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_NORMAL );
194 
195 TOOL_ACTION EDA_3D_ACTIONS::attributesSMD( "3DViewer.Control.attributesSMD",
196  AS_ACTIVE,
197  'S', "",
198  _( "Toggle SMD 3D models" ), _( "Toggle 3D models with 'Surface mount' attribute" ),
199  nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_NORMAL_INSERT );
200 
201 TOOL_ACTION EDA_3D_ACTIONS::attributesVirtual( "3DViewer.Control.attributesVirtual",
202  AS_ACTIVE,
203  'V', "",
204  _( "Toggle Virtual 3D models" ), _( "Toggle 3D models with 'Virtual' attribute" ),
205  nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_VIRTUAL );
206 
207 TOOL_ACTION EDA_3D_ACTIONS::showBoundingBoxes( "3DViewer.Control.showBoundingBoxes",
208  AS_GLOBAL, 0, "",
209  _( "Show Model Bounding Boxes" ), _( "Show Model Bounding Boxes" ),
211 
212 TOOL_ACTION EDA_3D_ACTIONS::renderShadows( "3DViewer.Control.renderShadows",
213  AS_GLOBAL, 0, "",
214  _( "Render Shadows" ), _( "Render Shadows" ),
215  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_SHADOWS );
216 
217 TOOL_ACTION EDA_3D_ACTIONS::proceduralTextures( "3DViewer.Control.proceduralTextures",
218  AS_GLOBAL, 0, "",
219  _( "Procedural Textures" ), _( "Apply procedural textures to materials (slow)" ),
221 
222 TOOL_ACTION EDA_3D_ACTIONS::addFloor( "3DViewer.Control.addFloor",
223  AS_GLOBAL, 0, "",
224  _( "Add Floor" ), _( "Adds a floor plane below the board (slow)"),
225  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_BACKFLOOR );
226 
227 TOOL_ACTION EDA_3D_ACTIONS::showRefractions( "3DViewer.Control.showRefractions",
228  AS_GLOBAL, 0, "",
229  _( "Refractions" ), _( "Render materials with refractive properties on final render (slow)" ),
230  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_REFRACTIONS );
231 
232 TOOL_ACTION EDA_3D_ACTIONS::showReflections( "3DViewer.Control.showReflections",
233  AS_GLOBAL, 0, "",
234  _( "Reflections" ), _( "Render materials with reflective properties on final render (slow)" ),
235  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_REFLECTIONS );
236 
237 TOOL_ACTION EDA_3D_ACTIONS::antiAliasing( "3DViewer.Control.antiAliasing",
238  AS_GLOBAL, 0, "",
239  _( "Anti-aliasing" ), _( "Render with improved quality on final render (slow)" ),
240  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_ANTI_ALIASING );
241 
242 TOOL_ACTION EDA_3D_ACTIONS::postProcessing( "3DViewer.Control.postProcessing",
243  AS_GLOBAL, 0, "",
244  _( "Post-processing" ),
245  _( "Apply Screen Space Ambient Occlusion and Global Illumination reflections on final render (slow)"),
246  nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_POST_PROCESSING );
247 
248 TOOL_ACTION EDA_3D_ACTIONS::toggleRealisticMode( "3DViewer.Control.toggleRealisticMode",
249  AS_GLOBAL, 0, "",
250  _( "Toggle realistic mode" ), _( "Toggle realistic mode" ),
251  nullptr, AF_NONE, (void*) FL_USE_REALISTIC_MODE );
252 
253 TOOL_ACTION EDA_3D_ACTIONS::toggleBoardBody( "3DViewer.Control.toggleBoardBody",
254  AS_GLOBAL, 0, "",
255  _( "Toggle board body display" ), _( "Toggle board body display" ),
256  nullptr, AF_NONE, (void*) FL_SHOW_BOARD_BODY );
257 
258 TOOL_ACTION EDA_3D_ACTIONS::showAxis( "3DViewer.Control.showAxis",
259  AS_GLOBAL, 0, "",
260  _( "Show 3D Axis" ), _( "Show 3D Axis" ),
261  axis3d_front_xpm, AF_NONE, (void*) FL_AXIS );
262 
263 TOOL_ACTION EDA_3D_ACTIONS::toggleZones( "3DViewer.Control.toggleZones",
264  AS_GLOBAL, 0, "",
265  _( "Toggle zone display" ), _( "Toggle zone display" ),
266  nullptr, AF_NONE, (void*) FL_ZONE );
267 
268 TOOL_ACTION EDA_3D_ACTIONS::toggleAdhesive( "3DViewer.Control.toggleAdhesive",
269  AS_GLOBAL, 0, "",
270  _( "Toggle adhesive display" ), _( "Toggle display of adhesive layers" ),
271  nullptr, AF_NONE, (void*) FL_ADHESIVE );
272 
273 TOOL_ACTION EDA_3D_ACTIONS::toggleSilk( "3DViewer.Control.toggleSilk",
274  AS_GLOBAL, 0, "",
275  _( "Toggle silkscreen display" ), _( "Toggle display of silkscreen layers" ),
276  nullptr, AF_NONE, (void*) FL_SILKSCREEN );
277 
278 TOOL_ACTION EDA_3D_ACTIONS::toggleSolderMask( "3DViewer.Control.toggleSolderMask",
279  AS_GLOBAL, 0, "",
280  _( "Toggle solder mask display" ), _( "Toggle display of solder mask layers" ),
281  nullptr, AF_NONE, (void*) FL_SOLDERMASK );
282 
283 TOOL_ACTION EDA_3D_ACTIONS::toggleSolderPaste( "3DViewer.Control.toggleSolderPaste",
284  AS_GLOBAL, 0, "",
285  _( "Toggle solder paste display" ), _( "Toggle display of solder paste layers" ),
286  nullptr, AF_NONE, (void*) FL_SOLDERPASTE );
287 
288 TOOL_ACTION EDA_3D_ACTIONS::toggleComments( "3DViewer.Control.toggleComments",
289  AS_GLOBAL, 0, "",
290  _( "Toggle comments display" ), _( "Toggle display of comments and drawings layers" ),
291  nullptr, AF_NONE, (void*) FL_COMMENTS );
292 
293 TOOL_ACTION EDA_3D_ACTIONS::toggleECO( "3DViewer.Control.toggleECO",
294  AS_GLOBAL, 0, "",
295  _( "Toggle ECO display" ), _( "Toggle display of ECO layers" ),
296  nullptr, AF_NONE, (void*) FL_ECO );
297 
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:70
static TOOL_ACTION pivotCenter
Definition: 3d_actions.h:46
static TOOL_ACTION showBoundingBoxes
Definition: 3d_actions.h:79
static TOOL_ACTION toggleAdhesive
Definition: 3d_actions.h:91
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:78
static TOOL_ACTION toggleSilk
Definition: 3d_actions.h:92
static TOOL_ACTION toggleSolderMask
Definition: 3d_actions.h:93
static TOOL_ACTION showRefractions
Definition: 3d_actions.h:83
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 flipView
Definition: 3d_actions.h:59
static TOOL_ACTION toggleZones
Definition: 3d_actions.h:90
static TOOL_ACTION viewRight
Definition: 3d_actions.h:65
static TOOL_ACTION viewLeft
Definition: 3d_actions.h:64
static TOOL_ACTION toggleECO
Definition: 3d_actions.h:96
static TOOL_ACTION antiAliasing
Definition: 3d_actions.h:85
static TOOL_ACTION rotate45axisZ
Definition: 3d_actions.h:75
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:95
static TOOL_ACTION show5mmGrid
Definition: 3d_actions.h:71
#define NULL
static TOOL_ACTION toggleSolderPaste
Definition: 3d_actions.h:94
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:67
static TOOL_ACTION rotateZCCW
Definition: 3d_actions.h:52
static TOOL_ACTION addFloor
Definition: 3d_actions.h:82
All active tools
Definition: tool_event.h:147
static TOOL_ACTION showAxis
Definition: 3d_actions.h:89
static TOOL_ACTION rotateZCW
Definition: 3d_actions.h:51
static TOOL_ACTION viewTop
Definition: 3d_actions.h:66
static TOOL_ACTION viewBack
Definition: 3d_actions.h:63
static TOOL_ACTION attributesSMD
Definition: 3d_actions.h:77
static TOOL_ACTION toggleRealisticMode
Definition: 3d_actions.h:87
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:81
static TOOL_ACTION show2_5mmGrid
Definition: 3d_actions.h:72
static TOOL_ACTION show1mmGrid
Definition: 3d_actions.h:73
const BITMAP_OPAQUE rotate_neg_y_xpm[1]
static TOOL_ACTION attributesTHT
Definition: 3d_actions.h:76
static TOOL_ACTION viewFront
Definition: 3d_actions.h:62
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:86
static TOOL_ACTION moveUp
Definition: 3d_actions.h:55
const BITMAP_OPAQUE reload2_xpm[1]
Definition: reload2.cpp:68
static TOOL_ACTION noGrid
Definition: 3d_actions.h:69
static TOOL_ACTION showReflections
Definition: 3d_actions.h:84
const BITMAP_OPAQUE axis3d_right_xpm[1]
static TOOL_ACTION toggleOrtho
Definition: 3d_actions.h:60
static TOOL_ACTION renderShadows
Definition: 3d_actions.h:80
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:88