← Back to team overview

kicad-developers team mailing list archive

[PATCH] Add zoom-to-selection tool

 

This patch adds a zoom-to-selection tool to the eeschema, libedit, pcbnew, and
modedit canvases, both legacy and GAL. It is my planned replacement for the
middle-button zoom that only works on legacy, as discussed earlier.

Because this patch only adds features, and relatively small ones, I'm going to
go ahead and push it tomorrow - just wanted to give everybody a heads-up since
it does touch a lot of files. I do want to push it in though to get some
testing exposure.

Please let me know if you have any issues, other than ones mentioned below.

Known issues, to be addressed:

- OSX has a centering problem. This isn't stricly in my new code, but in old
  code I'm calling. I'm going to have an OSX box of my own by the end of the
  week (got it specifically for kicad development :), so I'll look into it then
  - though if anyone else sees what the problem is, feel free to beat me to it
  ;)

- The vertical toolbar is getting a bit long, particularly in eeschema. I'm
  going to let this be for now, since I still plan to address this in the
  future. Simon Wells has a patch in the pipeline that adds a menu to the
  toolbars to hold any icons that don't fit, which should work well as an
  interim fix until I can get around to fixing the "too damn many buttons"
  issue at the root.

- I'm not too fond of the default hotkey ('@'), but we're a bit short on new
  default hotkeys...

- Doesn't work in gerbview or pl_editor. These tools have very different UIs
  from the others and it was nontrivial to patch them in. I'll look at adding
  it to them as well, which may require a bit of effort to unify block behavior
  between them a bit.

-- 
Chris
>From c8a70168845a2873251127664328cc8d5297792a Mon Sep 17 00:00:00 2001
From: Chris Pavlina <pavlina.chris@xxxxxxxxx>
Date: Tue, 7 Jun 2016 17:07:45 -0400
Subject: [PATCH] Add zoom-to-selection tool

---
 common/draw_frame.cpp            |   8 ++-
 common/draw_panel.cpp            |   4 +-
 eeschema/hotkeys.cpp             |   5 +-
 eeschema/libeditframe.cpp        |   8 ++-
 eeschema/schedit.cpp             |   6 +-
 eeschema/schframe.cpp            |   2 +
 eeschema/tool_lib.cpp            |   5 +-
 eeschema/tool_sch.cpp            |   5 +-
 include/draw_frame.h             |   8 ++-
 include/hotkeys_basic.h          |   3 +-
 include/id.h                     |   1 +
 pcbnew/CMakeLists.txt            |   1 +
 pcbnew/edit.cpp                  |   6 ++
 pcbnew/hotkeys.cpp               |   3 +-
 pcbnew/hotkeys_board_editor.cpp  |   4 ++
 pcbnew/hotkeys_module_editor.cpp |   7 ++-
 pcbnew/modedit.cpp               |   6 +-
 pcbnew/moduleframe.cpp           |   6 +-
 pcbnew/onleftclick.cpp           |   3 +-
 pcbnew/onrightclick.cpp          |   4 +-
 pcbnew/pcbframe.cpp              |   4 +-
 pcbnew/tool_modedit.cpp          |   5 +-
 pcbnew/tool_pcb.cpp              |   6 +-
 pcbnew/tools/common_actions.cpp  |   8 +++
 pcbnew/tools/common_actions.h    |   2 +
 pcbnew/tools/tools_common.cpp    |   5 +-
 pcbnew/tools/zoom_tool.cpp       | 132 +++++++++++++++++++++++++++++++++++++++
 pcbnew/tools/zoom_tool.h         |  48 ++++++++++++++
 28 files changed, 283 insertions(+), 22 deletions(-)
 create mode 100644 pcbnew/tools/zoom_tool.cpp
 create mode 100644 pcbnew/tools/zoom_tool.h

diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp
index 442e110..e73a293 100644
--- a/common/draw_frame.cpp
+++ b/common/draw_frame.cpp
@@ -799,14 +799,18 @@ wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMil
 }
 
 
-bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition )
+bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
+       int aExplicitCommand )
 {
     BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
 
     if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
         return false;
 
-    block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
+    if( aExplicitCommand == 0 )
+        block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
+    else
+        block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
 
     if( block->GetCommand() == 0 )
         return false;
diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp
index 1455ca5..75ebb7a 100644
--- a/common/draw_panel.cpp
+++ b/common/draw_panel.cpp
@@ -1323,7 +1323,9 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
                     m_minDragEventCount++;
                 else
                 {
-                    if( !GetParent()->HandleBlockBegin( &DC, cmd_type, m_CursorStartPos ) )
+                    auto cmd = (GetParent()->GetToolId() == ID_ZOOM_SELECTION) ? BLOCK_ZOOM : 0;
+
+                    if( !GetParent()->HandleBlockBegin( &DC, cmd_type, m_CursorStartPos, cmd ) )
                     {
                         // should not occur: error
                         GetParent()->DisplayToolMsg(
diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp
index eb4d3fe..f05e696 100644
--- a/eeschema/hotkeys.cpp
+++ b/eeschema/hotkeys.cpp
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -208,6 +208,7 @@ static EDA_HOTKEY HkFindReplace( _HKI( "Find and Replace" ), HK_FIND_REPLACE,
                                  'F' + GR_KB_CTRL + GR_KB_ALT, wxID_REPLACE );
 static EDA_HOTKEY HkFindNextDrcMarker( _HKI( "Find Next DRC Marker" ), HK_FIND_NEXT_DRC_MARKER,
                                        WXK_F5 + GR_KB_SHIFT, EVT_COMMAND_FIND_DRC_MARKER );
+static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION, '@', ID_ZOOM_SELECTION );
 
 // Special keys for library editor:
 static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
@@ -234,6 +235,7 @@ static EDA_HOTKEY* common_Hotkey_List[] =
     &HkZoomRedraw,
     &HkZoomCenter,
     &HkZoomAuto,
+    &HkZoomSelection,
     &HkResetLocalCoord,
     &HkEdit,
     &HkDelete,
@@ -454,6 +456,7 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
     case HK_ZOOM_REDRAW:
     case HK_ZOOM_CENTER:
     case HK_ZOOM_AUTO:
+    case HK_ZOOM_SELECTION:
     case HK_LEAVE_SHEET:
     case HK_DELETE_NODE:
     case HK_MOVEBLOCK_TO_DRAGBLOCK:          // Switch to drag mode, when block moving
diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp
index fef1f5a..c9d102d 100644
--- a/eeschema/libeditframe.cpp
+++ b/eeschema/libeditframe.cpp
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -118,6 +118,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
 
     // Right vertical toolbar.
     EVT_TOOL( ID_NO_TOOL_SELECTED, LIB_EDIT_FRAME::OnSelectTool )
+    EVT_TOOL( ID_ZOOM_SELECTION, LIB_EDIT_FRAME::OnSelectTool )
     EVT_TOOL_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT,
                     LIB_EDIT_FRAME::OnSelectTool )
 
@@ -171,6 +172,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
     EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal )
     EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert )
     EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, LIB_EDIT_FRAME::OnUpdateEditingPart )
+    EVT_UPDATE_UI( ID_ZOOM_SELECTION, LIB_EDIT_FRAME::OnUpdateEditingPart )
     EVT_UPDATE_UI_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT,
                          LIB_EDIT_FRAME::OnUpdateEditingPart )
 END_EVENT_TABLE()
@@ -1102,6 +1104,10 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
         SetToolID( id, m_canvas->GetDefaultCursor(), wxEmptyString );
         break;
 
+    case ID_ZOOM_SELECTION:
+        SetToolID( id, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
+        break;
+
     case ID_LIBEDIT_PIN_BUTT:
         if( part )
         {
diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp
index 707c0ca..059dbf2 100644
--- a/eeschema/schedit.cpp
+++ b/eeschema/schedit.cpp
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -529,6 +529,10 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
         SetToolID( id, m_canvas->GetDefaultCursor(), _( "No tool selected" ) );
         break;
 
+    case ID_ZOOM_SELECTION:
+        SetToolID( id, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
+        break;
+
     case ID_HIERARCHY_PUSH_POP_BUTT:
         SetToolID( id, wxCURSOR_HAND, _( "Descend or ascend hierarchy" ) );
         break;
diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp
index ecdc7fd..9cca131 100644
--- a/eeschema/schframe.cpp
+++ b/eeschema/schframe.cpp
@@ -276,6 +276,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
 
     // Tools and buttons for vertical toolbar.
     EVT_TOOL( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnSelectTool )
+    EVT_TOOL( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnSelectTool )
     EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
                     SCH_EDIT_FRAME::OnSelectTool )
 
@@ -310,6 +311,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
     EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins )
     EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
     EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnUpdateSelectTool )
+    EVT_UPDATE_UI( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnUpdateSelectTool )
     EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
                          SCH_EDIT_FRAME::OnUpdateSelectTool )
     EVT_UPDATE_UI( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnUpdateSave )
diff --git a/eeschema/tool_lib.cpp b/eeschema/tool_lib.cpp
index b8b4363..383d670 100644
--- a/eeschema/tool_lib.cpp
+++ b/eeschema/tool_lib.cpp
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@xxxxxxxxxxxxxxxxxx
  * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -61,6 +61,9 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
     m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ),
                             _( "Deselect current tool" ), wxITEM_CHECK );
 
+    m_drawToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ),
+                            _( "Zoom to selection" ), wxITEM_CHECK );
+
     m_drawToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString, KiBitmap( pin_xpm ),
                             HELP_ADD_PIN, wxITEM_CHECK  );
 
diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp
index eaea653..5802e09 100644
--- a/eeschema/tool_sch.cpp
+++ b/eeschema/tool_sch.cpp
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -190,6 +190,9 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
     m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ),
                             wxEmptyString, wxITEM_CHECK );
 
+    m_drawToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ),
+                            _( "Zoom to selection" ), wxITEM_CHECK );
+
     m_drawToolBar->AddTool( ID_HIERARCHY_PUSH_POP_BUTT, wxEmptyString,
                             KiBitmap( hierarchy_cursor_xpm ),
                             _( "Ascend/descend hierarchy" ), wxITEM_CHECK );
diff --git a/include/draw_frame.h b/include/draw_frame.h
index 7765e97..1913c52 100644
--- a/include/draw_frame.h
+++ b/include/draw_frame.h
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@xxxxxxxxxxxxxxxxxx
  * Copyright (C) 2011 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -641,8 +641,12 @@ public:
      * Function HandleBlockBegin
      * initializes the block command including the command type, initial position,
      * and other variables.
+     *
+     * @param aExplicitCommand - if this is given, begin with this command, rather
+     *  than looking up the command from aKey.
      */
