From 2237de015311657f7ae49ed5692c403048905172 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 28 Jun 2017 18:32:04 +0200 Subject: [PATCH] Gerbview "Always hide all layers but active" context menu selection doesn't work with keyboard Fixes: lp:1701008 https://bugs.launchpad.net/kicad/+bug/1701008 --- gerbview/class_gerbview_layer_widget.h | 2 +- gerbview/hotkeys.cpp | 34 +++++++++++++++++--------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/gerbview/class_gerbview_layer_widget.h b/gerbview/class_gerbview_layer_widget.h index ad40533af6..dcac8a7811 100644 --- a/gerbview/class_gerbview_layer_widget.h +++ b/gerbview/class_gerbview_layer_widget.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr + * Copyright (C) 2004-2010 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors. * diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index e95cadecdb..2a830358c1 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2010 - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2017 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 @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -62,19 +63,28 @@ static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); -static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION, '@', ID_ZOOM_SELECTION ); +static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), + HK_ZOOM_SELECTION, '@' ); static EDA_HOTKEY HkHelp( _HKI( "Help (this window)" ), HK_HELP, '?' ); 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 HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), + HK_RESET_LOCAL_COORD, ' ' ); -static EDA_HOTKEY HkLinesDisplayMode( _HKI( "Gbr Lines Display Mode" ), HK_GBR_LINES_DISPLAY_MODE, 'L' ); -static EDA_HOTKEY HkFlashedDisplayMode( _HKI( "Gbr Flashed Display Mode" ), HK_GBR_FLASHED_DISPLAY_MODE, 'F' ); -static EDA_HOTKEY HkPolygonDisplayMode( _HKI( "Gbr Polygons Display Mode" ), HK_GBR_POLYGON_DISPLAY_MODE, 'P' ); -static EDA_HOTKEY HkNegativeObjDisplayMode( _HKI( "Gbr Negative Obj Display Mode" ), HK_GBR_NEGATIVE_DISPLAY_ONOFF, 'N' ); -static EDA_HOTKEY HkDCodesDisplayMode( _HKI( "DCodes Display Mode" ), HK_GBR_DCODE_DISPLAY_ONOFF, 'D' ); +static EDA_HOTKEY HkLinesDisplayMode( _HKI( "Gbr Lines Display Mode" ), + HK_GBR_LINES_DISPLAY_MODE, 'L' ); +static EDA_HOTKEY HkFlashedDisplayMode( _HKI( "Gbr Flashed Display Mode" ), + HK_GBR_FLASHED_DISPLAY_MODE, 'F' ); +static EDA_HOTKEY HkPolygonDisplayMode( _HKI( "Gbr Polygons Display Mode" ), + HK_GBR_POLYGON_DISPLAY_MODE, 'P' ); +static EDA_HOTKEY HkNegativeObjDisplayMode( _HKI( "Gbr Negative Obj Display Mode" ), + HK_GBR_NEGATIVE_DISPLAY_ONOFF, 'N' ); +static EDA_HOTKEY HkDCodesDisplayMode( _HKI( "DCodes Display Mode" ), + HK_GBR_DCODE_DISPLAY_ONOFF, 'D' ); -static EDA_HOTKEY HkSwitch2NextCopperLayer( _HKI( "Switch to Next Layer" ), HK_SWITCH_LAYER_TO_NEXT, '+' ); -static EDA_HOTKEY HkSwitch2PreviousCopperLayer( _HKI( "Switch to Previous Layer" ), HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); +static EDA_HOTKEY HkSwitch2NextCopperLayer( _HKI( "Switch to Next Layer" ), + HK_SWITCH_LAYER_TO_NEXT, '+' ); +static EDA_HOTKEY HkSwitch2PreviousCopperLayer( _HKI( "Switch to Previous Layer" ), + HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); // List of common hotkey descriptors EDA_HOTKEY* gerbviewHotkeyList[] = { @@ -198,6 +208,7 @@ bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit if( getActiveLayer() > 0 ) { setActiveLayer( getActiveLayer() - 1 ); + m_LayersManager->OnLayerSelected(); m_canvas->Refresh(); } break; @@ -206,6 +217,7 @@ bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit if( getActiveLayer() < 31 ) { setActiveLayer( getActiveLayer() + 1 ); + m_LayersManager->OnLayerSelected(); m_canvas->Refresh(); } break;