← Back to team overview

kicad-developers team mailing list archive

[PATCH/RFC] Middle click actions in Pcbnew GAL

 

Hi,

Here are two patches:

* "Zoom to fit" on double middle click: resolves the Pcbnew side of
https://bugs.launchpad.net/kicad/+bug/1480868. Apparently this is an
AutoCAD thing, so it may make lots of people more are home in KiCad.
* "Centre on cursor" on middle single click. This is something I made
up out of thin air, but it allows people who don't like the
warp-on-zoom behaviour to be able to quickly recentre the view using
only the mouse.

Both these actions are already available from the keyboard (Home and
F4). I think ideally these would be configurable as well but there's
no framework for that right now.

The legacy canvas side is rather more complex, so I haven't attempted it here.

My mouse's middle click is pretty terrible, so I rarely use it, and so
I'm a bad judge of how useful these patches really are. Fell free to
comment on/reject either patch.

Cheers,

John
From 7576303590b9a6a5f555f469ce964dacd6fdf7fe Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Tue, 21 Mar 2017 02:00:11 +0800
Subject: [PATCH 2/2] Centre on cursor on middle click (Pcbnew GAL)

---
 pcbnew/tools/selection_tool.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index 600b516ce..1c3f24b62 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -303,6 +303,12 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
             }
         }
 
+        // Single middle-click - centre on cursor
+        else if( evt->IsClick( BUT_MIDDLE ) )
+        {
+            GetManager()->RunAction( ACTIONS::zoomCenter, true );
+        }
+
         // Double middle-click - zoom to fit
         else if( evt->IsDblClick( BUT_MIDDLE ) )
         {
-- 
2.12.0

From b2430a407789111b5fac008da4a045da4bd0f095 Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Wed, 15 Mar 2017 07:37:03 +0800
Subject: [PATCH 1/2] Zoom to fit on double middle click (Pcbnew GAL)

Fixes: lp:1480868
* https://bugs.launchpad.net/kicad/+bug/1480868
---
 pcbnew/tools/selection_tool.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index b3e85dca8..600b516ce 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -303,6 +303,12 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
             }
         }
 
+        // Double middle-click - zoom to fit
+        else if( evt->IsDblClick( BUT_MIDDLE ) )
+        {
+            GetManager()->RunAction( ACTIONS::zoomFitScreen, true );
+        }
+
         else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE )
         {
             clearSelection();
-- 
2.12.0


Follow ups