Browse Source
Actionize the rest of the 3D viewer.
Actionize the rest of the 3D viewer.
Fixes https://gitlab.com/kicad/code/kicad/issues/2228pull/16/head
25 changed files with 1009 additions and 1080 deletions
-
133d-viewer/3d_cache/dialogs/panel_prev_model.h
-
2833d-viewer/3d_canvas/eda_3d_canvas.cpp
-
1433d-viewer/3d_canvas/eda_3d_canvas.h
-
103d-viewer/3d_rendering/ccamera.cpp
-
33d-viewer/3d_rendering/ccamera.h
-
1293d-viewer/3d_viewer/3d_actions.cpp
-
1233d-viewer/3d_viewer/3d_menubar.cpp
-
993d-viewer/3d_viewer/3d_toolbar.cpp
-
3433d-viewer/3d_viewer/eda_3d_viewer.cpp
-
513d-viewer/3d_viewer/eda_3d_viewer.h
-
3003d-viewer/3d_viewer/tools/3d_actions.cpp
-
363d-viewer/3d_viewer/tools/3d_actions.h
-
3153d-viewer/3d_viewer/tools/3d_viewer_control.cpp
-
823d-viewer/3d_viewer/tools/3d_viewer_control.h
-
673d-viewer/3d_viewer_id.h
-
33d-viewer/CMakeLists.txt
-
37common/tool/tool_dispatcher.cpp
-
13common/tool/tool_manager.cpp
-
6include/id.h
-
26pcbnew/help_common_strings.h
-
1pcbnew/menubar_footprint_editor.cpp
-
1pcbnew/menubar_pcb_editor.cpp
-
2pcbnew/pcb_base_frame.cpp
-
2pcbnew/toolbars_footprint_editor.cpp
-
1pcbnew/toolbars_pcb_editor.cpp
@ -1,129 +0,0 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com> |
|||
* Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify it |
|||
* under the terms of the GNU General Public License as published by the |
|||
* Free Software Foundation, either version 3 of the License, or (at your |
|||
* option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, but |
|||
* WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License along |
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
#include <tool/tool_manager.h>
|
|||
#include <bitmaps.h>
|
|||
#include "3d_actions.h"
|
|||
|
|||
|
|||
// Actions, being statically-defined, require specialized I18N handling. We continue to
|
|||
// use the _() macro so that string harvesting by the I18N framework doesn't have to be
|
|||
// specialized, but we don't translate on initialization and instead do it in the getters.
|
|||
|
|||
#undef _
|
|||
#define _(s) s
|
|||
|
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( "3DViewer.Control.pivotCenter", |
|||
AS_GLOBAL, |
|||
' ', "", |
|||
"Center pivot rotation (Middle mouse click)" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::moveLeft( "3DViewer.Control.moveLeft", |
|||
AS_GLOBAL, |
|||
WXK_LEFT, "", |
|||
"Move board Left" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::moveRight( "3DViewer.Control.moveRight", |
|||
AS_GLOBAL, |
|||
WXK_RIGHT, "", |
|||
"Move board Right" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::moveUp( "3DViewer.Control.moveUp", |
|||
AS_GLOBAL, |
|||
WXK_UP, "", |
|||
"Move board Up" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::moveDown( "3DViewer.Control.moveDown", |
|||
AS_GLOBAL, |
|||
WXK_DOWN, "", |
|||
"Move board Down" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::homeView( "3DViewer.Control.homeView", |
|||
AS_GLOBAL, |
|||
WXK_HOME, "", |
|||
"Home view" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::resetView( "3DViewer.Control.resetView", |
|||
AS_GLOBAL, |
|||
'R', "", |
|||
"Reset view" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewFront( "3DViewer.Control.viewFront", |
|||
AS_GLOBAL, |
|||
'Y', "", |
|||
"View Front" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewBack( "3DViewer.Control.viewBack", |
|||
AS_GLOBAL, |
|||
MD_SHIFT + 'Y', "", |
|||
"View Back" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewLeft( "3DViewer.Control.viewLeft", |
|||
AS_GLOBAL, |
|||
MD_SHIFT + 'X', "", |
|||
"View Left" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewRight( "3DViewer.Control.viewRight", |
|||
AS_GLOBAL, |
|||
'X', "", |
|||
"View Right" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewTop( "3DViewer.Control.viewTop", |
|||
AS_GLOBAL, |
|||
'Z', "", |
|||
"View Top" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewBottom( "3DViewer.Control.viewBottom", |
|||
AS_GLOBAL, |
|||
MD_SHIFT + 'Z', "", |
|||
"View Bottom" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::rotate45axisZ( "3DViewer.Control.rotate45axisZ", |
|||
AS_GLOBAL, |
|||
WXK_TAB, "", |
|||
"Rotate 45 degrees over Z axis" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::zoomIn( "3DViewer.Control.zoomIn", |
|||
AS_GLOBAL, |
|||
WXK_F1, "", |
|||
"Zoom in " ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::zoomOut( "3DViewer.Control.zoomOut", |
|||
AS_GLOBAL, |
|||
WXK_F2, "", |
|||
"Zoom out" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::attributesTHT( "3DViewer.Control.attributesTHT", |
|||
AS_GLOBAL, |
|||
'T', "", |
|||
"Toggle 3D models with type Through Hole" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::attributesSMD( "3DViewer.Control.attributesSMD", |
|||
AS_GLOBAL, |
|||
'S', "", |
|||
"Toggle 3D models with type Surface Mount" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::attributesVirtual( "3DViewer.Control.attributesVirtual", |
|||
AS_GLOBAL, |
|||
'V', "", |
|||
"Toggle 3D models with type Virtual" ); |
|||
|
|||
|
@ -0,0 +1,300 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com> |
|||
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify it |
|||
* under the terms of the GNU General Public License as published by the |
|||
* Free Software Foundation, either version 3 of the License, or (at your |
|||
* option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, but |
|||
* WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License along |
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
#include <tool/tool_manager.h>
|
|||
#include <bitmaps.h>
|
|||
#include <3d_viewer_id.h>
|
|||
#include <3d_enums.h>
|
|||
#include "3d_actions.h"
|
|||
|
|||
|
|||
// Actions, being statically-defined, require specialized I18N handling. We continue to
|
|||
// use the _() macro so that string harvesting by the I18N framework doesn't have to be
|
|||
// specialized, but we don't translate on initialization and instead do it in the getters.
|
|||
|
|||
#undef _
|
|||
#define _(s) s
|
|||
|
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::controlActivate( "3DViewer.Control", AS_GLOBAL, |
|||
0, "", "", "", |
|||
NULL, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
|
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( "3DViewer.Control.pivotCenter", |
|||
AS_GLOBAL, |
|||
' ', "", |
|||
"Center pivot rotation (Middle mouse click)" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::rotateXCW( "3DViewer.Control.rotateXclockwise", |
|||
AS_GLOBAL, |
|||
0, "", |
|||
_( "Rotate X Clockwise" ), _( "Rotate X Clockwise" ), |
|||
rotate_neg_x_xpm, AF_NONE, (void*) ID_ROTATE3D_X_NEG ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::rotateXCCW( "3DViewer.Control.rotateXcounterclockwise", |
|||
AS_GLOBAL, |
|||
0, "", |
|||
_( "Rotate X Counterclockwise" ), _( "Rotate X Counterclockwise" ), |
|||
rotate_pos_x_xpm, AF_NONE, (void*) ID_ROTATE3D_X_POS ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::rotateYCW( "3DViewer.Control.rotateYclockwise", |
|||
AS_GLOBAL, |
|||
0, "", |
|||
_( "Rotate Y Clockwise" ), _( "Rotate Y Clockwise" ), |
|||
rotate_neg_y_xpm, AF_NONE, (void*) ID_ROTATE3D_Y_NEG ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::rotateYCCW( "3DViewer.Control.rotateYcounterclockwise", |
|||
AS_GLOBAL, |
|||
0, "", |
|||
_( "Rotate Y Counterclockwise" ), _( "Rotate Y Counterclockwise" ), |
|||
rotate_pos_y_xpm, AF_NONE, (void*) ID_ROTATE3D_Y_POS ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( "3DViewer.Control.rotateZclockwise", |
|||
AS_GLOBAL, |
|||
0, "", |
|||
_( "Rotate Z Clockwise" ), _( "Rotate Z Clockwise" ), |
|||
rotate_neg_z_xpm, AF_NONE, (void*) ID_ROTATE3D_Z_NEG ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::rotateZCCW( "3DViewer.Control.rotateZcounterclockwise", |
|||
AS_GLOBAL, |
|||
0, "", |
|||
_( "Rotate Z Counterclockwise" ), _( "Rotate Z Counterclockwise" ), |
|||
rotate_pos_z_xpm, AF_NONE, (void*) ID_ROTATE3D_Z_POS ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::moveLeft( "3DViewer.Control.moveLeft", |
|||
AS_GLOBAL, |
|||
WXK_LEFT, "", |
|||
_( "Move board Left" ), _( "Move board Left" ), |
|||
left_xpm, AF_NONE, (void*) CURSOR_LEFT ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::moveRight( "3DViewer.Control.moveRight", |
|||
AS_GLOBAL, |
|||
WXK_RIGHT, "", |
|||
_( "Move board Right" ), _( "Move board Right" ), |
|||
right_xpm, AF_NONE, (void*) CURSOR_RIGHT ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::moveUp( "3DViewer.Control.moveUp", |
|||
AS_GLOBAL, |
|||
WXK_UP, "", |
|||
_( "Move board Up" ), _( "Move board Up" ), |
|||
up_xpm, AF_NONE, (void*) CURSOR_UP ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::moveDown( "3DViewer.Control.moveDown", |
|||
AS_GLOBAL, |
|||
WXK_DOWN, "", |
|||
_( "Move board Down" ), _( "Move board Down" ), |
|||
down_xpm, AF_NONE, (void*) CURSOR_DOWN ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::homeView( "3DViewer.Control.homeView", |
|||
AS_GLOBAL, |
|||
WXK_HOME, "", |
|||
"Home view" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::resetView( "3DViewer.Control.resetView", |
|||
AS_GLOBAL, |
|||
'R', "", |
|||
"Reset view" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( "3DViewer.Control.toggleOrtho", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Toggle orthographic projection" ), _( "Enable/disable orthographic projection" ), |
|||
ortho_xpm ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewFront( "3DViewer.Control.viewFront", |
|||
AS_GLOBAL, |
|||
'Y', "", |
|||
_( "View Front" ), _( "View Front" ), |
|||
axis3d_front_xpm, AF_NONE, (void*) ID_VIEW3D_FRONT ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewBack( "3DViewer.Control.viewBack", |
|||
AS_GLOBAL, |
|||
MD_SHIFT + 'Y', "", |
|||
_( "View Back" ), _( "View Back" ), |
|||
axis3d_back_xpm, AF_NONE, (void*) ID_VIEW3D_BACK ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewLeft( "3DViewer.Control.viewLeft", |
|||
AS_GLOBAL, |
|||
MD_SHIFT + 'X', "", |
|||
_( "View Left" ), _( "View Left" ), |
|||
axis3d_left_xpm, AF_NONE, (void*) ID_VIEW3D_LEFT ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewRight( "3DViewer.Control.viewRight", |
|||
AS_GLOBAL, |
|||
'X', "", |
|||
_( "View Right" ), _( "View Right" ), |
|||
axis3d_right_xpm, AF_NONE, (void*) ID_VIEW3D_RIGHT ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewTop( "3DViewer.Control.viewTop", |
|||
AS_GLOBAL, |
|||
'Z', "", |
|||
_( "View Top" ), _( "View Top" ), |
|||
axis3d_top_xpm, AF_NONE, (void*) ID_VIEW3D_TOP ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::viewBottom( "3DViewer.Control.viewBottom", |
|||
AS_GLOBAL, |
|||
MD_SHIFT + 'Z', "", |
|||
_( "View Bottom" ), _( "View Bottom" ), |
|||
axis3d_bottom_xpm, AF_NONE, (void*) ID_VIEW3D_BOTTOM ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::noGrid( "3DViewer.Control.noGrid", |
|||
AS_GLOBAL, 0, "", |
|||
_( "No 3D Grid" ), _( "No 3D Grid" ), |
|||
nullptr, AF_NONE, (void*) GRID3D_TYPE::NONE ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::show10mmGrid( "3DViewer.Control.show10mmGrid", |
|||
AS_GLOBAL, 0, "", |
|||
_( "3D Grid 10mm" ), _( "3D Grid 10mm" ), |
|||
nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_10MM ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::show5mmGrid( "3DViewer.Control.show5mmGrid", |
|||
AS_GLOBAL, 0, "", |
|||
_( "3D Grid 5mm" ), _( "3D Grid 5mm" ), |
|||
nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_5MM ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::show2_5mmGrid( "3DViewer.Control.show2_5mmGrid", |
|||
AS_GLOBAL, 0, "", |
|||
_( "3D Grid 2.5mm" ), _( "3D Grid 2.5mm" ), |
|||
nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_2P5MM ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::show1mmGrid( "3DViewer.Control.show1mmGrid", |
|||
AS_GLOBAL, 0, "", |
|||
_( "3D Grid 1mm" ), _( "3D Grid 1mm" ), |
|||
nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_1MM ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::rotate45axisZ( "3DViewer.Control.rotate45axisZ", |
|||
AS_GLOBAL, |
|||
WXK_TAB, "", |
|||
"Rotate 45 degrees over Z axis" ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::attributesTHT( "3DViewer.Control.attributesTHT", |
|||
AS_GLOBAL, |
|||
'T', "", |
|||
_( "Toggle Through Hole 3D models" ), _( "Toggle 3D models with 'Through hole' attribute" ), |
|||
nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_NORMAL ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::attributesSMD( "3DViewer.Control.attributesSMD", |
|||
AS_GLOBAL, |
|||
'S', "", |
|||
_( "Toggle SMD 3D models" ), _( "Toggle 3D models with 'Surface mount' attribute" ), |
|||
nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_NORMAL_INSERT ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::attributesVirtual( "3DViewer.Control.attributesVirtual", |
|||
AS_GLOBAL, |
|||
'V', "", |
|||
_( "Toggle Virtual 3D models" ), _( "Toggle 3D models with 'Virtual' attribute" ), |
|||
nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_VIRTUAL ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::showCopperThickness( "3DViewer.Control.showCopperThickness", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Show Copper Thickness" ), _( "Shows the thickness of copper layers (slow)" ), |
|||
use_3D_copper_thickness_xpm, AF_NONE, (void*) FL_RENDER_OPENGL_COPPER_THICKNESS ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::showBoundingBoxes( "3DViewer.Control.showBoundingBoxes", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Show Model Bounding Boxes" ), _( "Show Model Bounding Boxes" ), |
|||
ortho_xpm, AF_NONE, (void*) FL_RENDER_OPENGL_SHOW_MODEL_BBOX ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::renderShadows( "3DViewer.Control.renderShadows", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Render Shadows" ), _( "Render Shadows" ), |
|||
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_SHADOWS ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::proceduralTextures( "3DViewer.Control.proceduralTextures", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Procedural Textures" ), _( "Apply procedural textures to materials (slow)" ), |
|||
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::addFloor( "3DViewer.Control.addFloor", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Add Floor" ), _( "Adds a floor plane below the board (slow)"), |
|||
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_BACKFLOOR ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::showRefractions( "3DViewer.Control.showRefractions", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Refractions" ), _( "Render materials with refractive properties on final render (slow)" ), |
|||
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_REFRACTIONS ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::showReflections( "3DViewer.Control.showReflections", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Reflections" ), _( "Render materials with reflective properties on final render (slow)" ), |
|||
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_REFLECTIONS ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::antiAliasing( "3DViewer.Control.antiAliasing", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Anti-aliasing" ), _( "Render with improved quality on final render (slow)" ), |
|||
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_ANTI_ALIASING ); |
|||
|
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::postProcessing( "3DViewer.Control.postProcessing", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Post-processing" ), |
|||
_( "Apply Screen Space Ambient Occlusion and Global Illumination reflections on final render (slow)"), |
|||
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_POST_PROCESSING ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::toggleRealisticMode( "3DViewer.Control.toggleRealisticMode", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Toggle realistic mode" ), _( "Toggle realistic mode" ), |
|||
nullptr, AF_NONE, (void*) FL_USE_REALISTIC_MODE ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::toggleBoardBody( "3DViewer.Control.toggleBoardBody", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Toggle board body display" ), _( "Toggle board body display" ), |
|||
nullptr, AF_NONE, (void*) FL_SHOW_BOARD_BODY ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::showAxis( "3DViewer.Control.showAxis", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Show 3D Axis" ), _( "Show 3D Axis" ), |
|||
axis3d_front_xpm, AF_NONE, (void*) FL_AXIS ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::toggleZones( "3DViewer.Control.toggleZones", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Toggle zone display" ), _( "Toggle zone display" ), |
|||
nullptr, AF_NONE, (void*) FL_ZONE ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::toggleAdhesive( "3DViewer.Control.toggleAdhesive", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Toggle adhesive display" ), _( "Toggle display of adhesive layers" ), |
|||
nullptr, AF_NONE, (void*) FL_ADHESIVE ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::toggleSilk( "3DViewer.Control.toggleSilk", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Toggle silkscreen display" ), _( "Toggle display of silkscreen layers" ), |
|||
nullptr, AF_NONE, (void*) FL_SILKSCREEN ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::toggleSolderMask( "3DViewer.Control.toggleSolderMask", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Toggle solder mask display" ), _( "Toggle display of solder mask layers" ), |
|||
nullptr, AF_NONE, (void*) FL_SOLDERMASK ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::toggleSolderPaste( "3DViewer.Control.toggleSolderPaste", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Toggle solder paste display" ), _( "Toggle display of solder paste layers" ), |
|||
nullptr, AF_NONE, (void*) FL_SOLDERPASTE ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::toggleComments( "3DViewer.Control.toggleComments", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Toggle comments display" ), _( "Toggle display of comments and drawings layers" ), |
|||
nullptr, AF_NONE, (void*) FL_COMMENTS ); |
|||
|
|||
TOOL_ACTION EDA_3D_ACTIONS::toggleECO( "3DViewer.Control.toggleECO", |
|||
AS_GLOBAL, 0, "", |
|||
_( "Toggle ECO display" ), _( "Toggle display of ECO layers" ), |
|||
nullptr, AF_NONE, (void*) FL_ECO ); |
|||
|
@ -0,0 +1,315 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
#include <tool/actions.h>
|
|||
#include <tool/tool_manager.h>
|
|||
#include <eda_3d_viewer.h>
|
|||
#include <id.h>
|
|||
#include <kiface_i.h>
|
|||
#include <3d_viewer_id.h>
|
|||
#include "3d_viewer_control.h"
|
|||
#include "3d_actions.h"
|
|||
|
|||
|
|||
bool EDA_3D_VIEWER_CONTROL::Init() |
|||
{ |
|||
CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu(); |
|||
|
|||
ctxMenu.AddItem( ACTIONS::zoomIn, SELECTION_CONDITIONS::ShowAlways ); |
|||
ctxMenu.AddItem( ACTIONS::zoomOut, SELECTION_CONDITIONS::ShowAlways ); |
|||
|
|||
ctxMenu.AddSeparator(); |
|||
ctxMenu.AddItem( EDA_3D_ACTIONS::viewTop, SELECTION_CONDITIONS::ShowAlways ); |
|||
ctxMenu.AddItem( EDA_3D_ACTIONS::viewBottom, SELECTION_CONDITIONS::ShowAlways ); |
|||
|
|||
ctxMenu.AddSeparator(); |
|||
ctxMenu.AddItem( EDA_3D_ACTIONS::viewRight, SELECTION_CONDITIONS::ShowAlways ); |
|||
ctxMenu.AddItem( EDA_3D_ACTIONS::viewLeft, SELECTION_CONDITIONS::ShowAlways ); |
|||
|
|||
ctxMenu.AddSeparator(); |
|||
ctxMenu.AddItem( EDA_3D_ACTIONS::viewFront, SELECTION_CONDITIONS::ShowAlways ); |
|||
ctxMenu.AddItem( EDA_3D_ACTIONS::viewBack, SELECTION_CONDITIONS::ShowAlways ); |
|||
|
|||
ctxMenu.AddSeparator(); |
|||
ctxMenu.AddItem( EDA_3D_ACTIONS::moveLeft, SELECTION_CONDITIONS::ShowAlways ); |
|||
ctxMenu.AddItem( EDA_3D_ACTIONS::moveRight, SELECTION_CONDITIONS::ShowAlways ); |
|||
ctxMenu.AddItem( EDA_3D_ACTIONS::moveUp, SELECTION_CONDITIONS::ShowAlways ); |
|||
ctxMenu.AddItem( EDA_3D_ACTIONS::moveDown, SELECTION_CONDITIONS::ShowAlways ); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
|
|||
void EDA_3D_VIEWER_CONTROL::Reset( RESET_REASON aReason ) |
|||
{ |
|||
m_frame = getEditFrame<EDA_3D_VIEWER>(); |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::UpdateMenu( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>(); |
|||
CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu ); |
|||
SELECTION dummySel; |
|||
|
|||
if( conditionalMenu ) |
|||
conditionalMenu->Evaluate( dummySel ); |
|||
|
|||
if( actionMenu ) |
|||
actionMenu->UpdateAll(); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::Main( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
// Main loop: keep receiving events
|
|||
while( TOOL_EVENT* evt = Wait() ) |
|||
{ |
|||
if( evt->IsClick( BUT_RIGHT ) ) |
|||
m_menu.ShowContextMenu(); |
|||
else |
|||
evt->SetPassEvent(); |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::ViewControl( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
m_frame->GetCanvas()->SetView3D( aEvent.Parameter<intptr_t>() ); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::PanControl( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
switch( aEvent.Parameter<intptr_t>() ) |
|||
{ |
|||
case ACTIONS::CURSOR_UP: m_frame->GetCanvas()->SetView3D( WXK_UP ); break; |
|||
case ACTIONS::CURSOR_DOWN: m_frame->GetCanvas()->SetView3D( WXK_DOWN ); break; |
|||
case ACTIONS::CURSOR_LEFT: m_frame->GetCanvas()->SetView3D( WXK_LEFT ); break; |
|||
case ACTIONS::CURSOR_RIGHT: m_frame->GetCanvas()->SetView3D( WXK_RIGHT ); break; |
|||
default: wxFAIL; break; |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
#define ROT_ANGLE 10.0
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::RotateView( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
CINFO3D_VISU& settings = m_frame->GetSettings(); |
|||
|
|||
switch( aEvent.Parameter<intptr_t>() ) |
|||
{ |
|||
case ID_ROTATE3D_X_NEG: settings.CameraGet().RotateX( -glm::radians( ROT_ANGLE ) ); break; |
|||
case ID_ROTATE3D_X_POS: settings.CameraGet().RotateX( glm::radians( ROT_ANGLE ) ); break; |
|||
case ID_ROTATE3D_Y_NEG: settings.CameraGet().RotateY( -glm::radians( ROT_ANGLE ) ); break; |
|||
case ID_ROTATE3D_Y_POS: settings.CameraGet().RotateY( glm::radians( ROT_ANGLE ) ); break; |
|||
case ID_ROTATE3D_Z_NEG: settings.CameraGet().RotateZ( -glm::radians( ROT_ANGLE ) ); break; |
|||
case ID_ROTATE3D_Z_POS: settings.CameraGet().RotateZ( glm::radians( ROT_ANGLE ) ); break; |
|||
default: wxFAIL; break; |
|||
} |
|||
|
|||
if( settings.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY ) |
|||
m_frame->GetCanvas()->Request_refresh(); |
|||
else |
|||
m_frame->GetCanvas()->RenderRaytracingRequest(); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::ToggleOrtho( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
m_frame->GetSettings().CameraGet().ToggleProjection(); |
|||
|
|||
if( m_frame->GetSettings().RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY ) |
|||
m_frame->GetCanvas()->Request_refresh(); |
|||
else |
|||
m_frame->GetCanvas()->RenderRaytracingRequest(); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::ToggleVisibility( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
DISPLAY3D_FLG flag = aEvent.Parameter<DISPLAY3D_FLG>(); |
|||
CINFO3D_VISU& settings = m_frame->GetSettings(); |
|||
|
|||
settings.SetFlag( flag, !settings.GetFlag( flag ) ); |
|||
|
|||
switch( flag ) |
|||
{ |
|||
case FL_RENDER_OPENGL_SHOW_MODEL_BBOX: |
|||
case FL_RENDER_RAYTRACING_SHADOWS: |
|||
case FL_RENDER_RAYTRACING_REFRACTIONS: |
|||
case FL_RENDER_RAYTRACING_REFLECTIONS: |
|||
case FL_RENDER_RAYTRACING_ANTI_ALIASING: |
|||
case FL_AXIS: |
|||
m_frame->GetCanvas()->Request_refresh(); |
|||
break; |
|||
default: |
|||
m_frame->NewDisplay( true ); |
|||
break; |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::On3DGridSelection( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
GRID3D_TYPE grid = aEvent.Parameter<GRID3D_TYPE>(); |
|||
m_frame->GetSettings().GridSet( grid ); |
|||
|
|||
if( m_frame->GetCanvas() ) |
|||
m_frame->GetCanvas()->Request_refresh(); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::ZoomRedraw( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
m_frame->GetCanvas()->Request_refresh(); |
|||
return 0; |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::ZoomInOut( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
bool direction = aEvent.IsAction( &ACTIONS::zoomIn ); |
|||
return doZoomInOut( direction, true ); |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::ZoomInOutCenter( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
bool direction = aEvent.IsAction( &ACTIONS::zoomInCenter ); |
|||
return doZoomInOut( direction, false ); |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::doZoomInOut( bool aDirection, bool aCenterOnCursor ) |
|||
{ |
|||
if( m_frame->GetCanvas() ) |
|||
{ |
|||
m_frame->GetCanvas()->SetView3D( aDirection ? WXK_F1 : WXK_F2 ); |
|||
m_frame->GetCanvas()->DisplayStatus(); |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
int EDA_3D_VIEWER_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent ) |
|||
{ |
|||
if( m_frame->GetCanvas() ) |
|||
{ |
|||
m_frame->GetCanvas()->SetView3D( WXK_HOME ); |
|||
m_frame->GetCanvas()->DisplayStatus(); |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
void EDA_3D_VIEWER_CONTROL::setTransitions() |
|||
{ |
|||
Go( &EDA_3D_VIEWER_CONTROL::Main, EDA_3D_ACTIONS::controlActivate.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() ); |
|||
|
|||
// Pan control
|
|||
Go( &EDA_3D_VIEWER_CONTROL::PanControl, ACTIONS::panUp.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::PanControl, ACTIONS::panDown.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::PanControl, ACTIONS::panLeft.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::PanControl, ACTIONS::panRight.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::PanControl, EDA_3D_ACTIONS::moveUp.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::PanControl, EDA_3D_ACTIONS::moveDown.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::PanControl, EDA_3D_ACTIONS::moveLeft.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::PanControl, EDA_3D_ACTIONS::moveRight.MakeEvent() ); |
|||
|
|||
// View rotation
|
|||
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewTop.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewBottom.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewLeft.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewRight.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewFront.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewBack.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateXCW.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateXCCW.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateYCW.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateYCCW.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateZCW.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateZCCW.MakeEvent() ); |
|||
|
|||
// Zoom control
|
|||
Go( &EDA_3D_VIEWER_CONTROL::ZoomRedraw, ACTIONS::zoomRedraw.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ZoomInOut, ACTIONS::zoomIn.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ZoomInOut, ACTIONS::zoomOut.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ZoomInOutCenter, ACTIONS::zoomInCenter.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ZoomInOutCenter, ACTIONS::zoomOutCenter.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ZoomFitScreen, ACTIONS::zoomFitScreen.MakeEvent() ); |
|||
|
|||
// Grid
|
|||
Go( &EDA_3D_VIEWER_CONTROL::On3DGridSelection, EDA_3D_ACTIONS::noGrid.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::On3DGridSelection, EDA_3D_ACTIONS::show10mmGrid.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::On3DGridSelection, EDA_3D_ACTIONS::show5mmGrid.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::On3DGridSelection, EDA_3D_ACTIONS::show2_5mmGrid.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::On3DGridSelection, EDA_3D_ACTIONS::show1mmGrid.MakeEvent() ); |
|||
|
|||
// Visibility
|
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleOrtho, EDA_3D_ACTIONS::toggleOrtho.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::attributesTHT.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::attributesSMD.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::attributesVirtual.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::showCopperThickness.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::showBoundingBoxes.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::renderShadows.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::proceduralTextures.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::addFloor.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::showRefractions.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::showReflections.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::antiAliasing.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::postProcessing.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleRealisticMode.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleBoardBody.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::showAxis.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleZones.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleAdhesive.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleSilk.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleSolderMask.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleSolderPaste.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleComments.MakeEvent() ); |
|||
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleECO.MakeEvent() ); |
|||
} |
|||
|
|||
|
@ -0,0 +1,82 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|||
* or you may search the http://www.gnu.org website for the version 2 license, |
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
#ifndef _3D_VIEWER_CONTROL_H |
|||
#define _3D_VIEWER_CONTROL_H |
|||
|
|||
#include <tool/tool_interactive.h> |
|||
|
|||
class EDA_3D_VIEWER; |
|||
|
|||
/** |
|||
* 3D_VIEWER_CONTROL |
|||
* |
|||
* Handles actions that are shared between different applications |
|||
*/ |
|||
|
|||
class EDA_3D_VIEWER_CONTROL : public TOOL_INTERACTIVE |
|||
{ |
|||
public: |
|||
EDA_3D_VIEWER_CONTROL() : |
|||
TOOL_INTERACTIVE( "3DViewer.Control" ), |
|||
m_frame( nullptr ) |
|||
{ } |
|||
|
|||
~EDA_3D_VIEWER_CONTROL() override { } |
|||
|
|||
/// @copydoc TOOL_INTERACTIVE::Init() |
|||
bool Init() override; |
|||
|
|||
/// @copydoc TOOL_BASE::Reset() |
|||
void Reset( RESET_REASON aReason ) override; |
|||
|
|||
int UpdateMenu( const TOOL_EVENT& aEvent ); |
|||
|
|||
int Main( const TOOL_EVENT& aEvent ); |
|||
|
|||
// View controls |
|||
int ZoomRedraw( const TOOL_EVENT& aEvent ); |
|||
int ZoomInOut( const TOOL_EVENT& aEvent ); |
|||
int ZoomInOutCenter( const TOOL_EVENT& aEvent ); |
|||
int ZoomFitScreen( const TOOL_EVENT& aEvent ); |
|||
|
|||
int PanControl( const TOOL_EVENT& aEvent ); |
|||
int ViewControl( const TOOL_EVENT& aEvent ); |
|||
int RotateView( const TOOL_EVENT& aEvent ); |
|||
|
|||
int On3DGridSelection( const TOOL_EVENT& aEvent ); |
|||
|
|||
int ToggleOrtho( const TOOL_EVENT& aEvent ); |
|||
int ToggleVisibility( const TOOL_EVENT& aEvent ); |
|||
|
|||
private: |
|||
///> Sets up handlers for various events. |
|||
void setTransitions() override; |
|||
|
|||
///> Pointer to the currently used edit frame. |
|||
EDA_3D_VIEWER* m_frame; |
|||
|
|||
int doZoomInOut( bool aDirection, bool aCenterOnCursor ); |
|||
}; |
|||
|
|||
#endif |
@ -1,26 +0,0 @@ |
|||
/** |
|||
* @file pcbnew/help_common_strings.h |
|||
* strings common to toolbars and menubar |
|||
*/ |
|||
|
|||
/** |
|||
* These strings are used in menus and tools, that do the same command |
|||
* But they are internationalized, and therefore must be created |
|||
* at run time, on the fly. |
|||
* So they cannot be static. |
|||
* |
|||
* Therefore they are defined by \#define, used inside menu constructors |
|||
*/ |
|||
|
|||
#define HELP_UNDO _( "Undo last edit" ) |
|||
#define HELP_REDO _( "Redo the last undo command" ) |
|||
#define HELP_FIND _( "Find components and text in current loaded board" ) |
|||
|
|||
#define HELP_ZOOM_IN _( "Zoom in" ) |
|||
#define HELP_ZOOM_OUT _( "Zoom out" ) |
|||
#define HELP_ZOOM_FIT _( "Zoom to fit board or page" ) |
|||
#define HELP_ZOOM_REDRAW _( "Redraw screen" ) |
|||
|
|||
#define HELP_SHOW_HIDE_LAYERMANAGER _( "Show/hide the layers manager toolbar" ) |
|||
|
|||
#define HELP_SHOW_HIDE_MICROWAVE_TOOLS _( "Show/hide microwave toolbar\n(Experimental feature)" ) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue