Fix rotate bug in symbol library editor.
The rotate hotkey was rotating individual items when a block was selected which is invalid behavior. Add check for block mode and disable rotating items when block mode is active. Fixes: lp:1660875 https://bugs.launchpad.net/kicad/+bug/1660875
This commit is contained in:
parent
77af6547c1
commit
9319ef034d
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -225,10 +225,12 @@ static EDA_HOTKEY HkLoadSchematic( _HKI( "Load Schematic" ), HK_LOAD_SCH, 'L' +
|
||||||
static EDA_HOTKEY HkAutoplaceFields( _HKI( "Autoplace Fields" ), HK_AUTOPLACE_FIELDS, 'O',
|
static EDA_HOTKEY HkAutoplaceFields( _HKI( "Autoplace Fields" ), HK_AUTOPLACE_FIELDS, 'O',
|
||||||
ID_AUTOPLACE_FIELDS );
|
ID_AUTOPLACE_FIELDS );
|
||||||
|
|
||||||
static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematics" ), HK_UPDATE_PCB_FROM_SCH, WXK_F8 );
|
static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematics" ), HK_UPDATE_PCB_FROM_SCH,
|
||||||
|
WXK_F8 );
|
||||||
|
|
||||||
// Higtlight connection
|
// Higtlight connection
|
||||||
static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Connection" ), ID_HOTKEY_HIGHLIGHT, 'X' + GR_KB_CTRL );
|
static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Connection" ), ID_HOTKEY_HIGHLIGHT,
|
||||||
|
'X' + GR_KB_CTRL );
|
||||||
|
|
||||||
// List of common hotkey descriptors
|
// List of common hotkey descriptors
|
||||||
static EDA_HOTKEY* common_Hotkey_List[] =
|
static EDA_HOTKEY* common_Hotkey_List[] =
|
||||||
|
@ -645,8 +647,6 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
|
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
|
||||||
bool itemInEdit = m_drawItem && m_drawItem->InEditMode();
|
|
||||||
|
|
||||||
/* Convert lower to upper case (the usual toupper function has problem
|
/* Convert lower to upper case (the usual toupper function has problem
|
||||||
* with non ascii codes like function keys */
|
* with non ascii codes like function keys */
|
||||||
if( (aHotKey >= 'a') && (aHotKey <= 'z') )
|
if( (aHotKey >= 'a') && (aHotKey <= 'z') )
|
||||||
|
@ -660,6 +660,10 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
if( hotKey == NULL )
|
if( hotKey == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool itemInEdit = GetScreen()->GetCurItem() && GetScreen()->GetCurItem()->GetFlags();
|
||||||
|
|
||||||
|
bool blocInProgress = GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK;
|
||||||
|
|
||||||
switch( hotKey->m_Idcommand )
|
switch( hotKey->m_Idcommand )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
@ -744,13 +748,20 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ROTATE:
|
case HK_ROTATE:
|
||||||
if( ! itemInEdit )
|
if( blocInProgress )
|
||||||
|
{
|
||||||
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
|
||||||
|
HandleBlockPlace( aDC );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_drawItem = LocateItemUsingCursor( aPosition );
|
m_drawItem = LocateItemUsingCursor( aPosition );
|
||||||
|
|
||||||
if( m_drawItem )
|
if( m_drawItem )
|
||||||
{
|
{
|
||||||
cmd.SetId( ID_LIBEDIT_ROTATE_ITEM );
|
cmd.SetId( ID_LIBEDIT_ROTATE_ITEM );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -802,6 +813,7 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_MIRROR_Y: // Mirror Y
|
case HK_MIRROR_Y: // Mirror Y
|
||||||
m_drawItem = LocateItemUsingCursor( aPosition );
|
m_drawItem = LocateItemUsingCursor( aPosition );
|
||||||
cmd.SetId( ID_LIBEDIT_MIRROR_Y );
|
cmd.SetId( ID_LIBEDIT_MIRROR_Y );
|
||||||
|
@ -831,8 +843,7 @@ EDA_HOTKEY* LIB_VIEW_FRAME::GetHotKeyDescription( int aCommand ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
|
||||||
EDA_ITEM* aItem )
|
|
||||||
{
|
{
|
||||||
if( aHotKey == 0 )
|
if( aHotKey == 0 )
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue