Tighten down the POINT_EDITORs a bit more.
This commit is contained in:
parent
f14e41133b
commit
0f4bdbd184
|
@ -310,8 +310,6 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
controls->SetAutoPan( false );
|
controls->SetAutoPan( false );
|
||||||
inDrag = false;
|
inDrag = false;
|
||||||
|
|
||||||
m_toolMgr->PassEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsCancel() )
|
else if( evt->IsCancel() )
|
||||||
|
@ -322,6 +320,9 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
|
||||||
modified = false;
|
modified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ESC should clear selection along with edit points
|
||||||
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,18 +180,8 @@ int PL_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( OPT_TOOL_EVENT evt = Wait() )
|
while( OPT_TOOL_EVENT evt = Wait() )
|
||||||
{
|
{
|
||||||
if( !m_editPoints || evt->IsCancel() || TOOL_EVT_UTILS::IsSelectionEvent( evt.get() ) )
|
if( !m_editPoints || TOOL_EVT_UTILS::IsSelectionEvent( evt.get() ) )
|
||||||
{
|
|
||||||
if( inDrag ) // Restore the last change
|
|
||||||
{
|
|
||||||
m_frame->PopTool();
|
|
||||||
m_frame->RollbackFromUndo();
|
|
||||||
inDrag = false;
|
|
||||||
modified = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if ( !inDrag )
|
if ( !inDrag )
|
||||||
updateEditedPoint( *evt );
|
updateEditedPoint( *evt );
|
||||||
|
@ -218,8 +208,22 @@ int PL_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
|
||||||
controls->SetAutoPan( false );
|
controls->SetAutoPan( false );
|
||||||
m_frame->PopTool();
|
m_frame->PopTool();
|
||||||
inDrag = false;
|
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
|
else
|
||||||
|
|
|
@ -330,7 +330,6 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
setEditedPoint( nullptr );
|
setEditedPoint( nullptr );
|
||||||
m_refill = false;
|
m_refill = false;
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
bool revert = false;
|
|
||||||
|
|
||||||
BOARD_COMMIT commit( editFrame );
|
BOARD_COMMIT commit( editFrame );
|
||||||
LSET snapLayers = item->GetLayerSet();
|
LSET snapLayers = item->GetLayerSet();
|
||||||
|
@ -341,20 +340,12 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( OPT_TOOL_EVENT evt = Wait() )
|
while( OPT_TOOL_EVENT evt = Wait() )
|
||||||
{
|
{
|
||||||
if( revert )
|
|
||||||
break;
|
|
||||||
|
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
|
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
|
||||||
controls->SetSnapping( !evt->Modifier( MD_ALT ) );
|
controls->SetSnapping( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
if( !m_editPoints ||
|
if( !m_editPoints || TOOL_EVT_UTILS::IsSelectionEvent( evt.get() ) )
|
||||||
evt->Matches( EVENTS::ClearedEvent ) ||
|
|
||||||
evt->Matches( EVENTS::UnselectedEvent ) ||
|
|
||||||
evt->Matches( EVENTS::SelectedEvent ) )
|
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if ( !modified )
|
if ( !modified )
|
||||||
updateEditedPoint( *evt );
|
updateEditedPoint( *evt );
|
||||||
|
@ -403,20 +394,17 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
modified = false;
|
modified = false;
|
||||||
m_refill = true;
|
m_refill = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_toolMgr->PassEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsCancel() )
|
else if( evt->IsCancel() )
|
||||||
{
|
{
|
||||||
if( modified ) // Restore the last change
|
if( modified ) // Restore the last change
|
||||||
revert = true;
|
commit.Revert();
|
||||||
|
|
||||||
// Let the selection tool receive the event too
|
// ESC should clear selection along with edit points
|
||||||
m_toolMgr->PassEvent();
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||||
|
|
||||||
// Do not exit right now, let the selection clear the selection
|
break;
|
||||||
//break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -429,9 +417,6 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
view->Remove( m_editPoints.get() );
|
view->Remove( m_editPoints.get() );
|
||||||
|
|
||||||
if( modified && revert )
|
|
||||||
commit.Revert();
|
|
||||||
|
|
||||||
finishItem();
|
finishItem();
|
||||||
m_editPoints.reset();
|
m_editPoints.reset();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue