Loading common/tool/action_manager.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,10 @@ ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) : m_toolMgr( aToolManager ) { // Register known actions std::list<TOOL_ACTION*>& actionList = GetActionList(); BOOST_FOREACH( TOOL_ACTION* action, actionList ) RegisterAction( action ); } Loading common/tool/tool_action.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,24 @@ */ #include <tool/tool_action.h> #include <tool/action_manager.h> 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 { Loading common/tool/tool_manager.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -202,11 +202,6 @@ TOOL_MANAGER::TOOL_MANAGER() : m_passEvent( false ) { m_actionMgr = new ACTION_MANAGER( this ); // Register known actions std::list<TOOL_ACTION*>& actionList = GetActionList(); BOOST_FOREACH( TOOL_ACTION* action, actionList ) RegisterAction( action ); } Loading include/tool/action_manager.h +13 −0 Original line number Diff line number Diff line Loading @@ -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<TOOL_ACTION*>& GetActionList() { // TODO I am afraid this approach won't work when we reach multitab version of kicad. static std::list<TOOL_ACTION*> actionList; return actionList; } private: ///> Tool manager needed to run actions TOOL_MANAGER* m_toolMgr; Loading include/tool/context_menu.h +4 −2 Original line number Diff line number Diff line Loading @@ -26,11 +26,13 @@ #ifndef __CONTEXT_MENU_H #define __CONTEXT_MENU_H #include <wx/menu.h> #include <tool/tool_action.h> #include <map> #include <list> #include <boost/function.hpp> #include <wx/menu.h> #include <tool/tool_action.h> class TOOL_INTERACTIVE; /** Loading Loading
common/tool/action_manager.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,10 @@ ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) : m_toolMgr( aToolManager ) { // Register known actions std::list<TOOL_ACTION*>& actionList = GetActionList(); BOOST_FOREACH( TOOL_ACTION* action, actionList ) RegisterAction( action ); } Loading
common/tool/tool_action.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,24 @@ */ #include <tool/tool_action.h> #include <tool/action_manager.h> 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 { Loading
common/tool/tool_manager.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -202,11 +202,6 @@ TOOL_MANAGER::TOOL_MANAGER() : m_passEvent( false ) { m_actionMgr = new ACTION_MANAGER( this ); // Register known actions std::list<TOOL_ACTION*>& actionList = GetActionList(); BOOST_FOREACH( TOOL_ACTION* action, actionList ) RegisterAction( action ); } Loading
include/tool/action_manager.h +13 −0 Original line number Diff line number Diff line Loading @@ -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<TOOL_ACTION*>& GetActionList() { // TODO I am afraid this approach won't work when we reach multitab version of kicad. static std::list<TOOL_ACTION*> actionList; return actionList; } private: ///> Tool manager needed to run actions TOOL_MANAGER* m_toolMgr; Loading
include/tool/context_menu.h +4 −2 Original line number Diff line number Diff line Loading @@ -26,11 +26,13 @@ #ifndef __CONTEXT_MENU_H #define __CONTEXT_MENU_H #include <wx/menu.h> #include <tool/tool_action.h> #include <map> #include <list> #include <boost/function.hpp> #include <wx/menu.h> #include <tool/tool_action.h> class TOOL_INTERACTIVE; /** Loading