-    virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition );
+    virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
+            int aExplicitCommand = 0 );
 
     /**
      * Function BlockCommand
diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h
index 3f841cf..7792162 100644
--- a/include/hotkeys_basic.h
+++ b/include/hotkeys_basic.h
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -243,6 +243,7 @@ enum common_hotkey_id_commnand {
     HK_ZOOM_REDRAW,
     HK_ZOOM_CENTER,
     HK_ZOOM_AUTO,
+    HK_ZOOM_SELECTION,
     HK_UNDO,
     HK_REDO,
     HK_COMMON_END
diff --git a/include/id.h b/include/id.h
index 7c518ca..8630c36 100644
--- a/include/id.h
+++ b/include/id.h
@@ -116,6 +116,7 @@ enum main_id
 
     ID_EDIT,
     ID_NO_TOOL_SELECTED,
+    ID_ZOOM_SELECTION,
     ID_SEL_BG_COLOR,
 
     ID_REPEAT_BUTT,
diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index aea5469..9af0f79 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -293,6 +293,7 @@ set( PCBNEW_CLASS_SRCS
     tools/common_actions.cpp
     tools/grid_helper.cpp
     tools/picker_tool.cpp
+    tools/zoom_tool.cpp
     tools/tools_common.cpp
 
     tools/grid_menu.cpp
diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp
index 84be126..524f7cb 100644
--- a/pcbnew/edit.cpp
+++ b/pcbnew/edit.cpp
@@ -1429,6 +1429,10 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
         SetToolID( id, m_canvas->GetDefaultCursor(), wxEmptyString );
         break;
 
+    case ID_ZOOM_SELECTION:
+        SetToolID( id, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
+        break;
+
     case ID_TRACK_BUTT:
         if( g_Drc_On )
             SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) );
@@ -1546,6 +1550,7 @@ void PCB_EDIT_FRAME::moveExact()
     m_canvas->MoveCursorToCrossHair();
 }
 
+
 void PCB_EDIT_FRAME::duplicateItems( bool aIncrement )
 {
     BOARD_ITEM* item = GetScreen()->GetCurItem();
@@ -1562,6 +1567,7 @@ void PCB_EDIT_FRAME::duplicateItems( bool aIncrement )
     PCB_BASE_EDIT_FRAME::duplicateItem( item, aIncrement );
 }
 
+
 void PCB_BASE_EDIT_FRAME::duplicateItem( BOARD_ITEM* aItem, bool aIncrement )
 {
     if( !aItem )
diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp
index 8c8a750..2fa1fa5 100644
--- a/pcbnew/hotkeys.cpp
+++ b/pcbnew/hotkeys.cpp
@@ -98,6 +98,7 @@ static EDA_HOTKEY HkSavefile( _HKI( "Save Board" ), HK_SAVE_BOARD, 'S' + GR_KB_C
 static EDA_HOTKEY HkSavefileAs( _HKI( "Save Board As" ), HK_SAVE_BOARD_AS, 'S' + GR_KB_CTRL + GR_KB_SHIFT );
 static EDA_HOTKEY HkLoadfile( _HKI( "Load Board" ), HK_LOAD_BOARD, 'L' + GR_KB_CTRL );
 static EDA_HOTKEY HkFindItem( _HKI( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
+static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION, '@', ID_ZOOM_SELECTION );
 static EDA_HOTKEY HkBackspace( _HKI( "Delete Track Segment" ), HK_BACK_SPACE, WXK_BACK );
 static EDA_HOTKEY HkAddNewTrack( _HKI( "Add New Track" ), HK_ADD_NEW_TRACK, 'X' );
 static EDA_HOTKEY HkAddThroughVia( _HKI( "Add Through Via" ), HK_ADD_THROUGH_VIA, 'V' );
@@ -229,7 +230,7 @@ static EDA_HOTKEY HkAddModule( _HKI( "Add Footprint" ), HK_ADD_MODULE, 'O' );
 EDA_HOTKEY* common_Hotkey_List[] =
 {
     &HkHelp,        &HkZoomIn,          &HkZoomOut,
-    &HkZoomRedraw,  &HkZoomCenter,      &HkZoomAuto,      &Hk3DViewer,
+    &HkZoomRedraw,  &HkZoomCenter,      &HkZoomAuto,      &HkZoomSelection, &Hk3DViewer,
     &HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin, &HkResetGridOrigin,
     &HkUndo,        &HkRedo,
     &HkMouseLeftClick,
diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp
index 2b61f08..4970cc0 100644
--- a/pcbnew/hotkeys_board_editor.cpp
+++ b/pcbnew/hotkeys_board_editor.cpp
@@ -239,6 +239,10 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
         evt_type = ID_POPUP_ZOOM_CENTER;
         break;
 
+    case HK_ZOOM_SELECTION:
+        evt_type = ID_ZOOM_SELECTION;
+        break;
+
     case HK_ADD_MODULE:
         evt_type = ID_PCB_MODULE_BUTT;
         break;
diff --git a/pcbnew/hotkeys_module_editor.cpp b/pcbnew/hotkeys_module_editor.cpp
index 48b0901..a7a7305 100644
--- a/pcbnew/hotkeys_module_editor.cpp
+++ b/pcbnew/hotkeys_module_editor.cpp
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2010-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -136,6 +136,11 @@ bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
         GetEventHandler()->ProcessEvent( cmd );
         break;
 
+    case HK_ZOOM_SELECTION:
+        cmd.SetId( ID_ZOOM_SELECTION );
+        GetEventHandler()->ProcessEvent( cmd );
+        break;
+
     case HK_UNDO:
     case HK_REDO:
         if( ItemFree && !blockActive )
diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp
index faa471a..5d73b13 100644
--- a/pcbnew/modedit.cpp
+++ b/pcbnew/modedit.cpp
@@ -1,7 +1,7 @@
 /*
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -946,6 +946,10 @@ void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent )
     case ID_NO_TOOL_SELECTED:
         break;
 
+    case ID_ZOOM_SELECTION:
+        SetToolID( id, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
+        break;
+
     case ID_MODEDIT_LINE_TOOL:
         SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
         break;
diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp
index 4e3f822..0de7921 100644
--- a/pcbnew/moduleframe.cpp
+++ b/pcbnew/moduleframe.cpp
@@ -4,7 +4,7 @@
  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@xxxxxxxxxxx>
  * Copyright (C) 2015 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -59,6 +59,7 @@
 #include <tool/tool_manager.h>
 #include <tool/tool_dispatcher.h>
 #include "tools/selection_tool.h"
+#include "tools/zoom_tool.h"
 #include "tools/edit_tool.h"
 #include "tools/drawing_tool.h"
 #include "tools/point_editor.h"
@@ -109,6 +110,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
 
     // Vertical tool bar button click event handler.
     EVT_TOOL( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
+    EVT_TOOL( ID_ZOOM_SELECTION, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
     EVT_TOOL_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
                     FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
 
@@ -185,6 +187,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
     EVT_UPDATE_UI( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
                    FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard )
     EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
+    EVT_UPDATE_UI( ID_ZOOM_SELECTION, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
 
     EVT_UPDATE_UI_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
                          FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
@@ -926,6 +929,7 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
     drawPanel->SetEventDispatcher( m_toolDispatcher );
 
     m_toolManager->RegisterTool( new SELECTION_TOOL );
+    m_toolManager->RegisterTool( new ZOOM_TOOL );
     m_toolManager->RegisterTool( new EDIT_TOOL );
     m_toolManager->RegisterTool( new DRAWING_TOOL );
     m_toolManager->RegisterTool( new POINT_EDITOR );
diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp
index ebbb288..fb18f67 100644
--- a/pcbnew/onleftclick.cpp
+++ b/pcbnew/onleftclick.cpp
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2007 Jean-Pierre Charras, jean-pierre.charras@xxxxxxxxxxxxxxxxx
  * Copyright (C) 2011 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -185,6 +185,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
     {
     case ID_MAIN_MENUBAR:
     case ID_NO_TOOL_SELECTED:
+    case ID_ZOOM_SELECTION:
         break;
 
     case ID_PCB_MUWAVE_TOOL_SELF_CMD:
diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp
index ea8b301..f5ed5d0 100644
--- a/pcbnew/onrightclick.cpp
+++ b/pcbnew/onrightclick.cpp
@@ -4,7 +4,7 @@
  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@xxxxxxxxxxx>
  * Copyright (C) 2007-2013 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -74,7 +74,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
         return true;
     }
 
-    if( GetToolId() != ID_NO_TOOL_SELECTED )
+    if( GetToolId() != ID_NO_TOOL_SELECTED && GetToolId() != ID_ZOOM_SELECTION )
     {
         if( item && item->GetFlags() )
         {
diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp
index 2ec99ba..685e08f 100644
--- a/pcbnew/pcbframe.cpp
+++ b/pcbnew/pcbframe.cpp
@@ -4,7 +4,7 @@
  * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@xxxxxxxxxxx>
  * Copyright (C) 2013-2016 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 2013-2016 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2013-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -247,6 +247,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
 
     // Vertical main toolbar:
     EVT_TOOL( ID_NO_TOOL_SELECTED, PCB_EDIT_FRAME::OnSelectTool )
+    EVT_TOOL( ID_ZOOM_SELECTION, PCB_EDIT_FRAME::OnSelectTool )
     EVT_TOOL_RANGE( ID_PCB_HIGHLIGHT_BUTT, ID_PCB_PLACE_GRID_COORD_BUTT,
                     PCB_EDIT_FRAME::OnSelectTool )
 
@@ -286,6 +287,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
     EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
                    PCB_EDIT_FRAME::OnUpdateShowMicrowaveToolbar )
     EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
+    EVT_UPDATE_UI( ID_ZOOM_SELECTION, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
     EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
     EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
                    PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth )
diff --git a/pcbnew/tool_modedit.cpp b/pcbnew/tool_modedit.cpp
index 5bebf53..842a555 100644
--- a/pcbnew/tool_modedit.cpp
+++ b/pcbnew/tool_modedit.cpp
@@ -4,7 +4,7 @@
  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@xxxxxxxxxxx>
  * Copyright (C) 2012 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -161,6 +161,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
     m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ),
                             wxEmptyString, wxITEM_CHECK );
 
+    m_drawToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ),
+                            _( "Zoom to selection" ), wxITEM_CHECK );
+
     m_drawToolBar->AddSeparator();
     m_drawToolBar->AddTool( ID_MODEDIT_PAD_TOOL, wxEmptyString, KiBitmap( pad_xpm ),
                             _( "Add pads" ), wxITEM_CHECK );
diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp
index 5a20c60..b65c355 100644
--- a/pcbnew/tool_pcb.cpp
+++ b/pcbnew/tool_pcb.cpp
@@ -4,7 +4,7 @@
  * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@xxxxxxxxxxxxxxx
  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@xxxxxxxxxxx>
  * Copyright (C) 2012=2015 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -425,6 +425,10 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
     // Set up toolbar
     m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ),
                             wxEmptyString, wxITEM_CHECK );
+
+    m_drawToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ),
+                            _( "Zoom to selection" ), wxITEM_CHECK );
+
     m_drawToolBar->AddSeparator();
 
     m_drawToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString, KiBitmap( net_highlight_xpm ),
diff --git a/pcbnew/tools/common_actions.cpp b/pcbnew/tools/common_actions.cpp
index ca057b3..011596b 100644
--- a/pcbnew/tools/common_actions.cpp
+++ b/pcbnew/tools/common_actions.cpp
@@ -2,6 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2013-2016 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
  * @author Maciej Suminski <maciej.suminski@xxxxxxx>
  *
  * This program is free software; you can redistribute it and/or
@@ -490,6 +491,10 @@ TOOL_ACTION COMMON_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
         AS_GLOBAL, 0,
         "", "", NULL, AF_ACTIVATE );
 
+TOOL_ACTION COMMON_ACTIONS::zoomTool( "pcbnew.Control.zoomTool",
+        AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_SELECTION ),
+        _( "Zoom to selection" ), "", NULL, AF_ACTIVATE );
+
 TOOL_ACTION COMMON_ACTIONS::pickerTool( "pcbnew.Picker", AS_GLOBAL, 0, "", "", NULL, AF_ACTIVATE );
 
 TOOL_ACTION COMMON_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
@@ -712,6 +717,9 @@ boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
     case ID_NO_TOOL_SELECTED:
         return COMMON_ACTIONS::selectionTool.MakeEvent();
 
+    case ID_ZOOM_SELECTION:
+        return COMMON_ACTIONS::zoomTool.MakeEvent();
+
     case ID_PCB_DELETE_ITEM_BUTT:
     case ID_MODEDIT_DELETE_TOOL:
         return COMMON_ACTIONS::deleteItemCursor.MakeEvent();
diff --git a/pcbnew/tools/common_actions.h b/pcbnew/tools/common_actions.h
index dfc88a1..dd2bb9f 100644
--- a/pcbnew/tools/common_actions.h
+++ b/pcbnew/tools/common_actions.h
@@ -2,6 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2013-2016 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
  * @author Maciej Suminski <maciej.suminski@xxxxxxx>
  *
  * This program is free software; you can redistribute it and/or
@@ -297,6 +298,7 @@ public:
 
     // Miscellaneous
     static TOOL_ACTION selectionTool;
+    static TOOL_ACTION zoomTool;
     static TOOL_ACTION pickerTool;
     static TOOL_ACTION resetCoords;
     static TOOL_ACTION switchCursor;
diff --git a/pcbnew/tools/tools_common.cpp b/pcbnew/tools/tools_common.cpp
index ee46245..d74a3df 100644
--- a/pcbnew/tools/tools_common.cpp
+++ b/pcbnew/tools/tools_common.cpp
@@ -2,6 +2,7 @@
  * This program source code file is part of KICAD, a free EDA CAD application.
  *
  * Copyright (C) 2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
  * @author Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
  *
  * This program is free software; you can redistribute it and/or
@@ -27,6 +28,7 @@
 #include <tool/tool_manager.h>
 
 #include <tools/selection_tool.h>
+#include <tools/zoom_tool.h>
 #include <tools/picker_tool.h>
 #include <tools/edit_tool.h>
 #include <tools/drawing_tool.h>
@@ -42,6 +44,7 @@
 void registerAllTools( TOOL_MANAGER *aToolManager )
 {
     aToolManager->RegisterTool( new SELECTION_TOOL );
+    aToolManager->RegisterTool( new ZOOM_TOOL );
     aToolManager->RegisterTool( new PICKER_TOOL );
     aToolManager->RegisterTool( new ROUTER_TOOL );
     aToolManager->RegisterTool( new LENGTH_TUNER_TOOL );
@@ -51,4 +54,4 @@ void registerAllTools( TOOL_MANAGER *aToolManager )
     aToolManager->RegisterTool( new PCBNEW_CONTROL );
     aToolManager->RegisterTool( new PCB_EDITOR_CONTROL );
     aToolManager->RegisterTool( new PLACEMENT_TOOL );
-}
\ No newline at end of file
+}
diff --git a/pcbnew/tools/zoom_tool.cpp b/pcbnew/tools/zoom_tool.cpp
new file mode 100644
index 0000000..9a3a082
--- /dev/null
+++ b/pcbnew/tools/zoom_tool.cpp
@@ -0,0 +1,132 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include <wxPcbStruct.h>
+#include <class_draw_panel_gal.h>
+#include <view/view_controls.h>
+#include <tool/tool_manager.h>
+
+#include "zoom_tool.h"
+#include "selection_area.h"
+#include "common_actions.h"
+
+
+ZOOM_TOOL::ZOOM_TOOL() :
+        TOOL_INTERACTIVE( "pcbnew.Control.zoomTool" )
+{
+    m_frame = NULL;
+}
+
+
+ZOOM_TOOL::~ZOOM_TOOL() {}
+
+
+void ZOOM_TOOL::Reset( RESET_REASON aReason )
+{
+    m_frame = getEditFrame<PCB_EDIT_FRAME>();
+}
+
+
+int ZOOM_TOOL::Main( const TOOL_EVENT& aEvent )
+{
+    m_frame->SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
+
+    while( auto evt = Wait() )
+    {
+        if( evt->IsCancel() || evt->IsActivate() )
+            break;
+
+        else if( evt->IsDrag( BUT_LEFT ) )
+        {
+            if( selectRegion() )
+                break;
+        }
+
+        else
+            m_toolMgr->PassEvent();
+    }
+
+    m_frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
+    return 0;
+}
+
+
+bool ZOOM_TOOL::selectRegion()
+{
+    bool cancelled = false;
+    auto view = getView();
+    auto canvas = m_frame->GetGalCanvas();
+    getViewControls()->SetAutoPan( true );
+
+    SELECTION_AREA area;
+    view->Add( &area );
+
+    while( auto evt = Wait() )
+    {
+        if( evt->IsCancel() || evt->IsActivate() )
+        {
+            cancelled = true;
+            break;
+        }
+
+        if( evt->IsDrag( BUT_LEFT ) )
+        {
+            area.SetOrigin( evt->DragOrigin() );
+            area.SetEnd( evt->Position() );
+            area.ViewSetVisible( true );
+            area.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
+        }
+
+        if( evt->IsMouseUp( BUT_LEFT ) )
+        {
+            area.ViewSetVisible( false );
+            auto selectionBox = area.ViewBBox();
+
+            VECTOR2D screenSize = view->ToWorld( canvas->GetClientSize(), false );
+
+            if( selectionBox.GetWidth() == 0 || selectionBox.GetHeight() == 0 )
+            {
+                break;
+            }
+            else
+            {
+                VECTOR2D vsize = selectionBox.GetSize();
+                double scale = view->GetScale() / std::max( fabs( vsize.x / screenSize.x ),
+                                                            fabs( vsize.y / screenSize.y ) );
+                view->SetScale( scale );
+                view->SetCenter( selectionBox.Centre() );
+
+                break;
+            }
+        }
+    }
+
+    area.ViewSetVisible( false );
+    view->Remove( &area );
+    getViewControls()->SetAutoPan( false );
+
+    return cancelled;
+}
+
+
+void ZOOM_TOOL::SetTransitions()
+{
+    Go( &ZOOM_TOOL::Main, COMMON_ACTIONS::zoomTool.MakeEvent() );
+}
diff --git a/pcbnew/tools/zoom_tool.h b/pcbnew/tools/zoom_tool.h
new file mode 100644
index 0000000..ca9842e
--- /dev/null
+++ b/pcbnew/tools/zoom_tool.h
@@ -0,0 +1,48 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _ZOOM_TOOL_H
+#define _ZOOM_TOOL_H
+
+#include <tool/tool_interactive.h>
+
+class PCB_EDIT_FRAME;
+
+
+class ZOOM_TOOL : public TOOL_INTERACTIVE
+{
+public:
+    ZOOM_TOOL();
+    ~ZOOM_TOOL();
+
+    /// @copydoc TOOL_BASE::Reset()
+    void Reset( RESET_REASON aReason );
+
+    /// Main loop
+    int Main( const TOOL_EVENT& aEvent );
+
+    /// @copydoc TOOL_BASE::SetTransitions()
+    void SetTransitions();
+
+private:
+    bool selectRegion();
+    PCB_EDIT_FRAME* m_frame;
+};
+
+#endif // _ZOOM_TOOL_H
-- 
2.8.3


Follow ups