Minor enhancements in 3D viewer hotkey code
This commit is contained in:
parent
b6a06aa129
commit
4543bde56b
|
@ -45,8 +45,6 @@
|
|||
#include <hotkeys_basic.h>
|
||||
#include <menus_helpers.h>
|
||||
|
||||
extern struct EDA_HOTKEY_CONFIG g_3DViewer_Hokeys_Descr[];
|
||||
|
||||
|
||||
/**
|
||||
* Flag to enable 3D canvas debug tracing.
|
||||
|
@ -660,71 +658,71 @@ void EDA_3D_CANVAS::OnRightClick( wxMouseEvent &event )
|
|||
pos.x = event.GetX();
|
||||
pos.y = event.GetY();
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom +" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Zoom +" ), GetHotkeyConfig(),
|
||||
ID_POPUP_ZOOMIN );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
|
||||
msg, KiBitmap( zoom_in_xpm ) );
|
||||
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom -" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Zoom -" ), GetHotkeyConfig(),
|
||||
ID_POPUP_ZOOMOUT );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
|
||||
msg, KiBitmap( zoom_out_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Top View" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Top View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_ZPOS );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
|
||||
msg, KiBitmap( axis3d_top_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Bottom View" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Bottom View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_ZNEG );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
|
||||
msg, KiBitmap( axis3d_bottom_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Right View" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Right View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_XPOS );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
|
||||
msg, KiBitmap( axis3d_right_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Left View" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Left View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_XNEG );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
|
||||
msg, KiBitmap( axis3d_left_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Front View" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Front View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_YPOS );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
|
||||
msg, KiBitmap( axis3d_front_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Back View" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Back View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_YNEG );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
|
||||
msg, KiBitmap( axis3d_back_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Move Left <-" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Move Left <-" ), GetHotkeyConfig(),
|
||||
ID_POPUP_MOVE3D_LEFT );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
|
||||
msg, KiBitmap( left_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Move Right ->" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Move Right ->" ), GetHotkeyConfig(),
|
||||
ID_POPUP_MOVE3D_RIGHT );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
|
||||
msg, KiBitmap( right_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Move Up ^" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Move Up ^" ), GetHotkeyConfig(),
|
||||
ID_POPUP_MOVE3D_UP );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
|
||||
msg, KiBitmap( up_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Move Down" ), g_3DViewer_Hokeys_Descr,
|
||||
msg = AddHotkeyName( _( "Move Down" ), GetHotkeyConfig(),
|
||||
ID_POPUP_MOVE3D_DOWN );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
|
||||
msg, KiBitmap( down_xpm ) );
|
||||
|
|
|
@ -128,6 +128,11 @@ class EDA_3D_CANVAS : public HIDPI_GL_CANVAS
|
|||
|
||||
bool IsOpenGLInitialized() const { return m_is_opengl_initialized; }
|
||||
|
||||
/**
|
||||
* Return a structure containing currently used hotkey mapping.
|
||||
*/
|
||||
EDA_HOTKEY_CONFIG* GetHotkeyConfig() const;
|
||||
|
||||
private:
|
||||
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
#include <3d_viewer_id.h>
|
||||
#include "help_common_strings.h"
|
||||
|
||||
extern struct EDA_HOTKEY_CONFIG g_3DViewer_Hokeys_Descr[];
|
||||
|
||||
void EDA_3D_VIEWER::CreateMenuBar()
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CreateMenuBar" );
|
||||
|
@ -308,7 +306,7 @@ void EDA_3D_VIEWER::CreateMenuBar()
|
|||
_( "Open \"Getting Started in KiCad\" guide for beginners" ),
|
||||
KiBitmap( help_xpm ) );
|
||||
|
||||
wxString text = AddHotkeyName( _( "&List Hotkeys..." ), g_3DViewer_Hokeys_Descr, HK_HELP );
|
||||
wxString text = AddHotkeyName( _( "&List Hotkeys..." ), GetHotkeyConfig(), HK_HELP );
|
||||
AddMenuItem( helpMenu, ID_MENU3D_HELP_HOTKEY_SHOW_CURRENT_LIST,
|
||||
text,
|
||||
_( "Displays the current hotkeys list and corresponding commands" ),
|
||||
|
|
|
@ -102,6 +102,11 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
|||
*/
|
||||
CINFO3D_VISU &GetSettings() { return m_settings; }
|
||||
|
||||
/**
|
||||
* Return a structure containing currently used hotkey mapping.
|
||||
*/
|
||||
EDA_HOTKEY_CONFIG* GetHotkeyConfig() const;
|
||||
|
||||
/**
|
||||
* Get a SFVEC3D from a wx colour dialog
|
||||
* @param aColor is the SFVEC3D to change
|
||||
|
@ -178,7 +183,10 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
|||
|
||||
void CreateMenuBar();
|
||||
|
||||
void DisplayHotKeys();
|
||||
void DisplayHotKeys()
|
||||
{
|
||||
DisplayHotkeyList( this, GetHotkeyConfig() );
|
||||
}
|
||||
|
||||
void ReCreateMainToolbar();
|
||||
|
||||
|
|
|
@ -86,14 +86,20 @@ static EDA_HOTKEY* viewer3d_Hotkey_List[] =
|
|||
|
||||
// list of sections and corresponding hotkey list for the 3D Viewer
|
||||
// (used to list current hotkeys)
|
||||
struct EDA_HOTKEY_CONFIG g_3DViewer_Hokeys_Descr[] =
|
||||
static struct EDA_HOTKEY_CONFIG s_3DViewer_Hotkeys_Descr[] =
|
||||
{
|
||||
{ &g_CommonSectionTag, viewer3d_Hotkey_List, &viewer3DSectionTitle },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::DisplayHotKeys()
|
||||
EDA_HOTKEY_CONFIG* EDA_3D_VIEWER::GetHotkeyConfig() const
|
||||
{
|
||||
DisplayHotkeyList( this, g_3DViewer_Hokeys_Descr );
|
||||
return s_3DViewer_Hotkeys_Descr;
|
||||
}
|
||||
|
||||
|
||||
EDA_HOTKEY_CONFIG* EDA_3D_CANVAS::GetHotkeyConfig() const
|
||||
{
|
||||
return s_3DViewer_Hotkeys_Descr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue