Make <esc> unhighlight nets, but only after all tools have been cleared.
Also moves the Highlight Net hotkey from activating the tool to just doing a one-shot highlight. Fixes: lp:1835658 * https://bugs.launchpad.net/kicad/+bug/1835658
This commit is contained in:
parent
b029e4e44a
commit
a11f3a0b80
|
@ -526,7 +526,7 @@ TOOL_EVENT* TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool, const TOOL_EVENT_LIST&
|
|||
|
||||
void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
// iterate over all registered tools
|
||||
// iterate over active tool stack
|
||||
for( auto it = m_activeTools.begin(); it != m_activeTools.end(); ++it )
|
||||
{
|
||||
TOOL_STATE* st = m_toolIdIndex[*it];
|
||||
|
@ -543,6 +543,9 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
if( st->waitEvents.Matches( aEvent ) )
|
||||
{
|
||||
if( !aEvent.FirstResponder() )
|
||||
const_cast<TOOL_EVENT*>( &aEvent )->SetFirstResponder( st->theTool );
|
||||
|
||||
// got matching event? clear wait list and wake up the coroutine
|
||||
st->wakeupEvent = aEvent;
|
||||
st->pendingWait = false;
|
||||
|
@ -579,6 +582,9 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
auto func_copy = tr.second;
|
||||
|
||||
if( !aEvent.FirstResponder() )
|
||||
const_cast<TOOL_EVENT*>( &aEvent )->SetFirstResponder( st->theTool );
|
||||
|
||||
// if there is already a context, then push it on the stack
|
||||
// and transfer the previous view control settings to the new context
|
||||
if( st->cofunc )
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
class TOOL_ACTION;
|
||||
class TOOL_MANAGER;
|
||||
class TOOL_BASE;
|
||||
|
||||
/**
|
||||
* Internal (GUI-independent) event definitions.
|
||||
|
@ -183,7 +184,8 @@ public:
|
|||
m_mouseButtons( 0 ),
|
||||
m_keyCode( 0 ),
|
||||
m_modifiers( 0 ),
|
||||
m_param( aParameter )
|
||||
m_param( aParameter ),
|
||||
m_firstResponder( nullptr )
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
@ -196,7 +198,8 @@ public:
|
|||
m_mouseButtons( 0 ),
|
||||
m_keyCode( 0 ),
|
||||
m_modifiers( 0 ),
|
||||
m_param( aParameter )
|
||||
m_param( aParameter ),
|
||||
m_firstResponder( nullptr )
|
||||
{
|
||||
if( aCategory == TC_MOUSE )
|
||||
{
|
||||
|
@ -228,7 +231,8 @@ public:
|
|||
m_mouseButtons( 0 ),
|
||||
m_keyCode( 0 ),
|
||||
m_modifiers( 0 ),
|
||||
m_param( aParameter )
|
||||
m_param( aParameter ),
|
||||
m_firstResponder( nullptr )
|
||||
{
|
||||
if( aCategory == TC_COMMAND || aCategory == TC_MESSAGE )
|
||||
m_commandStr = aExtraParam;
|
||||
|
@ -253,6 +257,9 @@ public:
|
|||
bool HasPosition() const { return m_hasPosition; }
|
||||
void SetHasPosition( bool aHasPosition ) { m_hasPosition = aHasPosition; }
|
||||
|
||||
TOOL_BASE* FirstResponder() const { return m_firstResponder; }
|
||||
void SetFirstResponder( TOOL_BASE* aTool ) { m_firstResponder = aTool; }
|
||||
|
||||
///> Returns information about difference between current mouse cursor position and the place
|
||||
///> where dragging has started.
|
||||
const VECTOR2D Delta() const
|
||||
|
@ -531,6 +538,9 @@ private:
|
|||
///> Generic parameter used for passing non-standard data.
|
||||
void* m_param;
|
||||
|
||||
///> The first tool to receive the event
|
||||
TOOL_BASE* m_firstResponder;
|
||||
|
||||
OPT<int> m_commandId;
|
||||
OPT<std::string> m_commandStr;
|
||||
};
|
||||
|
|
|
@ -1162,7 +1162,7 @@ int PCB_EDITOR_CONTROL::ClearHighlight( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int PCB_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
|
||||
int PCB_EDITOR_CONTROL::HighlightNetTool( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
// If the keyboard hotkey was triggered and we are already in the highlight tool, behave
|
||||
// the same as a left-click. Otherwise highlight the net of the selected item(s), or if
|
||||
|
@ -1413,10 +1413,10 @@ void PCB_EDITOR_CONTROL::setTransitions()
|
|||
Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, EVENTS::UnselectedEvent );
|
||||
Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, EVENTS::ClearedEvent );
|
||||
Go( &PCB_EDITOR_CONTROL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::HighlightNet, PCB_ACTIONS::highlightNetSelection.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::HighlightNet, PCB_ACTIONS::toggleLastNetHighlight.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::ClearHighlight, PCB_ACTIONS::clearHighlight.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetTool.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetSelection.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::HighlightNetTool, PCB_ACTIONS::highlightNetTool.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::ClearHighlight, ACTIONS::cancelInteractive.MakeEvent() );
|
||||
|
||||
Go( &PCB_EDITOR_CONTROL::LocalRatsnestTool, PCB_ACTIONS::localRatsnestTool.MakeEvent() );
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
int ClearHighlight( const TOOL_EVENT& aEvent );
|
||||
|
||||
///> Launches a tool to pick the item whose net is going to be highlighted.
|
||||
int HighlightNetCursor( const TOOL_EVENT& aEvent );
|
||||
int HighlightNetTool( const TOOL_EVENT& aEvent );
|
||||
|
||||
///> Updates ratsnest for selected items.
|
||||
int UpdateSelectionRatsnest( const TOOL_EVENT& aEvent );
|
||||
|
|
|
@ -285,7 +285,15 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE)
|
||||
else if( evt->IsCancel() )
|
||||
{
|
||||
clearSelection();
|
||||
|
||||
if( evt->FirstResponder() == this )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::clearHighlight );
|
||||
}
|
||||
|
||||
else if( evt->Action() == TA_UNDO_REDO_PRE )
|
||||
{
|
||||
clearSelection();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue