Fixes for canceling selection after invoking menu on an unselected item (9cbcb322
)
This commit is contained in:
parent
3629fcbf4a
commit
71c33d3dcd
|
@ -232,8 +232,6 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
|
||||||
|
|
||||||
int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
bool unselect = false;
|
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( OPT_TOOL_EVENT evt = Wait() )
|
while( OPT_TOOL_EVENT evt = Wait() )
|
||||||
{
|
{
|
||||||
|
@ -267,10 +265,11 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// right click? if there is any object - show the context menu
|
// right click? if there is any object - show the context menu
|
||||||
else if( evt->IsClick( BUT_RIGHT ) )
|
else if( evt->IsClick( BUT_RIGHT ) )
|
||||||
{
|
{
|
||||||
unselect = m_selection.Empty();
|
if( m_selection.Empty() )
|
||||||
|
{
|
||||||
if( unselect )
|
|
||||||
selectPoint( evt->Position() );
|
selectPoint( evt->Position() );
|
||||||
|
m_selection.SetIsHover( true );
|
||||||
|
}
|
||||||
|
|
||||||
m_menu.ShowContextMenu( m_selection );
|
m_menu.ShowContextMenu( m_selection );
|
||||||
}
|
}
|
||||||
|
@ -302,8 +301,8 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_selection.SetIsHover( true );
|
||||||
m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" );
|
m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" );
|
||||||
unselect = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,11 +322,9 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE
|
else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE )
|
||||||
|| ( unselect && m_toolMgr->GetCurrentToolId() == GetId() ) )
|
|
||||||
{
|
{
|
||||||
clearSelection();
|
clearSelection();
|
||||||
unselect = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->Action() == TA_CONTEXT_MENU_CLOSED )
|
else if( evt->Action() == TA_CONTEXT_MENU_CLOSED )
|
||||||
|
@ -356,10 +353,6 @@ SELECTION& SELECTION_TOOL::RequestSelection( int aFlags )
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, 0 );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, 0 );
|
||||||
m_selection.SetIsHover( true );
|
m_selection.SetIsHover( true );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_selection.SetIsHover( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Be careful with iterators: items can be removed from list
|
// Be careful with iterators: items can be removed from list
|
||||||
// that invalidate iterators.
|
// that invalidate iterators.
|
||||||
|
@ -1238,16 +1231,13 @@ int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
|
||||||
void SELECTION_TOOL::clearSelection()
|
void SELECTION_TOOL::clearSelection()
|
||||||
{
|
{
|
||||||
if( m_selection.Empty() )
|
if( m_selection.Empty() )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
for( auto item : m_selection )
|
for( auto item : m_selection )
|
||||||
{
|
|
||||||
unselectVisually( static_cast<BOARD_ITEM*>( item ) );
|
unselectVisually( static_cast<BOARD_ITEM*>( item ) );
|
||||||
}
|
|
||||||
|
|
||||||
m_selection.Clear();
|
m_selection.Clear();
|
||||||
|
m_selection.SetIsHover( false );
|
||||||
|
|
||||||
m_frame->SetCurItem( NULL );
|
m_frame->SetCurItem( NULL );
|
||||||
m_locked = true;
|
m_locked = true;
|
||||||
|
|
Loading…
Reference in New Issue