eeschema: keystroke zoom should obey disabled centering
Keystroke zoom (F1/F2) always centered the screen, because it was handled as ID_POPUP_ZOOM_IN event. Mousewheel scrolling was ok, because it is handled using different event based on the configuration. This patch introduces special event ids for keystroke zooming that are then properly translated to either ID_POPUP_ZOOM_IN or ID_OFFCENTER_ZOOM_IN depending on the configuration. The same issue is fixed for legacy canvas pcbnew. Fixes: lp:1742567 * https://bugs.launchpad.net/kicad/+bug/1742567 Signed-off-by: Martin Sivak <mars@montik.net>
This commit is contained in:
parent
7a28f3d4cf
commit
d5cdd78062
|
@ -132,6 +132,14 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
|
||||||
BASE_SCREEN* screen = GetScreen();
|
BASE_SCREEN* screen = GetScreen();
|
||||||
wxPoint center = GetScrollCenterPosition();
|
wxPoint center = GetScrollCenterPosition();
|
||||||
|
|
||||||
|
if ( id == ID_KEY_ZOOM_IN ) {
|
||||||
|
id = GetCanvas()->GetEnableZoomNoCenter() ?
|
||||||
|
ID_OFFCENTER_ZOOM_IN : ID_POPUP_ZOOM_IN;
|
||||||
|
} else if ( id == ID_KEY_ZOOM_OUT ) {
|
||||||
|
id = GetCanvas()->GetEnableZoomNoCenter() ?
|
||||||
|
ID_OFFCENTER_ZOOM_OUT : ID_POPUP_ZOOM_OUT;
|
||||||
|
}
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_OFFCENTER_ZOOM_IN:
|
case ID_OFFCENTER_ZOOM_IN:
|
||||||
|
|
|
@ -339,12 +339,12 @@ bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
{
|
{
|
||||||
case WXK_F1:
|
case WXK_F1:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_IN );
|
cmd.SetId( ID_KEY_ZOOM_IN );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_F2:
|
case WXK_F2:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
cmd.SetId( ID_KEY_ZOOM_OUT );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -103,16 +103,16 @@ static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTR
|
||||||
|
|
||||||
// Zoom In
|
// Zoom In
|
||||||
#if !defined( __WXMAC__ )
|
#if !defined( __WXMAC__ )
|
||||||
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN );
|
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_KEY_ZOOM_IN );
|
||||||
#else
|
#else
|
||||||
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_POPUP_ZOOM_IN );
|
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_KEY_ZOOM_IN );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Zoom Out
|
// Zoom Out
|
||||||
#if !defined( __WXMAC__ )
|
#if !defined( __WXMAC__ )
|
||||||
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_POPUP_ZOOM_OUT );
|
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_KEY_ZOOM_OUT );
|
||||||
#else
|
#else
|
||||||
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', ID_POPUP_ZOOM_OUT );
|
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', ID_KEY_ZOOM_OUT );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static EDA_HOTKEY HkHelp( _HKI( "Help (this window)" ), HK_HELP, '?' );
|
static EDA_HOTKEY HkHelp( _HKI( "Help (this window)" ), HK_HELP, '?' );
|
||||||
|
@ -907,12 +907,12 @@ bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_IN:
|
case HK_ZOOM_IN:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_IN );
|
cmd.SetId( ID_KEY_ZOOM_IN );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_OUT:
|
case HK_ZOOM_OUT:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
cmd.SetId( ID_KEY_ZOOM_OUT );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -169,12 +169,12 @@ bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_IN:
|
case HK_ZOOM_IN:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_IN );
|
cmd.SetId( ID_KEY_ZOOM_IN );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_OUT:
|
case HK_ZOOM_OUT:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
cmd.SetId( ID_KEY_ZOOM_OUT );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,9 @@ enum main_id
|
||||||
ID_POPUP_ZOOM_PAGE,
|
ID_POPUP_ZOOM_PAGE,
|
||||||
ID_POPUP_ZOOM_REDRAW,
|
ID_POPUP_ZOOM_REDRAW,
|
||||||
|
|
||||||
|
ID_KEY_ZOOM_IN,
|
||||||
|
ID_KEY_ZOOM_OUT,
|
||||||
|
|
||||||
/* Reserve IDs for popup menu zoom levels. If you need more
|
/* Reserve IDs for popup menu zoom levels. If you need more
|
||||||
* levels of zoom, change ID_POPUP_ZOOM_LEVEL_END. Note that more
|
* levels of zoom, change ID_POPUP_ZOOM_LEVEL_END. Note that more
|
||||||
* than 15 entries in a context submenu may get too large to display
|
* than 15 entries in a context submenu may get too large to display
|
||||||
|
|
|
@ -75,8 +75,8 @@ static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME, ID
|
||||||
static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4,
|
static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4,
|
||||||
ID_POPUP_ZOOM_CENTER );
|
ID_POPUP_ZOOM_CENTER );
|
||||||
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW );
|
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW );
|
||||||
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_POPUP_ZOOM_OUT );
|
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_KEY_ZOOM_OUT );
|
||||||
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN );
|
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_KEY_ZOOM_IN );
|
||||||
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, '@', ID_ZOOM_SELECTION );
|
||||||
static EDA_HOTKEY HkHelp( _HKI( "Help (this window)" ), HK_HELP, '?' );
|
static EDA_HOTKEY HkHelp( _HKI( "Help (this window)" ), HK_HELP, '?' );
|
||||||
static EDA_HOTKEY HkMoveItem( _HKI( "Move Item" ), HK_MOVE_ITEM, 'M', ID_POPUP_ITEM_MOVE );
|
static EDA_HOTKEY HkMoveItem( _HKI( "Move Item" ), HK_MOVE_ITEM, 'M', ID_POPUP_ITEM_MOVE );
|
||||||
|
|
|
@ -550,13 +550,13 @@ bool FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
{
|
{
|
||||||
case WXK_F1:
|
case WXK_F1:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_IN );
|
cmd.SetId( ID_KEY_ZOOM_IN );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
keyHandled = true;
|
keyHandled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_F2:
|
case WXK_F2:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
cmd.SetId( ID_KEY_ZOOM_OUT );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
keyHandled = true;
|
keyHandled = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -430,12 +430,12 @@ bool FOOTPRINT_VIEWER_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_IN:
|
case HK_ZOOM_IN:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_IN );
|
cmd.SetId( ID_KEY_ZOOM_IN );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_OUT:
|
case HK_ZOOM_OUT:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
cmd.SetId( ID_KEY_ZOOM_OUT );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -222,11 +222,11 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_IN:
|
case HK_ZOOM_IN:
|
||||||
evt_type = ID_POPUP_ZOOM_IN;
|
evt_type = ID_KEY_ZOOM_IN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_OUT:
|
case HK_ZOOM_OUT:
|
||||||
evt_type = ID_POPUP_ZOOM_OUT;
|
evt_type = ID_KEY_ZOOM_OUT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_REDRAW:
|
case HK_ZOOM_REDRAW:
|
||||||
|
|
|
@ -123,12 +123,12 @@ bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_IN:
|
case HK_ZOOM_IN:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_IN );
|
cmd.SetId( ID_KEY_ZOOM_IN );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_OUT:
|
case HK_ZOOM_OUT:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
cmd.SetId( ID_KEY_ZOOM_OUT );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue