KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
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.toggleShowMissingModels" )
62 .Scope( AS_GLOBAL )
63 .FriendlyName( _( "Show parts without 3D model" ) )
64 .Tooltip( _( "Display a placeholder for footprints with missing 3D models" ) )
65 .ToolbarState( TOOLBAR_STATE::TOGGLE ) );
66
68 .Name( "3DViewer.Control.copyToClipboard" )
69 .Scope( AS_GLOBAL )
70 .FriendlyName( _( "Copy 3D image to clipboard" ) )
71 .Tooltip( _( "Copy the current 3D image to the clipboard" ) )
72 .Icon( BITMAPS::copy )
73 .Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::CLIPBOARD ) );
74
76 .Name( "3DViewer.Control.exportImage" )
77 .Scope( AS_GLOBAL )
78 .FriendlyName( _( "Export Image..." ) )
79 .Tooltip( _( "Export the Current View as an image file" ) )
81 .Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::IMAGE ) );
82
84 .Name( "3DViewer.Control.pivotCenter" )
85 .Scope( AS_ACTIVE )
86 .DefaultHotkey( ' ' )
87 .FriendlyName( _( "Set Pivot" ) )
88 .Tooltip( _( "Place point around which the board will be rotated (middle mouse click)" ) )
89 .Flags( AF_NONE )
91
93 .Name( "3DViewer.Control.rotateXclockwise" )
94 .Scope( AS_GLOBAL )
95 .FriendlyName( _( "Rotate X Clockwise" ) )
97 .Flags( AF_NONE )
98 .Parameter( ROTATION_DIR::X_CW ) );
99
101 .Name( "3DViewer.Control.rotateXcounterclockwise" )
102 .Scope( AS_GLOBAL )
103 .FriendlyName( _( "Rotate X Counterclockwise" ) )
104 .Icon( BITMAPS::rotate_ccw_x )
105 .Flags( AF_NONE )
106 .Parameter( ROTATION_DIR::X_CCW ) );
107
109 .Name( "3DViewer.Control.rotateYclockwise" )
110 .Scope( AS_GLOBAL )
111 .FriendlyName( _( "Rotate Y Clockwise" ) )
112 .Icon( BITMAPS::rotate_cw_y )
113 .Flags( AF_NONE )
114 .Parameter( ROTATION_DIR::Y_CW ) );
115
117 .Name( "3DViewer.Control.rotateYcounterclockwise" )
118 .Scope( AS_GLOBAL )
119 .FriendlyName( _( "Rotate Y Counterclockwise" ) )
120 .Icon( BITMAPS::rotate_ccw_y )
121 .Flags( AF_NONE )
122 .Parameter( ROTATION_DIR::Y_CCW ) );
123
125 .Name( "3DViewer.Control.rotateZclockwise" )
126 .Scope( AS_GLOBAL )
127 .DefaultHotkey( MD_SHIFT + 'R' )
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 .DefaultHotkey( 'R' )
137 .FriendlyName( _( "Rotate Z Counterclockwise" ) )
138 .Icon( BITMAPS::rotate_ccw_z )
139 .Flags( AF_NONE )
140 .Parameter( ROTATION_DIR::Z_CCW ) );
141
143 .Name( "3DViewer.Control.moveLeft" )
144 .Scope( AS_ACTIVE )
145 .DefaultHotkey( WXK_LEFT )
146 .FriendlyName( _( "Move Board Left" ) )
147 .Icon( BITMAPS::left )
148 .Flags( AF_NONE )
149 .Parameter( CURSOR_LEFT ) );
150
152 .Name( "3DViewer.Control.moveRight" )
153 .Scope( AS_ACTIVE )
154 .DefaultHotkey( WXK_RIGHT )
155 .FriendlyName( _( "Move Board Right" ) )
156 .Icon( BITMAPS::right )
157 .Flags( AF_NONE )
158 .Parameter( CURSOR_RIGHT ) );
159
161 .Name( "3DViewer.Control.moveUp" )
162 .Scope( AS_ACTIVE )
163 .DefaultHotkey( WXK_UP )
164 .FriendlyName( _( "Move Board Up" ) )
165 .Icon( BITMAPS::up )
166 .Flags( AF_NONE )
167 .Parameter( CURSOR_UP ) );
168
170 .Name( "3DViewer.Control.moveDown" )
171 .Scope( AS_ACTIVE )
172 .DefaultHotkey( WXK_DOWN )
173 .FriendlyName( _( "Move Board Down" ) )
174 .Icon( BITMAPS::down )
175 .Flags( AF_NONE )
176 .Parameter( CURSOR_DOWN ) );
177
179 .Name( "3DViewer.Control.homeView" )
180 .Scope( AS_ACTIVE )
181 .DefaultHotkey( WXK_HOME )
182 .FriendlyName ( _( "Home View" ) )
183 .Tooltip( _( "Redraw at the home position and zoom" ) )
184 .Flags( AF_NONE )
185 .Parameter( VIEW3D_TYPE::VIEW3D_FIT_SCREEN ) );
186
188 .Name( "3DViewer.Control.flipView" )
189 .Scope( AS_ACTIVE )
190 .DefaultHotkey( 'F' )
191 .FriendlyName( _( "Flip Board" ) )
192 .Tooltip( _( "Flip the board view" ) )
193 .Icon( BITMAPS::flip_board )
194 .Flags( AF_NONE )
195 .Parameter( VIEW3D_TYPE::VIEW3D_FLIP ) );
196
198 .Name( "3DViewer.Control.toggleOrtho" )
199 .Scope( AS_GLOBAL )
200 .FriendlyName( _( "Toggle Orthographic Projection" ) )
201 .Tooltip( _( "Enable/disable orthographic projection" ) )
202 .Icon( BITMAPS::ortho )
203 .ToolbarState( TOOLBAR_STATE::TOGGLE ) );
204
206 .Name( "3DViewer.Control.viewFront" )
207 .Scope( AS_ACTIVE )
208 .DefaultHotkey( 'Y' )
209 .FriendlyName( _( "View Front" ) )
210 .Icon( BITMAPS::axis3d_front )
211 .Flags( AF_NONE )
212 .Parameter( VIEW3D_TYPE::VIEW3D_FRONT ) );
213
215 .Name( "3DViewer.Control.viewBack" )
216 .Scope( AS_ACTIVE )
217 .DefaultHotkey( MD_SHIFT + 'Y' )
218 .FriendlyName( _( "View Back" ) )
219 .Icon( BITMAPS::axis3d_back )
220 .Flags( AF_NONE )
221 .Parameter( VIEW3D_TYPE::VIEW3D_BACK ) );
222
224 .Name( "3DViewer.Control.viewLeft" )
225 .Scope( AS_ACTIVE )
226 .DefaultHotkey( MD_SHIFT + 'X' )
227 .FriendlyName( _( "View Left" ) )
228 .Icon( BITMAPS::axis3d_left )
229 .Flags( AF_NONE )
230 .Parameter( VIEW3D_TYPE::VIEW3D_LEFT ) );
231
233 .Name( "3DViewer.Control.viewRight" )
234 .Scope( AS_ACTIVE )
235 .DefaultHotkey( 'X' )
236 .FriendlyName( _( "View Right" ) )
237 .Icon( BITMAPS::axis3d_right )
238 .Flags( AF_NONE )
239 .Parameter( VIEW3D_TYPE::VIEW3D_RIGHT ) );
240
242 .Name( "3DViewer.Control.viewTop" )
243 .Scope( AS_ACTIVE )
244 .DefaultHotkey( 'Z' )
245 .FriendlyName( _( "View Top" ) )
246 .Icon( BITMAPS::axis3d_top )
247 .Flags( AF_NONE )
248 .Parameter( VIEW3D_TYPE::VIEW3D_TOP ) );
249
251 .Name( "3DViewer.Control.viewBottom" )
252 .Scope( AS_ACTIVE )
253 .DefaultHotkey( MD_SHIFT + 'Z' )
254 .FriendlyName( _( "View Bottom" ) )
256 .Flags( AF_NONE )
257 .Parameter( VIEW3D_TYPE::VIEW3D_BOTTOM ) );
258
260 .Name( "3DViewer.Control.noGrid" )
261 .Scope( AS_GLOBAL )
262 .FriendlyName( _( "No 3D Grid" ) )
263 .Flags( AF_NONE )
264 .Parameter( GRID3D_TYPE::NONE ) );
265
267 .Name( "3DViewer.Control.show10mmGrid" )
268 .Scope( AS_GLOBAL )
269 .FriendlyName( _( "3D Grid 10mm" ) )
270 .Flags( AF_NONE )
271 .Parameter( GRID3D_TYPE::GRID_10MM ) );
272
274 .Name( "3DViewer.Control.show5mmGrid" )
275 .Scope( AS_GLOBAL )
276 .FriendlyName( _( "3D Grid 5mm" ) )
277 .Flags( AF_NONE )
278 .Parameter( GRID3D_TYPE::GRID_5MM ) );
279
281 .Name( "3DViewer.Control.show2_5mmGrid" )
282 .Scope( AS_GLOBAL )
283 .FriendlyName( _( "3D Grid 2.5mm" ) )
284 .Flags( AF_NONE )
285 .Parameter( GRID3D_TYPE::GRID_2P5MM ) );
286
288 .Name( "3DViewer.Control.show1mmGrid" )
289 .Scope( AS_GLOBAL )
290 .FriendlyName( _( "3D Grid 1mm" ) )
291 .Flags( AF_NONE )
292 .Parameter( GRID3D_TYPE::GRID_1MM ) );
293
295 .Name( "3DViewer.Control.materialNormal" )
296 .Scope( AS_ACTIVE )
297 .FriendlyName( _( "Render Realistic Materials" ) )
298 .Tooltip( _( "Use all material properties from each 3D model file" ) )
299 .Flags( AF_NONE )
300 .Parameter( MATERIAL_MODE::NORMAL ) );
301
303 .Name( "3DViewer.Control.materialDiffuse" )
304 .Scope( AS_ACTIVE )
305 .FriendlyName( _( "Render Solid Colors" ) )
306 .Tooltip( _( "Use only the diffuse color property from 3D model file" ) )
307 .Flags( AF_NONE )
308 .Parameter( MATERIAL_MODE::DIFFUSE_ONLY ) );
309
311 .Name( "3DViewer.Control.materialCAD" )
312 .Scope( AS_ACTIVE )
313 .FriendlyName( _( "Render CAD Colors" ) )
314 .Tooltip( _( "Use a CAD color style based on the diffuse color of the material" ) )
315 .Flags( AF_NONE )
316 .Parameter( MATERIAL_MODE::CAD_MODE ) );
317
319 .Name( "3DViewer.Control.attributesTHT" )
320 .Scope( AS_ACTIVE )
321 .DefaultHotkey( 'T' )
322 .FriendlyName( _( "Show Through Hole 3D Models" ) )
323 .Tooltip( _( "Show 3D models for 'Through hole' type footprints" ) )
324 .Icon( BITMAPS::show_tht )
325 .Flags( AF_NONE ) );
326
328 .Name( "3DViewer.Control.attributesSMD" )
329 .Scope( AS_ACTIVE )
330 .DefaultHotkey( 'S' )
331 .FriendlyName( _( "Show SMD 3D Models" ) )
332 .Tooltip( _( "Show 3D models for 'Surface mount' type footprints" ) )
333 .Icon( BITMAPS::show_smt )
334 .Flags( AF_NONE ) );
335
337 .Name( "3DViewer.Control.attributesOther" )
338 .Scope( AS_ACTIVE )
339 .DefaultHotkey( 'V' )
340 .FriendlyName( _( "Show Unspecified 3D Models" ) )
341 .Tooltip( _( "Show 3D models for 'unspecified' type footprints" ) )
342 .Icon( BITMAPS::show_other )
343 .Flags( AF_NONE ) );
344
346 .Name( "3DViewer.Control.attribute_not_in_posfile" )
347 .Scope( AS_ACTIVE )
348 .DefaultHotkey( 'P' )
349 .FriendlyName( _( "Show 3D Models not in POS File" ) )
350 .Tooltip( _( "Show 3D models even if not found in .pos file" ) )
352 .Flags( AF_NONE ) );
353
355 .Name( "3DViewer.Control.attribute_dnp" )
356 .Scope( AS_ACTIVE )
357 .DefaultHotkey( 'D' )
358 .FriendlyName( _( "Show 3D Models marked DNP" ) )
359 .Tooltip( _( "Show 3D models even if marked 'Do Not Place'" ) )
360 .Icon( BITMAPS::show_dnp )
361 .Flags( AF_NONE ) );
362
364 .Name( "3DViewer.Control.showBoundingBoxes" )
365 .Scope( AS_GLOBAL )
366 .FriendlyName( _( "Show Model Bounding Boxes" ) )
367 .Tooltip( _( "Show 3D model bounding boxes in realtime renderer" ) )
368 .Icon( BITMAPS::ortho )
369 .Flags( AF_NONE ) );
370
372 .Name( "3DViewer.Control.showNavigator" )
373 .Scope( AS_GLOBAL )
374 .FriendlyName( _( "Show 3D Navigator" ) )
375 .Icon( BITMAPS::axis3d_front )
376 .Flags( AF_NONE ) );
377
379 .Name( "3DViewer.Control.showLayersManager" )
380 .Scope( AS_GLOBAL )
381 .FriendlyName( _( "Show Appearance Manager" ) )
382 .Tooltip( _( "Show/hide the appearance manager" ) )
384 .ToolbarState( TOOLBAR_STATE::TOGGLE ) );
385
declared enumerations and flags
@ NORMAL
Use all material properties from model file.
Definition 3d_enums.h:72
@ CAD_MODE
Use a gray shading based on diffuse material.
Definition 3d_enums.h:74
@ DIFFUSE_ONLY
Use only diffuse material properties.
Definition 3d_enums.h:73
@ VIEW3D_FIT_SCREEN
Definition 3d_enums.h:98
@ VIEW3D_PIVOT_CENTER
Definition 3d_enums.h:95
@ VIEW3D_BOTTOM
Definition 3d_enums.h:81
@ show_not_in_posfile
static TOOL_ACTION showNavigator
static TOOL_ACTION showLayersManager
static TOOL_ACTION rotateXCCW
static TOOL_ACTION showNotInPosFile
static TOOL_ACTION exportImage
static TOOL_ACTION showTHT
static TOOL_ACTION noGrid
static TOOL_ACTION show2_5mmGrid
static TOOL_ACTION reloadBoard
static TOOL_ACTION rotateZCCW
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 toggleShowMissingModels
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 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
Build up the properties of a TOOL_ACTION in an incremental manner that is static-construction safe.
Represent a single user action.
#define _(s)
Declaration of the eda_3d_viewer class.
@ TOGGLE
Action is a toggle button on the toolbar.
Definition tool_action.h:64
@ HIDDEN
Action is hidden from the toolbar.
Definition tool_action.h:63
@ 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