diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 0e916943cf..d4980a7d6a 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -275,6 +275,7 @@ set( PCBNEW_CLASS_SRCS tools/module_tools.cpp tools/placement_tool.cpp tools/common_actions.cpp + tools/tools_common.cpp ) set( PCBNEW_SRCS ${PCBNEW_AUTOROUTER_SRCS} ${PCBNEW_CLASS_SRCS} ${PCBNEW_DIALOGS} ) diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 1ccc128d66..e4a8d42612 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -68,17 +68,9 @@ #include #include - -#include -#include -#include -#include -#include -#include -#include -#include #include + #include #if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON) @@ -545,14 +537,8 @@ void PCB_EDIT_FRAME::setupTools() m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager ); // Register tools - m_toolManager->RegisterTool( new SELECTION_TOOL ); - m_toolManager->RegisterTool( new ROUTER_TOOL ); - m_toolManager->RegisterTool( new EDIT_TOOL ); - m_toolManager->RegisterTool( new DRAWING_TOOL ); - m_toolManager->RegisterTool( new POINT_EDITOR ); - m_toolManager->RegisterTool( new PCBNEW_CONTROL ); - m_toolManager->RegisterTool( new PCB_EDITOR_CONTROL ); - m_toolManager->RegisterTool( new PLACEMENT_TOOL ); + registerAllTools ( m_toolManager ); + m_toolManager->ResetTools( TOOL_BASE::RUN ); // Run the selection tool, it is supposed to be always active diff --git a/pcbnew/tools/common_actions.h b/pcbnew/tools/common_actions.h index 73849a755e..1c3b690eab 100644 --- a/pcbnew/tools/common_actions.h +++ b/pcbnew/tools/common_actions.h @@ -22,10 +22,14 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifndef __COMMON_ACTIONS_H +#define __COMMON_ACTIONS_H + #include #include class TOOL_EVENT; +class TOOL_MANAGER; /** * Class COMMON_ACTIONS @@ -241,3 +245,7 @@ public: */ static boost::optional TranslateLegacyId( int aId ); }; + +void registerAllTools ( TOOL_MANAGER *aToolManager ); + +#endif