Loading common/tool/action_manager.cpp +2 −9 Original line number Original line Diff line number Diff line Loading @@ -44,8 +44,6 @@ ACTION_MANAGER::~ACTION_MANAGER() void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction ) void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction ) { { // Check if the TOOL_ACTION was not registered before assert( aAction->GetId() == -1 ); // TOOL_ACTIONs are supposed to be named [appName.]toolName.actionName (with dots between) // TOOL_ACTIONs are supposed to be named [appName.]toolName.actionName (with dots between) // action name without specifying at least toolName is not valid // action name without specifying at least toolName is not valid assert( aAction->GetName().find( '.', 0 ) != std::string::npos ); assert( aAction->GetName().find( '.', 0 ) != std::string::npos ); Loading @@ -54,15 +52,14 @@ void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction ) assert( m_actionNameIndex.find( aAction->m_name ) == m_actionNameIndex.end() ); assert( m_actionNameIndex.find( aAction->m_name ) == m_actionNameIndex.end() ); assert( m_actionIdIndex.find( aAction->m_id ) == m_actionIdIndex.end() ); assert( m_actionIdIndex.find( aAction->m_id ) == m_actionIdIndex.end() ); aAction->setId( MakeActionId( aAction->m_name ) ); if( aAction->m_id == -1 ) aAction->m_id = MakeActionId( aAction->m_name ); m_actionNameIndex[aAction->m_name] = aAction; m_actionNameIndex[aAction->m_name] = aAction; m_actionIdIndex[aAction->m_id] = aAction; m_actionIdIndex[aAction->m_id] = aAction; if( aAction->HasHotKey() ) if( aAction->HasHotKey() ) m_actionHotKeys[aAction->m_currentHotKey].push_back( aAction ); m_actionHotKeys[aAction->m_currentHotKey].push_back( aAction ); aAction->setActionMgr( this ); } } Loading @@ -71,10 +68,6 @@ void ACTION_MANAGER::UnregisterAction( TOOL_ACTION* aAction ) m_actionNameIndex.erase( aAction->m_name ); m_actionNameIndex.erase( aAction->m_name ); m_actionIdIndex.erase( aAction->m_id ); m_actionIdIndex.erase( aAction->m_id ); // Indicate that the ACTION_MANAGER no longer care about the object aAction->setActionMgr( NULL ); aAction->setId( -1 ); if( aAction->HasHotKey() ) if( aAction->HasHotKey() ) { { std::list<TOOL_ACTION*>& actions = m_actionHotKeys[aAction->m_currentHotKey]; std::list<TOOL_ACTION*>& actions = m_actionHotKeys[aAction->m_currentHotKey]; Loading common/tool/tool_manager.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -99,6 +99,11 @@ TOOL_MANAGER::TOOL_MANAGER() : m_model( NULL ), m_view( NULL ), m_viewControls( NULL ), m_editFrame( NULL ) m_model( NULL ), m_view( NULL ), m_viewControls( NULL ), m_editFrame( NULL ) { { m_actionMgr = new ACTION_MANAGER( this ); 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/tool_action.h +0 −15 Original line number Original line Diff line number Diff line Loading @@ -189,18 +189,6 @@ public: private: private: friend class ACTION_MANAGER; friend class ACTION_MANAGER; /// Assigns an unique identifier. It is given by an instance of ACTION_MANAGER. void setId( int aId ) { m_id = aId; } /// Assigns ACTION_MANAGER object that handles the TOOL_ACTION. void setActionMgr( ACTION_MANAGER* aManager ) { m_actionMgr = aManager; } /// Name of the action (convention is: app.[tool.]action.name) /// Name of the action (convention is: app.[tool.]action.name) std::string m_name; std::string m_name; Loading @@ -225,9 +213,6 @@ private: /// Unique ID for fast matching. Assigned by ACTION_MANAGER. /// Unique ID for fast matching. Assigned by ACTION_MANAGER. int m_id; int m_id; /// Action manager that handles this TOOL_ACTION. ACTION_MANAGER* m_actionMgr; /// Origin of the action /// Origin of the action // const TOOL_BASE* m_origin; // const TOOL_BASE* m_origin; Loading pcbnew/tools/pcb_tools.cpp +0 −5 Original line number Original line Diff line number Diff line Loading @@ -60,11 +60,6 @@ void PCB_EDIT_FRAME::setupTools() wxCommandEventHandler( PCB_EDIT_FRAME::onGenericCommand ), NULL, this ); wxCommandEventHandler( PCB_EDIT_FRAME::onGenericCommand ), NULL, this ); #endif #endif // Register actions std::list<TOOL_ACTION*>& actionList = m_toolManager->GetActionList(); BOOST_FOREACH( TOOL_ACTION* action, actionList ) m_toolManager->RegisterAction( action ); // Register tools // Register tools m_toolManager->RegisterTool( new SELECTION_TOOL ); m_toolManager->RegisterTool( new SELECTION_TOOL ); m_toolManager->RegisterTool( new ROUTER_TOOL ); m_toolManager->RegisterTool( new ROUTER_TOOL ); Loading Loading
common/tool/action_manager.cpp +2 −9 Original line number Original line Diff line number Diff line Loading @@ -44,8 +44,6 @@ ACTION_MANAGER::~ACTION_MANAGER() void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction ) void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction ) { { // Check if the TOOL_ACTION was not registered before assert( aAction->GetId() == -1 ); // TOOL_ACTIONs are supposed to be named [appName.]toolName.actionName (with dots between) // TOOL_ACTIONs are supposed to be named [appName.]toolName.actionName (with dots between) // action name without specifying at least toolName is not valid // action name without specifying at least toolName is not valid assert( aAction->GetName().find( '.', 0 ) != std::string::npos ); assert( aAction->GetName().find( '.', 0 ) != std::string::npos ); Loading @@ -54,15 +52,14 @@ void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction ) assert( m_actionNameIndex.find( aAction->m_name ) == m_actionNameIndex.end() ); assert( m_actionNameIndex.find( aAction->m_name ) == m_actionNameIndex.end() ); assert( m_actionIdIndex.find( aAction->m_id ) == m_actionIdIndex.end() ); assert( m_actionIdIndex.find( aAction->m_id ) == m_actionIdIndex.end() ); aAction->setId( MakeActionId( aAction->m_name ) ); if( aAction->m_id == -1 ) aAction->m_id = MakeActionId( aAction->m_name ); m_actionNameIndex[aAction->m_name] = aAction; m_actionNameIndex[aAction->m_name] = aAction; m_actionIdIndex[aAction->m_id] = aAction; m_actionIdIndex[aAction->m_id] = aAction; if( aAction->HasHotKey() ) if( aAction->HasHotKey() ) m_actionHotKeys[aAction->m_currentHotKey].push_back( aAction ); m_actionHotKeys[aAction->m_currentHotKey].push_back( aAction ); aAction->setActionMgr( this ); } } Loading @@ -71,10 +68,6 @@ void ACTION_MANAGER::UnregisterAction( TOOL_ACTION* aAction ) m_actionNameIndex.erase( aAction->m_name ); m_actionNameIndex.erase( aAction->m_name ); m_actionIdIndex.erase( aAction->m_id ); m_actionIdIndex.erase( aAction->m_id ); // Indicate that the ACTION_MANAGER no longer care about the object aAction->setActionMgr( NULL ); aAction->setId( -1 ); if( aAction->HasHotKey() ) if( aAction->HasHotKey() ) { { std::list<TOOL_ACTION*>& actions = m_actionHotKeys[aAction->m_currentHotKey]; std::list<TOOL_ACTION*>& actions = m_actionHotKeys[aAction->m_currentHotKey]; Loading
common/tool/tool_manager.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -99,6 +99,11 @@ TOOL_MANAGER::TOOL_MANAGER() : m_model( NULL ), m_view( NULL ), m_viewControls( NULL ), m_editFrame( NULL ) m_model( NULL ), m_view( NULL ), m_viewControls( NULL ), m_editFrame( NULL ) { { m_actionMgr = new ACTION_MANAGER( this ); 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/tool_action.h +0 −15 Original line number Original line Diff line number Diff line Loading @@ -189,18 +189,6 @@ public: private: private: friend class ACTION_MANAGER; friend class ACTION_MANAGER; /// Assigns an unique identifier. It is given by an instance of ACTION_MANAGER. void setId( int aId ) { m_id = aId; } /// Assigns ACTION_MANAGER object that handles the TOOL_ACTION. void setActionMgr( ACTION_MANAGER* aManager ) { m_actionMgr = aManager; } /// Name of the action (convention is: app.[tool.]action.name) /// Name of the action (convention is: app.[tool.]action.name) std::string m_name; std::string m_name; Loading @@ -225,9 +213,6 @@ private: /// Unique ID for fast matching. Assigned by ACTION_MANAGER. /// Unique ID for fast matching. Assigned by ACTION_MANAGER. int m_id; int m_id; /// Action manager that handles this TOOL_ACTION. ACTION_MANAGER* m_actionMgr; /// Origin of the action /// Origin of the action // const TOOL_BASE* m_origin; // const TOOL_BASE* m_origin; Loading
pcbnew/tools/pcb_tools.cpp +0 −5 Original line number Original line Diff line number Diff line Loading @@ -60,11 +60,6 @@ void PCB_EDIT_FRAME::setupTools() wxCommandEventHandler( PCB_EDIT_FRAME::onGenericCommand ), NULL, this ); wxCommandEventHandler( PCB_EDIT_FRAME::onGenericCommand ), NULL, this ); #endif #endif // Register actions std::list<TOOL_ACTION*>& actionList = m_toolManager->GetActionList(); BOOST_FOREACH( TOOL_ACTION* action, actionList ) m_toolManager->RegisterAction( action ); // Register tools // Register tools m_toolManager->RegisterTool( new SELECTION_TOOL ); m_toolManager->RegisterTool( new SELECTION_TOOL ); m_toolManager->RegisterTool( new ROUTER_TOOL ); m_toolManager->RegisterTool( new ROUTER_TOOL ); Loading