Update immediate mode location and restart wires
The immediate action option clears (or not) the position of the events. We use this to determine if the command should start at the given position or merely activate the tool. This was being checked in the menu options, which only activated for tool commands in the context menu. Moving to the process event, we catch hotkeys as well. This also restores the previous logic in eeschema that used a static variable for storing wires rather than the private class variable. Starting the draw event now picks up from the existing wires when activated in immediate mode. Fixes #3891 | https://gitlab.com/kicad/code/kicad/issues/3891
This commit is contained in:
parent
feab56f6e7
commit
03f74c87a1
|
@ -448,11 +448,8 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
|
|||
// clients that don't supply a tool will have to check GetSelected() themselves
|
||||
if( evt && m_tool )
|
||||
{
|
||||
|
||||
wxLogTrace( kicadTraceToolStack, "ACTION_MENU::OnMenuEvent %s", evt->Format() );
|
||||
|
||||
TOOL_MANAGER* toolMgr = m_tool->GetManager();
|
||||
|
||||
// Pass the position the menu was opened from into the generated event if it is a select event
|
||||
if( type == wxEVT_COMMAND_MENU_SELECTED )
|
||||
evt->SetMousePosition( g_menu_open_position );
|
||||
|
@ -462,16 +459,6 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
|
|||
if( g_last_menu_highlighted_id == aEvent.GetId() && !m_isContextMenu )
|
||||
evt->SetHasPosition( false );
|
||||
|
||||
if( toolMgr->GetEditFrame() && !toolMgr->GetEditFrame()->GetDoImmediateActions() )
|
||||
{
|
||||
// An tool-selection-event has no position
|
||||
if( evt->GetCommandStr().is_initialized()
|
||||
&& evt->GetCommandStr().get() != toolMgr->GetEditFrame()->CurrentToolName() )
|
||||
{
|
||||
evt->SetHasPosition( false );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_tool->GetManager() )
|
||||
m_tool->GetManager()->ProcessEvent( *evt );
|
||||
}
|
||||
|
|
|
@ -1082,13 +1082,26 @@ bool TOOL_MANAGER::processEvent( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( !handled )
|
||||
{
|
||||
TOOL_EVENT mod_event( aEvent );
|
||||
|
||||
// Only immediate actions get the position. Otherwise clear for tool activation
|
||||
if( GetEditFrame() && !GetEditFrame()->GetDoImmediateActions() )
|
||||
{
|
||||
// An tool-selection-event has no position
|
||||
if( mod_event.GetCommandStr().is_initialized()
|
||||
&& mod_event.GetCommandStr().get() != GetEditFrame()->CurrentToolName() )
|
||||
{
|
||||
mod_event.SetHasPosition( false );
|
||||
}
|
||||
}
|
||||
|
||||
// If the event is not handled through a hotkey activation, pass it to the currently
|
||||
// running tool loops
|
||||
handled |= dispatchInternal( aEvent );
|
||||
handled |= dispatchActivation( aEvent );
|
||||
handled |= dispatchInternal( mod_event );
|
||||
handled |= dispatchActivation( mod_event );
|
||||
|
||||
// Open the context menu if requested by a tool
|
||||
DispatchContextMenu( aEvent );
|
||||
DispatchContextMenu( mod_event );
|
||||
|
||||
// Dispatch any remaining events in the event queue
|
||||
while( !m_eventQueue.empty() )
|
||||
|
|
|
@ -481,6 +481,10 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType
|
|||
if( m_busUnfold.label )
|
||||
m_selectionTool->AddItemToSel( m_busUnfold.label, true );
|
||||
|
||||
// Continue the existing wires if we've started (usually by immediate action preference)
|
||||
if( !m_wires.empty() )
|
||||
segment = m_wires.back();
|
||||
|
||||
// Main loop: keep receiving events
|
||||
while( TOOL_EVENT* evt = Wait() )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue