Add zoom-to-selection tool
This commit is contained in:
parent
ce3ccec528
commit
8c01318141
|
@ -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;
|
||||
|
||||
if( aExplicitCommand == 0 )
|
||||
block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
|
||||
else
|
||||
block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
|
||||
|
||||
if( block->GetCommand() == 0 )
|
||||
return false;
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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 )
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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;
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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 );
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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 );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -116,6 +116,7 @@ enum main_id
|
|||
|
||||
ID_EDIT,
|
||||
ID_NO_TOOL_SELECTED,
|
||||
ID_ZOOM_SELECTION,
|
||||
ID_SEL_BG_COLOR,
|
||||
|
||||
ID_REPEAT_BUTT,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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 );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2007 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2007-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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() )
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2013-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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 )
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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 );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012=2015 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* 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 ),
|
||||
|
|
|
@ -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@cern.ch>
|
||||
*
|
||||
* 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();
|
||||
|
|
|
@ -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@cern.ch>
|
||||
*
|
||||
* 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;
|
||||
|
|
|
@ -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@cern.ch>
|
||||
*
|
||||
* 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 );
|
||||
|
|
|
@ -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() );
|
||||
}
|
|
@ -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
|
Loading…
Reference in New Issue