2013-08-02 14:46:53 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 CERN
|
|
|
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
2013-09-27 16:51:21 +00:00
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
2013-08-02 14:46:53 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TOOL_MANAGER_H
|
|
|
|
#define __TOOL_MANAGER_H
|
|
|
|
|
|
|
|
#include <deque>
|
2014-07-09 09:59:24 +00:00
|
|
|
#include <typeinfo>
|
2014-07-09 11:50:27 +00:00
|
|
|
#include <map>
|
2013-08-02 14:46:53 +00:00
|
|
|
|
|
|
|
#include <math/vector2d.h>
|
|
|
|
|
|
|
|
#include <tool/tool_base.h>
|
|
|
|
|
|
|
|
class TOOL_BASE;
|
2013-09-27 16:51:21 +00:00
|
|
|
class ACTION_MANAGER;
|
2013-08-02 14:46:53 +00:00
|
|
|
class CONTEXT_MENU;
|
|
|
|
class wxWindow;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class TOOL_MANAGER.
|
|
|
|
* Master controller class:
|
|
|
|
* - registers editing tools
|
|
|
|
* - pumps UI events to tools requesting them
|
|
|
|
* - manages tool state machines (transitions and wait requests)
|
|
|
|
*/
|
|
|
|
class TOOL_MANAGER
|
|
|
|
{
|
2013-08-08 12:59:59 +00:00
|
|
|
public:
|
2014-05-14 14:29:53 +00:00
|
|
|
TOOL_MANAGER();
|
2014-03-21 09:40:50 +00:00
|
|
|
|
2013-08-08 12:59:59 +00:00
|
|
|
~TOOL_MANAGER();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generates an unique ID from for a tool with given name.
|
|
|
|
*/
|
|
|
|
static TOOL_ID MakeToolId( const std::string& aToolName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function RegisterTool()
|
|
|
|
* Adds a tool to the manager set and sets it up. Called once for
|
|
|
|
* each tool during application initialization.
|
|
|
|
* @param aTool: tool to be added. Ownership is transferred.
|
|
|
|
*/
|
|
|
|
void RegisterTool( TOOL_BASE* aTool );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function InvokeTool()
|
2013-09-19 15:02:57 +00:00
|
|
|
* Calls a tool by sending a tool activation event to tool of given ID.
|
2013-09-06 14:01:46 +00:00
|
|
|
*
|
2013-09-19 15:02:57 +00:00
|
|
|
* @param aToolId is the ID number of the requested tool.
|
2013-09-06 14:01:46 +00:00
|
|
|
* @return True if the requested tool was invoked successfully.
|
2013-08-08 12:59:59 +00:00
|
|
|
*/
|
2013-08-30 08:37:26 +00:00
|
|
|
bool InvokeTool( TOOL_ID aToolId );
|
2013-08-08 12:59:59 +00:00
|
|
|
|
2013-09-19 15:02:57 +00:00
|
|
|
/**
|
|
|
|
* Function InvokeTool()
|
|
|
|
* Calls a tool by sending a tool activation event to tool of given name.
|
|
|
|
*
|
|
|
|
* @param aToolName is the name of the requested tool.
|
|
|
|
* @return True if the requested tool was invoked successfully.
|
|
|
|
*/
|
|
|
|
bool InvokeTool( const std::string& aToolName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function RegisterAction()
|
|
|
|
* Registers an action that can be used to control tools (eg. invoke, trigger specific
|
|
|
|
* behaviours).
|
|
|
|
*
|
|
|
|
* @param aAction is the action to be registered.
|
|
|
|
*/
|
2013-09-27 16:51:21 +00:00
|
|
|
void RegisterAction( TOOL_ACTION* aAction );
|
2013-09-19 15:02:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function UnregisterAction()
|
|
|
|
* Unregisters an action, so it is no longer active.
|
|
|
|
*
|
|
|
|
* @param aAction is the action to be unregistered.
|
|
|
|
*/
|
2013-09-27 16:51:21 +00:00
|
|
|
void UnregisterAction( TOOL_ACTION* aAction );
|
2013-08-08 12:59:59 +00:00
|
|
|
|
2013-12-03 14:41:41 +00:00
|
|
|
/**
|
|
|
|
* Function RunAction()
|
2014-02-28 14:46:05 +00:00
|
|
|
* Runs the specified action. The common format for action names is "application.ToolName.Action".
|
2013-12-03 14:41:41 +00:00
|
|
|
*
|
|
|
|
* @param aActionName is the name of action to be invoked.
|
2014-07-09 14:25:50 +00:00
|
|
|
* @param aNow decides if the action has to be run immediately or after the current coroutine
|
|
|
|
* is preemptied.
|
2014-11-21 10:28:34 +00:00
|
|
|
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning
|
|
|
|
* depends on the action.
|
2014-07-09 14:25:50 +00:00
|
|
|
* @return False if the action was not found.
|
2013-12-03 14:41:41 +00:00
|
|
|
*/
|
2014-11-21 10:28:34 +00:00
|
|
|
bool RunAction( const std::string& aActionName, bool aNow = false, void* aParam = NULL );
|
2013-12-03 14:41:41 +00:00
|
|
|
|
2014-02-28 14:46:05 +00:00
|
|
|
/**
|
|
|
|
* Function RunAction()
|
|
|
|
* Runs the specified action.
|
|
|
|
*
|
|
|
|
* @param aAction is the action to be invoked.
|
2014-07-09 14:25:50 +00:00
|
|
|
* @param aNow decides if the action has to be run immediately or after the current coroutine
|
|
|
|
* is preemptied.
|
2014-11-21 10:28:34 +00:00
|
|
|
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning
|
|
|
|
* depends on the action.
|
2014-02-28 14:46:05 +00:00
|
|
|
*/
|
2014-11-21 10:28:34 +00:00
|
|
|
void RunAction( const TOOL_ACTION& aAction, bool aNow = false, void* aParam = NULL );
|
2014-02-28 14:46:05 +00:00
|
|
|
|
2013-08-08 12:59:59 +00:00
|
|
|
/**
|
|
|
|
* Function FindTool()
|
2013-09-19 15:02:57 +00:00
|
|
|
* Searches for a tool with given ID.
|
2013-09-06 14:01:46 +00:00
|
|
|
*
|
2013-09-19 15:02:57 +00:00
|
|
|
* @param aId is the ID number of the requested tool.
|
|
|
|
* @return Pointer to the requested tool or NULL in case of failure.
|
2013-08-08 12:59:59 +00:00
|
|
|
*/
|
2013-08-19 07:47:36 +00:00
|
|
|
TOOL_BASE* FindTool( int aId ) const;
|
2013-09-19 15:02:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function FindTool()
|
|
|
|
* Searches for a tool with given name.
|
|
|
|
*
|
|
|
|
* @param aName is the name of the requested tool.
|
|
|
|
* @return Pointer to the requested tool or NULL in case of failure.
|
|
|
|
*/
|
2013-08-19 07:47:36 +00:00
|
|
|
TOOL_BASE* FindTool( const std::string& aName ) const;
|
2013-08-08 12:59:59 +00:00
|
|
|
|
2014-07-09 09:59:24 +00:00
|
|
|
/*
|
|
|
|
* Function GetTool()
|
|
|
|
* Returns the tool of given type or NULL if there is no such tool registered.
|
|
|
|
*/
|
|
|
|
template<typename T>
|
|
|
|
T* GetTool()
|
|
|
|
{
|
2014-07-09 11:50:27 +00:00
|
|
|
std::map<const char*, TOOL_BASE*>::iterator tool = m_toolTypes.find( typeid( T ).name() );
|
2014-07-09 09:59:24 +00:00
|
|
|
|
|
|
|
if( tool != m_toolTypes.end() )
|
|
|
|
return static_cast<T*>( tool->second );
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-08-08 12:59:59 +00:00
|
|
|
/**
|
2013-12-09 09:42:38 +00:00
|
|
|
* Function ResetTools()
|
|
|
|
* Resets all tools (i.e. calls their Reset() method).
|
2013-08-08 12:59:59 +00:00
|
|
|
*/
|
2013-12-09 09:42:38 +00:00
|
|
|
void ResetTools( TOOL_BASE::RESET_REASON aReason );
|
2013-08-08 12:59:59 +00:00
|
|
|
|
|
|
|
/**
|
2014-07-09 14:25:50 +00:00
|
|
|
* Propagates an event to tools that requested events of matching type(s).
|
|
|
|
* @param aEvent is the event to be processed.
|
2013-08-08 12:59:59 +00:00
|
|
|
*/
|
|
|
|
bool ProcessEvent( TOOL_EVENT& aEvent );
|
|
|
|
|
2014-07-09 14:25:50 +00:00
|
|
|
/**
|
|
|
|
* Puts an event to the event queue to be processed at the end of event processing cycle.
|
|
|
|
* @param aEvent is the event to be put into the queue.
|
|
|
|
*/
|
|
|
|
inline void PostEvent( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
m_eventQueue.push_back( aEvent );
|
|
|
|
}
|
|
|
|
|
2013-08-08 12:59:59 +00:00
|
|
|
/**
|
|
|
|
* Sets the work environment (model, view, view controls and the parent window).
|
|
|
|
* These are made available to the tool. Called by the parent frame (PCB_EDIT_FRAME)
|
2013-09-06 14:01:46 +00:00
|
|
|
* when the board is set up.
|
2013-08-08 12:59:59 +00:00
|
|
|
*/
|
2013-10-14 14:13:35 +00:00
|
|
|
void SetEnvironment( EDA_ITEM* aModel, KIGFX::VIEW* aView,
|
|
|
|
KIGFX::VIEW_CONTROLS* aViewControls, wxWindow* aFrame );
|
2013-08-08 12:59:59 +00:00
|
|
|
|
|
|
|
/* Accessors for the environment objects (view, model, etc.) */
|
2013-10-14 14:13:35 +00:00
|
|
|
KIGFX::VIEW* GetView() const
|
2013-08-08 12:59:59 +00:00
|
|
|
{
|
|
|
|
return m_view;
|
|
|
|
}
|
|
|
|
|
2014-07-09 14:25:50 +00:00
|
|
|
inline KIGFX::VIEW_CONTROLS* GetViewControls() const
|
2013-08-08 12:59:59 +00:00
|
|
|
{
|
|
|
|
return m_viewControls;
|
|
|
|
}
|
|
|
|
|
2014-07-09 14:25:50 +00:00
|
|
|
inline EDA_ITEM* GetModel() const
|
2013-08-08 12:59:59 +00:00
|
|
|
{
|
|
|
|
return m_model;
|
|
|
|
}
|
|
|
|
|
2014-07-09 14:25:50 +00:00
|
|
|
inline wxWindow* GetEditFrame() const
|
2013-08-08 12:59:59 +00:00
|
|
|
{
|
|
|
|
return m_editFrame;
|
|
|
|
}
|
|
|
|
|
2014-04-04 09:50:15 +00:00
|
|
|
/**
|
|
|
|
* Returns id of the tool that is on the top of the active tools stack
|
|
|
|
* (was invoked the most recently).
|
|
|
|
* @return Id of the currently used tool.
|
|
|
|
*/
|
2014-07-09 14:25:50 +00:00
|
|
|
inline int GetCurrentToolId() const
|
2014-04-04 09:50:15 +00:00
|
|
|
{
|
|
|
|
return m_activeTools.front();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the tool that is on the top of the active tools stack
|
|
|
|
* (was invoked the most recently).
|
|
|
|
* @return Pointer to the currently used tool.
|
|
|
|
*/
|
2014-07-09 14:25:50 +00:00
|
|
|
inline TOOL_BASE* GetCurrentTool() const
|
2014-04-04 09:50:15 +00:00
|
|
|
{
|
|
|
|
return FindTool( GetCurrentToolId() );
|
|
|
|
}
|
|
|
|
|
2014-04-09 15:05:05 +00:00
|
|
|
/**
|
|
|
|
* Returns priority of a given tool. Higher number means that the tool is closer to the
|
|
|
|
* beginning of the active tools queue (i.e. receives events earlier, tools with lower
|
|
|
|
* priority receive events later).
|
|
|
|
* @param aToolId is the id of queried tool.
|
|
|
|
* @return The priority of a given tool. If returned number is negative, then it means that
|
|
|
|
* the tool id is invalid or the tool is not active.
|
|
|
|
*/
|
|
|
|
int GetPriority( int aToolId ) const;
|
|
|
|
|
2013-08-08 12:59:59 +00:00
|
|
|
/**
|
|
|
|
* Defines a state transition - the events that cause a given handler method in the tool
|
|
|
|
* to be called. Called by TOOL_INTERACTIVE::Go(). May be called from a coroutine context.
|
|
|
|
*/
|
|
|
|
void ScheduleNextState( TOOL_BASE* aTool, TOOL_STATE_FUNC& aHandler,
|
2013-10-14 14:13:35 +00:00
|
|
|
const TOOL_EVENT_LIST& aConditions );
|
2013-08-08 12:59:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pauses execution of a given tool until one or more events matching aConditions arrives.
|
|
|
|
* The pause/resume operation is done through COROUTINE object.
|
|
|
|
* Called only from coroutines.
|
|
|
|
*/
|
|
|
|
boost::optional<TOOL_EVENT> ScheduleWait( TOOL_BASE* aTool,
|
2013-10-14 14:13:35 +00:00
|
|
|
const TOOL_EVENT_LIST& aConditions );
|
2013-08-08 12:59:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets behaviour of the tool's context popup menu.
|
2014-11-02 16:25:04 +00:00
|
|
|
* @param aTool - the parent tool
|
2013-08-08 12:59:59 +00:00
|
|
|
* @param aMenu - the menu structure, defined by the tool
|
|
|
|
* @param aTrigger - when the menu is activated:
|
2014-11-02 16:25:04 +00:00
|
|
|
* CMENU_NOW: opens the menu right now
|
|
|
|
* CMENU_BUTTON: opens the menu when RMB is pressed
|
|
|
|
* CMENU_OFF: menu is disabled.
|
2013-08-08 12:59:59 +00:00
|
|
|
* May be called from a coroutine context.
|
|
|
|
*/
|
|
|
|
void ScheduleContextMenu( TOOL_BASE* aTool, CONTEXT_MENU* aMenu,
|
2013-10-14 14:13:35 +00:00
|
|
|
CONTEXT_MENU_TRIGGER aTrigger );
|
2013-08-08 12:59:59 +00:00
|
|
|
|
2013-08-30 08:37:26 +00:00
|
|
|
/**
|
2013-09-04 14:25:57 +00:00
|
|
|
* Allows a tool to pass the already handled event to the next tool on the stack.
|
2013-08-30 08:37:26 +00:00
|
|
|
*/
|
|
|
|
void PassEvent()
|
|
|
|
{
|
|
|
|
m_passEvent = true;
|
|
|
|
}
|
2013-08-08 12:59:59 +00:00
|
|
|
|
2014-07-09 12:01:07 +00:00
|
|
|
/**
|
|
|
|
* Stores an information to the system clipboard.
|
|
|
|
* @param aText is the information to be stored.
|
|
|
|
* @return False if error occured.
|
|
|
|
*/
|
|
|
|
bool SaveClipboard( const std::string& aText );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the information currently stored in the system clipboard. If data stored in the
|
|
|
|
* clipboard is in non-text format, empty string is returned.
|
|
|
|
*/
|
|
|
|
std::string GetClipboard() const;
|
|
|
|
|
2014-05-14 14:29:53 +00:00
|
|
|
/**
|
|
|
|
* 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;
|
2014-03-21 09:40:50 +00:00
|
|
|
|
2014-05-14 14:29:53 +00:00
|
|
|
return actionList;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2013-09-02 12:21:12 +00:00
|
|
|
struct TOOL_STATE;
|
|
|
|
typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> TRANSITION;
|
2013-08-08 12:59:59 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
/**
|
|
|
|
* Function dispatchInternal
|
|
|
|
* Passes an event at first to the active tools, then to all others.
|
|
|
|
*/
|
2013-08-30 08:37:26 +00:00
|
|
|
void dispatchInternal( TOOL_EVENT& aEvent );
|
2013-09-19 15:02:57 +00:00
|
|
|
|
2013-09-27 16:51:21 +00:00
|
|
|
/**
|
|
|
|
* Function dispatchStandardEvents()
|
|
|
|
* Handles specific events, that are intended for TOOL_MANAGER rather than tools.
|
2014-11-02 16:25:04 +00:00
|
|
|
* @param aEvent is the event to be processed.
|
2013-09-27 16:51:21 +00:00
|
|
|
* @return False if the event was processed and should not go any further.
|
|
|
|
*/
|
|
|
|
bool dispatchStandardEvents( TOOL_EVENT& aEvent );
|
|
|
|
|
2013-09-19 15:02:57 +00:00
|
|
|
/**
|
|
|
|
* Function dispatchActivation()
|
|
|
|
* Checks if it is a valid activation event and invokes a proper tool.
|
|
|
|
* @param aEvent is an event to be tested.
|
|
|
|
* @return True if a tool was invoked, false otherwise.
|
|
|
|
*/
|
|
|
|
bool dispatchActivation( TOOL_EVENT& aEvent );
|
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
/**
|
|
|
|
* Function dispatchContextMenu()
|
|
|
|
* Handles context menu related events.
|
|
|
|
*/
|
|
|
|
void dispatchContextMenu( TOOL_EVENT& aEvent );
|
|
|
|
|
2013-09-19 15:02:57 +00:00
|
|
|
/**
|
|
|
|
* Function invokeTool()
|
2013-09-27 16:51:21 +00:00
|
|
|
* Invokes a tool by sending a proper event (in contrary to runTool, which makes the tool run
|
|
|
|
* for real).
|
2013-09-19 15:02:57 +00:00
|
|
|
* @param aTool is the tool to be invoked.
|
|
|
|
*/
|
|
|
|
bool invokeTool( TOOL_BASE* aTool );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function runTool()
|
|
|
|
* Makes a tool active, so it can receive events and react to them. Activated tool is pushed
|
|
|
|
* on the active tools stack, so the last activated tool receives events first.
|
|
|
|
*
|
|
|
|
* @param aToolId is the ID number of tool to be run.
|
|
|
|
*/
|
|
|
|
bool runTool( TOOL_ID aToolId );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function runTool()
|
|
|
|
* Makes a tool active, so it can receive events and react to them. Activated tool is pushed
|
|
|
|
* on the active tools stack, so the last activated tool receives events first.
|
|
|
|
*
|
2014-11-02 16:25:04 +00:00
|
|
|
* @param aName is the name of tool to be run.
|
2013-09-19 15:02:57 +00:00
|
|
|
*/
|
|
|
|
bool runTool( const std::string& aName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function runTool()
|
|
|
|
* Makes a tool active, so it can receive events and react to them. Activated tool is pushed
|
|
|
|
* on the active tools stack, so the last activated tool receives events first.
|
|
|
|
*
|
2014-11-02 16:25:04 +00:00
|
|
|
* @param aTool is the tool to be run.
|
2013-09-19 15:02:57 +00:00
|
|
|
*/
|
|
|
|
bool runTool( TOOL_BASE* aTool );
|
|
|
|
|
|
|
|
template <class Parameters>
|
2013-10-14 14:13:35 +00:00
|
|
|
void invokeTool( const std::string& aName, const Parameters& aToolParams );
|
2013-09-19 15:02:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function finishTool()
|
|
|
|
* Deactivates a tool and does the necessary clean up.
|
|
|
|
*
|
|
|
|
* @param aState is the state variable of the tool to be stopped.
|
|
|
|
*/
|
2013-09-02 12:21:12 +00:00
|
|
|
void finishTool( TOOL_STATE* aState );
|
2013-08-30 08:37:26 +00:00
|
|
|
|
2013-09-19 15:02:57 +00:00
|
|
|
/**
|
|
|
|
* Function isRegistered()
|
|
|
|
* Returns information about a tool registration status.
|
|
|
|
*
|
|
|
|
* @param aTool is the tool to be checked.
|
2014-11-02 16:25:04 +00:00
|
|
|
* @return true if the tool is in the registered tools list, false otherwise.
|
2013-09-19 15:02:57 +00:00
|
|
|
*/
|
|
|
|
bool isRegistered( TOOL_BASE* aTool ) const
|
|
|
|
{
|
2013-10-14 14:13:35 +00:00
|
|
|
return m_toolState.count( aTool ) > 0;
|
2013-09-19 15:02:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function isActive()
|
|
|
|
* Returns information about a tool activation status.
|
|
|
|
*
|
|
|
|
* @param aTool is the tool to be checked.
|
|
|
|
* @return True if the tool is on the active tools stack, false otherwise.
|
|
|
|
*/
|
|
|
|
bool isActive( TOOL_BASE* aTool );
|
|
|
|
|
|
|
|
/// Index of registered tools current states, associated by tools' objects.
|
2014-07-09 11:50:27 +00:00
|
|
|
std::map<TOOL_BASE*, TOOL_STATE*> m_toolState;
|
2013-09-19 15:02:57 +00:00
|
|
|
|
|
|
|
/// Index of the registered tools current states, associated by tools' names.
|
2014-07-09 11:50:27 +00:00
|
|
|
std::map<std::string, TOOL_STATE*> m_toolNameIndex;
|
2014-07-09 09:59:24 +00:00
|
|
|
|
|
|
|
/// Index of the registered tools to easily lookup by their type.
|
2014-07-09 11:50:27 +00:00
|
|
|
std::map<const char*, TOOL_BASE*> m_toolTypes;
|
2013-09-19 15:02:57 +00:00
|
|
|
|
|
|
|
/// Index of the registered tools current states, associated by tools' ID numbers.
|
2014-07-09 11:50:27 +00:00
|
|
|
std::map<TOOL_ID, TOOL_STATE*> m_toolIdIndex;
|
2013-09-19 15:02:57 +00:00
|
|
|
|
|
|
|
/// Stack of the active tools
|
2013-08-30 08:37:26 +00:00
|
|
|
std::deque<TOOL_ID> m_activeTools;
|
2013-08-08 12:59:59 +00:00
|
|
|
|
2013-09-27 16:51:21 +00:00
|
|
|
/// Instance of ACTION_MANAGER that handles TOOL_ACTIONs
|
|
|
|
ACTION_MANAGER* m_actionMgr;
|
|
|
|
|
2013-08-08 12:59:59 +00:00
|
|
|
EDA_ITEM* m_model;
|
2013-10-14 14:13:35 +00:00
|
|
|
KIGFX::VIEW* m_view;
|
|
|
|
KIGFX::VIEW_CONTROLS* m_viewControls;
|
2013-08-08 12:59:59 +00:00
|
|
|
wxWindow* m_editFrame;
|
2013-09-19 15:02:57 +00:00
|
|
|
|
2014-07-09 14:25:50 +00:00
|
|
|
/// Queue that stores events to be processed at the end of the event processing cycle.
|
|
|
|
std::list<TOOL_EVENT> m_eventQueue;
|
|
|
|
|
2013-09-19 15:02:57 +00:00
|
|
|
/// Flag saying if the currently processed event should be passed to other tools.
|
2013-08-30 08:37:26 +00:00
|
|
|
bool m_passEvent;
|
2013-08-02 14:46:53 +00:00
|
|
|
};
|
|
|
|
|
2013-08-06 08:30:09 +00:00
|
|
|
#endif
|