kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #24105
[PATCH] first patch to solve Bug #1562617.
First patch to solve Bug #1562617.
With this patch pcbnew shows shortcut in toolbar popup-tip.
From 3a6b245f540ba3a6579c5986e9db9102d58541f7 Mon Sep 17 00:00:00 2001
From: "Patrick J.P" <patrick.pereira@xxxxxxxxx>
Date: Mon, 11 Apr 2016 16:40:43 -0300
Subject: [PATCH 1/1] pcbnew, shortcut appears in popup-tip
First commit to solve Bug #1562617.
Signed-off-by: Patrick J.P <patrick.pereira@xxxxxxxxx>
---
common/hotkeys_basic.cpp | 12 ++++++++++++
include/hotkeys_basic.h | 9 +++++++++
pcbnew/tool_pcb.cpp | 19 ++++++++++++-------
pcbnew/toolbars_update_user_interface.cpp | 15 +++++++--------
4 files changed, 40 insertions(+), 15 deletions(-)
diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp
index b9d8644..e5c4c84 100644
--- a/common/hotkeys_basic.cpp
+++ b/common/hotkeys_basic.cpp
@@ -365,6 +365,18 @@ wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
return keyname;
}
+/**
+ * Function HotkeyFromCommandId
+ * return the hotkey from the Command id value ( m_KeyCode member value)
+ * @param aList = pointer to a EDA_HOTKEY list of commands
+ * @param aCommandId = Command Id value
+ * @return the hotkey in int
+ */
+wxString KeyNameBoxFromCommandId( EDA_HOTKEY** aList, int aCommandId )
+{
+ return wxString::Format(wxT(" [%s]"), KeyNameFromCommandId(aList, aCommandId));
+}
+
/**
* Function KeyCodeFromKeyName
diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h
index 1b9ad9f..8fed4b2 100644
--- a/include/hotkeys_basic.h
+++ b/include/hotkeys_basic.h
@@ -141,6 +141,15 @@ wxString KeyNameFromKeyCode( int aKeycode, bool * aIsFound = NULL );
wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId );
/**
+ * Function HotkeyBoxFromCommandId
+ * return the key name from the Command id value ( m_KeyCode member value) inside " [%s]"
+ * @param aList = pointer to a EDA_HOTKEY list of commands
+ * @param aCommandId = Command Id value
+ * @return the hotkey in int
+ */
+wxString KeyNameBoxFromCommandId( EDA_HOTKEY** aList, int aCommandId );
+
+/**
* Function KeyCodeFromKeyName
* return the key code from its key name
diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp
index ee27942..1d6a8bc 100644
--- a/pcbnew/tool_pcb.cpp
+++ b/pcbnew/tool_pcb.cpp
@@ -338,10 +338,12 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
_( "Display polar coordinates" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiBitmap( unit_inch_xpm ),
- _( "Units in inches" ), wxITEM_CHECK );
+ _( "Units in inches" )+KeyNameBoxFromCommandId(common_Hotkey_List, HK_SWITCH_UNITS),
+ wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiBitmap( unit_mm_xpm ),
- _( "Units in millimeters" ), wxITEM_CHECK );
+ _( "Units in millimeters" )+KeyNameBoxFromCommandId(common_Hotkey_List, HK_SWITCH_UNITS),
+ wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiBitmap( cursor_shape_xpm ),
_( "Change cursor shape" ), wxITEM_CHECK );
@@ -387,7 +389,7 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString,
KiBitmap( contrast_mode_xpm ),
- _( "Enable high contrast display mode" ),
+ _( "Enable high contrast display mode" )+KeyNameBoxFromCommandId(common_Hotkey_List, HK_SWITCH_HIGHCONTRAST_MODE),
wxITEM_CHECK );
// Tools to show/hide toolbars:
@@ -433,10 +435,12 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->AddSeparator();
m_drawToolBar->AddTool( ID_PCB_MODULE_BUTT, wxEmptyString, KiBitmap( module_xpm ),
- _( "Add footprints" ), wxITEM_CHECK );
+ (wxString::Format(_( "Add footprints" ))+KeyNameBoxFromCommandId(board_edit_Hotkey_List, HK_ADD_MODULE)),
+ wxITEM_CHECK );
m_drawToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString, KiBitmap( add_tracks_xpm ),
- _( "Add tracks and vias" ), wxITEM_CHECK );
+ (wxString::Format(_( "Add tracks and vias" ))+KeyNameBoxFromCommandId(board_edit_Hotkey_List, HK_ADD_NEW_TRACK)),
+ wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, KiBitmap( add_zone_xpm ),
_( "Add filled zones" ), wxITEM_CHECK );
@@ -467,7 +471,8 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->AddSeparator();
m_drawToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString, KiBitmap( delete_xpm ),
- _( "Delete items" ), wxITEM_CHECK );
+ (wxString::Format(_( "Delete items" ))+KeyNameBoxFromCommandId(board_edit_Hotkey_List, HK_DELETE)),
+ wxITEM_CHECK );
m_drawToolBar->AddSeparator();
m_drawToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString,
@@ -477,7 +482,7 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->AddTool( ID_PCB_PLACE_GRID_COORD_BUTT, wxEmptyString,
KiBitmap( grid_select_axis_xpm ),
- _( "Set the origin point for the grid" ),
+ _( "Set the origin point for the grid" )+KeyNameBoxFromCommandId(common_Hotkey_List, HK_SET_GRID_ORIGIN),
wxITEM_CHECK );
m_drawToolBar->Realize();
diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp
index 693eb93..6e07cd4 100644
--- a/pcbnew/toolbars_update_user_interface.cpp
+++ b/pcbnew/toolbars_update_user_interface.cpp
@@ -37,6 +37,7 @@
#include <dialog_helpers.h>
#include <class_board.h>
#include <pcbnew.h>
+#include <hotkeys.h>
#include <pcbnew_id.h>
#include <drc_stuff.h>
#include <class_pcb_layer_box_selector.h>
@@ -177,30 +178,28 @@ void PCB_EDIT_FRAME::OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent )
aEvent.Check( !displ_opts->m_DisplayViaFill );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
displ_opts->m_DisplayViaFill ?
- _( "Show vias in outline mode" ) :
- _( "Show vias in fill mode" ) );
+ _( "Show vias in outline mode" ):
+ _( "Show vias in fill mode" ));
}
-
void PCB_EDIT_FRAME::OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent )
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayPcbTrackFill );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
displ_opts->m_DisplayPcbTrackFill ?
- _( "Show tracks in outline mode" ) :
- _( "Show tracks in fill mode" ) );
+ _( "Show tracks in outline mode" )+KeyNameBoxFromCommandId(board_edit_Hotkey_List, HK_SWITCH_TRACK_DISPLAY_MODE):
+ _( "Show tracks in fill mode" )+KeyNameBoxFromCommandId(board_edit_Hotkey_List, HK_SWITCH_TRACK_DISPLAY_MODE));
}
-
void PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent )
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( displ_opts->m_ContrastModeDisplay );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
displ_opts->m_ContrastModeDisplay ?
- _( "Normal contrast display mode" ) :
- _( "High contrast display mode" ) );
+ _( "Normal contrast display mode" )+KeyNameBoxFromCommandId(board_edit_Hotkey_List,HK_SWITCH_HIGHCONTRAST_MODE) :
+ _( "High contrast display mode" )+KeyNameBoxFromCommandId(board_edit_Hotkey_List,HK_SWITCH_HIGHCONTRAST_MODE) );
}
--
2.8.0
Follow ups