Loading common/tool/tool_manager.cpp +10 −14 Original line number Original line Diff line number Diff line Loading @@ -292,21 +292,19 @@ void TOOL_MANAGER::UnregisterAction( TOOL_ACTION* aAction ) } } bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow ) bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* aParam ) { { TOOL_ACTION* action = m_actionMgr->FindAction( aActionName ); TOOL_ACTION* action = m_actionMgr->FindAction( aActionName ); if( action ) if( action ) { if( aNow ) { { TOOL_EVENT event = action->MakeEvent(); TOOL_EVENT event = action->MakeEvent(); event.SetParameter( aParam ); if( aNow ) ProcessEvent( event ); ProcessEvent( event ); } else else { PostEvent( event ); PostEvent( action->MakeEvent() ); } return true; return true; } } Loading @@ -315,17 +313,15 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow ) } } void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow ) void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aParam ) { if( aNow ) { { TOOL_EVENT event = aAction.MakeEvent(); TOOL_EVENT event = aAction.MakeEvent(); event.SetParameter( aParam ); if( aNow ) ProcessEvent( event ); ProcessEvent( event ); } else else { PostEvent( event ); PostEvent( aAction.MakeEvent() ); } } } Loading include/tool/tool_event.h +30 −3 Original line number Original line Diff line number Diff line Loading @@ -165,7 +165,8 @@ public: m_scope( aScope ), m_scope( aScope ), m_mouseButtons( 0 ), m_mouseButtons( 0 ), m_keyCode( 0 ), m_keyCode( 0 ), m_modifiers( 0 ) {} m_modifiers( 0 ), m_param( NULL ) {} TOOL_EVENT( TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam, TOOL_EVENT( TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam, TOOL_ACTION_SCOPE aScope = AS_GLOBAL ) : TOOL_ACTION_SCOPE aScope = AS_GLOBAL ) : Loading @@ -174,7 +175,8 @@ public: m_scope( aScope ), m_scope( aScope ), m_mouseButtons( 0 ), m_mouseButtons( 0 ), m_keyCode( 0 ), m_keyCode( 0 ), m_modifiers( 0 ) m_modifiers( 0 ), m_param( NULL ) { { if( aCategory == TC_MOUSE ) if( aCategory == TC_MOUSE ) { { Loading Loading @@ -202,7 +204,8 @@ public: m_scope( aScope ), m_scope( aScope ), m_mouseButtons( 0 ), m_mouseButtons( 0 ), m_keyCode( 0 ), m_keyCode( 0 ), m_modifiers( 0 ) m_modifiers( 0 ), m_param( NULL ) { { if( aCategory == TC_COMMAND || aCategory == TC_MESSAGE ) if( aCategory == TC_COMMAND || aCategory == TC_MESSAGE ) m_commandStr = aExtraParam; m_commandStr = aExtraParam; Loading Loading @@ -352,6 +355,27 @@ public: */ */ bool IsAction( const TOOL_ACTION* aAction ) const; bool IsAction( const TOOL_ACTION* aAction ) const; /** * Function Parameter() * Returns a non-standard parameter assigned to the event. Its meaning depends on the * target tool. */ void* Parameter() const { return m_param; } /** * Function SetParameter() * Sets a non-standard parameter assigned to the event. Its meaning depends on the * target tool. * @param aParam is the new parameter. */ void SetParameter(void* aParam) { m_param = aParam; } boost::optional<int> GetCommandId() const boost::optional<int> GetCommandId() const { { return m_commandId; return m_commandId; Loading Loading @@ -388,6 +412,9 @@ private: ///> State of key modifierts (Ctrl/Alt/etc.) ///> State of key modifierts (Ctrl/Alt/etc.) int m_modifiers; int m_modifiers; ///> Generic parameter used for passing non-standard data. void* m_param; boost::optional<int> m_commandId; boost::optional<int> m_commandId; boost::optional<std::string> m_commandStr; boost::optional<std::string> m_commandStr; }; }; Loading include/tool/tool_manager.h +6 −2 Original line number Original line Diff line number Diff line Loading @@ -108,9 +108,11 @@ public: * @param aActionName is the name of action to be invoked. * @param aActionName is the name of action to be invoked. * @param aNow decides if the action has to be run immediately or after the current coroutine * @param aNow decides if the action has to be run immediately or after the current coroutine * is preemptied. * is preemptied. * @param aParam is an optional parameter that might be used by the invoked action. Its meaning * depends on the action. * @return False if the action was not found. * @return False if the action was not found. */ */ bool RunAction( const std::string& aActionName, bool aNow = false ); bool RunAction( const std::string& aActionName, bool aNow = false, void* aParam = NULL ); /** /** * Function RunAction() * Function RunAction() Loading @@ -119,8 +121,10 @@ public: * @param aAction is the action to be invoked. * @param aAction is the action to be invoked. * @param aNow decides if the action has to be run immediately or after the current coroutine * @param aNow decides if the action has to be run immediately or after the current coroutine * is preemptied. * is preemptied. * @param aParam is an optional parameter that might be used by the invoked action. Its meaning * depends on the action. */ */ void RunAction( const TOOL_ACTION& aAction, bool aNow = false ); void RunAction( const TOOL_ACTION& aAction, bool aNow = false, void* aParam = NULL ); /** /** * Function FindTool() * Function FindTool() Loading Loading
common/tool/tool_manager.cpp +10 −14 Original line number Original line Diff line number Diff line Loading @@ -292,21 +292,19 @@ void TOOL_MANAGER::UnregisterAction( TOOL_ACTION* aAction ) } } bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow ) bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* aParam ) { { TOOL_ACTION* action = m_actionMgr->FindAction( aActionName ); TOOL_ACTION* action = m_actionMgr->FindAction( aActionName ); if( action ) if( action ) { if( aNow ) { { TOOL_EVENT event = action->MakeEvent(); TOOL_EVENT event = action->MakeEvent(); event.SetParameter( aParam ); if( aNow ) ProcessEvent( event ); ProcessEvent( event ); } else else { PostEvent( event ); PostEvent( action->MakeEvent() ); } return true; return true; } } Loading @@ -315,17 +313,15 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow ) } } void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow ) void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aParam ) { if( aNow ) { { TOOL_EVENT event = aAction.MakeEvent(); TOOL_EVENT event = aAction.MakeEvent(); event.SetParameter( aParam ); if( aNow ) ProcessEvent( event ); ProcessEvent( event ); } else else { PostEvent( event ); PostEvent( aAction.MakeEvent() ); } } } Loading
include/tool/tool_event.h +30 −3 Original line number Original line Diff line number Diff line Loading @@ -165,7 +165,8 @@ public: m_scope( aScope ), m_scope( aScope ), m_mouseButtons( 0 ), m_mouseButtons( 0 ), m_keyCode( 0 ), m_keyCode( 0 ), m_modifiers( 0 ) {} m_modifiers( 0 ), m_param( NULL ) {} TOOL_EVENT( TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam, TOOL_EVENT( TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam, TOOL_ACTION_SCOPE aScope = AS_GLOBAL ) : TOOL_ACTION_SCOPE aScope = AS_GLOBAL ) : Loading @@ -174,7 +175,8 @@ public: m_scope( aScope ), m_scope( aScope ), m_mouseButtons( 0 ), m_mouseButtons( 0 ), m_keyCode( 0 ), m_keyCode( 0 ), m_modifiers( 0 ) m_modifiers( 0 ), m_param( NULL ) { { if( aCategory == TC_MOUSE ) if( aCategory == TC_MOUSE ) { { Loading Loading @@ -202,7 +204,8 @@ public: m_scope( aScope ), m_scope( aScope ), m_mouseButtons( 0 ), m_mouseButtons( 0 ), m_keyCode( 0 ), m_keyCode( 0 ), m_modifiers( 0 ) m_modifiers( 0 ), m_param( NULL ) { { if( aCategory == TC_COMMAND || aCategory == TC_MESSAGE ) if( aCategory == TC_COMMAND || aCategory == TC_MESSAGE ) m_commandStr = aExtraParam; m_commandStr = aExtraParam; Loading Loading @@ -352,6 +355,27 @@ public: */ */ bool IsAction( const TOOL_ACTION* aAction ) const; bool IsAction( const TOOL_ACTION* aAction ) const; /** * Function Parameter() * Returns a non-standard parameter assigned to the event. Its meaning depends on the * target tool. */ void* Parameter() const { return m_param; } /** * Function SetParameter() * Sets a non-standard parameter assigned to the event. Its meaning depends on the * target tool. * @param aParam is the new parameter. */ void SetParameter(void* aParam) { m_param = aParam; } boost::optional<int> GetCommandId() const boost::optional<int> GetCommandId() const { { return m_commandId; return m_commandId; Loading Loading @@ -388,6 +412,9 @@ private: ///> State of key modifierts (Ctrl/Alt/etc.) ///> State of key modifierts (Ctrl/Alt/etc.) int m_modifiers; int m_modifiers; ///> Generic parameter used for passing non-standard data. void* m_param; boost::optional<int> m_commandId; boost::optional<int> m_commandId; boost::optional<std::string> m_commandStr; boost::optional<std::string> m_commandStr; }; }; Loading
include/tool/tool_manager.h +6 −2 Original line number Original line Diff line number Diff line Loading @@ -108,9 +108,11 @@ public: * @param aActionName is the name of action to be invoked. * @param aActionName is the name of action to be invoked. * @param aNow decides if the action has to be run immediately or after the current coroutine * @param aNow decides if the action has to be run immediately or after the current coroutine * is preemptied. * is preemptied. * @param aParam is an optional parameter that might be used by the invoked action. Its meaning * depends on the action. * @return False if the action was not found. * @return False if the action was not found. */ */ bool RunAction( const std::string& aActionName, bool aNow = false ); bool RunAction( const std::string& aActionName, bool aNow = false, void* aParam = NULL ); /** /** * Function RunAction() * Function RunAction() Loading @@ -119,8 +121,10 @@ public: * @param aAction is the action to be invoked. * @param aAction is the action to be invoked. * @param aNow decides if the action has to be run immediately or after the current coroutine * @param aNow decides if the action has to be run immediately or after the current coroutine * is preemptied. * is preemptied. * @param aParam is an optional parameter that might be used by the invoked action. Its meaning * depends on the action. */ */ void RunAction( const TOOL_ACTION& aAction, bool aNow = false ); void RunAction( const TOOL_ACTION& aAction, bool aNow = false, void* aParam = NULL ); /** /** * Function FindTool() * Function FindTool() Loading