From de706635ccb8125426e2a9069318a85d67df8308 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 3 Mar 2019 23:45:52 +0000 Subject: [PATCH] Add high contrast hotkey to GerbView Also add all existing hotkeys to menubar. Fixes: lp:1795388 https://bugs.launchpad.net/kicad/+bug/1795388 --- gerbview/hotkeys.cpp | 8 ++++++++ gerbview/hotkeys.h | 1 + gerbview/menubar.cpp | 30 ++++++++++++++++++------------ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index cf2452b7d3..d4345fd207 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -69,6 +69,8 @@ static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 static EDA_HOTKEY HkSwitchUnits( _HKI( "Switch Units" ), HK_SWITCH_UNITS, 'U' ); static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' ); +static EDA_HOTKEY HkSwitchHighContrastMode( _HKI( "Toggle High Contrast Mode" ), + HK_SWITCH_HIGHCONTRAST_MODE, 'H' + GR_KB_CTRL ); static EDA_HOTKEY HkLinesDisplayMode( _HKI( "Gbr Lines Display Mode" ), HK_GBR_LINES_DISPLAY_MODE, 'L' ); @@ -115,6 +117,7 @@ EDA_HOTKEY* gerbviewHotkeyList[] = { &HkZoomAuto, &HkZoomSelection, &HkSwitchUnits, &HkResetLocalCoord, &HkLinesDisplayMode, &HkFlashedDisplayMode, &HkPolygonDisplayMode, &HkDCodesDisplayMode, &HkNegativeObjDisplayMode, + &HkSwitchHighContrastMode, &HkSwitch2NextCopperLayer, &HkSwitch2PreviousCopperLayer, &HkCanvasDefault, @@ -237,6 +240,11 @@ bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit m_canvas->Refresh(); break; + case HK_SWITCH_HIGHCONTRAST_MODE: + CHANGE( m_DisplayOptions.m_HighContrastMode ); + m_canvas->Refresh(); + break; + case HK_SWITCH_LAYER_TO_PREVIOUS: if( GetActiveLayer() > 0 ) { diff --git a/gerbview/hotkeys.h b/gerbview/hotkeys.h index 21e2c30b6d..376b05b20a 100644 --- a/gerbview/hotkeys.h +++ b/gerbview/hotkeys.h @@ -41,6 +41,7 @@ enum hotkey_id_commnand { HK_GBR_POLYGON_DISPLAY_MODE, HK_GBR_NEGATIVE_DISPLAY_ONOFF, HK_GBR_DCODE_DISPLAY_ONOFF, + HK_SWITCH_HIGHCONTRAST_MODE, HK_SWITCH_LAYER_TO_NEXT, HK_SWITCH_LAYER_TO_PREVIOUS, HK_CANVAS_LEGACY, diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 1a1fdaddd4..4151b80200 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -246,24 +246,29 @@ void GERBVIEW_FRAME::ReCreateMenuBar() viewMenu->AppendSeparator(); - AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, - _( "Sketch F&lashed Items" ),_( "Show flashed items in outline mode" ), + text = AddHotkeyName( _( "Sketch F&lashed Items" ), GerbviewHokeysDescr, HK_GBR_FLASHED_DISPLAY_MODE ); + AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, text, + _( "Show flashed items in outline mode" ), KiBitmap( pad_sketch_xpm ), wxITEM_CHECK ); - AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_LINES_SKETCH, - _( "Sketch &Lines" ),_( "Show lines in outline mode" ), + text = AddHotkeyName( _( "Sketch &Lines" ), GerbviewHokeysDescr, HK_GBR_LINES_DISPLAY_MODE ); + AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_LINES_SKETCH, text, + _( "Show lines in outline mode" ), KiBitmap( showtrack_xpm ), wxITEM_CHECK ); - AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, - _( "Sketch Pol&ygons" ),_( "Show polygons in outline mode" ), + text = AddHotkeyName( _( "Sketch Pol&ygons" ), GerbviewHokeysDescr, HK_GBR_POLYGON_DISPLAY_MODE ); + AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, text, + _( "Show polygons in outline mode" ), KiBitmap( opt_show_polygon_xpm ), wxITEM_CHECK ); - AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_DCODES, - _( "Show &DCodes" ), _( "Show or hide DCodes" ), + text = AddHotkeyName( _( "Show &DCodes" ), GerbviewHokeysDescr, HK_GBR_DCODE_DISPLAY_ONOFF ); + AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_DCODES, text, + _( "Show or hide DCodes" ), KiBitmap( show_dcodenumber_xpm ), wxITEM_CHECK ); - AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, - _( "Show &Negative Objects" ), _( "Show negative objects in ghost color" ), + text = AddHotkeyName( _( "Show &Negative Objects" ), GerbviewHokeysDescr, HK_GBR_NEGATIVE_DISPLAY_ONOFF ); + AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, text, + _( "Show negative objects in ghost color" ), KiBitmap( gerbview_show_negative_objects_xpm ), wxITEM_CHECK ); if( IsGalCanvasActive() ) @@ -272,8 +277,9 @@ void GERBVIEW_FRAME::ReCreateMenuBar() _( "Show in Differential Mode" ), _( "Show layers in differential mode" ), KiBitmap( gbr_select_mode2_xpm ), wxITEM_CHECK ); - AddMenuItem( viewMenu, ID_TB_OPTIONS_HIGH_CONTRAST_MODE, - _( "Show in High Contrast" ), _( "Show in high contrast mode" ), + text = AddHotkeyName( _( "Show in High Contrast" ), GerbviewHokeysDescr, HK_SWITCH_HIGHCONTRAST_MODE ); + AddMenuItem( viewMenu, ID_TB_OPTIONS_HIGH_CONTRAST_MODE, text, + _( "Show in high contrast mode" ), KiBitmap( contrast_mode_xpm ), wxITEM_CHECK ); } else