KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
eda_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) 2023 CERN
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <tool/tool_manager.h>
23#include <bitmaps.h>
24#include <3d_viewer_id.h>
25#include <3d_enums.h>
27#include "eda_3d_actions.h"
28#include "tool/tool_action.h"
29
30
31// Actions, being statically-defined, require specialized I18N handling. We continue to
32// use the _() macro so that string harvesting by the I18N framework doesn't have to be
33// specialized, but we don't translate on initialization and instead do it in the getters.
34
35#undef _
36#define _(s) s
37
38// No description, it is not supposed to be shown anywhere
40 .Name( "3DViewer.Control" )
41 .Scope( AS_GLOBAL )
42 .Flags( AF_ACTIVATE )
43 .ToolbarState( TOOLBAR_STATE::HIDDEN) );
44
46 .Name( "3DViewer.Control.reloadBoard" )
47 .Scope( AS_GLOBAL )
48 .FriendlyName( _( "Reload board" ) )
49 .Tooltip( _( "Reload board and refresh 3D view" ) )
50 .Icon( BITMAPS::import3d ) );
51
53 .Name( "3DViewer.Control.toggleRaytacing" )
54 .Scope( AS_GLOBAL )
55 .FriendlyName( _( "Use raytracing" ) )
56 .Tooltip( _( "Render current view using Raytracing" ) )
58 .ToolbarState( TOOLBAR_STATE::TOGGLE) );
59
61 .Name( "3DViewer.Control.copyToClipboard" )
62 .Scope( AS_GLOBAL )
63 .FriendlyName( _( "Copy 3D image to clipboard" ) )
64 .Tooltip( _( "Copy the current 3D image to the clipboard" ) )
65 .Icon( BITMAPS::copy )
66 .Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::CLIPBOARD ) );
67
69 .Name( "3DViewer.Control.exportAsPNG" )
70 .Scope( AS_GLOBAL )
71 .FriendlyName( _( "Export Current View as PNG..." ) )
72 .Tooltip( _( "Export the Current View as a PNG image" ) )
73 .Icon( BITMAPS::export_png )
74 .Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::PNG ) );
75
77 .Name( "3DViewer.Control.exportAsJPEG" )
78 .Scope( AS_GLOBAL )
79 .FriendlyName( _( "Export Current View as JPEG..." ) )
80 .Tooltip( _( "Export the Current View as a JPEG image" ) )
82 .Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::JPEG ) );
83
85 .Name( "3DViewer.Control.pivotCenter" )
86 .Scope( AS_ACTIVE )
87 .DefaultHotkey( ' ' )
88 .FriendlyName( _( "Set Pivot" ) )
89 .Tooltip( _( "Place point around which the board will be rotated (middle mouse click)" ) )
90 .Flags( AF_NONE )
92
94 .Name( "3DViewer.Control.rotateXclockwise" )
95 .Scope( AS_GLOBAL )
96 .FriendlyName( _( "Rotate X Clockwise" ) )
98 .Flags( AF_NONE )
99 .Parameter( ROTATION_DIR::X_CW ) );
100
102 .Name( "3DViewer.Control.rotateXcounterclockwise" )
103 .Scope( AS_GLOBAL )
104 .FriendlyName( _( "Rotate X Counterclockwise" ) )
105 .Icon( BITMAPS::rotate_ccw_x )
106 .Flags( AF_NONE )
107 .Parameter( ROTATION_DIR::X_CCW ) );
108
110 .Name( "3DViewer.Control.rotateYclockwise" )
111 .Scope( AS_GLOBAL )
112 .FriendlyName( _( "Rotate Y Clockwise" ) )
113 .Icon( BITMAPS::rotate_cw_y )
114 .Flags( AF_NONE )
115 .Parameter( ROTATION_DIR::Y_CW ) );
116
118 .Name( "3DViewer.Control.rotateYcounterclockwise" )
119 .Scope( AS_GLOBAL )
120 .FriendlyName( _( "Rotate Y Counterclockwise" ) )
121 .Icon( BITMAPS::rotate_ccw_y )
122 .Flags( AF_NONE )
123 .Parameter( ROTATION_DIR::Y_CCW ) );
124
126 .Name( "3DViewer.Control.rotateZclockwise" )
127 .Scope( AS_GLOBAL )
128 .FriendlyName( _( "Rotate Z Clockwise" ) )
129 .Icon( BITMAPS::rotate_cw_z )
130 .Flags( AF_NONE )
131 .Parameter( ROTATION_DIR::Z_CW ) );
132
134 .Name( "3DViewer.Control.rotateZcounterclockwise" )
135 .Scope( AS_GLOBAL )
136 .FriendlyName( _( "Rotate Z Counterclockwise" ) )
137 .Icon( BITMAPS::rotate_ccw_z )
138 .Flags( AF_NONE )
139 .Parameter( ROTATION_DIR::Z_CCW ) );
140
142 .Name( "3DViewer.Control.moveLeft" )
143 .Scope( AS_ACTIVE )
144 .DefaultHotkey( WXK_LEFT )
145 .FriendlyName( _( "Move Board Left" ) )
146 .Icon( BITMAPS::left )
147 .Flags( AF_NONE )
148 .Parameter( CURSOR_LEFT ) );
149
151 .Name( "3DViewer.Control.moveRight" )
152 .Scope( AS_ACTIVE )
153 .DefaultHotkey( WXK_RIGHT )
154 .FriendlyName( _( "Move Board Right" ) )
155 .Icon( BITMAPS::right )
156 .Flags( AF_NONE )
157 .Parameter( CURSOR_RIGHT ) );
158
160 .Name( "3DViewer.Control.moveUp" )
161 .Scope( AS_ACTIVE )
162 .DefaultHotkey( WXK_UP )
163 .FriendlyName( _( "Move Board Up" ) )
164 .Icon( BITMAPS::up )
165 .Flags( AF_NONE )
166 .Parameter( CURSOR_UP ) );
167
169 .Name( "3DViewer.Control.moveDown" )
170 .Scope( AS_ACTIVE )
171 .DefaultHotkey( WXK_DOWN )
172 .FriendlyName( _( "Move Board Down" ) )
173 .Icon( BITMAPS::down )
174 .Flags( AF_NONE )
175 .Parameter( CURSOR_DOWN ) );
176
178 .Name( "3DViewer.Control.homeView" )
179 .Scope( AS_ACTIVE )
180 .DefaultHotkey( WXK_HOME )
181 .FriendlyName ( _( "Home View" ) )
182 .Tooltip( _( "Redraw at the home position and zoom" ) )
183 .Flags( AF_NONE )
184 .Parameter( VIEW3D_TYPE::VIEW3D_FIT_SCREEN ) );
185
187 .Name( "3DViewer.Control.flipView" )
188 .Scope( AS_ACTIVE )
189 .DefaultHotkey( 'F' )
190 .FriendlyName( _( "Flip Board" ) )
191 .Tooltip( _( "Flip the board view" ) )
192 .Icon( BITMAPS::flip_board )
193 .Flags( AF_NONE )
194 .Parameter( VIEW3D_TYPE::VIEW3D_FLIP ) );
195
197 .Name( "3DViewer.Control.toggleOrtho" )
198 .Scope( AS_GLOBAL )
199 .FriendlyName( _( "Toggle Orthographic Projection" ) )
200 .Tooltip( _( "Enable/disable orthographic projection" ) )
201 .Icon( BITMAPS::ortho )
202 .ToolbarState( TOOLBAR_STATE::TOGGLE ) );
203
205 .Name( "3DViewer.Control.viewFront" )
206 .Scope( AS_ACTIVE )
207 .DefaultHotkey( 'Y' )
208 .FriendlyName( _( "View Front" ) )
209 .Icon( BITMAPS::axis3d_front )
210 .Flags( AF_NONE )
211 .Parameter( VIEW3D_TYPE::VIEW3D_FRONT ) );
212
214 .Name( "3DViewer.Control.viewBack" )
215 .Scope( AS_ACTIVE )
216 .DefaultHotkey( MD_SHIFT + 'Y' )
217 .FriendlyName( _( "View Back" ) )
218 .Icon( BITMAPS::axis3d_back )
219 .Flags( AF_NONE )
220 .Parameter( VIEW3D_TYPE::VIEW3D_BACK ) );
221
223 .Name( "3DViewer.Control.viewLeft" )
224 .Scope( AS_ACTIVE )
225 .DefaultHotkey( MD_SHIFT + 'X' )
226 .FriendlyName( _( "View Left" ) )
227 .Icon( BITMAPS::axis3d_left )
228 .Flags( AF_NONE )
229 .Parameter( VIEW3D_TYPE::VIEW3D_LEFT ) );
230
232 .Name( "3DViewer.Control.viewRight" )
233 .Scope( AS_ACTIVE )
234 .DefaultHotkey( 'X' )
235 .FriendlyName( _( "View Right" ) )
236 .Icon( BITMAPS::axis3d_right )
237 .Flags( AF_NONE )
238 .Parameter( VIEW3D_TYPE::VIEW3D_RIGHT ) );
239
241 .Name( "3DViewer.Control.viewTop" )
242 .Scope( AS_ACTIVE )
243 .DefaultHotkey( 'Z' )
244 .FriendlyName( _( "View Top" ) )
245 .Icon( BITMAPS::axis3d_top )
246 .Flags( AF_NONE )
247 .Parameter( VIEW3D_TYPE::VIEW3D_TOP ) );
248
250 .Name( "3DViewer.Control.viewBottom" )
251 .Scope( AS_ACTIVE )
252 .DefaultHotkey( MD_SHIFT + 'Z' )
253 .FriendlyName( _( "View Bottom" ) )
255 .Flags( AF_NONE )
256 .Parameter( VIEW3D_TYPE::VIEW3D_BOTTOM ) );
257
259 .Name( "3DViewer.Control.noGrid" )
260 .Scope( AS_GLOBAL )
261 .FriendlyName( _( "No 3D Grid" ) )
262 .Flags( AF_NONE )
263 .Parameter( GRID3D_TYPE::NONE ) );
264
266 .Name( "3DViewer.Control.show10mmGrid" )
267 .Scope( AS_GLOBAL )
268 .FriendlyName( _( "3D Grid 10mm" ) )
269 .Flags( AF_NONE )
270 .Parameter( GRID3D_TYPE::GRID_10MM ) );
271
273 .Name( "3DViewer.Control.show5mmGrid" )
274 .Scope( AS_GLOBAL )
275 .FriendlyName( _( "3D Grid 5mm" ) )
276 .Flags( AF_NONE )
277 .Parameter( GRID3D_TYPE::GRID_5MM ) );
278
280 .Name( "3DViewer.Control.show2_5mmGrid" )
281 .Scope( AS_GLOBAL )
282 .FriendlyName( _( "3D Grid 2.5mm" ) )
283 .Flags( AF_NONE )
284 .Parameter( GRID3D_TYPE::GRID_2P5MM ) );
285
287 .Name( "3DViewer.Control.show1mmGrid" )
288 .Scope( AS_GLOBAL )
289 .FriendlyName( _( "3D Grid 1mm" ) )
290 .Flags( AF_NONE )
291 .Parameter( GRID3D_TYPE::GRID_1MM ) );
292
294 .Name( "3DViewer.Control.materialNormal" )
295 .Scope( AS_ACTIVE )
296 .FriendlyName( _( "Render Realistic Materials" ) )
297 .Tooltip( _( "Use all material properties from each 3D model file" ) )
298 .Flags( AF_NONE )
299 .Parameter( MATERIAL_MODE::NORMAL ) );
300
302 .Name( "3DViewer.Control.materialDiffuse" )
303 .Scope( AS_ACTIVE )
304 .FriendlyName( _( "Render Solid Colors" ) )
305 .Tooltip( _( "Use only the diffuse color property from 3D model file" ) )
306 .Flags( AF_NONE )
307 .Parameter( MATERIAL_MODE::DIFFUSE_ONLY ) );
308
310 .Name( "3DViewer.Control.materialCAD" )
311 .Scope( AS_ACTIVE )
312 .FriendlyName( _( "Render CAD Colors" ) )
313 .Tooltip( _( "Use a CAD color style based on the diffuse color of the material" ) )
314 .Flags( AF_NONE )
315 .Parameter( MATERIAL_MODE::CAD_MODE ) );
316
318 .Name( "3DViewer.Control.attributesTHT" )
319 .Scope( AS_ACTIVE )
320 .DefaultHotkey( 'T' )
321 .FriendlyName( _( "Show Through Hole 3D Models" ) )
322 .Tooltip( _( "Show 3D models for 'Through hole' type footprints" ) )
323 .Icon( BITMAPS::show_tht )
324 .Flags( AF_NONE ) );
325
327 .Name( "3DViewer.Control.attributesSMD" )
328 .Scope( AS_ACTIVE )
329 .DefaultHotkey( 'S' )
330 .FriendlyName( _( "Show SMD 3D Models" ) )
331 .Tooltip( _( "Show 3D models for 'Surface mount' type footprints" ) )
332 .Icon( BITMAPS::show_smt )
333 .Flags( AF_NONE ) );
334
336 .Name( "3DViewer.Control.attributesOther" )
337 .Scope( AS_ACTIVE )
338 .DefaultHotkey( 'V' )
339 .FriendlyName( _( "Show Unspecified 3D Models" ) )
340 .Tooltip( _( "Show 3D models for 'unspecified' type footprints" ) )
341 .Icon( BITMAPS::show_other )
342 .Flags( AF_NONE ) );
343
345 .Name( "3DViewer.Control.attribute_not_in_posfile" )
346 .Scope( AS_ACTIVE )
347 .DefaultHotkey( 'P' )
348 .FriendlyName( _( "Show 3D Models not in POS File" ) )
349 .Tooltip( _( "Show 3D models even if not found in .pos file" ) )
351 .Flags( AF_NONE ) );
352
354 .Name( "3DViewer.Control.attribute_dnp" )
355 .Scope( AS_ACTIVE )
356 .DefaultHotkey( 'D' )
357 .FriendlyName( _( "Show 3D Models marked DNP" ) )
358 .Tooltip( _( "Show 3D models even if marked 'Do Not Place'" ) )
359 .Icon( BITMAPS::show_dnp )
360 .Flags( AF_NONE ) );
361
363 .Name( "3DViewer.Control.showBoundingBoxes" )
364 .Scope( AS_GLOBAL )
365 .FriendlyName( _( "Show Model Bounding Boxes" ) )
366 .Tooltip( _( "Show 3D model bounding boxes in realtime renderer" ) )
367 .Icon( BITMAPS::ortho )
368 .Flags( AF_NONE ) );
369
371 .Name( "3DViewer.Control.showAxis" )
372 .Scope( AS_GLOBAL )
373 .FriendlyName( _( "Show 3D Axis" ) )
374 .Icon( BITMAPS::axis3d_front )
375 .Flags( AF_NONE ) );
376
378 .Name( "3DViewer.Control.showLayersManager" )
379 .Scope( AS_GLOBAL )
380 .FriendlyName( _( "Show Appearance Manager" ) )
381 .Tooltip( _( "Show/hide the appearance manager" ) )
383 .ToolbarState( TOOLBAR_STATE::TOGGLE ) );
384
declared enumerations and flags
@ NORMAL
Use all material properties from model file.
@ CAD_MODE
Use a gray shading based on diffuse material.
@ DIFFUSE_ONLY
Use only diffuse material properties.
@ rotate_ccw_z
@ rotate_ccw_x
@ rotate_ccw_y
@ show_not_in_posfile
@ axis3d_bottom
@ axis3d_front
@ axis3d_right
@ layers_manager
static TOOL_ACTION showLayersManager
static TOOL_ACTION rotateXCCW
static TOOL_ACTION showNotInPosFile
static TOOL_ACTION showTHT
static TOOL_ACTION noGrid
static TOOL_ACTION show2_5mmGrid
static TOOL_ACTION reloadBoard
static TOOL_ACTION rotateZCCW
static TOOL_ACTION exportAsPNG
static TOOL_ACTION rotateZCW
static TOOL_ACTION rotateYCCW
static TOOL_ACTION rotateXCW
static TOOL_ACTION viewTop
static TOOL_ACTION show1mmGrid
static TOOL_ACTION showDNP
static TOOL_ACTION toggleOrtho
static TOOL_ACTION moveLeft
static TOOL_ACTION viewLeft
static TOOL_ACTION show10mmGrid
static TOOL_ACTION toggleRaytacing
static TOOL_ACTION viewBack
static TOOL_ACTION show5mmGrid
static TOOL_ACTION viewRight
static TOOL_ACTION showSMD
static TOOL_ACTION homeView
static TOOL_ACTION exportAsJPEG
static TOOL_ACTION moveUp
static TOOL_ACTION flipView
static TOOL_ACTION moveDown
static TOOL_ACTION viewBottom
static TOOL_ACTION copyToClipboard
static TOOL_ACTION moveRight
static TOOL_ACTION materialDiffuse
static TOOL_ACTION pivotCenter
static TOOL_ACTION controlActivate
static TOOL_ACTION showVirtual
static TOOL_ACTION rotateYCW
static TOOL_ACTION materialCAD
static TOOL_ACTION viewFront
static TOOL_ACTION showBBoxes
static TOOL_ACTION materialNormal
static TOOL_ACTION showAxis
Build up the properties of a TOOL_ACTION in an incremental manner that is static-construction safe.
Definition: tool_action.h:118
Represent a single user action.
Definition: tool_action.h:304
#define _(s)
Declaration of the eda_3d_viewer class.
@ TOGGLE
Action is a toggle button on the toolbar.
@ HIDDEN
Action is hidden from the toolbar.
@ AS_GLOBAL
Global action (toolbar/main menu event, global shortcut)
Definition: tool_action.h:49
@ AS_ACTIVE
All active tools.
Definition: tool_action.h:48
@ AF_ACTIVATE
Action activates a tool.
Definition: tool_action.h:56
@ AF_NONE
Definition: tool_action.h:55
@ MD_SHIFT
Definition: tool_event.h:143