← Back to team overview

kicad-developers team mailing list archive

[PATCH] Add cross-probing messages to zoom in, zoom out and zoom to one of the preset zoom levels.

 

This is something I find useful when integrating pcbnew into my own
workflows; it means that as well as focusing on a component using KiWay
commands, you can set the zoom level to something other than the default
this-component-only level.

Regards,
Tom
From 4e6fc37c6c1ac7f6d243d529509a3b0d03c84323 Mon Sep 17 00:00:00 2001
From: Tom Cook <tom.k.cook@xxxxxxxxx>
Date: Thu, 8 Feb 2018 15:45:57 +0000
Subject: [PATCH] Add cross-probing messages to zoom in, zoom out and zoom to
 one of the preset zoom levels.

---
 pcbnew/cross-probing.cpp | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp
index f83397576..95541ef54 100644
--- a/pcbnew/cross-probing.cpp
+++ b/pcbnew/cross-probing.cpp
@@ -143,6 +143,20 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
 
         return;
     }
+    else if( strcmp( idcmd, "$ZOOMIN:" ) == 0 )
+    {
+        GetToolManager()->RunAction( ACTIONS::zoomIn,
+            true,
+            0
+            );
+    }
+    else if( strcmp( idcmd, "$ZOOMOUT:" ) == 0 )
+    {
+        GetToolManager()->RunAction( ACTIONS::zoomOut,
+            true,
+            0
+            );
+    }
 
     if( text == NULL )
         return;
@@ -226,6 +240,19 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
 
         SetStatusText( msg );
     }
+    else if( strcmp( idcmd, "$ZOOMPRESET:" ) == 0 )
+    {
+        wxString idxString( FROM_UTF8( text ) );
+        unsigned long idx = 0;
+        if( idxString.ToCULong( &idx ) )
+        {
+            GetToolManager()->RunAction( ACTIONS::zoomPreset,
+                true,
+                idx
+                );
+        }           
+    }                                  
+
 
     if( module )  // if found, center the module on screen, and redraw the screen.
     {
-- 
2.14.1


Follow ups