Tighten down the POINT_EDITORs a bit more.

This commit is contained in:
Jeff Young 2019-06-16 01:06:43 +01:00
parent f14e41133b
commit 0f4bdbd184
3 changed files with 24 additions and 34 deletions

View File

@ -310,8 +310,6 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
{
controls->SetAutoPan( false );
inDrag = false;
m_toolMgr->PassEvent();
}
else if( evt->IsCancel() )
@ -322,6 +320,9 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
modified = false;
}
// ESC should clear selection along with edit points
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
break;
}

View File

@ -180,18 +180,8 @@ int PL_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
if( !m_editPoints || evt->IsCancel() || TOOL_EVT_UTILS::IsSelectionEvent( evt.get() ) )
{
if( inDrag ) // Restore the last change
{
m_frame->PopTool();
m_frame->RollbackFromUndo();
inDrag = false;
modified = false;
}
if( !m_editPoints || TOOL_EVT_UTILS::IsSelectionEvent( evt.get() ) )
break;
}
if ( !inDrag )
updateEditedPoint( *evt );
@ -218,8 +208,22 @@ int PL_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
controls->SetAutoPan( false );
m_frame->PopTool();
inDrag = false;
}
m_toolMgr->PassEvent();
else if( evt->IsCancel() )
{
if( inDrag ) // Restore the last change
{
m_frame->PopTool();
m_frame->RollbackFromUndo();
inDrag = false;
modified = false;
}
// ESC should clear selection along with edit points
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
break;
}
else

View File

@ -330,7 +330,6 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
setEditedPoint( nullptr );
m_refill = false;
bool modified = false;
bool revert = false;
BOARD_COMMIT commit( editFrame );
LSET snapLayers = item->GetLayerSet();
@ -341,20 +340,12 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
if( revert )
break;
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
controls->SetSnapping( !evt->Modifier( MD_ALT ) );
if( !m_editPoints ||
evt->Matches( EVENTS::ClearedEvent ) ||
evt->Matches( EVENTS::UnselectedEvent ) ||
evt->Matches( EVENTS::SelectedEvent ) )
{
if( !m_editPoints || TOOL_EVT_UTILS::IsSelectionEvent( evt.get() ) )
break;
}
if ( !modified )
updateEditedPoint( *evt );
@ -403,20 +394,17 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
modified = false;
m_refill = true;
}
m_toolMgr->PassEvent();
}
else if( evt->IsCancel() )
{
if( modified ) // Restore the last change
revert = true;
commit.Revert();
// Let the selection tool receive the event too
m_toolMgr->PassEvent();
// ESC should clear selection along with edit points
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
// Do not exit right now, let the selection clear the selection
//break;
break;
}
else
@ -429,9 +417,6 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
{
view->Remove( m_editPoints.get() );
if( modified && revert )
commit.Revert();
finishItem();
m_editPoints.reset();
}