pcbnew: Hide dynamic ratsnest after canceling edit

The dynamic ratsnest is shown while moving items but this needs to be
hidden after cancelling.  Previously this was handled by the
SelectionClear event but we've changed this to (correctly) keep the
previous selection when canceling.

Fixes: lp:1831350
* https://bugs.launchpad.net/kicad/+bug/1831350
This commit is contained in:
Seth Hillbrand 2019-06-02 20:22:57 -07:00
parent 1f30d0c803
commit 95ab0b1813
6 changed files with 16 additions and 12 deletions

View File

@ -585,10 +585,16 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
if( unselect )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
// If canceled, we need to remove the dynamic ratsnest from the screen
if( restore_state )
{
m_toolMgr->RunAction( PCB_ACTIONS::hideDynamicRatsnest, true );
m_commit->Revert();
}
else
{
m_commit->Push( _( "Drag" ) );
}
return 0;
}

View File

@ -314,7 +314,7 @@ public:
// Ratsnest
static TOOL_ACTION localRatsnestTool;
static TOOL_ACTION hideLocalRatsnest;
static TOOL_ACTION hideDynamicRatsnest;
static TOOL_ACTION updateLocalRatsnest;
/// Find an item

View File

@ -157,9 +157,8 @@ TOOL_ACTION PCB_ACTIONS::localRatsnestTool( "pcbnew.Control.localRatsnestTool",
_( "Highlight Ratsnest" ), "",
tool_ratsnest_xpm );
TOOL_ACTION PCB_ACTIONS::hideLocalRatsnest( "pcbnew.Control.hideLocalRatsnest",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION PCB_ACTIONS::hideDynamicRatsnest(
"pcbnew.Control.hideDynamicRatsnest", AS_GLOBAL, 0, "", "" );
TOOL_ACTION PCB_ACTIONS::updateLocalRatsnest( "pcbnew.Control.updateLocalRatsnest",
AS_GLOBAL, 0,
@ -1295,9 +1294,9 @@ int PCB_EDITOR_CONTROL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::HideSelectionRatsnest( const TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::HideDynamicRatsnest( const TOOL_EVENT& aEvent )
{
getModel<BOARD>()->GetConnectivity()->ClearDynamicRatsnest();
getModel<BOARD>()->GetConnectivity()->HideDynamicRatsnest();
m_slowRatsnest = false;
return 0;
}
@ -1384,7 +1383,7 @@ void PCB_EDITOR_CONTROL::setTransitions()
Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetSelection.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::LocalRatsnestTool, PCB_ACTIONS::localRatsnestTool.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HideSelectionRatsnest, PCB_ACTIONS::hideLocalRatsnest.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HideDynamicRatsnest, PCB_ACTIONS::hideDynamicRatsnest.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::UpdateSelectionRatsnest, PCB_ACTIONS::updateLocalRatsnest.MakeEvent() );
}

View File

@ -124,7 +124,7 @@ public:
int UpdateSelectionRatsnest( const TOOL_EVENT& aEvent );
///> Hides ratsnest for selected items. Called when there are no items selected.
int HideSelectionRatsnest( const TOOL_EVENT& aEvent );
int HideDynamicRatsnest( const TOOL_EVENT& aEvent );
///> Shows local ratsnest of a component
int LocalRatsnestTool( const TOOL_EVENT& aEvent );

View File

@ -1352,7 +1352,7 @@ void SELECTION_TOOL::clearSelection()
// Inform other potentially interested tools
m_toolMgr->ProcessEvent( EVENTS::ClearedEvent );
m_toolMgr->RunAction( PCB_ACTIONS::hideLocalRatsnest, true );
m_toolMgr->RunAction( PCB_ACTIONS::hideDynamicRatsnest, true );
}

View File

@ -229,9 +229,8 @@ MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
return nullptr;
}
TOOL_ACTION PCB_ACTIONS::hideLocalRatsnest( "pcbnew.Control.hideLocalRatsnest",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION PCB_ACTIONS::hideDynamicRatsnest(
"pcbnew.Control.hideLocalRatsnest", AS_GLOBAL, 0, "", "" );
TOOL_ACTION PCB_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FLIP_ITEM ),