KiCad PCB EDA Suite
3d-viewer/3d_viewer/hotkeys.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) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
29 #include <hotkeys_basic.h>
30 #include "eda_3d_viewer.h"
31 #include "../3d_viewer_id.h"
32 
33 // Define 3D Viewer Hotkeys
34 static EDA_HOTKEY HkHotkeysHelp( _HKI( "Help (this window)" ), HK_HELP, GR_KB_CTRL + WXK_F1 );
35 static EDA_HOTKEY Hk3D_PivotCenter( _HKI( "Center pivot rotation (Middle mouse click)" ), 0, WXK_SPACE );
36 static EDA_HOTKEY Hk3D_MoveLeft( _HKI( "Move board Left" ), ID_POPUP_MOVE3D_LEFT, WXK_LEFT );
37 static EDA_HOTKEY Hk3D_MoveRight( _HKI( "Move board Right" ), ID_POPUP_MOVE3D_RIGHT, WXK_RIGHT );
38 static EDA_HOTKEY Hk3D_MoveUp( _HKI( "Move board Up" ), ID_POPUP_MOVE3D_UP, WXK_UP );
39 static EDA_HOTKEY Hk3D_MoveDown( _HKI( "Move board Down" ), ID_POPUP_MOVE3D_DOWN, WXK_DOWN );
40 static EDA_HOTKEY Hk3D_HomeView( _HKI( "Home view" ), 0, WXK_HOME );
41 static EDA_HOTKEY Hk3D_ResetView( _HKI( "Reset view" ), 0, 'R' );
42 
43 static EDA_HOTKEY Hk3D_ViewFront( _HKI( "View Front" ), ID_POPUP_VIEW_YPOS, 'Y' );
44 static EDA_HOTKEY Hk3D_ViewBack( _HKI( "View Back" ), ID_POPUP_VIEW_YNEG, GR_KB_SHIFT + 'Y' );
45 static EDA_HOTKEY Hk3D_ViewLeft( _HKI( "View Left" ), ID_POPUP_VIEW_XNEG, GR_KB_SHIFT + 'X' );
46 static EDA_HOTKEY Hk3D_ViewRight( _HKI( "View Right" ), ID_POPUP_VIEW_XPOS, 'X' );
47 static EDA_HOTKEY Hk3D_ViewTop( _HKI( "View Top" ), ID_POPUP_VIEW_ZPOS, 'Z' );
48 static EDA_HOTKEY Hk3D_ViewBot( _HKI( "View Bot" ), ID_POPUP_VIEW_ZNEG, GR_KB_SHIFT + 'Z' );
49 
50 static EDA_HOTKEY Hk3D_Rotate45axisZ( _HKI( "Rotate 45 degrees over Z axis" ), 0, WXK_TAB );
51 static EDA_HOTKEY Hk3D_ZoomIn( _HKI( "Zoom in " ), ID_POPUP_ZOOMIN, WXK_F1 );
52 static EDA_HOTKEY Hk3D_ZoomOut( _HKI( "Zoom out" ), ID_POPUP_ZOOMOUT, WXK_F2 );
53 static EDA_HOTKEY Hk3D_AttributesTHT( _HKI( "Toggle 3D models with type Through Hole" ), 0, 'T' );
54 static EDA_HOTKEY Hk3D_AttributesSMD( _HKI( "Toggle 3D models with type Surface Mount" ), 0, 'S' );
55 static EDA_HOTKEY Hk3D_AttributesVirtual( _HKI( "Toggle 3D models with type Virtual" ), 0, 'V' );
56 
57 static wxString viewer3DSectionTitle( _HKI( "Viewer 3D" ) );
58 
59 // List of hotkey descriptors for the 3D Viewer only
60 // !TODO: this is used just for help menu, the structured are not used yet in the viewer
62 {
67  &Hk3D_MoveUp,
75  &Hk3D_ViewTop,
76  &Hk3D_ViewBot,
78  &Hk3D_ZoomIn,
79  &Hk3D_ZoomOut,
83  NULL
84 };
85 
86 
87 // list of sections and corresponding hotkey list for the 3D Viewer
88 // (used to list current hotkeys)
90 {
92  { NULL, NULL, NULL }
93 };
94 
95 
97 {
98  DisplayHotkeyList( this, g_3DViewer_Hokeys_Descr );
99 }
static EDA_HOTKEY Hk3D_ResetView(_HKI("Reset view"), 0, 'R')
Structure EDA_HOTKEY_CONFIG contains the information required to save hot key information to a config...
Definition: hotkeys_basic.h:94
static EDA_HOTKEY Hk3D_ZoomIn(_HKI("Zoom in "), ID_POPUP_ZOOMIN, WXK_F1)
#define GR_KB_CTRL
static EDA_HOTKEY Hk3D_ViewFront(_HKI("View Front"), ID_POPUP_VIEW_YPOS, 'Y')
static EDA_HOTKEY Hk3D_Rotate45axisZ(_HKI("Rotate 45 degrees over Z axis"), 0, WXK_TAB)
static EDA_HOTKEY Hk3D_AttributesVirtual(_HKI("Toggle 3D models with type Virtual"), 0, 'V')
static EDA_HOTKEY Hk3D_AttributesTHT(_HKI("Toggle 3D models with type Through Hole"), 0, 'T')
static EDA_HOTKEY Hk3D_ViewBot(_HKI("View Bot"), ID_POPUP_VIEW_ZNEG, GR_KB_SHIFT+ 'Z')
static EDA_HOTKEY Hk3D_ViewLeft(_HKI("View Left"), ID_POPUP_VIEW_XNEG, GR_KB_SHIFT+ 'X')
void DisplayHotkeyList(EDA_BASE_FRAME *aFrame, struct EDA_HOTKEY_CONFIG *aDescList)
Function DisplayHotkeyList Displays the current hotkey list.
static EDA_HOTKEY HkHotkeysHelp(_HKI("Help (this window)"), HK_HELP, GR_KB_CTRL+WXK_F1)
static EDA_HOTKEY Hk3D_MoveRight(_HKI("Move board Right"), ID_POPUP_MOVE3D_RIGHT, WXK_RIGHT)
static EDA_HOTKEY Hk3D_MoveUp(_HKI("Move board Up"), ID_POPUP_MOVE3D_UP, WXK_UP)
#define GR_KB_SHIFT
static EDA_HOTKEY Hk3D_ViewTop(_HKI("View Top"), ID_POPUP_VIEW_ZPOS, 'Z')
static EDA_HOTKEY Hk3D_PivotCenter(_HKI("Center pivot rotation (Middle mouse click)"), 0, WXK_SPACE)
static EDA_HOTKEY * viewer3d_Hotkey_List[]
static EDA_HOTKEY Hk3D_MoveLeft(_HKI("Move board Left"), ID_POPUP_MOVE3D_LEFT, WXK_LEFT)
static EDA_HOTKEY Hk3D_AttributesSMD(_HKI("Toggle 3D models with type Surface Mount"), 0, 'S')
static EDA_HOTKEY Hk3D_ZoomOut(_HKI("Zoom out"), ID_POPUP_ZOOMOUT, WXK_F2)
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
Declaration of the eda_3d_viewer class.
static EDA_HOTKEY Hk3D_ViewRight(_HKI("View Right"), ID_POPUP_VIEW_XPOS, 'X')
static EDA_HOTKEY Hk3D_MoveDown(_HKI("Move board Down"), ID_POPUP_MOVE3D_DOWN, WXK_DOWN)
static EDA_HOTKEY Hk3D_ViewBack(_HKI("View Back"), ID_POPUP_VIEW_YNEG, GR_KB_SHIFT+ 'Y')
Some functions to handle hotkeys in KiCad.
static EDA_HOTKEY Hk3D_HomeView(_HKI("Home view"), 0, WXK_HOME)
wxString g_CommonSectionTag
struct EDA_HOTKEY_CONFIG g_3DViewer_Hokeys_Descr[]
#define _HKI(x)
static wxString viewer3DSectionTitle(_HKI("Viewer 3D"))