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.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 .DefaultHotkey( MD_SHIFT + 'R' )
129 .FriendlyName( _( "Rotate Z Clockwise" ) )
130 .Icon( BITMAPS::rotate_cw_z )
131 .Flags( AF_NONE )
132 .Parameter( ROTATION_DIR::Z_CW ) );
133
135 .Name( "3DViewer.Control.rotateZcounterclockwise" )
136 .Scope( AS_GLOBAL )
137 .DefaultHotkey( 'R' )
138 .FriendlyName( _( "Rotate Z Counterclockwise" ) )
139 .Icon( BITMAPS::rotate_ccw_z )
140 .Flags( AF_NONE )
141 .Parameter( ROTATION_DIR::Z_CCW ) );
142
144 .Name( "3DViewer.Control.moveLeft" )
145 .Scope( AS_ACTIVE )
146 .DefaultHotkey( WXK_LEFT )
147 .FriendlyName( _( "Move Board Left" ) )
148 .Icon( BITMAPS::left )
149 .Flags( AF_NONE )
150 .Parameter( CURSOR_LEFT ) );
151
153 .Name( "3DViewer.Control.moveRight" )
154 .Scope( AS_ACTIVE )
155 .DefaultHotkey( WXK_RIGHT )
156 .FriendlyName( _( "Move Board Right" ) )
157 .Icon( BITMAPS::right )
158 .Flags( AF_NONE )
159 .Parameter( CURSOR_RIGHT ) );
160
162 .Name( "3DViewer.Control.moveUp" )
163 .Scope( AS_ACTIVE )
164 .DefaultHotkey( WXK_UP )
165 .FriendlyName( _( "Move Board Up" ) )
166 .Icon( BITMAPS::up )
167 .Flags( AF_NONE )
168 .Parameter( CURSOR_UP ) );
169
171 .Name( "3DViewer.Control.moveDown" )
172 .Scope( AS_ACTIVE )
173 .DefaultHotkey( WXK_DOWN )
174 .FriendlyName( _( "Move Board Down" ) )
175 .Icon( BITMAPS::down )
176 .Flags( AF_NONE )
177 .Parameter( CURSOR_DOWN ) );
178
180 .Name( "3DViewer.Control.homeView" )
181 .Scope( AS_ACTIVE )
182 .DefaultHotkey( WXK_HOME )
183 .FriendlyName ( _( "Home View" ) )
184 .Tooltip( _( "Redraw at the home position and zoom" ) )
185 .Flags( AF_NONE )
186 .Parameter( VIEW3D_TYPE::VIEW3D_FIT_SCREEN ) );
187
189 .Name( "3DViewer.Control.flipView" )
190 .Scope( AS_ACTIVE )
191 .DefaultHotkey( 'F' )
192 .FriendlyName( _( "Flip Board" ) )
193 .Tooltip( _( "Flip the board view" ) )
194 .Icon( BITMAPS::flip_board )
195 .Flags( AF_NONE )
196 .Parameter( VIEW3D_TYPE::VIEW3D_FLIP ) );
197
199 .Name( "3DViewer.Control.toggleOrtho" )
200 .Scope( AS_GLOBAL )
201 .FriendlyName( _( "Toggle Orthographic Projection" ) )
202 .Tooltip( _( "Enable/disable orthographic projection" ) )
203 .Icon( BITMAPS::ortho )
204 .ToolbarState( TOOLBAR_STATE::TOGGLE ) );
205
207 .Name( "3DViewer.Control.viewFront" )
208 .Scope( AS_ACTIVE )
209 .DefaultHotkey( 'Y' )
210 .FriendlyName( _( "View Front" ) )
211 .Icon( BITMAPS::axis3d_front )
212 .Flags( AF_NONE )
213 .Parameter( VIEW3D_TYPE::VIEW3D_FRONT ) );
214
216 .Name( "3DViewer.Control.viewBack" )
217 .Scope( AS_ACTIVE )
218 .DefaultHotkey( MD_SHIFT + 'Y' )
219 .FriendlyName( _( "View Back" ) )
220 .Icon( BITMAPS::axis3d_back )
221 .Flags( AF_NONE )
222 .Parameter( VIEW3D_TYPE::VIEW3D_BACK ) );
223
225 .Name( "3DViewer.Control.viewLeft" )
226 .Scope( AS_ACTIVE )
227 .DefaultHotkey( MD_SHIFT + 'X' )
228 .FriendlyName( _( "View Left" ) )
229 .Icon( BITMAPS::axis3d_left )
230 .Flags( AF_NONE )
231 .Parameter( VIEW3D_TYPE::VIEW3D_LEFT ) );
232
234 .Name( "3DViewer.Control.viewRight" )
235 .Scope( AS_ACTIVE )
236 .DefaultHotkey( 'X' )
237 .FriendlyName( _( "View Right" ) )
238 .Icon( BITMAPS::axis3d_right )
239 .Flags( AF_NONE )
240 .Parameter( VIEW3D_TYPE::VIEW3D_RIGHT ) );
241
243 .Name( "3DViewer.Control.viewTop" )
244 .Scope( AS_ACTIVE )
245 .DefaultHotkey( 'Z' )
246 .FriendlyName( _( "View Top" ) )
247 .Icon( BITMAPS::axis3d_top )
248 .Flags( AF_NONE )
249 .Parameter( VIEW3D_TYPE::VIEW3D_TOP ) );
250
252 .Name( "3DViewer.Control.viewBottom" )
253 .Scope( AS_ACTIVE )
254 .DefaultHotkey( MD_SHIFT + 'Z' )
255 .FriendlyName( _( "View Bottom" ) )
257 .Flags( AF_NONE )
258 .Parameter( VIEW3D_TYPE::VIEW3D_BOTTOM ) );
259
261 .Name( "3DViewer.Control.noGrid" )
262 .Scope( AS_GLOBAL )
263 .FriendlyName( _( "No 3D Grid" ) )
264 .Flags( AF_NONE )
265 .Parameter( GRID3D_TYPE::NONE ) );
266
268 .Name( "3DViewer.Control.show10mmGrid" )
269 .Scope( AS_GLOBAL )
270 .FriendlyName( _( "3D Grid 10mm" ) )
271 .Flags( AF_NONE )
272 .Parameter( GRID3D_TYPE::GRID_10MM ) );
273
275 .Name( "3DViewer.Control.show5mmGrid" )
276 .Scope( AS_GLOBAL )
277 .FriendlyName( _( "3D Grid 5mm" ) )
278 .Flags( AF_NONE )
279 .Parameter( GRID3D_TYPE::GRID_5MM ) );
280
282 .Name( "3DViewer.Control.show2_5mmGrid" )
283 .Scope( AS_GLOBAL )
284 .FriendlyName( _( "3D Grid 2.5mm" ) )
285 .Flags( AF_NONE )
286 .Parameter( GRID3D_TYPE::GRID_2P5MM ) );
287
289 .Name( "3DViewer.Control.show1mmGrid" )
290 .Scope( AS_GLOBAL )
291 .FriendlyName( _( "3D Grid 1mm" ) )
292 .Flags( AF_NONE )
293 .Parameter( GRID3D_TYPE::GRID_1MM ) );
294
296 .Name( "3DViewer.Control.materialNormal" )
297 .Scope( AS_ACTIVE )
298 .FriendlyName( _( "Render Realistic Materials" ) )
299 .Tooltip( _( "Use all material properties from each 3D model file" ) )
300 .Flags( AF_NONE )
301 .Parameter( MATERIAL_MODE::NORMAL ) );
302
304 .Name( "3DViewer.Control.materialDiffuse" )
305 .Scope( AS_ACTIVE )
306 .FriendlyName( _( "Render Solid Colors" ) )
307 .Tooltip( _( "Use only the diffuse color property from 3D model file" ) )
308 .Flags( AF_NONE )
309 .Parameter( MATERIAL_MODE::DIFFUSE_ONLY ) );
310
312 .Name( "3DViewer.Control.materialCAD" )
313 .Scope( AS_ACTIVE )
314 .FriendlyName( _( "Render CAD Colors" ) )
315 .Tooltip( _( "Use a CAD color style based on the diffuse color of the material" ) )
316 .Flags( AF_NONE )
317 .Parameter( MATERIAL_MODE::CAD_MODE ) );
318
320 .Name( "3DViewer.Control.attributesTHT" )
321 .Scope( AS_ACTIVE )
322 .DefaultHotkey( 'T' )
323 .FriendlyName( _( "Show Through Hole 3D Models" ) )
324 .Tooltip( _( "Show 3D models for 'Through hole' type footprints" ) )
325 .Icon( BITMAPS::show_tht )
326 .Flags( AF_NONE ) );
327
329 .Name( "3DViewer.Control.attributesSMD" )
330 .Scope( AS_ACTIVE )
331 .DefaultHotkey( 'S' )
332 .FriendlyName( _( "Show SMD 3D Models" ) )
333 .Tooltip( _( "Show 3D models for 'Surface mount' type footprints" ) )
334 .Icon( BITMAPS::show_smt )
335 .Flags( AF_NONE ) );
336
338 .Name( "3DViewer.Control.attributesOther" )
339 .Scope( AS_ACTIVE )
340 .DefaultHotkey( 'V' )
341 .FriendlyName( _( "Show Unspecified 3D Models" ) )
342 .Tooltip( _( "Show 3D models for 'unspecified' type footprints" ) )
343 .Icon( BITMAPS::show_other )
344 .Flags( AF_NONE ) );
345
347 .Name( "3DViewer.Control.attribute_not_in_posfile" )
348 .Scope( AS_ACTIVE )
349 .DefaultHotkey( 'P' )
350 .FriendlyName( _( "Show 3D Models not in POS File" ) )
351 .Tooltip( _( "Show 3D models even if not found in .pos file" ) )
353 .Flags( AF_NONE ) );
354
356 .Name( "3DViewer.Control.attribute_dnp" )
357 .Scope( AS_ACTIVE )
358 .DefaultHotkey( 'D' )
359 .FriendlyName( _( "Show 3D Models marked DNP" ) )
360 .Tooltip( _( "Show 3D models even if marked 'Do Not Place'" ) )
361 .Icon( BITMAPS::show_dnp )
362 .Flags( AF_NONE ) );
363
365 .Name( "3DViewer.Control.showBoundingBoxes" )
366 .Scope( AS_GLOBAL )
367 .FriendlyName( _( "Show Model Bounding Boxes" ) )
368 .Tooltip( _( "Show 3D model bounding boxes in realtime renderer" ) )
369 .Icon( BITMAPS::ortho )
370 .Flags( AF_NONE ) );
371
373 .Name( "3DViewer.Control.showNavigator" )
374 .Scope( AS_GLOBAL )
375 .FriendlyName( _( "Show 3D Navigator" ) )
376 .Icon( BITMAPS::axis3d_front )
377 .Flags( AF_NONE ) );
378
380 .Name( "3DViewer.Control.showLayersManager" )
381 .Scope( AS_GLOBAL )
382 .FriendlyName( _( "Show Appearance Manager" ) )
383 .Tooltip( _( "Show/hide the appearance manager" ) )
385 .ToolbarState( TOOLBAR_STATE::TOGGLE ) );
386
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 showNavigator
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
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