If tool was previously active and it is called again, it is brought to the top of the active tool stack.
It fixes issue of dragging of items that have EDIT_POINTs, when dragging was activated by hovering over an item and using hot key.
This commit is contained in:
parent
79d353671b
commit
e79934b03d
|
@ -253,9 +253,15 @@ bool TOOL_MANAGER::runTool( TOOL_BASE* aTool )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the tool is already active, do not invoke it again
|
// If the tool is already active, bring it to the top of the active tools stack
|
||||||
if( isActive( aTool ) )
|
if( isActive( aTool ) )
|
||||||
|
{
|
||||||
|
m_activeTools.erase( std::find( m_activeTools.begin(), m_activeTools.end(),
|
||||||
|
aTool->GetId() ) );
|
||||||
|
m_activeTools.push_front( aTool->GetId() );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
aTool->Reset( TOOL_INTERACTIVE::RUN );
|
aTool->Reset( TOOL_INTERACTIVE::RUN );
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,13 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
// Be sure that there is at least one item that we can modify
|
// Be sure that there is at least one item that we can modify
|
||||||
if( !makeSelection( selection ) )
|
if( !makeSelection( selection ) )
|
||||||
|
{
|
||||||
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Activate();
|
||||||
|
|
||||||
m_dragging = false; // Are selected items being dragged?
|
m_dragging = false; // Are selected items being dragged?
|
||||||
bool restore = false; // Should items' state be restored when finishing the tool?
|
bool restore = false; // Should items' state be restored when finishing the tool?
|
||||||
|
@ -205,7 +211,11 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
|
||||||
bool unselect = selection.Empty();
|
bool unselect = selection.Empty();
|
||||||
|
|
||||||
if( !makeSelection( selection ) )
|
if( !makeSelection( selection ) )
|
||||||
|
{
|
||||||
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Properties are displayed when there is only one item selected
|
// Properties are displayed when there is only one item selected
|
||||||
if( selection.Size() == 1 )
|
if( selection.Size() == 1 )
|
||||||
|
@ -471,20 +481,8 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION_TOOL::SELECTION& aSelec
|
||||||
|
|
||||||
bool EDIT_TOOL::makeSelection( const SELECTION_TOOL::SELECTION& aSelection )
|
bool EDIT_TOOL::makeSelection( const SELECTION_TOOL::SELECTION& aSelection )
|
||||||
{
|
{
|
||||||
if( aSelection.Empty() )
|
if( aSelection.Empty() ) // Try to find an item that could be modified
|
||||||
{
|
|
||||||
// Try to find an item that could be modified
|
|
||||||
m_toolMgr->RunAction( COMMON_ACTIONS::selectionSingle );
|
m_toolMgr->RunAction( COMMON_ACTIONS::selectionSingle );
|
||||||
|
|
||||||
if( aSelection.Empty() )
|
return !aSelection.Empty();
|
||||||
{
|
|
||||||
// This is necessary, so later the tool may be activated upon
|
|
||||||
// reception of the activation event
|
|
||||||
setTransitions();
|
|
||||||
|
|
||||||
return false; // Still no items to work with
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue