diff --git a/common/tool/action_manager.cpp b/common/tool/action_manager.cpp index a56637c5d4..3ad778605b 100644 --- a/common/tool/action_manager.cpp +++ b/common/tool/action_manager.cpp @@ -32,6 +32,10 @@ ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) : m_toolMgr( aToolManager ) { + // Register known actions + std::list& actionList = GetActionList(); + BOOST_FOREACH( TOOL_ACTION* action, actionList ) + RegisterAction( action ); } diff --git a/common/tool/tool_action.cpp b/common/tool/tool_action.cpp index 4d1fd9d658..1ae327a907 100644 --- a/common/tool/tool_action.cpp +++ b/common/tool/tool_action.cpp @@ -23,6 +23,24 @@ */ #include +#include + +TOOL_ACTION::TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope, + int aDefaultHotKey, const wxString aMenuItem, const wxString& aMenuDesc, + const BITMAP_OPAQUE* aIcon, TOOL_ACTION_FLAGS aFlags, void* aParam ) : + m_name( aName ), m_scope( aScope ), m_defaultHotKey( aDefaultHotKey ), + m_currentHotKey( aDefaultHotKey ), m_menuItem( aMenuItem ), m_menuDescription( aMenuDesc ), + m_icon( aIcon ), m_id( -1 ), m_flags( aFlags ), m_param( aParam ) +{ + ACTION_MANAGER::GetActionList().push_back( this ); +} + + +TOOL_ACTION::~TOOL_ACTION() +{ + ACTION_MANAGER::GetActionList().remove( this ); +} + std::string TOOL_ACTION::GetToolName() const { diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index 116664aa30..332db29c4d 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -202,11 +202,6 @@ TOOL_MANAGER::TOOL_MANAGER() : m_passEvent( false ) { m_actionMgr = new ACTION_MANAGER( this ); - - // Register known actions - std::list& actionList = GetActionList(); - BOOST_FOREACH( TOOL_ACTION* action, actionList ) - RegisterAction( action ); } diff --git a/include/tool/action_manager.h b/include/tool/action_manager.h index 7c4c52cd4d..89d03500a8 100644 --- a/include/tool/action_manager.h +++ b/include/tool/action_manager.h @@ -90,6 +90,19 @@ public: */ bool RunHotKey( int aHotKey ) const; + /** + * Returns list of TOOL_ACTIONs. TOOL_ACTIONs add themselves to the list upon their + * creation. + * @return List of TOOL_ACTIONs. + */ + static std::list& GetActionList() + { + // TODO I am afraid this approach won't work when we reach multitab version of kicad. + static std::list actionList; + + return actionList; + } + private: ///> Tool manager needed to run actions TOOL_MANAGER* m_toolMgr; diff --git a/include/tool/context_menu.h b/include/tool/context_menu.h index 23a643004d..faf94170a4 100644 --- a/include/tool/context_menu.h +++ b/include/tool/context_menu.h @@ -26,10 +26,12 @@ #ifndef __CONTEXT_MENU_H #define __CONTEXT_MENU_H +#include +#include +#include + #include #include -#include -#include class TOOL_INTERACTIVE; diff --git a/include/tool/tool_action.h b/include/tool/tool_action.h index ff9de67d5a..ba7a5df71a 100644 --- a/include/tool/tool_action.h +++ b/include/tool/tool_action.h @@ -29,7 +29,7 @@ #include #include -#include +#include struct BITMAP_OPAQUE; @@ -49,18 +49,9 @@ public: TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope = AS_CONTEXT, int aDefaultHotKey = 0, const wxString aMenuItem = wxEmptyString, const wxString& aMenuDesc = wxEmptyString, const BITMAP_OPAQUE* aIcon = NULL, - TOOL_ACTION_FLAGS aFlags = AF_NONE, void* aParam = NULL ) : - m_name( aName ), m_scope( aScope ), m_defaultHotKey( aDefaultHotKey ), - m_currentHotKey( aDefaultHotKey ), m_menuItem( aMenuItem ), m_menuDescription( aMenuDesc ), - m_icon( aIcon ), m_id( -1 ), m_flags( aFlags ), m_param( aParam ) - { - TOOL_MANAGER::GetActionList().push_back( this ); - } + TOOL_ACTION_FLAGS aFlags = AF_NONE, void* aParam = NULL ); - ~TOOL_ACTION() - { - TOOL_MANAGER::GetActionList().remove( this ); - } + ~TOOL_ACTION(); bool operator==( const TOOL_ACTION& aRhs ) const { diff --git a/include/tool/tool_manager.h b/include/tool/tool_manager.h index aeb19823d0..d0886d88ed 100644 --- a/include/tool/tool_manager.h +++ b/include/tool/tool_manager.h @@ -308,19 +308,6 @@ public: */ std::string GetClipboard() const; - /** - * Returns list of TOOL_ACTIONs. TOOL_ACTIONs add themselves to the list upon their - * creation. - * @return List of TOOL_ACTIONs. - */ - static std::list& GetActionList() - { - // TODO I am afraid this approach won't work when we reach multitab version of kicad. - static std::list actionList; - - return actionList; - } - private: struct TOOL_STATE; typedef std::pair TRANSITION; diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 9b236cc41e..37566fd0a6 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -26,6 +26,7 @@ #include #include +#include #include /* Execute a remote command send by Eeschema via a socket, diff --git a/pcbnew/router/length_tuner_tool.cpp b/pcbnew/router/length_tuner_tool.cpp index 00ec4c2bd7..31877b997a 100644 --- a/pcbnew/router/length_tuner_tool.cpp +++ b/pcbnew/router/length_tuner_tool.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include "pns_segment.h" diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 3014fc7268..510c315b25 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -40,6 +40,7 @@ #include #include +#include #include #include diff --git a/pcbnew/tools/common_actions.cpp b/pcbnew/tools/common_actions.cpp index 8f80404e4f..83f935f62d 100644 --- a/pcbnew/tools/common_actions.cpp +++ b/pcbnew/tools/common_actions.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include // These members are static in class COMMON_ACTIONS: Build them here: diff --git a/pcbnew/tools/common_actions.h b/pcbnew/tools/common_actions.h index 106221b0a1..92a0272e7d 100644 --- a/pcbnew/tools/common_actions.h +++ b/pcbnew/tools/common_actions.h @@ -294,6 +294,6 @@ public: static boost::optional TranslateLegacyId( int aId ); }; -void registerAllTools ( TOOL_MANAGER *aToolManager ); +void registerAllTools( TOOL_MANAGER* aToolManager ); #endif diff --git a/pcbnew/tools/module_tools.cpp b/pcbnew/tools/module_tools.cpp index ece3429d8b..36e23fc403 100644 --- a/pcbnew/tools/module_tools.cpp +++ b/pcbnew/tools/module_tools.cpp @@ -25,6 +25,7 @@ #include "module_tools.h" #include "selection_tool.h" #include "common_actions.h" +#include #include #include diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 84b0833b58..b1e3f66347 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -26,6 +26,7 @@ #include "pcb_editor_control.h" #include "common_actions.h" +#include #include "selection_tool.h" diff --git a/pcbnew/tools/placement_tool.cpp b/pcbnew/tools/placement_tool.cpp index 435e4d352e..fc9a71a8af 100644 --- a/pcbnew/tools/placement_tool.cpp +++ b/pcbnew/tools/placement_tool.cpp @@ -25,6 +25,7 @@ #include "placement_tool.h" #include "common_actions.h" #include "selection_tool.h" +#include #include #include