Moved the list of TOOL_ACTIONs to ACTION_MANAGER.
This commit is contained in:
parent
1cd3cfa225
commit
99e5228948
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -26,10 +26,12 @@
|
|||
#ifndef __CONTEXT_MENU_H
|
||||
#define __CONTEXT_MENU_H
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include <wx/menu.h>
|
||||
#include <tool/tool_action.h>
|
||||
#include <map>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
class TOOL_INTERACTIVE;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_event.h>
|
||||
|
||||
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
|
||||
{
|
||||
|
|
|
@ -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<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:
|
||||
struct TOOL_STATE;
|
||||
typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> TRANSITION;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <pcbnew.h>
|
||||
|
||||
#include <tools/common_actions.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
|
||||
/* Execute a remote command send by Eeschema via a socket,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <dialogs/dialog_pns_length_tuning_settings.h>
|
||||
|
||||
#include <tool/context_menu.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/common_actions.h>
|
||||
|
||||
#include "pns_segment.h"
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <base_units.h>
|
||||
|
||||
#include <tool/context_menu.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/common_actions.h>
|
||||
|
||||
#include <ratsnest_data.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <tool/action_manager.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <bitmaps.h>
|
||||
#include <wx/defs.h>
|
||||
|
||||
// These members are static in class COMMON_ACTIONS: Build them here:
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "module_tools.h"
|
||||
#include "selection_tool.h"
|
||||
#include "common_actions.h"
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <view/view_controls.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "pcb_editor_control.h"
|
||||
#include "common_actions.h"
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
#include "selection_tool.h"
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "placement_tool.h"
|
||||
#include "common_actions.h"
|
||||
#include "selection_tool.h"
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
#include <wxPcbStruct.h>
|
||||
#include <class_board.h>
|
||||
|
|
Loading…
Reference in New Issue