diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 4fce3a5d55..9c51ecca7e 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 0000000000..ad7cbfb6e6 --- /dev/null +++ b/common/tool/actions.cpp @@ -0,0 +1,63 @@ +#include +#include +#include + +// 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 0000000000..b5b7b07b88 --- /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 + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +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(); +} + + +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(); + + 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 b9ceb4d17c..8747ea1e10 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 0000000000..c37d0cd2d3 --- /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 + * + * 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 + +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 e348b837a4..e7ec2fc9b3 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 93bd5c36fb..1e6e7daedf 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -808,7 +808,7 @@ void FOOTPRINT_EDIT_FRAME::updateView() { static_cast( 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 34ab708034..2b7f9ea526 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -873,7 +873,7 @@ void FOOTPRINT_VIEWER_FRAME::updateView() { static_cast( 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 b1b72c6b8e..e568f5ab7d 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -62,6 +62,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 7399e50c90..093af47f74 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -44,6 +44,8 @@ #include #include #include +#include +#include #include #include @@ -57,6 +59,66 @@ using SCOPED_DRAW_MODE = SCOPED_SET_RESET; +// 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 c79b33a052..187bc2c548 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include @@ -62,6 +64,92 @@ using namespace std::placeholders; #include +// 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 cf14e62e5a..15b605e9c2 100644 --- a/pcbnew/tools/grid_menu.cpp +++ b/pcbnew/tools/grid_menu.cpp @@ -53,7 +53,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 772c464584..610a401131 100644 --- a/pcbnew/tools/module_editor_tools.cpp +++ b/pcbnew/tools/module_editor_tools.cpp @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include @@ -51,6 +53,32 @@ using namespace std::placeholders; #include +// 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 21e82c219e..f3ce145b7f 100644 --- a/pcbnew/tools/pad_tool.cpp +++ b/pcbnew/tools/pad_tool.cpp @@ -42,6 +42,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 1bf5ab3fc7..a4fb3301cf 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -24,643 +24,7 @@ */ #include "pcb_actions.h" -#include #include -#include -#include -#include -#include - -// 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 PCB_ACTIONS::TranslateLegacyId( int aId ) @@ -730,16 +94,16 @@ boost::optional 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 0a63440632..00c16ef110 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 207d6215b1..7be6dcd4e4 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -58,6 +59,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 cb4486bb6f..fabc005d83 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include @@ -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(); - - 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 6fcc12f3e9..6ca4ee1088 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 9e45d12773..14618f028e 100644 --- a/pcbnew/tools/picker_tool.cpp +++ b/pcbnew/tools/picker_tool.cpp @@ -29,6 +29,9 @@ #include #include +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 e963678f97..12339c5d24 100644 --- a/pcbnew/tools/placement_tool.cpp +++ b/pcbnew/tools/placement_tool.cpp @@ -31,10 +31,43 @@ #include #include #include +#include #include #include +// 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 e007713c21..7e91c76263 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -35,6 +35,7 @@ using namespace std::placeholders; #include "selection_tool.h" #include "point_editor.h" #include +#include #include #include @@ -44,6 +45,16 @@ using namespace std::placeholders; #include #include +// 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 6028007060..61a544cc9e 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -43,6 +43,8 @@ using namespace std::placeholders; #include #include #include +#include +#include #include #include @@ -53,6 +55,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 825fb3936b..12e1cadcf2 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 7313bd8c55..d06efedecf 100644 --- a/pcbnew/tools/tools_common.cpp +++ b/pcbnew/tools/tools_common.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -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 fe26382810..46fed5da0a 100644 --- a/pcbnew/tools/zoom_menu.cpp +++ b/pcbnew/tools/zoom_menu.cpp @@ -54,7 +54,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 );