Added AF_ACTIVATE flag for TOOL_ACTIONs.
Reworked the way of processing events in TOOL_MANAGER class. Added GetCommandStr() for TOOL_EVENT class.
This commit is contained in:
parent
34fbde42fc
commit
94cc845b3f
|
@ -495,15 +495,7 @@ bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
// Check if there is a hotkey associated
|
// Check if there is a hotkey associated
|
||||||
if( m_actionMgr->RunHotKey( aEvent.Modifier() | aEvent.KeyCode() ) )
|
if( m_actionMgr->RunHotKey( aEvent.Modifier() | aEvent.KeyCode() ) )
|
||||||
return false; // hotkey event was handled so it does not go any further
|
return false; // hotkey event was handled so it does not go any further
|
||||||
}
|
|
||||||
else if( aEvent.Action() == TA_ACTIVATE )
|
|
||||||
{
|
|
||||||
// Check if the tool name conforms to the the used tool name format
|
|
||||||
assert( std::count( aEvent.m_commandStr->begin(), aEvent.m_commandStr->end(), '.' ) == 1 );
|
|
||||||
|
|
||||||
dispatchActivation( aEvent );
|
|
||||||
// do not return false, as the event has to go on to the destined tool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -512,41 +504,23 @@ bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
|
bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
std::map<std::string, TOOL_STATE*>::iterator tool = m_toolNameIndex.find( *aEvent.m_commandStr );
|
if( aEvent.IsActivate() )
|
||||||
|
|
||||||
if( tool != m_toolNameIndex.end() )
|
|
||||||
{
|
{
|
||||||
runTool( tool->second->theTool );
|
std::map<std::string, TOOL_STATE*>::iterator tool = m_toolNameIndex.find( *aEvent.m_commandStr );
|
||||||
return true;
|
|
||||||
|
if( tool != m_toolNameIndex.end() )
|
||||||
|
{
|
||||||
|
runTool( tool->second->theTool );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
|
void TOOL_MANAGER::dispatchContextMenu( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
if( !aState->Pop() ) // if there are no other contexts saved on the stack
|
|
||||||
{
|
|
||||||
// find the tool and deactivate it
|
|
||||||
std::deque<TOOL_ID>::iterator tool = std::find( m_activeTools.begin(), m_activeTools.end(),
|
|
||||||
aState->theTool->GetId() );
|
|
||||||
|
|
||||||
if( tool != m_activeTools.end() )
|
|
||||||
m_activeTools.erase( tool );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
|
|
||||||
{
|
|
||||||
// Early dispatch of events destined for the TOOL_MANAGER
|
|
||||||
if( !dispatchStandardEvents( aEvent ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
dispatchInternal( aEvent );
|
|
||||||
|
|
||||||
// popup menu handling
|
|
||||||
BOOST_FOREACH( TOOL_ID toolId, m_activeTools )
|
BOOST_FOREACH( TOOL_ID toolId, m_activeTools )
|
||||||
{
|
{
|
||||||
TOOL_STATE* st = m_toolIdIndex[toolId];
|
TOOL_STATE* st = m_toolIdIndex[toolId];
|
||||||
|
@ -577,6 +551,32 @@ bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
|
||||||
|
{
|
||||||
|
if( !aState->Pop() ) // if there are no other contexts saved on the stack
|
||||||
|
{
|
||||||
|
// find the tool and deactivate it
|
||||||
|
std::deque<TOOL_ID>::iterator tool = std::find( m_activeTools.begin(), m_activeTools.end(),
|
||||||
|
aState->theTool->GetId() );
|
||||||
|
|
||||||
|
if( tool != m_activeTools.end() )
|
||||||
|
m_activeTools.erase( tool );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
// Early dispatch of events destined for the TOOL_MANAGER
|
||||||
|
if( !dispatchStandardEvents( aEvent ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
dispatchInternal( aEvent );
|
||||||
|
dispatchActivation( aEvent );
|
||||||
|
dispatchContextMenu( aEvent );
|
||||||
|
|
||||||
if( m_view->IsDirty() )
|
if( m_view->IsDirty() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include <tool/tool_base.h>
|
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,10 +46,10 @@ class TOOL_ACTION
|
||||||
public:
|
public:
|
||||||
TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope = AS_CONTEXT,
|
TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope = AS_CONTEXT,
|
||||||
int aDefaultHotKey = 0, const std::string& aMenuItem = std::string( "" ),
|
int aDefaultHotKey = 0, const std::string& aMenuItem = std::string( "" ),
|
||||||
const std::string& aMenuDesc = std::string( "" ) ) :
|
const std::string& aMenuDesc = std::string( "" ), TOOL_ACTION_FLAGS aFlags = AF_NONE ) :
|
||||||
m_name( aName ), m_scope( aScope ), m_defaultHotKey( aDefaultHotKey ),
|
m_name( aName ), m_scope( aScope ), m_defaultHotKey( aDefaultHotKey ),
|
||||||
m_currentHotKey( aDefaultHotKey ), m_menuItem( aMenuItem ),
|
m_currentHotKey( aDefaultHotKey ), m_menuItem( aMenuItem ),
|
||||||
m_menuDescription( aMenuDesc ), m_id( -1 )
|
m_menuDescription( aMenuDesc ), m_id( -1 ), m_flags( aFlags )
|
||||||
{
|
{
|
||||||
TOOL_MANAGER::GetActionList().push_back( this );
|
TOOL_MANAGER::GetActionList().push_back( this );
|
||||||
}
|
}
|
||||||
|
@ -190,8 +189,7 @@ public:
|
||||||
*/
|
*/
|
||||||
bool IsActivation() const
|
bool IsActivation() const
|
||||||
{
|
{
|
||||||
// Tool activation events are of format appName.toolName
|
return m_flags & AF_ACTIVATE;
|
||||||
return std::count( m_name.begin(), m_name.end(), '.' ) == 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -200,7 +198,7 @@ private:
|
||||||
/// 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;
|
||||||
|
|
||||||
/// Scope of the action (ie. the event that is issued after activation).
|
/// Scope of the action (i.e. the event that is issued after activation).
|
||||||
TOOL_ACTION_SCOPE m_scope;
|
TOOL_ACTION_SCOPE m_scope;
|
||||||
|
|
||||||
/// Default hot key that activates the action.
|
/// Default hot key that activates the action.
|
||||||
|
@ -221,6 +219,9 @@ 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 flags
|
||||||
|
TOOL_ACTION_FLAGS m_flags;
|
||||||
|
|
||||||
/// Origin of the action
|
/// Origin of the action
|
||||||
// const TOOL_BASE* m_origin;
|
// const TOOL_BASE* m_origin;
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,13 @@ enum TOOL_ACTION_SCOPE
|
||||||
AS_GLOBAL ///> Global action (toolbar/main menu event, global shortcut)
|
AS_GLOBAL ///> Global action (toolbar/main menu event, global shortcut)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Flags for tool actions
|
||||||
|
enum TOOL_ACTION_FLAGS
|
||||||
|
{
|
||||||
|
AF_NONE = 0,
|
||||||
|
AF_ACTIVATE = 1 ///> Action activates a tool
|
||||||
|
};
|
||||||
|
|
||||||
/// Defines when a context menu is opened.
|
/// Defines when a context menu is opened.
|
||||||
enum CONTEXT_MENU_TRIGGER
|
enum CONTEXT_MENU_TRIGGER
|
||||||
{
|
{
|
||||||
|
@ -268,6 +275,11 @@ public:
|
||||||
return m_actions == TA_CANCEL_TOOL;
|
return m_actions == TA_CANCEL_TOOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsActivate() const
|
||||||
|
{
|
||||||
|
return m_actions == TA_ACTIVATE;
|
||||||
|
}
|
||||||
|
|
||||||
///> Returns information about key modifiers state (Ctrl, Alt, etc.)
|
///> Returns information about key modifiers state (Ctrl, Alt, etc.)
|
||||||
int Modifier( int aMask = MD_MODIFIER_MASK ) const
|
int Modifier( int aMask = MD_MODIFIER_MASK ) const
|
||||||
{
|
{
|
||||||
|
@ -334,11 +346,16 @@ public:
|
||||||
*/
|
*/
|
||||||
bool IsAction( const TOOL_ACTION* aAction ) const;
|
bool IsAction( const TOOL_ACTION* aAction ) const;
|
||||||
|
|
||||||
boost::optional<int> GetCommandId()
|
boost::optional<int> GetCommandId() const
|
||||||
{
|
{
|
||||||
return m_commandId;
|
return m_commandId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::optional<std::string> GetCommandStr() const
|
||||||
|
{
|
||||||
|
return m_commandStr;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class TOOL_MANAGER;
|
friend class TOOL_MANAGER;
|
||||||
|
|
||||||
|
|
|
@ -274,6 +274,10 @@ private:
|
||||||
struct TOOL_STATE;
|
struct TOOL_STATE;
|
||||||
typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> TRANSITION;
|
typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> TRANSITION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function dispatchInternal
|
||||||
|
* Passes an event at first to the active tools, then to all others.
|
||||||
|
*/
|
||||||
void dispatchInternal( TOOL_EVENT& aEvent );
|
void dispatchInternal( TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -292,6 +296,12 @@ private:
|
||||||
*/
|
*/
|
||||||
bool dispatchActivation( TOOL_EVENT& aEvent );
|
bool dispatchActivation( TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function dispatchContextMenu()
|
||||||
|
* Handles context menu related events.
|
||||||
|
*/
|
||||||
|
void dispatchContextMenu( TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function invokeTool()
|
* Function invokeTool()
|
||||||
* Invokes a tool by sending a proper event (in contrary to runTool, which makes the tool run
|
* Invokes a tool by sending a proper event (in contrary to runTool, which makes the tool run
|
||||||
|
|
|
@ -480,8 +480,7 @@ void ROUTER_TOOL::updateEndItem( TOOL_EVENT& aEvent )
|
||||||
VECTOR2I p = getView()->ToWorld( ctls->GetMousePosition() );
|
VECTOR2I p = getView()->ToWorld( ctls->GetMousePosition() );
|
||||||
VECTOR2I cp = ctls->GetCursorPosition();
|
VECTOR2I cp = ctls->GetCursorPosition();
|
||||||
int layer;
|
int layer;
|
||||||
|
bool snapEnabled = !aEvent.Modifier( MD_SHIFT );
|
||||||
bool snapEnabled = !aEvent.Modifier(MD_SHIFT);
|
|
||||||
|
|
||||||
m_router->EnableSnapping ( snapEnabled );
|
m_router->EnableSnapping ( snapEnabled );
|
||||||
|
|
||||||
|
@ -554,7 +553,7 @@ void ROUTER_TOOL::performRouting()
|
||||||
|
|
||||||
while( OPT_TOOL_EVENT evt = Wait() )
|
while( OPT_TOOL_EVENT evt = Wait() )
|
||||||
{
|
{
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
break;
|
break;
|
||||||
else if( evt->Action() == TA_UNDO_REDO )
|
else if( evt->Action() == TA_UNDO_REDO )
|
||||||
{
|
{
|
||||||
|
@ -663,7 +662,7 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
|
||||||
m_needsSync = false;
|
m_needsSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
break; // Finish
|
break; // Finish
|
||||||
else if( evt->Action() == TA_UNDO_REDO )
|
else if( evt->Action() == TA_UNDO_REDO )
|
||||||
m_needsSync = true;
|
m_needsSync = true;
|
||||||
|
@ -677,10 +676,11 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
|
||||||
performDragging();
|
performDragging();
|
||||||
else
|
else
|
||||||
performRouting();
|
performRouting();
|
||||||
} else if ( evt->IsAction( &ACT_Drag ) )
|
}
|
||||||
|
else if ( evt->IsAction( &ACT_Drag ) )
|
||||||
performDragging();
|
performDragging();
|
||||||
|
|
||||||
handleCommonEvents(*evt);
|
handleCommonEvents( *evt );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore the default settings
|
// Restore the default settings
|
||||||
|
@ -715,7 +715,7 @@ void ROUTER_TOOL::performDragging()
|
||||||
|
|
||||||
while( OPT_TOOL_EVENT evt = Wait() )
|
while( OPT_TOOL_EVENT evt = Wait() )
|
||||||
{
|
{
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
break;
|
break;
|
||||||
else if( evt->Action() == TA_UNDO_REDO )
|
else if( evt->Action() == TA_UNDO_REDO )
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
// Selection tool actions
|
// Selection tool actions
|
||||||
TOOL_ACTION COMMON_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
|
TOOL_ACTION COMMON_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
|
||||||
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
|
AS_GLOBAL, 0, "", "", AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::selectionSingle( "pcbnew.InteractiveSelection.Single",
|
TOOL_ACTION COMMON_ACTIONS::selectionSingle( "pcbnew.InteractiveSelection.Single",
|
||||||
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
|
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
|
||||||
|
@ -41,7 +41,7 @@ TOOL_ACTION COMMON_ACTIONS::selectionClear( "pcbnew.InteractiveSelection.Clear",
|
||||||
// Edit tool actions
|
// Edit tool actions
|
||||||
TOOL_ACTION COMMON_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
|
TOOL_ACTION COMMON_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
|
||||||
AS_GLOBAL, 'M',
|
AS_GLOBAL, 'M',
|
||||||
"Move", "Moves the selected item(s)" );
|
"Move", "Moves the selected item(s)", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::rotate( "pcbnew.InteractiveEdit.rotate",
|
TOOL_ACTION COMMON_ACTIONS::rotate( "pcbnew.InteractiveEdit.rotate",
|
||||||
AS_GLOBAL, 'R',
|
AS_GLOBAL, 'R',
|
||||||
|
@ -63,50 +63,43 @@ TOOL_ACTION COMMON_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
|
||||||
// Drawing tool actions
|
// Drawing tool actions
|
||||||
TOOL_ACTION COMMON_ACTIONS::drawLine( "pcbnew.InteractiveDrawing.line",
|
TOOL_ACTION COMMON_ACTIONS::drawLine( "pcbnew.InteractiveDrawing.line",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
"Draw a line", "Draw a line" );
|
"Draw a line", "Draw a line", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::drawCircle( "pcbnew.InteractiveDrawing.circle",
|
TOOL_ACTION COMMON_ACTIONS::drawCircle( "pcbnew.InteractiveDrawing.circle",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
"Draw a circle", "Draw a circle" );
|
"Draw a circle", "Draw a circle", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::drawArc( "pcbnew.InteractiveDrawing.arc",
|
TOOL_ACTION COMMON_ACTIONS::drawArc( "pcbnew.InteractiveDrawing.arc",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
"Draw an arc", "Draw an arc" );
|
"Draw an arc", "Draw an arc", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::placeTextModule( "pcbnew.InteractiveDrawing.textPcb",
|
TOOL_ACTION COMMON_ACTIONS::placeTextModule( "pcbnew.InteractiveDrawing.textPcb",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
"Add a text", "Add a text" );
|
"Add a text", "Add a text", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::placeTextPcb( "pcbnew.InteractiveDrawing.textModule",
|
TOOL_ACTION COMMON_ACTIONS::placeTextPcb( "pcbnew.InteractiveDrawing.textModule",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
"Add a text", "Add a text" );
|
"Add a text", "Add a text", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::drawDimension( "pcbnew.InteractiveDrawing.dimension",
|
TOOL_ACTION COMMON_ACTIONS::drawDimension( "pcbnew.InteractiveDrawing.dimension",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
"Add a dimension", "Add a dimension" );
|
"Add a dimension", "Add a dimension", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::drawZone( "pcbnew.InteractiveDrawing.zone",
|
TOOL_ACTION COMMON_ACTIONS::drawZone( "pcbnew.InteractiveDrawing.zone",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
"Add a filled zone", "Add a filled zone" );
|
"Add a filled zone", "Add a filled zone", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::drawKeepout( "pcbnew.InteractiveDrawing.keepout",
|
TOOL_ACTION COMMON_ACTIONS::drawKeepout( "pcbnew.InteractiveDrawing.keepout",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
"Add a keepout area", "Add a keepout area" );
|
"Add a keepout area", "Add a keepout area", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::placeTarget( "pcbnew.InteractiveDrawing.placeTarget",
|
TOOL_ACTION COMMON_ACTIONS::placeTarget( "pcbnew.InteractiveDrawing.placeTarget",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
"Add layer alignment target", "Add layer alignment target" );
|
"Add layer alignment target", "Add layer alignment target", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::placeModule( "pcbnew.InteractiveDrawing.placeModule",
|
TOOL_ACTION COMMON_ACTIONS::placeModule( "pcbnew.InteractiveDrawing.placeModule",
|
||||||
AS_GLOBAL, 'O',
|
AS_GLOBAL, 'O',
|
||||||
"Add modules", "Add modules" );
|
"Add modules", "Add modules", AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::routerActivate( "pcbnew.InteractiveRouter",
|
|
||||||
AS_GLOBAL, 'X',
|
|
||||||
"Run push & shove router", "Run push & shove router" );
|
|
||||||
|
|
||||||
TOOL_ACTION COMMON_ACTIONS::pointEditorUpdate( "pcbnew.PointEditor.update",
|
|
||||||
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
|
|
||||||
|
|
||||||
|
|
||||||
// View Controls
|
// View Controls
|
||||||
|
@ -268,6 +261,13 @@ TOOL_ACTION COMMON_ACTIONS::showHelp( "pcbnew.Control.showHelp",
|
||||||
AS_GLOBAL, '?',
|
AS_GLOBAL, '?',
|
||||||
"", "" );
|
"", "" );
|
||||||
|
|
||||||
|
TOOL_ACTION COMMON_ACTIONS::routerActivate( "pcbnew.InteractiveRouter",
|
||||||
|
AS_GLOBAL, 'X',
|
||||||
|
"Run push & shove router", "Run push & shove router", AF_ACTIVATE );
|
||||||
|
|
||||||
|
TOOL_ACTION COMMON_ACTIONS::pointEditorUpdate( "pcbnew.PointEditor.update",
|
||||||
|
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
|
||||||
|
|
||||||
|
|
||||||
boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
|
boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
|
||||||
{
|
{
|
||||||
|
|
|
@ -123,7 +123,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
cursorPos = m_controls->GetCursorPosition();
|
cursorPos = m_controls->GetCursorPosition();
|
||||||
|
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( step != SET_ORIGIN ) // start from the beginning
|
if( step != SET_ORIGIN ) // start from the beginning
|
||||||
{
|
{
|
||||||
|
@ -135,6 +135,9 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if( evt->IsActivate() ) // now finish unconditionally
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsKeyPressed() && step != SET_ORIGIN )
|
else if( evt->IsKeyPressed() && step != SET_ORIGIN )
|
||||||
|
@ -301,7 +304,7 @@ int DRAWING_TOOL::PlaceTextModule( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||||
|
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( text )
|
if( text )
|
||||||
{
|
{
|
||||||
|
@ -315,6 +318,9 @@ int DRAWING_TOOL::PlaceTextModule( TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if( evt->IsActivate() ) // now finish unconditionally
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( text && evt->Category() == TC_COMMAND )
|
else if( text && evt->Category() == TC_COMMAND )
|
||||||
|
@ -406,7 +412,7 @@ int DRAWING_TOOL::PlaceTextPcb( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||||
|
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( text )
|
if( text )
|
||||||
{
|
{
|
||||||
|
@ -420,6 +426,9 @@ int DRAWING_TOOL::PlaceTextPcb( TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if( evt->IsActivate() ) // now finish unconditionally
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( text && evt->Category() == TC_COMMAND )
|
else if( text && evt->Category() == TC_COMMAND )
|
||||||
|
@ -520,7 +529,7 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||||
|
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( step != SET_ORIGIN ) // start from the beginning
|
if( step != SET_ORIGIN ) // start from the beginning
|
||||||
{
|
{
|
||||||
|
@ -532,6 +541,9 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if( evt->IsActivate() ) // now finish unconditionally
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsKeyPressed() && step != SET_ORIGIN )
|
else if( evt->IsKeyPressed() && step != SET_ORIGIN )
|
||||||
|
@ -707,7 +719,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
cursorPos = m_controls->GetCursorPosition();
|
cursorPos = m_controls->GetCursorPosition();
|
||||||
|
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
else if( evt->IsKeyPressed() )
|
else if( evt->IsKeyPressed() )
|
||||||
|
@ -783,7 +795,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||||
|
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( module )
|
if( module )
|
||||||
{
|
{
|
||||||
|
@ -796,6 +808,9 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if( evt->IsActivate() ) // now finish unconditionally
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( module && evt->Category() == TC_COMMAND )
|
else if( module && evt->Category() == TC_COMMAND )
|
||||||
|
@ -915,7 +930,7 @@ int DRAWING_TOOL::drawSegment( int aShape, bool aContinous )
|
||||||
updatePreview = true;
|
updatePreview = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( !graphic )
|
if( !graphic )
|
||||||
break;
|
break;
|
||||||
|
@ -927,6 +942,9 @@ int DRAWING_TOOL::drawSegment( int aShape, bool aContinous )
|
||||||
graphic = NULL;
|
graphic = NULL;
|
||||||
|
|
||||||
m_controls->SetAutoPan( false );
|
m_controls->SetAutoPan( false );
|
||||||
|
|
||||||
|
if( evt->IsActivate() ) // now finish unconditionally
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( graphic && evt->IsKeyPressed() )
|
else if( graphic && evt->IsKeyPressed() )
|
||||||
|
@ -1093,7 +1111,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
|
||||||
updatePreview = true;
|
updatePreview = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( evt->IsCancel() )
|
if( evt->IsCancel() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( numPoints > 0 ) // cancel the current zone
|
if( numPoints > 0 ) // cancel the current zone
|
||||||
{
|
{
|
||||||
|
@ -1114,6 +1132,9 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
|
||||||
}
|
}
|
||||||
else // there is no zone currently drawn - just stop the tool
|
else // there is no zone currently drawn - just stop the tool
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if( evt->IsActivate() ) // now finish unconditionally
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_LEFT ) )
|
else if( evt->IsClick( BUT_LEFT ) )
|
||||||
|
|
Loading…
Reference in New Issue