kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #27987
Re: [PATCH] Refactor COMMON_ACTIONS into a base and derived class
This time with the patch attached :)
On Mon, Feb 20, 2017 at 1:12 PM, Jon Evans <jon@xxxxxxxxxxxxx> wrote:
> Hi Orson,
>
> I've attached a follow-up patch that moves all TOOL_ACTIONs out of
> pcb_actions.cpp and creates a COMMON_TOOLS class for storing
> cross-application tools. I was not able to move all zoom/grid tools
> because of dependencies on pcbnew that need to be resolved -- I did not
> want to take on the refactoring needed to fix this in this patch, but I
> plan on looking at it in the near future.
>
> Best,
> Jon
>
> On Mon, Feb 20, 2017 at 11:13 AM, Maciej Sumiński <maciej.suminski@xxxxxxx
> > wrote:
>
>> Thank you John, we really appreciate your efforts.
>>
>> Regards,
>> Orson
>>
>> On 02/20/2017 03:50 PM, Jon Evans wrote:
>> > Hi Orson,
>> >
>> > I can definitely pull the pcb_actions into their respective files, I
>> will
>> > do that and send another patch.
>> >
>> > Best,
>> > Jon
>> >
>> > On Mon, Feb 20, 2017 at 4:25 AM, John Beard <john.j.beard@xxxxxxxxx>
>> wrote:
>> >
>> >> HI Orson,
>> >>
>> >> I think that sounds like a sensible idea. Having a huge central list
>> >> of actions has a bit of a code smell for me, as it's a big header than
>> >> then needs including everywhere. Smaller lists that are included along
>> >> with their tool's headers (if needed), or even actions that are
>> >> totally hidden in implementations for when the action only works
>> >> during an interactive tool feels much nicer.
>> >>
>> >> The file now called common_actions.cpp (maybe pcb_actions.cpp or
>> >> something in future) would need to include most of these headers so it
>> >> can still map legacy event IDs, but that's how it should be - a file
>> >> that needs lots, includes lots.
>> >>
>> >> Cheers,
>> >>
>> >> John
>> >>
>> >>
>> >> On Mon, Feb 20, 2017 at 4:58 PM, Maciej Sumiński
>> >> <maciej.suminski@xxxxxxx> wrote:
>> >>> Hi Jon,
>> >>>
>> >>> I see the point of your patch, as COMMON_ACTIONS are now a bit
>> misused.
>> >>> They should not keep majority of the TOOL_ACTIONs, as many of them are
>> >>> pcbnew specific, but there are still actions that will be shared with
>> >>> other applications (e.g. zoom & grid control, move/rotate/flip).
>> >>>
>> >>> For some time I was also wondering whether it would not be better to
>> >>> move the actions to their corresponding tools, as is done e.g. in
>> >>> pcbnew/router/router_tool.cpp (ACT_* objects), and leave only truly
>> >>> generic actions in {COMMON,PCB}_ACTIONS.
>> >>>
>> >>> What do you think about splitting the current set to PCB_ACTIONS and
>> >>> COMMON_ACTIONS, perhaps moving some of them to the tools source files?
>> >>>
>> >>> Regards,
>> >>> Orson
>> >>>
>> >>> On 02/17/2017 04:56 AM, Jon Evans wrote:
>> >>>> Hi all,
>> >>>>
>> >>>> More preparation for GerbView GAL port: this patch pulls a virtual
>> >> ACTIONS
>> >>>> class out of pcbnew and renames the COMMON_ACTIONS to PCB_ACTIONS for
>> >>>> clarity.
>> >>>>
>> >>>> Best,
>> >>>> Jon
>> >>>>
>> >>>>
>> >>>>
>> >>>> _______________________________________________
>> >>>> Mailing list: https://launchpad.net/~kicad-developers
>> >>>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> >>>> Unsubscribe : https://launchpad.net/~kicad-developers
>> >>>> More help : https://help.launchpad.net/ListHelp
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> Mailing list: https://launchpad.net/~kicad-developers
>> >>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> >>> Unsubscribe : https://launchpad.net/~kicad-developers
>> >>> More help : https://help.launchpad.net/ListHelp
>> >>>
>> >>
>> >> _______________________________________________
>> >> Mailing list: https://launchpad.net/~kicad-developers
>> >> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> >> Unsubscribe : https://launchpad.net/~kicad-developers
>> >> More help : https://help.launchpad.net/ListHelp
>> >>
>> >
>>
>>
>>
>
From 1466f391414bb0d4a6139a682307182ced1baff9 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Mon, 20 Feb 2017 13:10:20 -0500
Subject: [PATCH] Move TOOL_ACTIONs to their corresponding tools; create
COMMON_TOOLS
Some grid/zoom tools are left in PCBNEW_CONTROL because they currently
depend on Pcbnew-specific class members. Once refactoring is done to
make it possible to use all zoom and grid controls outside of pcbnew,
these last tools can be moved to common to match their ACTIONs.
---
common/CMakeLists.txt | 2 +
common/tool/actions.cpp | 63 ++++
common/tool/common_tools.cpp | 150 ++++++++
include/tool/actions.h | 18 +
include/tool/common_tools.h | 68 ++++
pcbnew/dialogs/dialog_set_grid.cpp | 2 +-
pcbnew/moduleframe.cpp | 2 +-
pcbnew/modview_frame.cpp | 2 +-
pcbnew/router/router_tool.cpp | 37 ++
pcbnew/tools/drawing_tool.cpp | 61 ++++
pcbnew/tools/edit_tool.cpp | 87 +++++
pcbnew/tools/grid_menu.cpp | 2 +-
pcbnew/tools/module_editor_tools.cpp | 27 ++
pcbnew/tools/pad_tool.cpp | 20 ++
pcbnew/tools/pcb_actions.cpp | 644 +----------------------------------
pcbnew/tools/pcb_actions.h | 18 +-
pcbnew/tools/pcb_editor_control.cpp | 91 +++++
pcbnew/tools/pcbnew_control.cpp | 264 +++++++++-----
pcbnew/tools/pcbnew_control.h | 6 -
pcbnew/tools/picker_tool.cpp | 3 +
pcbnew/tools/placement_tool.cpp | 32 ++
pcbnew/tools/point_editor.cpp | 10 +
pcbnew/tools/selection_tool.cpp | 46 +++
pcbnew/tools/tool_menu.cpp | 8 +-
pcbnew/tools/tools_common.cpp | 2 +
pcbnew/tools/zoom_menu.cpp | 2 +-
26 files changed, 902 insertions(+), 765 deletions(-)
create mode 100644 common/tool/actions.cpp
create mode 100644 common/tool/common_tools.cpp
create mode 100644 include/tool/common_tools.h
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 4fce3a5..9c51ecc 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -294,6 +294,8 @@ set( COMMON_SRCS
tool/tool_interactive.cpp
tool/action_manager.cpp
tool/context_menu.cpp
+ tool/actions.cpp
+ tool/common_tools.cpp
geometry/seg.cpp
geometry/shape.cpp
diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp
new file mode 100644
index 0000000..ad7cbfb
--- /dev/null
+++ b/common/tool/actions.cpp
@@ -0,0 +1,63 @@
+#include <tool/actions.h>
+#include <hotkeys.h>
+#include <bitmaps.h>
+
+// These members are static in class ACTIONS: Build them here:
+
+// View Controls
+TOOL_ACTION ACTIONS::zoomIn( "common.Control.zoomIn",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_IN ),
+ _( "Zoom In" ), "", zoom_in_xpm );
+
+TOOL_ACTION ACTIONS::zoomOut( "common.Control.zoomOut",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_OUT ),
+ _( "Zoom Out" ), "", zoom_out_xpm );
+
+TOOL_ACTION ACTIONS::zoomInCenter( "common.Control.zoomInCenter",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION ACTIONS::zoomOutCenter( "common.Control.zoomOutCenter",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION ACTIONS::zoomCenter( "common.Control.zoomCenter",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_CENTER ),
+ _( "Center" ), "", zoom_center_on_screen_xpm );
+
+TOOL_ACTION ACTIONS::zoomFitScreen( "common.Control.zoomFitScreen",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_AUTO ),
+ _( "Zoom Auto" ), "", zoom_fit_in_page_xpm );
+
+TOOL_ACTION ACTIONS::zoomPreset( "common.Control.zoomPreset",
+ AS_GLOBAL, 0,
+ "", "" );
+
+// Grid control
+TOOL_ACTION ACTIONS::gridFast1( "common.Control.gridFast1",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_FASTGRID1 ),
+ "", "" );
+
+TOOL_ACTION ACTIONS::gridFast2( "common.Control.gridFast2",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_FASTGRID2 ),
+ "", "" );
+
+TOOL_ACTION ACTIONS::gridNext( "common.Control.gridNext",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_NEXT ),
+ "", "" );
+
+TOOL_ACTION ACTIONS::gridPrev( "common.Control.gridPrev",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_PREVIOUS ),
+ "", "" );
+
+TOOL_ACTION ACTIONS::gridSetOrigin( "common.Control.gridSetOrigin",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SET_GRID_ORIGIN ),
+ "", "" );
+
+TOOL_ACTION ACTIONS::gridResetOrigin( "common.Control.gridResetOrigin",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_GRID_ORIGIN ),
+ "", "" );
+
+TOOL_ACTION ACTIONS::gridPreset( "common.Control.gridPreset",
+ AS_GLOBAL, 0,
+ "", "" );
diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp
new file mode 100644
index 0000000..b5b7b07
--- /dev/null
+++ b/common/tool/common_tools.cpp
@@ -0,0 +1,150 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2014-2016 CERN
+ * @author Maciej Suminski <maciej.suminski@xxxxxxx>
+ *
+ * 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 2
+ * 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, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <tool/actions.h>
+#include <draw_frame.h>
+#include <class_draw_panel_gal.h>
+#include <view/view.h>
+#include <view/view_controls.h>
+#include <gal/graphics_abstraction_layer.h>
+#include <class_base_screen.h>
+
+#include <tool/common_tools.h>
+
+COMMON_TOOLS::COMMON_TOOLS() :
+ TOOL_INTERACTIVE( "common.Control" ), m_frame( NULL )
+{
+}
+
+
+COMMON_TOOLS::~COMMON_TOOLS()
+{
+}
+
+
+void COMMON_TOOLS::Reset( RESET_REASON aReason )
+{
+ m_frame = getEditFrame<EDA_DRAW_FRAME>();
+}
+
+
+int COMMON_TOOLS::ZoomInOut( const TOOL_EVENT& aEvent )
+{
+ KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
+ KIGFX::VIEW_CONTROLS* ctls = getViewControls();
+ double zoomScale = 1.0;
+
+ if( aEvent.IsAction( &ACTIONS::zoomIn ) )
+ zoomScale = 1.3;
+ else if( aEvent.IsAction( &ACTIONS::zoomOut ) )
+ zoomScale = 0.7;
+
+ view->SetScale( view->GetScale() * zoomScale, getViewControls()->GetCursorPosition() );
+
+ if( ctls->IsCursorWarpingEnabled() )
+ ctls->CenterOnCursor();
+
+ return 0;
+}
+
+
+int COMMON_TOOLS::ZoomInOutCenter( const TOOL_EVENT& aEvent )
+{
+ KIGFX::VIEW* view = getView();
+ double zoomScale = 1.0;
+
+ if( aEvent.IsAction( &ACTIONS::zoomInCenter ) )
+ zoomScale = 1.3;
+ else if( aEvent.IsAction( &ACTIONS::zoomOutCenter ) )
+ zoomScale = 0.7;
+
+ view->SetScale( view->GetScale() * zoomScale );
+
+ return 0;
+}
+
+
+int COMMON_TOOLS::ZoomCenter( const TOOL_EVENT& aEvent )
+{
+ KIGFX::VIEW_CONTROLS* ctls = getViewControls();
+
+ if( ctls->IsCursorWarpingEnabled() )
+ ctls->CenterOnCursor();
+ else
+ getView()->SetCenter( getViewControls()->GetCursorPosition() );
+
+ return 0;
+}
+
+
+// Grid control
+int COMMON_TOOLS::GridNext( const TOOL_EVENT& aEvent )
+{
+ m_frame->SetNextGrid();
+ updateGrid();
+
+ return 0;
+}
+
+
+int COMMON_TOOLS::GridPrev( const TOOL_EVENT& aEvent )
+{
+ m_frame->SetPrevGrid();
+ updateGrid();
+
+ return 0;
+}
+
+
+int COMMON_TOOLS::GridPreset( const TOOL_EVENT& aEvent )
+{
+ long idx = aEvent.Parameter<intptr_t>();
+
+ m_frame->SetPresetGrid( idx );
+ updateGrid();
+
+ return 0;
+}
+
+
+void COMMON_TOOLS::SetTransitions()
+{
+ Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
+ Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomOut.MakeEvent() );
+ Go( &COMMON_TOOLS::ZoomInOutCenter, ACTIONS::zoomInCenter.MakeEvent() );
+ Go( &COMMON_TOOLS::ZoomInOutCenter, ACTIONS::zoomOutCenter.MakeEvent() );
+ Go( &COMMON_TOOLS::ZoomCenter, ACTIONS::zoomCenter.MakeEvent() );
+
+ Go( &COMMON_TOOLS::GridNext, ACTIONS::gridNext.MakeEvent() );
+ Go( &COMMON_TOOLS::GridPrev, ACTIONS::gridPrev.MakeEvent() );
+ Go( &COMMON_TOOLS::GridPreset, ACTIONS::gridPreset.MakeEvent() );
+}
+
+
+void COMMON_TOOLS::updateGrid()
+{
+ BASE_SCREEN* screen = m_frame->GetScreen();
+ getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
+ getView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
+}
diff --git a/include/tool/actions.h b/include/tool/actions.h
index b9ceb4d..8747ea1 100644
--- a/include/tool/actions.h
+++ b/include/tool/actions.h
@@ -44,6 +44,24 @@ public:
virtual ~ACTIONS() {};
+ // View controls
+ static TOOL_ACTION zoomIn;
+ static TOOL_ACTION zoomOut;
+ static TOOL_ACTION zoomInCenter;
+ static TOOL_ACTION zoomOutCenter;
+ static TOOL_ACTION zoomCenter;
+ static TOOL_ACTION zoomFitScreen;
+ static TOOL_ACTION zoomPreset;
+
+ // Grid control
+ static TOOL_ACTION gridFast1;
+ static TOOL_ACTION gridFast2;
+ static TOOL_ACTION gridNext;
+ static TOOL_ACTION gridPrev;
+ static TOOL_ACTION gridSetOrigin;
+ static TOOL_ACTION gridResetOrigin;
+ static TOOL_ACTION gridPreset;
+
/**
* Function TranslateLegacyId()
* Translates legacy tool ids to the corresponding TOOL_ACTION name.
diff --git a/include/tool/common_tools.h b/include/tool/common_tools.h
new file mode 100644
index 0000000..c37d0cd
--- /dev/null
+++ b/include/tool/common_tools.h
@@ -0,0 +1,68 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2014-2016 CERN
+ * @author Maciej Suminski <maciej.suminski@xxxxxxx>
+ *
+ * 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 2
+ * 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, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _COMMON_TOOLS_H
+#define _COMMON_TOOLS_H
+
+#include <tool/tool_interactive.h>
+
+class EDA_DRAW_FRAME;
+
+/**
+ * Class COMMON_TOOLS
+ *
+ * Handles actions that are shared between different applications
+ */
+
+class COMMON_TOOLS : public TOOL_INTERACTIVE
+{
+public:
+ COMMON_TOOLS();
+ ~COMMON_TOOLS();
+
+ /// @copydoc TOOL_BASE::Reset()
+ void Reset( RESET_REASON aReason ) override;
+
+ // View controls
+ int ZoomInOut( const TOOL_EVENT& aEvent );
+ int ZoomInOutCenter( const TOOL_EVENT& aEvent );
+ int ZoomCenter( const TOOL_EVENT& aEvent );
+
+ // Grid control
+ int GridNext( const TOOL_EVENT& aEvent );
+ int GridPrev( const TOOL_EVENT& aEvent );
+ int GridPreset( const TOOL_EVENT& aEvent );
+
+ ///> Sets up handlers for various events.
+ void SetTransitions() override;
+
+private:
+ ///> Pointer to the currently used edit frame.
+ EDA_DRAW_FRAME* m_frame;
+
+ ///> Applies the legacy canvas grid settings for GAL.
+ void updateGrid();
+};
+
+#endif
diff --git a/pcbnew/dialogs/dialog_set_grid.cpp b/pcbnew/dialogs/dialog_set_grid.cpp
index e348b83..e7ec2fc 100644
--- a/pcbnew/dialogs/dialog_set_grid.cpp
+++ b/pcbnew/dialogs/dialog_set_grid.cpp
@@ -154,7 +154,7 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
mgr->RunAction( "common.Control.gridPreset", true,
screen->GetGridCmdId() - ID_POPUP_GRID_LEVEL_1000 );
- TOOL_EVENT gridOriginUpdate = PCB_ACTIONS::gridSetOrigin.MakeEvent();
+ TOOL_EVENT gridOriginUpdate = ACTIONS::gridSetOrigin.MakeEvent();
gridOriginUpdate.SetParameter( new VECTOR2D( gridOrigin ) );
mgr->ProcessEvent( gridOriginUpdate );
}
diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp
index c06d50b..f5ebcd6 100644
--- a/pcbnew/moduleframe.cpp
+++ b/pcbnew/moduleframe.cpp
@@ -807,7 +807,7 @@ void FOOTPRINT_EDIT_FRAME::updateView()
{
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() );
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
- m_toolManager->RunAction( PCB_ACTIONS::zoomFitScreen, true );
+ m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
}
diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp
index 889d9a9..8403344 100644
--- a/pcbnew/modview_frame.cpp
+++ b/pcbnew/modview_frame.cpp
@@ -872,7 +872,7 @@ void FOOTPRINT_VIEWER_FRAME::updateView()
{
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() );
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
- m_toolManager->RunAction( PCB_ACTIONS::zoomFitScreen, true );
+ m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
}
}
diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp
index 186a950..198b8e7 100644
--- a/pcbnew/router/router_tool.cpp
+++ b/pcbnew/router/router_tool.cpp
@@ -61,6 +61,43 @@ using namespace std::placeholders;
using namespace KIGFX;
using boost::optional;
+TOOL_ACTION PCB_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleTrack",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_TRACK ),
+ _( "Interactive Router (Single Tracks)" ),
+ _( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffPair",
+ AS_GLOBAL, '6',
+ _( "Interactive Router (Differential Pairs)" ),
+ _( "Run push & shove router (differential pairs)" ), ps_diff_pair_xpm, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::routerActivateSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",
+ AS_GLOBAL, 0,
+ _( "Interactive Router Settings" ),
+ _( "Open Interactive Router settings" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRouter.DpDimensionsDialog",
+ AS_GLOBAL, 0,
+ _( "Differential Pair Dimension settings" ),
+ _( "Open Differential Pair Dimension settings" ), ps_diff_pair_gap_xpm, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack",
+ AS_GLOBAL, '7',
+ _( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
+ AS_GLOBAL, '8',
+ _( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
+ AS_GLOBAL, '9',
+ _( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DRAG_TRACK_KEEP_SLOPE ),
+ _( "Drag Track/Via" ), _( "Drags tracks and vias without breaking connections" ),
+ drag_track_segment_xpm );
+
static const TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack", AS_CONTEXT,
TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_TRACK ),
_( "New Track" ), _( "Starts laying a new track." ), add_tracks_xpm );
diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp
index 7399e50..90776c6 100644
--- a/pcbnew/tools/drawing_tool.cpp
+++ b/pcbnew/tools/drawing_tool.cpp
@@ -44,6 +44,7 @@
#include <ratsnest_data.h>
#include <board_commit.h>
#include <scoped_set_reset.h>
+#include <hotkeys.h>
#include <class_board.h>
#include <class_edge_mod.h>
@@ -57,6 +58,66 @@
using SCOPED_DRAW_MODE = SCOPED_SET_RESET<DRAWING_TOOL::MODE>;
+// Drawing tool actions
+TOOL_ACTION PCB_ACTIONS::drawLine( "pcbnew.InteractiveDrawing.line",
+ AS_GLOBAL, 0,
+ _( "Draw Line" ), _( "Draw a line" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::drawCircle( "pcbnew.InteractiveDrawing.circle",
+ AS_GLOBAL, 0,
+ _( "Draw Circle" ), _( "Draw a circle" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::drawArc( "pcbnew.InteractiveDrawing.arc",
+ AS_GLOBAL, 0,
+ _( "Draw Arc" ), _( "Draw an arc" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::placeText( "pcbnew.InteractiveDrawing.text",
+ AS_GLOBAL, 0,
+ _( "Add Text" ), _( "Add a text" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::drawDimension( "pcbnew.InteractiveDrawing.dimension",
+ AS_GLOBAL, 0,
+ _( "Add Dimension" ), _( "Add a dimension" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::drawZone( "pcbnew.InteractiveDrawing.zone",
+ AS_GLOBAL, 0,
+ _( "Add Filled Zone" ), _( "Add a filled zone" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::drawKeepout( "pcbnew.InteractiveDrawing.keepout",
+ AS_GLOBAL, 0,
+ _( "Add Keepout Area" ), _( "Add a keepout area" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::drawZoneCutout( "pcbnew.InteractiveDrawing.zoneCutout",
+ AS_GLOBAL, 0,
+ _( "Add a Zone Cutout" ), _( "Add a cutout area of an existing zone" ),
+ add_zone_cutout_xpm, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::drawSimilarZone( "pcbnew.InteractiveDrawing.similarZone",
+ AS_GLOBAL, 0,
+ _( "Add a Similar Zone" ), _( "Add a zone with the same settings as an existing zone" ),
+ add_zone_xpm, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::placeDXF( "pcbnew.InteractiveDrawing.placeDXF",
+ AS_GLOBAL, 0,
+ "Place DXF", "", NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::setAnchor( "pcbnew.InteractiveDrawing.setAnchor",
+ AS_GLOBAL, 0,
+ _( "Place the Footprint Anchor" ), _( "Place the footprint anchor" ),
+ NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::incWidth( "pcbnew.InteractiveDrawing.incWidth",
+ AS_CONTEXT, '+',
+ _( "Increase Line Width" ), _( "Increase the line width" ) );
+
+TOOL_ACTION PCB_ACTIONS::decWidth( "pcbnew.InteractiveDrawing.decWidth",
+ AS_CONTEXT, '-',
+ _( "Decrease Line Width" ), _( "Decrease the line width" ) );
+
+TOOL_ACTION PCB_ACTIONS::arcPosture( "pcbnew.InteractiveDrawing.arcPosture",
+ AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_POSTURE ),
+ _( "Switch Arc Posture" ), _( "Switch the arc posture" ) );
+
DRAWING_TOOL::DRAWING_TOOL() :
PCB_TOOL( "pcbnew.InteractiveDrawing" ),
m_view( nullptr ), m_controls( nullptr ),
diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp
index c79b33a..eb6b533 100644
--- a/pcbnew/tools/edit_tool.cpp
+++ b/pcbnew/tools/edit_tool.cpp
@@ -42,6 +42,7 @@
#include <gal/graphics_abstraction_layer.h>
#include <ratsnest_data.h>
#include <confirm.h>
+#include <hotkeys.h>
#include <cassert>
#include <functional>
@@ -62,6 +63,92 @@ using namespace std::placeholders;
#include <board_commit.h>
+// Edit tool actions
+TOOL_ACTION PCB_ACTIONS::editFootprintInFpEditor( "pcbnew.InteractiveEdit.editFootprintInFpEditor",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_MODULE_WITH_MODEDIT ),
+ _( "Open in Footprint Editor" ),
+ _( "Opens the selected footprint in the Footprint Editor" ),
+ module_editor_xpm );
+
+TOOL_ACTION PCB_ACTIONS::copyPadToSettings( "pcbnew.InteractiveEdit.copyPadToSettings",
+ AS_GLOBAL, 0,
+ _( "Copy Pad Settings to Current Settings" ),
+ _( "Copies the properties of selected pad to the current template pad settings." ) );
+
+TOOL_ACTION PCB_ACTIONS::copySettingsToPads( "pcbnew.InteractiveEdit.copySettingsToPads",
+ AS_GLOBAL, 0,
+ _( "Copy Current Settings to Pads" ),
+ _( "Copies the current template pad settings to the selected pad(s)." ) );
+
+TOOL_ACTION PCB_ACTIONS::globalEditPads( "pcbnew.InteractiveEdit.globalPadEdit",
+ AS_GLOBAL, 0,
+ _( "Global Pad Edition" ),
+ _( "Changes pad properties globally." ), push_pad_settings_xpm );
+
+TOOL_ACTION PCB_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_ITEM ),
+ _( "Move" ), _( "Moves the selected item(s)" ), move_xpm, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::duplicate( "pcbnew.InteractiveEdit.duplicate",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE_ITEM ),
+ _( "Duplicate" ), _( "Duplicates the selected item(s)" ), duplicate_module_xpm );
+
+TOOL_ACTION PCB_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE_ITEM_AND_INCREMENT ),
+ _( "Duplicate" ), _( "Duplicates the selected item(s), incrementing pad numbers" ) );
+
+TOOL_ACTION PCB_ACTIONS::moveExact( "pcbnew.InteractiveEdit.moveExact",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_ITEM_EXACT ),
+ _( "Move Exactly..." ), _( "Moves the selected item(s) by an exact amount" ),
+ move_module_xpm );
+
+TOOL_ACTION PCB_ACTIONS::createArray( "pcbnew.InteractiveEdit.createArray",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CREATE_ARRAY ),
+ _( "Create Array" ), _( "Create array" ), array_module_xpm, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::rotateCw( "pcbnew.InteractiveEdit.rotateCw",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROTATE_ITEM ),
+ _( "Rotate Clockwise" ), _( "Rotates selected item(s) clockwise" ),
+ rotate_cw_xpm, AF_NONE, (void*) 1 );
+
+TOOL_ACTION PCB_ACTIONS::rotateCcw( "pcbnew.InteractiveEdit.rotateCcw",
+ AS_GLOBAL, MD_SHIFT + 'R',
+ _( "Rotate Counter-clockwise" ), _( "Rotates selected item(s) counter-clockwise" ),
+ rotate_ccw_xpm, AF_NONE, (void*) -1 );
+
+TOOL_ACTION PCB_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FLIP_ITEM ),
+ _( "Flip" ), _( "Flips selected item(s)" ), swap_layer_xpm );
+
+TOOL_ACTION PCB_ACTIONS::mirror( "pcbnew.InteractiveEdit.mirror",
+ AS_GLOBAL, 0,
+ _( "Mirror" ), _( "Mirrors selected item" ), mirror_h_xpm );
+
+TOOL_ACTION PCB_ACTIONS::remove( "pcbnew.InteractiveEdit.remove",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BACK_SPACE ),
+ _( "Remove" ), _( "Deletes selected item(s)" ), delete_xpm,
+ AF_NONE, (void*) REMOVE_FLAGS::NORMAL );
+
+TOOL_ACTION PCB_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
+ _( "Remove (Alternative)" ), _( "Deletes selected item(s)" ), delete_xpm,
+ AF_NONE, (void*) REMOVE_FLAGS::ALT );
+
+TOOL_ACTION PCB_ACTIONS::exchangeFootprints( "pcbnew.InteractiveEdit.ExchangeFootprints",
+ AS_GLOBAL, 0,
+ _( "Exchange Footprint(s)" ), _( "Change the footprint used for modules" ),
+ import_module_xpm );
+
+
+TOOL_ACTION PCB_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_ITEM ),
+ _( "Properties..." ), _( "Displays item properties dialog" ), editor_xpm );
+
+TOOL_ACTION PCB_ACTIONS::editModifiedSelection( "pcbnew.InteractiveEdit.ModifiedSelection",
+ AS_GLOBAL, 0,
+ "", "" );
+
+
EDIT_TOOL::EDIT_TOOL() :
PCB_TOOL( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ),
m_dragging( false )
diff --git a/pcbnew/tools/grid_menu.cpp b/pcbnew/tools/grid_menu.cpp
index a530a6a..549d5c8 100644
--- a/pcbnew/tools/grid_menu.cpp
+++ b/pcbnew/tools/grid_menu.cpp
@@ -52,7 +52,7 @@ GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) : m_parent( aParent )
OPT_TOOL_EVENT GRID_MENU::eventHandler( const wxMenuEvent& aEvent )
{
- OPT_TOOL_EVENT event( PCB_ACTIONS::gridPreset.MakeEvent() );
+ OPT_TOOL_EVENT event( ACTIONS::gridPreset.MakeEvent() );
intptr_t idx = aEvent.GetId() - ID_POPUP_GRID_SELECT - 1;
event->SetParameter( idx );
diff --git a/pcbnew/tools/module_editor_tools.cpp b/pcbnew/tools/module_editor_tools.cpp
index 772c464..dd59401 100644
--- a/pcbnew/tools/module_editor_tools.cpp
+++ b/pcbnew/tools/module_editor_tools.cpp
@@ -38,6 +38,7 @@
#include <collectors.h>
#include <confirm.h>
#include <dialogs/dialog_enum_pads.h>
+#include <hotkeys.h>
#include <wxPcbStruct.h>
#include <class_board.h>
@@ -51,6 +52,32 @@
using namespace std::placeholders;
#include <wx/defs.h>
+// Module editor tools
+TOOL_ACTION PCB_ACTIONS::placePad( "pcbnew.ModuleEditor.placePad",
+ AS_GLOBAL, 0,
+ _( "Add Pad" ), _( "Add a pad" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::enumeratePads( "pcbnew.ModuleEditor.enumeratePads",
+ AS_GLOBAL, 0,
+ _( "Enumerate Pads" ), _( "Enumerate pads" ), pad_enumerate_xpm, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::copyItems( "pcbnew.ModuleEditor.copyItems",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_COPY_ITEM ),
+ _( "Copy" ), _( "Copy items" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::pasteItems( "pcbnew.ModuleEditor.pasteItems",
+ AS_GLOBAL, MD_CTRL + int( 'V' ),
+ _( "Paste" ), _( "Paste items" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::moduleEdgeOutlines( "pcbnew.ModuleEditor.graphicOutlines",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::moduleTextOutlines( "pcbnew.ModuleEditor.textOutlines",
+ AS_GLOBAL, 0,
+ "", "" );
+
+
MODULE_EDITOR_TOOLS::MODULE_EDITOR_TOOLS() :
TOOL_INTERACTIVE( "pcbnew.ModuleEditor" ), m_view( NULL ), m_controls( NULL ),
m_board( NULL ), m_frame( NULL )
diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp
index c8176f0..8d23cf5 100644
--- a/pcbnew/tools/pad_tool.cpp
+++ b/pcbnew/tools/pad_tool.cpp
@@ -41,6 +41,26 @@
#include "selection_conditions.h"
#include "edit_tool.h"
+// Pad tools
+TOOL_ACTION PCB_ACTIONS::copyPadSettings(
+ "pcbnew.PadTool.CopyPadSettings",
+ AS_GLOBAL, 0,
+ _( "Copy Pad Settings" ), _( "Copy current pad's settings to the board design settings" ),
+ copy_pad_settings_xpm );
+
+TOOL_ACTION PCB_ACTIONS::applyPadSettings(
+ "pcbnew.PadTool.ApplyPadSettings",
+ AS_GLOBAL, 0,
+ _( "Apply Pad Settings" ), _( "Copy the board design settings pad properties to the current pad" ),
+ apply_pad_settings_xpm );
+
+TOOL_ACTION PCB_ACTIONS::pushPadSettings(
+ "pcbnew.PadTool.PushPadSettings",
+ AS_GLOBAL, 0,
+ _( "Push Pad Settings" ), _( "Copy the current pad settings to other pads" ),
+ push_pad_settings_xpm );
+
+
class PAD_CONTEXT_MENU : public CONTEXT_MENU
{
public:
diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp
index 1bf5ab3..a4fb330 100644
--- a/pcbnew/tools/pcb_actions.cpp
+++ b/pcbnew/tools/pcb_actions.cpp
@@ -24,643 +24,7 @@
*/
#include "pcb_actions.h"
-#include <tool/action_manager.h>
#include <pcbnew_id.h>
-#include <layers_id_colors_and_visibility.h>
-#include <bitmaps.h>
-#include <wx/defs.h>
-#include <hotkeys.h>
-
-// These members are static in class PCB_ACTIONS: Build them here:
-
-// Selection tool actions
-TOOL_ACTION PCB_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
- AS_GLOBAL, 0,
- "", "", NULL, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
-
-TOOL_ACTION PCB_ACTIONS::selectionCursor( "pcbnew.InteractiveSelection.Cursor",
- AS_GLOBAL, 0,
- "", "" ); // No description, it is not supposed to be shown anywhere
-
-TOOL_ACTION PCB_ACTIONS::selectItem( "pcbnew.InteractiveSelection.SelectItem",
- AS_GLOBAL, 0,
- "", "" ); // No description, it is not supposed to be shown anywhere
-
-TOOL_ACTION PCB_ACTIONS::unselectItem( "pcbnew.InteractiveSelection.UnselectItem",
- AS_GLOBAL, 0,
- "", "" ); // No description, it is not supposed to be shown anywhere
-
-TOOL_ACTION PCB_ACTIONS::selectionClear( "pcbnew.InteractiveSelection.Clear",
- AS_GLOBAL, 0,
- "", "" ); // No description, it is not supposed to be shown anywhere
-
-TOOL_ACTION PCB_ACTIONS::selectConnection( "pcbnew.InteractiveSelection.SelectConnection",
- AS_GLOBAL, 'U',
- _( "Trivial Connection" ), _( "Selects a connection between two junctions." ) );
-
-TOOL_ACTION PCB_ACTIONS::selectCopper( "pcbnew.InteractiveSelection.SelectCopper",
- AS_GLOBAL, 'I',
- _( "Copper Connection" ), _( "Selects whole copper connection." ) );
-
-TOOL_ACTION PCB_ACTIONS::selectNet( "pcbnew.InteractiveSelection.SelectNet",
- AS_GLOBAL, 0,
- _( "Whole Net" ), _( "Selects all tracks & vias belonging to the same net." ) );
-
-TOOL_ACTION PCB_ACTIONS::selectSameSheet( "pcbnew.InteractiveSelection.SelectSameSheet",
- AS_GLOBAL, 'P',
- _( "Same Sheet" ), _( "Selects all modules and tracks in the same schematic sheet" ) );
-
-TOOL_ACTION PCB_ACTIONS::find( "pcbnew.InteractiveSelection.Find",
- AS_GLOBAL, 0, //TOOL_ACTION::LegacyHotKey( HK_FIND_ITEM ), // handled by wxWidgets
- _( "Find Item" ), _( "Searches the document for an item" ), find_xpm );
-
-TOOL_ACTION PCB_ACTIONS::findMove( "pcbnew.InteractiveSelection.FindMove",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GET_AND_MOVE_FOOTPRINT ) );
-
-
-// Edit tool actions
-TOOL_ACTION PCB_ACTIONS::editFootprintInFpEditor( "pcbnew.InteractiveEdit.editFootprintInFpEditor",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_MODULE_WITH_MODEDIT ),
- _( "Open in Footprint Editor" ),
- _( "Opens the selected footprint in the Footprint Editor" ),
- module_editor_xpm );
-
-TOOL_ACTION PCB_ACTIONS::copyPadToSettings( "pcbnew.InteractiveEdit.copyPadToSettings",
- AS_GLOBAL, 0,
- _( "Copy Pad Settings to Current Settings" ),
- _( "Copies the properties of selected pad to the current template pad settings." ) );
-
-TOOL_ACTION PCB_ACTIONS::copySettingsToPads( "pcbnew.InteractiveEdit.copySettingsToPads",
- AS_GLOBAL, 0,
- _( "Copy Current Settings to Pads" ),
- _( "Copies the current template pad settings to the selected pad(s)." ) );
-
-TOOL_ACTION PCB_ACTIONS::globalEditPads( "pcbnew.InteractiveEdit.globalPadEdit",
- AS_GLOBAL, 0,
- _( "Global Pad Edition" ),
- _( "Changes pad properties globally." ), push_pad_settings_xpm );
-
-TOOL_ACTION PCB_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_ITEM ),
- _( "Move" ), _( "Moves the selected item(s)" ), move_xpm, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::duplicate( "pcbnew.InteractiveEdit.duplicate",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE_ITEM ),
- _( "Duplicate" ), _( "Duplicates the selected item(s)" ), duplicate_module_xpm );
-
-TOOL_ACTION PCB_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE_ITEM_AND_INCREMENT ),
- _( "Duplicate" ), _( "Duplicates the selected item(s), incrementing pad numbers" ) );
-
-TOOL_ACTION PCB_ACTIONS::moveExact( "pcbnew.InteractiveEdit.moveExact",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_ITEM_EXACT ),
- _( "Move Exactly..." ), _( "Moves the selected item(s) by an exact amount" ),
- move_module_xpm );
-
-TOOL_ACTION PCB_ACTIONS::createArray( "pcbnew.InteractiveEdit.createArray",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CREATE_ARRAY ),
- _( "Create Array" ), _( "Create array" ), array_module_xpm, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::rotateCw( "pcbnew.InteractiveEdit.rotateCw",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROTATE_ITEM ),
- _( "Rotate Clockwise" ), _( "Rotates selected item(s) clockwise" ),
- rotate_cw_xpm, AF_NONE, (void*) 1 );
-
-TOOL_ACTION PCB_ACTIONS::rotateCcw( "pcbnew.InteractiveEdit.rotateCcw",
- AS_GLOBAL, MD_SHIFT + 'R',
- _( "Rotate Counter-clockwise" ), _( "Rotates selected item(s) counter-clockwise" ),
- rotate_ccw_xpm, AF_NONE, (void*) -1 );
-
-TOOL_ACTION PCB_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FLIP_ITEM ),
- _( "Flip" ), _( "Flips selected item(s)" ), swap_layer_xpm );
-
-TOOL_ACTION PCB_ACTIONS::mirror( "pcbnew.InteractiveEdit.mirror",
- AS_GLOBAL, 0,
- _( "Mirror" ), _( "Mirrors selected item" ), mirror_h_xpm );
-
-TOOL_ACTION PCB_ACTIONS::remove( "pcbnew.InteractiveEdit.remove",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BACK_SPACE ),
- _( "Remove" ), _( "Deletes selected item(s)" ), delete_xpm,
- AF_NONE, (void*) REMOVE_FLAGS::NORMAL );
-
-TOOL_ACTION PCB_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
- _( "Remove (Alternative)" ), _( "Deletes selected item(s)" ), delete_xpm,
- AF_NONE, (void*) REMOVE_FLAGS::ALT );
-
-TOOL_ACTION PCB_ACTIONS::exchangeFootprints( "pcbnew.InteractiveEdit.ExchangeFootprints",
- AS_GLOBAL, 0,
- _( "Exchange Footprint(s)" ), _( "Change the footprint used for modules" ),
- import_module_xpm );
-
-
-TOOL_ACTION PCB_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_ITEM ),
- _( "Properties..." ), _( "Displays item properties dialog" ), editor_xpm );
-
-TOOL_ACTION PCB_ACTIONS::editModifiedSelection( "pcbnew.InteractiveEdit.ModifiedSelection",
- AS_GLOBAL, 0,
- "", "" );
-
-
-// Drawing tool actions
-TOOL_ACTION PCB_ACTIONS::drawLine( "pcbnew.InteractiveDrawing.line",
- AS_GLOBAL, 0,
- _( "Draw Line" ), _( "Draw a line" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::drawCircle( "pcbnew.InteractiveDrawing.circle",
- AS_GLOBAL, 0,
- _( "Draw Circle" ), _( "Draw a circle" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::drawArc( "pcbnew.InteractiveDrawing.arc",
- AS_GLOBAL, 0,
- _( "Draw Arc" ), _( "Draw an arc" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::placeText( "pcbnew.InteractiveDrawing.text",
- AS_GLOBAL, 0,
- _( "Add Text" ), _( "Add a text" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::drawDimension( "pcbnew.InteractiveDrawing.dimension",
- AS_GLOBAL, 0,
- _( "Add Dimension" ), _( "Add a dimension" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::drawZone( "pcbnew.InteractiveDrawing.zone",
- AS_GLOBAL, 0,
- _( "Add Filled Zone" ), _( "Add a filled zone" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::drawKeepout( "pcbnew.InteractiveDrawing.keepout",
- AS_GLOBAL, 0,
- _( "Add Keepout Area" ), _( "Add a keepout area" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::drawZoneCutout( "pcbnew.InteractiveDrawing.zoneCutout",
- AS_GLOBAL, 0,
- _( "Add a Zone Cutout" ), _( "Add a cutout area of an existing zone" ),
- add_zone_cutout_xpm, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::drawSimilarZone( "pcbnew.InteractiveDrawing.similarZone",
- AS_GLOBAL, 0,
- _( "Add a Similar Zone" ), _( "Add a zone with the same settings as an existing zone" ),
- add_zone_xpm, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::placeDXF( "pcbnew.InteractiveDrawing.placeDXF",
- AS_GLOBAL, 0,
- "Place DXF", "", NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::setAnchor( "pcbnew.InteractiveDrawing.setAnchor",
- AS_GLOBAL, 0,
- _( "Place the Footprint Anchor" ), _( "Place the footprint anchor" ),
- NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::incWidth( "pcbnew.InteractiveDrawing.incWidth",
- AS_CONTEXT, '+',
- _( "Increase Line Width" ), _( "Increase the line width" ) );
-
-TOOL_ACTION PCB_ACTIONS::decWidth( "pcbnew.InteractiveDrawing.decWidth",
- AS_CONTEXT, '-',
- _( "Decrease Line Width" ), _( "Decrease the line width" ) );
-
-TOOL_ACTION PCB_ACTIONS::arcPosture( "pcbnew.InteractiveDrawing.arcPosture",
- AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_POSTURE ),
- _( "Switch Arc Posture" ), _( "Switch the arc posture" ) );
-
-
-// View Controls
-TOOL_ACTION PCB_ACTIONS::zoomIn( "common.Control.zoomIn",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_IN ),
- _( "Zoom In" ), "", zoom_in_xpm );
-
-TOOL_ACTION PCB_ACTIONS::zoomOut( "common.Control.zoomOut",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_OUT ),
- _( "Zoom Out" ), "", zoom_out_xpm );
-
-TOOL_ACTION PCB_ACTIONS::zoomInCenter( "common.Control.zoomInCenter",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::zoomOutCenter( "common.Control.zoomOutCenter",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::zoomCenter( "common.Control.zoomCenter",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_CENTER ),
- _( "Center" ), "", zoom_center_on_screen_xpm );
-
-TOOL_ACTION PCB_ACTIONS::zoomFitScreen( "common.Control.zoomFitScreen",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_AUTO ),
- _( "Zoom Auto" ), "", zoom_fit_in_page_xpm );
-
-TOOL_ACTION PCB_ACTIONS::zoomPreset( "common.Control.zoomPreset",
- AS_GLOBAL, 0,
- "", "" );
-
-
-// Display modes
-TOOL_ACTION PCB_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_DISPLAY_MODE ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::padDisplayMode( "pcbnew.Control.padDisplayMode",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::viaDisplayMode( "pcbnew.Control.viaDisplayMode",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::zoneDisplayDisable( "pcbnew.Control.zoneDisplayDisable",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutlines",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_HIGHCONTRAST_MODE ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc",
- AS_GLOBAL, '>',
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
- AS_GLOBAL, '<',
- "", "" );
-
-
-// Layer control
-TOOL_ACTION PCB_ACTIONS::layerTop( "pcbnew.Control.layerTop",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_COMPONENT ),
- "", "", NULL, AF_NONE, (void*) F_Cu );
-
-TOOL_ACTION PCB_ACTIONS::layerInner1( "pcbnew.Control.layerInner1",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER1 ),
- "", "", NULL, AF_NONE, (void*) In1_Cu );
-
-TOOL_ACTION PCB_ACTIONS::layerInner2( "pcbnew.Control.layerInner2",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER2 ),
- "", "", NULL, AF_NONE, (void*) In2_Cu );
-
-TOOL_ACTION PCB_ACTIONS::layerInner3( "pcbnew.Control.layerInner3",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER3 ),
- "", "", NULL, AF_NONE, (void*) In3_Cu );
-
-TOOL_ACTION PCB_ACTIONS::layerInner4( "pcbnew.Control.layerInner4",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER4 ),
- "", "", NULL, AF_NONE, (void*) In4_Cu );
-
-TOOL_ACTION PCB_ACTIONS::layerInner5( "pcbnew.Control.layerInner5",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER5 ),
- "", "", NULL, AF_NONE, (void*) In5_Cu );
-
-TOOL_ACTION PCB_ACTIONS::layerInner6( "pcbnew.Control.layerInner6",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER6 ),
- "", "", NULL, AF_NONE, (void*) In6_Cu );
-
-TOOL_ACTION PCB_ACTIONS::layerBottom( "pcbnew.Control.layerBottom",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_COPPER ),
- "", "", NULL, AF_NONE, (void*) B_Cu );
-
-TOOL_ACTION PCB_ACTIONS::layerNext( "pcbnew.Control.layerNext",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_NEXT ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::layerPrev( "pcbnew.Control.layerPrev",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_PREVIOUS ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::layerToggle( "pcbnew.Control.layerToggle",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_THROUGH_VIA ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::layerAlphaInc( "pcbnew.Control.layerAlphaInc",
- AS_GLOBAL, '}',
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
- AS_GLOBAL, '{',
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
- AS_GLOBAL, 0,
- "", "", NULL, AF_NOTIFY );
-
-
-// Grid control
-TOOL_ACTION PCB_ACTIONS::gridFast1( "common.Control.gridFast1",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_FASTGRID1 ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::gridFast2( "common.Control.gridFast2",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_FASTGRID2 ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::gridNext( "common.Control.gridNext",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_NEXT ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::gridPrev( "common.Control.gridPrev",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_PREVIOUS ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::gridSetOrigin( "common.Control.gridSetOrigin",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SET_GRID_ORIGIN ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::gridResetOrigin( "common.Control.gridResetOrigin",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_GRID_ORIGIN ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::gridPreset( "common.Control.gridPreset",
- AS_GLOBAL, 0,
- "", "" );
-
-// Track & via size control
-TOOL_ACTION PCB_ACTIONS::trackWidthInc( "pcbnew.EditorControl.trackWidthInc",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_WIDTH_TO_NEXT ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::trackWidthDec( "pcbnew.EditorControl.trackWidthDec",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::viaSizeInc( "pcbnew.EditorControl.viaSizeInc",
- AS_GLOBAL, '\'',
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::viaSizeDec( "pcbnew.EditorControl.viaSizeDec",
- AS_GLOBAL, '\\',
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::trackViaSizeChanged( "pcbnew.EditorControl.trackViaSizeChanged",
- AS_GLOBAL, 0,
- "", "", NULL, AF_NOTIFY );
-
-
-// Zone actions
-TOOL_ACTION PCB_ACTIONS::zoneFill( "pcbnew.EditorControl.zoneFill",
- AS_GLOBAL, 0,
- _( "Fill" ), _( "Fill zone(s)" ), fill_zone_xpm );
-
-TOOL_ACTION PCB_ACTIONS::zoneFillAll( "pcbnew.EditorControl.zoneFillAll",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZONE_FILL_OR_REFILL ),
- _( "Fill All" ), _( "Fill all zones" ) );
-
-TOOL_ACTION PCB_ACTIONS::zoneUnfill( "pcbnew.EditorControl.zoneUnfill",
- AS_GLOBAL, 0,
- _( "Unfill" ), _( "Unfill zone(s)" ), zone_unfill_xpm );
-
-TOOL_ACTION PCB_ACTIONS::zoneUnfillAll( "pcbnew.EditorControl.zoneUnfillAll",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZONE_REMOVE_FILLED ),
- _( "Unfill All" ), _( "Unfill all zones" ) );
-
-TOOL_ACTION PCB_ACTIONS::zoneMerge( "pcbnew.EditorControl.zoneMerge",
- AS_GLOBAL, 0,
- _( "Merge Zones" ), _( "Merge zones" ) );
-
-TOOL_ACTION PCB_ACTIONS::zoneDuplicate( "pcbnew.EditorControl.zoneDuplicate",
- AS_GLOBAL, 0,
- _( "Duplicate Zone onto Layer" ), _( "Duplicate zone outline onto a different layer" ),
- zone_duplicate_xpm );
-
-
-TOOL_ACTION PCB_ACTIONS::placeTarget( "pcbnew.EditorControl.placeTarget",
- AS_GLOBAL, 0,
- _( "Add Layer Alignment Target" ), _( "Add a layer alignment target" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::placeModule( "pcbnew.EditorControl.placeModule",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_MODULE ),
- _( "Add Footprint" ), _( "Add a footprint" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::drillOrigin( "pcbnew.EditorControl.drillOrigin",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::crossProbeSchToPcb( "pcbnew.EditorControl.crossProbSchToPcb",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::toggleLock( "pcbnew.EditorControl.toggleLock",
- AS_GLOBAL, 'L',
- "Toggle Lock", "" );
-
-TOOL_ACTION PCB_ACTIONS::lock( "pcbnew.EditorControl.lock",
- AS_GLOBAL, 0,
- _( "Lock" ), "" );
-
-TOOL_ACTION PCB_ACTIONS::unlock( "pcbnew.EditorControl.unlock",
- AS_GLOBAL, 0,
- _( "Unlock" ), "" );
-
-TOOL_ACTION PCB_ACTIONS::appendBoard( "pcbnew.EditorControl.appendBoard",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::highlightNet( "pcbnew.EditorControl.highlightNet",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::highlightNetCursor( "pcbnew.EditorControl.highlightNetCursor",
- AS_GLOBAL, 0,
- "", "" );
-
-
-// Module editor tools
-TOOL_ACTION PCB_ACTIONS::placePad( "pcbnew.ModuleEditor.placePad",
- AS_GLOBAL, 0,
- _( "Add Pad" ), _( "Add a pad" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::enumeratePads( "pcbnew.ModuleEditor.enumeratePads",
- AS_GLOBAL, 0,
- _( "Enumerate Pads" ), _( "Enumerate pads" ), pad_enumerate_xpm, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::copyItems( "pcbnew.ModuleEditor.copyItems",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_COPY_ITEM ),
- _( "Copy" ), _( "Copy items" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::pasteItems( "pcbnew.ModuleEditor.pasteItems",
- AS_GLOBAL, MD_CTRL + int( 'V' ),
- _( "Paste" ), _( "Paste items" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::moduleEdgeOutlines( "pcbnew.ModuleEditor.graphicOutlines",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::moduleTextOutlines( "pcbnew.ModuleEditor.textOutlines",
- AS_GLOBAL, 0,
- "", "" );
-
-// Pad tools
-TOOL_ACTION PCB_ACTIONS::copyPadSettings(
- "pcbnew.PadTool.CopyPadSettings",
- AS_GLOBAL, 0,
- _( "Copy Pad Settings" ), _( "Copy current pad's settings to the board design settings" ),
- copy_pad_settings_xpm );
-
-TOOL_ACTION PCB_ACTIONS::applyPadSettings(
- "pcbnew.PadTool.ApplyPadSettings",
- AS_GLOBAL, 0,
- _( "Apply Pad Settings" ), _( "Copy the board design settings pad properties to the current pad" ),
- apply_pad_settings_xpm );
-
-TOOL_ACTION PCB_ACTIONS::pushPadSettings(
- "pcbnew.PadTool.PushPadSettings",
- AS_GLOBAL, 0,
- _( "Push Pad Settings" ), _( "Copy the current pad settings to other pads" ),
- push_pad_settings_xpm );
-
-// Cursor control
-TOOL_ACTION PCB_ACTIONS::cursorUp( "pcbnew.Control.cursorUp",
- AS_GLOBAL, WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
-TOOL_ACTION PCB_ACTIONS::cursorDown( "pcbnew.Control.cursorDown",
- AS_GLOBAL, WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
-TOOL_ACTION PCB_ACTIONS::cursorLeft( "pcbnew.Control.cursorLeft",
- AS_GLOBAL, WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
-TOOL_ACTION PCB_ACTIONS::cursorRight( "pcbnew.Control.cursorRight",
- AS_GLOBAL, WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
-
-TOOL_ACTION PCB_ACTIONS::cursorUpFast( "pcbnew.Control.cursorUpFast",
- AS_GLOBAL, MD_CTRL + WXK_UP, "", "", NULL, AF_NONE, (void*) ( CURSOR_UP | CURSOR_FAST_MOVE ) );
-TOOL_ACTION PCB_ACTIONS::cursorDownFast( "pcbnew.Control.cursorDownFast",
- AS_GLOBAL, MD_CTRL + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) ( CURSOR_DOWN | CURSOR_FAST_MOVE ) );
-TOOL_ACTION PCB_ACTIONS::cursorLeftFast( "pcbnew.Control.cursorLeftFast",
- AS_GLOBAL, MD_CTRL + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_LEFT | CURSOR_FAST_MOVE ) );
-TOOL_ACTION PCB_ACTIONS::cursorRightFast( "pcbnew.Control.cursorRightFast",
- AS_GLOBAL, MD_CTRL + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_RIGHT | CURSOR_FAST_MOVE ) );
-
-TOOL_ACTION PCB_ACTIONS::cursorClick( "pcbnew.Control.cursorClick",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_CLICK ),
- "", "", NULL, AF_NONE, (void*) CURSOR_CLICK );
-TOOL_ACTION PCB_ACTIONS::cursorDblClick( "pcbnew.Control.cursorDblClick",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_DCLICK ),
- "", "", NULL, AF_NONE, (void*) CURSOR_DBL_CLICK );
-
-TOOL_ACTION PCB_ACTIONS::panUp( "pcbnew.Control.panUp",
- AS_GLOBAL, MD_SHIFT + WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
-TOOL_ACTION PCB_ACTIONS::panDown( "pcbnew.Control.panDown",
- AS_GLOBAL, MD_SHIFT + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
-TOOL_ACTION PCB_ACTIONS::panLeft( "pcbnew.Control.panLeft",
- AS_GLOBAL, MD_SHIFT + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
-TOOL_ACTION PCB_ACTIONS::panRight( "pcbnew.Control.panRight",
- AS_GLOBAL, MD_SHIFT + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
-
-// Miscellaneous
-TOOL_ACTION PCB_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
- AS_GLOBAL, 0,
- "", "", NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::zoomTool( "pcbnew.Control.zoomTool",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_SELECTION ),
- _( "Zoom to Selection" ), "", NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::pickerTool( "pcbnew.Picker", AS_GLOBAL, 0, "", "", NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
- AS_GLOBAL, ' ',
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::switchCursor( "pcbnew.Control.switchCursor",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::switchUnits( "pcbnew.Control.switchUnits",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_UNITS ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::deleteItemCursor( "pcbnew.Control.deleteItemCursor",
- AS_GLOBAL, 0,
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::showHelp( "pcbnew.Control.showHelp",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ),
- "", "" );
-
-TOOL_ACTION PCB_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
- AS_GLOBAL, 0, // dialog saying it is not implemented yet
- "", "" ); // so users are aware of that
-
-
-TOOL_ACTION PCB_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleTrack",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_TRACK ),
- _( "Interactive Router (Single Tracks)" ),
- _( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffPair",
- AS_GLOBAL, '6',
- _( "Interactive Router (Differential Pairs)" ),
- _( "Run push & shove router (differential pairs)" ), ps_diff_pair_xpm, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::routerActivateSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",
- AS_GLOBAL, 0,
- _( "Interactive Router Settings" ),
- _( "Open Interactive Router settings" ), NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRouter.DpDimensionsDialog",
- AS_GLOBAL, 0,
- _( "Differential Pair Dimension settings" ),
- _( "Open Differential Pair Dimension settings" ), ps_diff_pair_gap_xpm, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack",
- AS_GLOBAL, '7',
- _( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
- AS_GLOBAL, '8',
- _( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
- AS_GLOBAL, '9',
- _( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
-
-TOOL_ACTION PCB_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
- AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DRAG_TRACK_KEEP_SLOPE ),
- _( "Drag Track/Via" ), _( "Drags tracks and vias without breaking connections" ),
- drag_track_segment_xpm );
-
-// Point editor
-TOOL_ACTION PCB_ACTIONS::pointEditorAddCorner( "pcbnew.PointEditor.addCorner",
- AS_GLOBAL, 0,
- _( "Create Corner" ), _( "Create a corner" ), add_corner_xpm );
-
-TOOL_ACTION PCB_ACTIONS::pointEditorRemoveCorner( "pcbnew.PointEditor.removeCorner",
- AS_GLOBAL, 0,
- _( "Remove Corner" ), _( "Remove corner" ), delete_xpm );
-
-// Placement tool
-TOOL_ACTION PCB_ACTIONS::alignTop( "pcbnew.Place.alignTop",
- AS_GLOBAL, 0,
- _( "Align to Top" ),
- _( "Aligns selected items to the top edge" ), up_xpm );
-
-TOOL_ACTION PCB_ACTIONS::alignBottom( "pcbnew.Place.alignBottom",
- AS_GLOBAL, 0,
- _( "Align to Bottom" ),
- _( "Aligns selected items to the bottom edge" ), down_xpm );
-
-TOOL_ACTION PCB_ACTIONS::alignLeft( "pcbnew.Place.alignLeft",
- AS_GLOBAL, 0,
- _( "Align to Left" ),
- _( "Aligns selected items to the left edge" ), left_xpm );
-
-TOOL_ACTION PCB_ACTIONS::alignRight( "pcbnew.Place.alignRight",
- AS_GLOBAL, 0,
- _( "Align to Right" ),
- _( "Aligns selected items to the right edge" ), right_xpm );
-
-TOOL_ACTION PCB_ACTIONS::distributeHorizontally( "pcbnew.Place.distributeHorizontally",
- AS_GLOBAL, 0,
- _( "Distribute Horizontally" ),
- _( "Distributes selected items along the horizontal axis" ), distribute_horizontal_xpm );
-
-TOOL_ACTION PCB_ACTIONS::distributeVertically( "pcbnew.Place.distributeVertically",
- AS_GLOBAL, 0,
- _( "Distribute Vertically" ),
- _( "Distributes selected items along the vertical axis" ), distribute_vertical_xpm );
boost::optional<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
@@ -730,16 +94,16 @@ boost::optional<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
case ID_PCB_PLACE_GRID_COORD_BUTT:
case ID_MODEDIT_PLACE_GRID_COORD:
- return PCB_ACTIONS::gridSetOrigin.MakeEvent();
+ return ACTIONS::gridSetOrigin.MakeEvent();
case ID_ZOOM_IN: // toolbar button "Zoom In"
- return PCB_ACTIONS::zoomInCenter.MakeEvent();
+ return ACTIONS::zoomInCenter.MakeEvent();
case ID_ZOOM_OUT: // toolbar button "Zoom In"
- return PCB_ACTIONS::zoomOutCenter.MakeEvent();
+ return ACTIONS::zoomOutCenter.MakeEvent();
case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
- return PCB_ACTIONS::zoomFitScreen.MakeEvent();
+ return ACTIONS::zoomFitScreen.MakeEvent();
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
return PCB_ACTIONS::trackDisplayMode.MakeEvent();
diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h
index 0a63440..00c16ef 100644
--- a/pcbnew/tools/pcb_actions.h
+++ b/pcbnew/tools/pcb_actions.h
@@ -207,14 +207,7 @@ public:
/// Distributes items evenly along the vertical axis
static TOOL_ACTION distributeVertically;
- // View controls
- static TOOL_ACTION zoomIn;
- static TOOL_ACTION zoomOut;
- static TOOL_ACTION zoomInCenter;
- static TOOL_ACTION zoomOutCenter;
- static TOOL_ACTION zoomCenter;
- static TOOL_ACTION zoomFitScreen;
- static TOOL_ACTION zoomPreset;
+
// Display modes
static TOOL_ACTION trackDisplayMode;
@@ -244,15 +237,6 @@ public:
static TOOL_ACTION layerChanged; // notification
- // Grid control
- static TOOL_ACTION gridFast1;
- static TOOL_ACTION gridFast2;
- static TOOL_ACTION gridNext;
- static TOOL_ACTION gridPrev;
- static TOOL_ACTION gridSetOrigin;
- static TOOL_ACTION gridResetOrigin;
- static TOOL_ACTION gridPreset;
-
// Track & via size control
static TOOL_ACTION trackWidthInc;
static TOOL_ACTION trackWidthDec;
diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp
index dc4e6b1..d696c05 100644
--- a/pcbnew/tools/pcb_editor_control.cpp
+++ b/pcbnew/tools/pcb_editor_control.cpp
@@ -46,6 +46,7 @@
#include <zones_functions_for_undo_redo.h>
#include <board_commit.h>
#include <confirm.h>
+#include <hotkeys.h>
#include <view/view_group.h>
#include <view/view_controls.h>
@@ -57,6 +58,96 @@
using namespace std::placeholders;
+// Track & via size control
+TOOL_ACTION PCB_ACTIONS::trackWidthInc( "pcbnew.EditorControl.trackWidthInc",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_WIDTH_TO_NEXT ),
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::trackWidthDec( "pcbnew.EditorControl.trackWidthDec",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS ),
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::viaSizeInc( "pcbnew.EditorControl.viaSizeInc",
+ AS_GLOBAL, '\'',
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::viaSizeDec( "pcbnew.EditorControl.viaSizeDec",
+ AS_GLOBAL, '\\',
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::trackViaSizeChanged( "pcbnew.EditorControl.trackViaSizeChanged",
+ AS_GLOBAL, 0,
+ "", "", NULL, AF_NOTIFY );
+
+
+// Zone actions
+TOOL_ACTION PCB_ACTIONS::zoneFill( "pcbnew.EditorControl.zoneFill",
+ AS_GLOBAL, 0,
+ _( "Fill" ), _( "Fill zone(s)" ), fill_zone_xpm );
+
+TOOL_ACTION PCB_ACTIONS::zoneFillAll( "pcbnew.EditorControl.zoneFillAll",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZONE_FILL_OR_REFILL ),
+ _( "Fill All" ), _( "Fill all zones" ) );
+
+TOOL_ACTION PCB_ACTIONS::zoneUnfill( "pcbnew.EditorControl.zoneUnfill",
+ AS_GLOBAL, 0,
+ _( "Unfill" ), _( "Unfill zone(s)" ), zone_unfill_xpm );
+
+TOOL_ACTION PCB_ACTIONS::zoneUnfillAll( "pcbnew.EditorControl.zoneUnfillAll",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZONE_REMOVE_FILLED ),
+ _( "Unfill All" ), _( "Unfill all zones" ) );
+
+TOOL_ACTION PCB_ACTIONS::zoneMerge( "pcbnew.EditorControl.zoneMerge",
+ AS_GLOBAL, 0,
+ _( "Merge Zones" ), _( "Merge zones" ) );
+
+TOOL_ACTION PCB_ACTIONS::zoneDuplicate( "pcbnew.EditorControl.zoneDuplicate",
+ AS_GLOBAL, 0,
+ _( "Duplicate Zone onto Layer" ), _( "Duplicate zone outline onto a different layer" ),
+ zone_duplicate_xpm );
+
+
+TOOL_ACTION PCB_ACTIONS::placeTarget( "pcbnew.EditorControl.placeTarget",
+ AS_GLOBAL, 0,
+ _( "Add Layer Alignment Target" ), _( "Add a layer alignment target" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::placeModule( "pcbnew.EditorControl.placeModule",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_MODULE ),
+ _( "Add Footprint" ), _( "Add a footprint" ), NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::drillOrigin( "pcbnew.EditorControl.drillOrigin",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::crossProbeSchToPcb( "pcbnew.EditorControl.crossProbSchToPcb",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::toggleLock( "pcbnew.EditorControl.toggleLock",
+ AS_GLOBAL, 'L',
+ "Toggle Lock", "" );
+
+TOOL_ACTION PCB_ACTIONS::lock( "pcbnew.EditorControl.lock",
+ AS_GLOBAL, 0,
+ _( "Lock" ), "" );
+
+TOOL_ACTION PCB_ACTIONS::unlock( "pcbnew.EditorControl.unlock",
+ AS_GLOBAL, 0,
+ _( "Unlock" ), "" );
+
+TOOL_ACTION PCB_ACTIONS::appendBoard( "pcbnew.EditorControl.appendBoard",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::highlightNet( "pcbnew.EditorControl.highlightNet",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::highlightNetCursor( "pcbnew.EditorControl.highlightNetCursor",
+ AS_GLOBAL, 0,
+ "", "" );
+
+
class ZONE_CONTEXT_MENU : public CONTEXT_MENU
{
public:
diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp
index cb4486b..fabc005 100644
--- a/pcbnew/tools/pcbnew_control.cpp
+++ b/pcbnew/tools/pcbnew_control.cpp
@@ -37,7 +37,7 @@
#include <class_pcb_screen.h>
#include <confirm.h>
-#include <hotkeys_basic.h>
+#include <hotkeys.h>
#include <properties.h>
#include <io_mgr.h>
@@ -62,6 +62,170 @@ extern bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileN
extern IO_MGR::PCB_FILE_T plugin_type( const wxString& aFileName, int aCtl );
+// Display modes
+TOOL_ACTION PCB_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_DISPLAY_MODE ),
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::padDisplayMode( "pcbnew.Control.padDisplayMode",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::viaDisplayMode( "pcbnew.Control.viaDisplayMode",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::zoneDisplayDisable( "pcbnew.Control.zoneDisplayDisable",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutlines",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_HIGHCONTRAST_MODE ),
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc",
+ AS_GLOBAL, '>',
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
+ AS_GLOBAL, '<',
+ "", "" );
+
+
+// Layer control
+TOOL_ACTION PCB_ACTIONS::layerTop( "pcbnew.Control.layerTop",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_COMPONENT ),
+ "", "", NULL, AF_NONE, (void*) F_Cu );
+
+TOOL_ACTION PCB_ACTIONS::layerInner1( "pcbnew.Control.layerInner1",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER1 ),
+ "", "", NULL, AF_NONE, (void*) In1_Cu );
+
+TOOL_ACTION PCB_ACTIONS::layerInner2( "pcbnew.Control.layerInner2",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER2 ),
+ "", "", NULL, AF_NONE, (void*) In2_Cu );
+
+TOOL_ACTION PCB_ACTIONS::layerInner3( "pcbnew.Control.layerInner3",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER3 ),
+ "", "", NULL, AF_NONE, (void*) In3_Cu );
+
+TOOL_ACTION PCB_ACTIONS::layerInner4( "pcbnew.Control.layerInner4",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER4 ),
+ "", "", NULL, AF_NONE, (void*) In4_Cu );
+
+TOOL_ACTION PCB_ACTIONS::layerInner5( "pcbnew.Control.layerInner5",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER5 ),
+ "", "", NULL, AF_NONE, (void*) In5_Cu );
+
+TOOL_ACTION PCB_ACTIONS::layerInner6( "pcbnew.Control.layerInner6",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER6 ),
+ "", "", NULL, AF_NONE, (void*) In6_Cu );
+
+TOOL_ACTION PCB_ACTIONS::layerBottom( "pcbnew.Control.layerBottom",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_COPPER ),
+ "", "", NULL, AF_NONE, (void*) B_Cu );
+
+TOOL_ACTION PCB_ACTIONS::layerNext( "pcbnew.Control.layerNext",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_NEXT ),
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::layerPrev( "pcbnew.Control.layerPrev",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_PREVIOUS ),
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::layerToggle( "pcbnew.Control.layerToggle",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_THROUGH_VIA ),
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::layerAlphaInc( "pcbnew.Control.layerAlphaInc",
+ AS_GLOBAL, '}',
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
+ AS_GLOBAL, '{',
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
+ AS_GLOBAL, 0,
+ "", "", NULL, AF_NOTIFY );
+
+// Cursor control
+TOOL_ACTION PCB_ACTIONS::cursorUp( "pcbnew.Control.cursorUp",
+ AS_GLOBAL, WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
+TOOL_ACTION PCB_ACTIONS::cursorDown( "pcbnew.Control.cursorDown",
+ AS_GLOBAL, WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
+TOOL_ACTION PCB_ACTIONS::cursorLeft( "pcbnew.Control.cursorLeft",
+ AS_GLOBAL, WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
+TOOL_ACTION PCB_ACTIONS::cursorRight( "pcbnew.Control.cursorRight",
+ AS_GLOBAL, WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
+
+TOOL_ACTION PCB_ACTIONS::cursorUpFast( "pcbnew.Control.cursorUpFast",
+ AS_GLOBAL, MD_CTRL + WXK_UP, "", "", NULL, AF_NONE, (void*) ( CURSOR_UP | CURSOR_FAST_MOVE ) );
+TOOL_ACTION PCB_ACTIONS::cursorDownFast( "pcbnew.Control.cursorDownFast",
+ AS_GLOBAL, MD_CTRL + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) ( CURSOR_DOWN | CURSOR_FAST_MOVE ) );
+TOOL_ACTION PCB_ACTIONS::cursorLeftFast( "pcbnew.Control.cursorLeftFast",
+ AS_GLOBAL, MD_CTRL + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_LEFT | CURSOR_FAST_MOVE ) );
+TOOL_ACTION PCB_ACTIONS::cursorRightFast( "pcbnew.Control.cursorRightFast",
+ AS_GLOBAL, MD_CTRL + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_RIGHT | CURSOR_FAST_MOVE ) );
+
+TOOL_ACTION PCB_ACTIONS::cursorClick( "pcbnew.Control.cursorClick",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_CLICK ),
+ "", "", NULL, AF_NONE, (void*) CURSOR_CLICK );
+TOOL_ACTION PCB_ACTIONS::cursorDblClick( "pcbnew.Control.cursorDblClick",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_DCLICK ),
+ "", "", NULL, AF_NONE, (void*) CURSOR_DBL_CLICK );
+
+TOOL_ACTION PCB_ACTIONS::panUp( "pcbnew.Control.panUp",
+ AS_GLOBAL, MD_SHIFT + WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
+TOOL_ACTION PCB_ACTIONS::panDown( "pcbnew.Control.panDown",
+ AS_GLOBAL, MD_SHIFT + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
+TOOL_ACTION PCB_ACTIONS::panLeft( "pcbnew.Control.panLeft",
+ AS_GLOBAL, MD_SHIFT + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
+TOOL_ACTION PCB_ACTIONS::panRight( "pcbnew.Control.panRight",
+ AS_GLOBAL, MD_SHIFT + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
+
+// Miscellaneous
+TOOL_ACTION PCB_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
+ AS_GLOBAL, 0,
+ "", "", NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::zoomTool( "pcbnew.Control.zoomTool",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_SELECTION ),
+ _( "Zoom to Selection" ), "", NULL, AF_ACTIVATE );
+
+TOOL_ACTION PCB_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
+ AS_GLOBAL, ' ',
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::switchCursor( "pcbnew.Control.switchCursor",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::switchUnits( "pcbnew.Control.switchUnits",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_UNITS ),
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::deleteItemCursor( "pcbnew.Control.deleteItemCursor",
+ AS_GLOBAL, 0,
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::showHelp( "pcbnew.Control.showHelp",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ),
+ "", "" );
+
+TOOL_ACTION PCB_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
+ AS_GLOBAL, 0, // dialog saying it is not implemented yet
+ "", "" ); // so users are aware of that
+
+
PCBNEW_CONTROL::PCBNEW_CONTROL() :
TOOL_INTERACTIVE( "pcbnew.Control" ), m_frame( NULL )
{
@@ -89,55 +253,6 @@ void PCBNEW_CONTROL::Reset( RESET_REASON aReason )
}
-int PCBNEW_CONTROL::ZoomInOut( const TOOL_EVENT& aEvent )
-{
- KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
- KIGFX::VIEW_CONTROLS* ctls = getViewControls();
- double zoomScale = 1.0;
-
- if( aEvent.IsAction( &PCB_ACTIONS::zoomIn ) )
- zoomScale = 1.3;
- else if( aEvent.IsAction( &PCB_ACTIONS::zoomOut ) )
- zoomScale = 0.7;
-
- view->SetScale( view->GetScale() * zoomScale, getViewControls()->GetCursorPosition() );
-
- if( ctls->IsCursorWarpingEnabled() )
- ctls->CenterOnCursor();
-
- return 0;
-}
-
-
-int PCBNEW_CONTROL::ZoomInOutCenter( const TOOL_EVENT& aEvent )
-{
- KIGFX::VIEW* view = getView();
- double zoomScale = 1.0;
-
- if( aEvent.IsAction( &PCB_ACTIONS::zoomInCenter ) )
- zoomScale = 1.3;
- else if( aEvent.IsAction( &PCB_ACTIONS::zoomOutCenter ) )
- zoomScale = 0.7;
-
- view->SetScale( view->GetScale() * zoomScale );
-
- return 0;
-}
-
-
-int PCBNEW_CONTROL::ZoomCenter( const TOOL_EVENT& aEvent )
-{
- KIGFX::VIEW_CONTROLS* ctls = getViewControls();
-
- if( ctls->IsCursorWarpingEnabled() )
- ctls->CenterOnCursor();
- else
- getView()->SetCenter( getViewControls()->GetCursorPosition() );
-
- return 0;
-}
-
-
int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = getView();
@@ -598,24 +713,6 @@ int PCBNEW_CONTROL::GridFast2( const TOOL_EVENT& aEvent )
}
-int PCBNEW_CONTROL::GridNext( const TOOL_EVENT& aEvent )
-{
- m_frame->SetNextGrid();
- updateGrid();
-
- return 0;
-}
-
-
-int PCBNEW_CONTROL::GridPrev( const TOOL_EVENT& aEvent )
-{
- m_frame->SetPrevGrid();
- updateGrid();
-
- return 0;
-}
-
-
static bool setOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
KIGFX::ORIGIN_VIEWITEM* aItem, const VECTOR2D& aPoint )
{
@@ -664,17 +761,6 @@ int PCBNEW_CONTROL::GridResetOrigin( const TOOL_EVENT& aEvent )
}
-int PCBNEW_CONTROL::GridPreset( const TOOL_EVENT& aEvent )
-{
- long idx = aEvent.Parameter<intptr_t>();
-
- m_frame->SetPresetGrid( idx );
- updateGrid();
-
- return 0;
-}
-
-
// Miscellaneous
int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent )
{
@@ -915,13 +1001,8 @@ int PCBNEW_CONTROL::ToBeDone( const TOOL_EVENT& aEvent )
void PCBNEW_CONTROL::SetTransitions()
{
// View controls
- Go( &PCBNEW_CONTROL::ZoomInOut, PCB_ACTIONS::zoomIn.MakeEvent() );
- Go( &PCBNEW_CONTROL::ZoomInOut, PCB_ACTIONS::zoomOut.MakeEvent() );
- Go( &PCBNEW_CONTROL::ZoomInOutCenter, PCB_ACTIONS::zoomInCenter.MakeEvent() );
- Go( &PCBNEW_CONTROL::ZoomInOutCenter, PCB_ACTIONS::zoomOutCenter.MakeEvent() );
- Go( &PCBNEW_CONTROL::ZoomCenter, PCB_ACTIONS::zoomCenter.MakeEvent() );
- Go( &PCBNEW_CONTROL::ZoomFitScreen, PCB_ACTIONS::zoomFitScreen.MakeEvent() );
- Go( &PCBNEW_CONTROL::ZoomPreset, PCB_ACTIONS::zoomPreset.MakeEvent() );
+ Go( &PCBNEW_CONTROL::ZoomFitScreen, ACTIONS::zoomFitScreen.MakeEvent() );
+ Go( &PCBNEW_CONTROL::ZoomPreset, ACTIONS::zoomPreset.MakeEvent() );
// Display modes
Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
@@ -968,13 +1049,10 @@ void PCBNEW_CONTROL::SetTransitions()
Go( &PCBNEW_CONTROL::PanControl, PCB_ACTIONS::panRight.MakeEvent() );
// Grid control
- Go( &PCBNEW_CONTROL::GridFast1, PCB_ACTIONS::gridFast1.MakeEvent() );
- Go( &PCBNEW_CONTROL::GridFast2, PCB_ACTIONS::gridFast2.MakeEvent() );
- Go( &PCBNEW_CONTROL::GridNext, PCB_ACTIONS::gridNext.MakeEvent() );
- Go( &PCBNEW_CONTROL::GridPrev, PCB_ACTIONS::gridPrev.MakeEvent() );
- Go( &PCBNEW_CONTROL::GridSetOrigin, PCB_ACTIONS::gridSetOrigin.MakeEvent() );
- Go( &PCBNEW_CONTROL::GridResetOrigin, PCB_ACTIONS::gridResetOrigin.MakeEvent() );
- Go( &PCBNEW_CONTROL::GridPreset, PCB_ACTIONS::gridPreset.MakeEvent() );
+ Go( &PCBNEW_CONTROL::GridFast1, ACTIONS::gridFast1.MakeEvent() );
+ Go( &PCBNEW_CONTROL::GridFast2, ACTIONS::gridFast2.MakeEvent() );
+ Go( &PCBNEW_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() );
+ Go( &PCBNEW_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() );
// Miscellaneous
Go( &PCBNEW_CONTROL::ResetCoords, PCB_ACTIONS::resetCoords.MakeEvent() );
diff --git a/pcbnew/tools/pcbnew_control.h b/pcbnew/tools/pcbnew_control.h
index 6fcc12f..6ca4ee1 100644
--- a/pcbnew/tools/pcbnew_control.h
+++ b/pcbnew/tools/pcbnew_control.h
@@ -48,9 +48,6 @@ public:
void Reset( RESET_REASON aReason ) override;
// View controls
- int ZoomInOut( const TOOL_EVENT& aEvent );
- int ZoomInOutCenter( const TOOL_EVENT& aEvent );
- int ZoomCenter( const TOOL_EVENT& aEvent );
int ZoomFitScreen( const TOOL_EVENT& aEvent );
int ZoomPreset( const TOOL_EVENT& aEvent );
@@ -77,11 +74,8 @@ public:
// Grid control
int GridFast1( const TOOL_EVENT& aEvent );
int GridFast2( const TOOL_EVENT& aEvent );
- int GridNext( const TOOL_EVENT& aEvent );
- int GridPrev( const TOOL_EVENT& aEvent );
int GridSetOrigin( const TOOL_EVENT& aEvent );
int GridResetOrigin( const TOOL_EVENT& aEvent );
- int GridPreset( const TOOL_EVENT& aEvent );
// Miscellaneous
int ResetCoords( const TOOL_EVENT& aEvent );
diff --git a/pcbnew/tools/picker_tool.cpp b/pcbnew/tools/picker_tool.cpp
index 9e45d12..14618f0 100644
--- a/pcbnew/tools/picker_tool.cpp
+++ b/pcbnew/tools/picker_tool.cpp
@@ -29,6 +29,9 @@
#include <view/view_controls.h>
#include <tool/tool_manager.h>
+TOOL_ACTION PCB_ACTIONS::pickerTool( "pcbnew.Picker", AS_GLOBAL, 0, "", "", NULL, AF_ACTIVATE );
+
+
PICKER_TOOL::PICKER_TOOL()
: TOOL_INTERACTIVE( "pcbnew.Picker" )
{
diff --git a/pcbnew/tools/placement_tool.cpp b/pcbnew/tools/placement_tool.cpp
index e963678..cbd5593 100644
--- a/pcbnew/tools/placement_tool.cpp
+++ b/pcbnew/tools/placement_tool.cpp
@@ -35,6 +35,38 @@
#include <confirm.h>
#include <menus_helpers.h>
+// Placement tool
+TOOL_ACTION PCB_ACTIONS::alignTop( "pcbnew.Place.alignTop",
+ AS_GLOBAL, 0,
+ _( "Align to Top" ),
+ _( "Aligns selected items to the top edge" ), up_xpm );
+
+TOOL_ACTION PCB_ACTIONS::alignBottom( "pcbnew.Place.alignBottom",
+ AS_GLOBAL, 0,
+ _( "Align to Bottom" ),
+ _( "Aligns selected items to the bottom edge" ), down_xpm );
+
+TOOL_ACTION PCB_ACTIONS::alignLeft( "pcbnew.Place.alignLeft",
+ AS_GLOBAL, 0,
+ _( "Align to Left" ),
+ _( "Aligns selected items to the left edge" ), left_xpm );
+
+TOOL_ACTION PCB_ACTIONS::alignRight( "pcbnew.Place.alignRight",
+ AS_GLOBAL, 0,
+ _( "Align to Right" ),
+ _( "Aligns selected items to the right edge" ), right_xpm );
+
+TOOL_ACTION PCB_ACTIONS::distributeHorizontally( "pcbnew.Place.distributeHorizontally",
+ AS_GLOBAL, 0,
+ _( "Distribute Horizontally" ),
+ _( "Distributes selected items along the horizontal axis" ), distribute_horizontal_xpm );
+
+TOOL_ACTION PCB_ACTIONS::distributeVertically( "pcbnew.Place.distributeVertically",
+ AS_GLOBAL, 0,
+ _( "Distribute Vertically" ),
+ _( "Distributes selected items along the vertical axis" ), distribute_vertical_xpm );
+
+
PLACEMENT_TOOL::PLACEMENT_TOOL() :
TOOL_INTERACTIVE( "pcbnew.Placement" ), m_selectionTool( NULL ), m_placementMenu( NULL )
{
diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp
index e007713..a7d62bf 100644
--- a/pcbnew/tools/point_editor.cpp
+++ b/pcbnew/tools/point_editor.cpp
@@ -44,6 +44,16 @@ using namespace std::placeholders;
#include <class_module.h>
#include <ratsnest_data.h>
+// Point editor
+TOOL_ACTION PCB_ACTIONS::pointEditorAddCorner( "pcbnew.PointEditor.addCorner",
+ AS_GLOBAL, 0,
+ _( "Create Corner" ), _( "Create a corner" ), add_corner_xpm );
+
+TOOL_ACTION PCB_ACTIONS::pointEditorRemoveCorner( "pcbnew.PointEditor.removeCorner",
+ AS_GLOBAL, 0,
+ _( "Remove Corner" ), _( "Remove corner" ), delete_xpm );
+
+
// Few constants to avoid using bare numbers for point indices
enum SEG_POINTS
{
diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index 6028007..00f352d 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -43,6 +43,7 @@ using namespace std::placeholders;
#include <view/view_controls.h>
#include <view/view_group.h>
#include <painter.h>
+#include <hotkeys.h>
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
@@ -53,6 +54,51 @@ using namespace std::placeholders;
#include "bright_box.h"
#include "pcb_actions.h"
+// Selection tool actions
+TOOL_ACTION PCB_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
+ AS_GLOBAL, 0,
+ "", "", NULL, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
+
+TOOL_ACTION PCB_ACTIONS::selectionCursor( "pcbnew.InteractiveSelection.Cursor",
+ AS_GLOBAL, 0,
+ "", "" ); // No description, it is not supposed to be shown anywhere
+
+TOOL_ACTION PCB_ACTIONS::selectItem( "pcbnew.InteractiveSelection.SelectItem",
+ AS_GLOBAL, 0,
+ "", "" ); // No description, it is not supposed to be shown anywhere
+
+TOOL_ACTION PCB_ACTIONS::unselectItem( "pcbnew.InteractiveSelection.UnselectItem",
+ AS_GLOBAL, 0,
+ "", "" ); // No description, it is not supposed to be shown anywhere
+
+TOOL_ACTION PCB_ACTIONS::selectionClear( "pcbnew.InteractiveSelection.Clear",
+ AS_GLOBAL, 0,
+ "", "" ); // No description, it is not supposed to be shown anywhere
+
+TOOL_ACTION PCB_ACTIONS::selectConnection( "pcbnew.InteractiveSelection.SelectConnection",
+ AS_GLOBAL, 'U',
+ _( "Trivial Connection" ), _( "Selects a connection between two junctions." ) );
+
+TOOL_ACTION PCB_ACTIONS::selectCopper( "pcbnew.InteractiveSelection.SelectCopper",
+ AS_GLOBAL, 'I',
+ _( "Copper Connection" ), _( "Selects whole copper connection." ) );
+
+TOOL_ACTION PCB_ACTIONS::selectNet( "pcbnew.InteractiveSelection.SelectNet",
+ AS_GLOBAL, 0,
+ _( "Whole Net" ), _( "Selects all tracks & vias belonging to the same net." ) );
+
+TOOL_ACTION PCB_ACTIONS::selectSameSheet( "pcbnew.InteractiveSelection.SelectSameSheet",
+ AS_GLOBAL, 'P',
+ _( "Same Sheet" ), _( "Selects all modules and tracks in the same schematic sheet" ) );
+
+TOOL_ACTION PCB_ACTIONS::find( "pcbnew.InteractiveSelection.Find",
+ AS_GLOBAL, 0, //TOOL_ACTION::LegacyHotKey( HK_FIND_ITEM ), // handled by wxWidgets
+ _( "Find Item" ), _( "Searches the document for an item" ), find_xpm );
+
+TOOL_ACTION PCB_ACTIONS::findMove( "pcbnew.InteractiveSelection.FindMove",
+ AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GET_AND_MOVE_FOOTPRINT ) );
+
+
class SELECT_MENU: public CONTEXT_MENU
{
public:
diff --git a/pcbnew/tools/tool_menu.cpp b/pcbnew/tools/tool_menu.cpp
index 825fb39..12e1cad 100644
--- a/pcbnew/tools/tool_menu.cpp
+++ b/pcbnew/tools/tool_menu.cpp
@@ -91,10 +91,10 @@ using S_C = SELECTION_CONDITIONS;
void TOOL_MENU::AddStandardSubMenus( EDA_DRAW_FRAME& aFrame )
{
- m_menu.AddItem( PCB_ACTIONS::zoomCenter, S_C::ShowAlways, 1000 );
- m_menu.AddItem( PCB_ACTIONS::zoomIn, S_C::ShowAlways, 1000 );
- m_menu.AddItem( PCB_ACTIONS::zoomOut, S_C::ShowAlways, 1000 );
- m_menu.AddItem( PCB_ACTIONS::zoomFitScreen, S_C::ShowAlways, 1000 );
+ m_menu.AddItem( ACTIONS::zoomCenter, S_C::ShowAlways, 1000 );
+ m_menu.AddItem( ACTIONS::zoomIn, S_C::ShowAlways, 1000 );
+ m_menu.AddItem( ACTIONS::zoomOut, S_C::ShowAlways, 1000 );
+ m_menu.AddItem( ACTIONS::zoomFitScreen, S_C::ShowAlways, 1000 );
m_menu.AddSeparator(SELECTION_CONDITIONS::ShowAlways, 1000 );
diff --git a/pcbnew/tools/tools_common.cpp b/pcbnew/tools/tools_common.cpp
index 7313bd8..d06efed 100644
--- a/pcbnew/tools/tools_common.cpp
+++ b/pcbnew/tools/tools_common.cpp
@@ -26,6 +26,7 @@
#include <io_mgr.h>
#include <tool/tool_manager.h>
+#include <tool/common_tools.h>
#include <tools/selection_tool.h>
#include <tools/zoom_tool.h>
@@ -44,6 +45,7 @@
void PCB_ACTIONS::RegisterAllTools( TOOL_MANAGER* aToolManager )
{
+ aToolManager->RegisterTool( new COMMON_TOOLS );
aToolManager->RegisterTool( new SELECTION_TOOL );
aToolManager->RegisterTool( new ZOOM_TOOL );
aToolManager->RegisterTool( new PICKER_TOOL );
diff --git a/pcbnew/tools/zoom_menu.cpp b/pcbnew/tools/zoom_menu.cpp
index 962072f..9930fa6 100644
--- a/pcbnew/tools/zoom_menu.cpp
+++ b/pcbnew/tools/zoom_menu.cpp
@@ -53,7 +53,7 @@ ZOOM_MENU::ZOOM_MENU( EDA_DRAW_FRAME* aParent ) : m_parent( aParent )
OPT_TOOL_EVENT ZOOM_MENU::eventHandler( const wxMenuEvent& aEvent )
{
- OPT_TOOL_EVENT event( PCB_ACTIONS::zoomPreset.MakeEvent() );
+ OPT_TOOL_EVENT event( ACTIONS::zoomPreset.MakeEvent() );
intptr_t idx = aEvent.GetId() - ID_POPUP_ZOOM_LEVEL_START;
event->SetParameter( idx );
--
2.7.4
Follow ups
References