← Back to team overview

kicad-developers team mailing list archive

[PATCH] Save view control settings before dispatching new tool events

 

Fix another cause of https://bugs.launchpad.net/kicad/+bug/1741357

Using the "add via" hotkey was causing an immediate dispatch of that tool
event, which was overriding the view settings of the active tool (i.e.
router tool with cursor displayed).

This patch saves and restores the view settings before dispatching tool
events, which fixes this and should prevent some other weirdness if one
tool dispatches another with modified view settings.

-Jon
From ca0c6b04451154c33882ddf4d363a97a0753f69a Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Thu, 11 Jan 2018 22:12:46 -0500
Subject: [PATCH] Save view control settings before dispatching new tool events

Fixes: lp:1741357
* https://bugs.launchpad.net/kicad/+bug/1741357
---
 common/tool/tool_manager.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp
index 669b62f11..bfc628200 100644
--- a/common/tool/tool_manager.cpp
+++ b/common/tool/tool_manager.cpp
@@ -510,6 +510,9 @@ OPT<TOOL_EVENT> TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool,
 
 void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
 {
+    // Save current settings before overwriting with the dispatched tool
+    auto vc_settings = m_viewControls->GetSettings();
+
     // iterate over all registered tools
     for( auto it = m_activeTools.begin(); it != m_activeTools.end(); ++it )
     {
@@ -591,6 +594,8 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
         if( finished )
             break;      // only the first tool gets the event
     }
+
+    m_viewControls->ApplySettings( vc_settings );
 }
 
 
-- 
2.14.1


Follow ups