EDIT_TOOL: correctly handle locked items in Rotate/Flip/Mirror functions when the selection is already being dragged

Fixes: lp:1812009
* https://bugs.launchpad.net/kicad/+bug/1812009
This commit is contained in:
Tomasz Włostowski 2019-01-16 17:00:38 +01:00
parent f9f87b3ff8
commit d50bc6a85f
3 changed files with 12 additions and 6 deletions

View File

@ -672,7 +672,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
auto& selection = m_selectionTool->RequestSelection( auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector ) []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
{ EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED | EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS ); } ); { EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS ); }, nullptr, ! m_dragging );
if( selection.Empty() ) if( selection.Empty() )
return 0; return 0;
@ -751,7 +751,7 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
{ {
auto& selection = m_selectionTool->RequestSelection( auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector ) []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
{ EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED | EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS ); } ); { EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS ); }, nullptr, ! m_dragging );
if( selection.Empty() ) if( selection.Empty() )
return 0; return 0;
@ -833,7 +833,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
{ {
auto& selection = m_selectionTool->RequestSelection( auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector ) []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
{ EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED | EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS ); } ); { EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS ); }, nullptr, ! m_dragging );
if( selection.Empty() ) if( selection.Empty() )
return 0; return 0;

View File

@ -396,7 +396,7 @@ static EDA_RECT getRect( const BOARD_ITEM* aItem )
SELECTION& SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aClientFilter, SELECTION& SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aClientFilter,
std::vector<BOARD_ITEM*>* aFiltered ) std::vector<BOARD_ITEM*>* aFiltered, bool aConfirmLockedItems )
{ {
bool selectionEmpty = m_selection.Empty(); bool selectionEmpty = m_selection.Empty();
m_selection.SetIsHover( selectionEmpty ); m_selection.SetIsHover( selectionEmpty );
@ -406,7 +406,13 @@ SELECTION& SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aClientFilt
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, aClientFilter ); m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, aClientFilter );
m_selection.ClearReferencePoint(); m_selection.ClearReferencePoint();
} }
else if( aClientFilter )
if ( aConfirmLockedItems && CheckLock() == SELECTION_LOCKED )
{
clearSelection();
}
if( aClientFilter )
{ {
GENERAL_COLLECTOR collector; GENERAL_COLLECTOR collector;

View File

@ -96,7 +96,7 @@ public:
* @param aFiltered is an optional vector, that is filled with items removed by the filter * @param aFiltered is an optional vector, that is filled with items removed by the filter
*/ */
SELECTION& RequestSelection( CLIENT_SELECTION_FILTER aClientFilter, SELECTION& RequestSelection( CLIENT_SELECTION_FILTER aClientFilter,
std::vector<BOARD_ITEM*>* aFiltered = NULL ); std::vector<BOARD_ITEM*>* aFiltered = NULL, bool aConfirmLockedItems = false );
inline TOOL_MENU& GetToolMenu() inline TOOL_MENU& GetToolMenu()