diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 5dc358f3a3..0725c08ebc 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -284,6 +284,9 @@ set( PCBNEW_CLASS_SRCS tools/common_actions.cpp tools/grid_helper.cpp tools/tools_common.cpp + + tools/grid_menu.cpp + tools/zoom_menu.cpp ) set( PCBNEW_SRCS ${PCBNEW_AUTOROUTER_SRCS} ${PCBNEW_CLASS_SRCS} ${PCBNEW_DIALOGS} ) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 2030407283..2c0873745b 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -51,6 +51,8 @@ #include "selection_tool.h" #include "selection_area.h" +#include "zoom_menu.h" +#include "grid_menu.h" #include "bright_box.h" #include "common_actions.h" @@ -70,12 +72,6 @@ SELECTION_TOOL::SELECTION_TOOL() : m_frame( NULL ), m_additive( false ), m_multiple( false ), m_editModules( false ), m_locked( true ) { - m_selArea = new SELECTION_AREA; - m_selection.group = new KIGFX::VIEW_GROUP; - - AddSubMenu( new SELECT_MENU, _( "Select..." ), - (SELECTION_CONDITION) SELECTION_CONDITIONS::OnlyConnectedItems && - SELECTION_CONDITIONS::Count( 1 ) ); } @@ -86,6 +82,28 @@ SELECTION_TOOL::~SELECTION_TOOL() } +bool SELECTION_TOOL::Init() +{ + m_selArea = new SELECTION_AREA; + m_selection.group = new KIGFX::VIEW_GROUP; + + AddSubMenu( new SELECT_MENU, _( "Select..." ), + (SELECTION_CONDITION) SELECTION_CONDITIONS::OnlyConnectedItems && + SELECTION_CONDITIONS::Count( 1 ) ); + + AddMenuItem( COMMON_ACTIONS::zoomCenter ); + AddMenuItem( COMMON_ACTIONS::zoomIn ); + AddMenuItem( COMMON_ACTIONS::zoomOut ); + AddMenuItem( COMMON_ACTIONS::zoomFitScreen ); + + AddSubMenu( new ZOOM_MENU( getEditFrame() ), "Zoom" ); + + AddSubMenu( new GRID_MENU( getEditFrame() ), "Grid" ); + + return true; +} + + void SELECTION_TOOL::Reset( RESET_REASON aReason ) { if( aReason == TOOL_BASE::MODEL_RELOAD ) diff --git a/pcbnew/tools/selection_tool.h b/pcbnew/tools/selection_tool.h index bc726ed8b1..b74d6220f7 100644 --- a/pcbnew/tools/selection_tool.h +++ b/pcbnew/tools/selection_tool.h @@ -104,7 +104,10 @@ public: SELECTION_TOOL(); ~SELECTION_TOOL(); - /// @copydoc TOOL_INTERACTIVE::Reset() + /// @copydoc TOOL_BASE::Init() + bool Init(); + + /// @copydoc TOOL_BASE::Reset() void Reset( RESET_REASON aReason ); /**