Moved EDIT_TOOL::hoverSelection() code to SELECTION_TOOL::CursorSelection()
This commit is contained in:
parent
14b9e5991b
commit
a16586756f
|
@ -867,26 +867,8 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION& aSelection )
|
|||
|
||||
bool EDIT_TOOL::hoverSelection( bool aSanitize )
|
||||
{
|
||||
const SELECTION& selection = m_selectionTool->GetSelection();
|
||||
|
||||
if( selection.Empty() ) // Try to find an item that could be modified
|
||||
{
|
||||
m_toolMgr->RunAction( COMMON_ACTIONS::selectionCursor, true );
|
||||
|
||||
if( m_selectionTool->CheckLock() == SELECTION_LOCKED )
|
||||
{
|
||||
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( aSanitize )
|
||||
m_selectionTool->SanitizeSelection();
|
||||
|
||||
if( selection.Empty() ) // TODO is it necessary?
|
||||
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
|
||||
|
||||
return !selection.Empty();
|
||||
m_toolMgr->RunAction( COMMON_ACTIONS::selectionCursor, true, aSanitize );
|
||||
return !m_selectionTool->GetSelection().Empty();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -507,7 +507,21 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock()
|
|||
|
||||
int SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
selectCursor( true );
|
||||
bool sanitize = (bool) aEvent.Parameter<intptr_t>();
|
||||
|
||||
if( m_selection.Empty() ) // Try to find an item that could be modified
|
||||
{
|
||||
selectCursor( true );
|
||||
|
||||
if( CheckLock() == SELECTION_LOCKED )
|
||||
{
|
||||
clearSelection();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( sanitize )
|
||||
SanitizeSelection();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue