Changed 'line width change' & 'change arc posture' to TOOL_ACTIONs.
This commit is contained in:
parent
cdffdc398e
commit
242d42cf1d
|
@ -109,6 +109,18 @@ TOOL_ACTION COMMON_ACTIONS::setAnchor( "pcbnew.InteractiveDrawing.setAnchor",
|
|||
"Place the footprint anchor", "Place the footprint anchor",
|
||||
AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::incWidth( "pcbnew.InteractiveDrawing.incWidth",
|
||||
AS_CONTEXT, '+',
|
||||
"Increase the line width", "Increase the line width" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::decWidth( "pcbnew.InteractiveDrawing.decWidth",
|
||||
AS_CONTEXT, '-',
|
||||
"Decrease the line width", "Decrease the line width" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::arcPosture( "pcbnew.InteractiveDrawing.arcPosture",
|
||||
AS_CONTEXT, '/',
|
||||
"Switch the arc posture", "Switch the arc posture" );
|
||||
|
||||
|
||||
// View Controls
|
||||
TOOL_ACTION COMMON_ACTIONS::zoomIn( "pcbnew.Control.zoomIn",
|
||||
|
|
|
@ -96,6 +96,15 @@ public:
|
|||
/// Activation of the drawing tool (placing the footprint anchor)
|
||||
static TOOL_ACTION setAnchor;
|
||||
|
||||
/// Increase width of currently drawn line
|
||||
static TOOL_ACTION incWidth;
|
||||
|
||||
/// Decrease width of currently drawn line
|
||||
static TOOL_ACTION decWidth;
|
||||
|
||||
/// Switch posture when drawing arc
|
||||
static TOOL_ACTION arcPosture;
|
||||
|
||||
// Push and Shove Router Tool
|
||||
/// Activation of the Push and Shove router
|
||||
static TOOL_ACTION routerActivate;
|
||||
|
|
|
@ -941,19 +941,6 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
|
|||
break;
|
||||
}
|
||||
|
||||
else if( evt->IsKeyPressed() )
|
||||
{
|
||||
int width = aGraphic->GetWidth();
|
||||
|
||||
// Modify the new item width
|
||||
if( evt->KeyCode() == '-' && width > WIDTH_STEP ) // TODO change it to TOOL_ACTIONs
|
||||
aGraphic->SetWidth( width - WIDTH_STEP );
|
||||
else if( evt->KeyCode() == '=' )
|
||||
aGraphic->SetWidth( width + WIDTH_STEP );
|
||||
|
||||
updatePreview = true;
|
||||
}
|
||||
|
||||
else if( evt->IsClick( BUT_LEFT ) )
|
||||
{
|
||||
if( !started )
|
||||
|
@ -1014,6 +1001,23 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
|
|||
updatePreview = true;
|
||||
}
|
||||
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::incWidth ) )
|
||||
{
|
||||
aGraphic->SetWidth( aGraphic->GetWidth() + WIDTH_STEP );
|
||||
updatePreview = true;
|
||||
}
|
||||
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::decWidth ) )
|
||||
{
|
||||
int width = aGraphic->GetWidth();
|
||||
|
||||
if( width > WIDTH_STEP )
|
||||
{
|
||||
aGraphic->SetWidth( width - WIDTH_STEP );
|
||||
updatePreview = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( updatePreview )
|
||||
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
}
|
||||
|
@ -1071,28 +1075,6 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
|
|||
break;
|
||||
}
|
||||
|
||||
else if( evt->IsKeyPressed() && step != SET_ORIGIN )
|
||||
{
|
||||
int width = aGraphic->GetWidth();
|
||||
|
||||
// Modify the new item width
|
||||
if( evt->KeyCode() == '-' && width > WIDTH_STEP ) // TODO convert to tool actions
|
||||
aGraphic->SetWidth( width - WIDTH_STEP );
|
||||
else if( evt->KeyCode() == '=' )
|
||||
aGraphic->SetWidth( width + WIDTH_STEP );
|
||||
else if( evt->KeyCode() == '/' )
|
||||
{
|
||||
if( clockwise )
|
||||
aGraphic->SetAngle( aGraphic->GetAngle() - 3600.0 );
|
||||
else
|
||||
aGraphic->SetAngle( aGraphic->GetAngle() + 3600.0 );
|
||||
|
||||
clockwise = !clockwise;
|
||||
}
|
||||
|
||||
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
}
|
||||
|
||||
else if( evt->IsClick( BUT_LEFT ) )
|
||||
{
|
||||
switch( step )
|
||||
|
@ -1191,6 +1173,34 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
|
|||
// Show a preview of the item
|
||||
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
}
|
||||
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::incWidth ) )
|
||||
{
|
||||
aGraphic->SetWidth( aGraphic->GetWidth() + WIDTH_STEP );
|
||||
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
}
|
||||
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::decWidth ) )
|
||||
{
|
||||
int width = aGraphic->GetWidth();
|
||||
|
||||
if( width > WIDTH_STEP )
|
||||
{
|
||||
aGraphic->SetWidth( width - WIDTH_STEP );
|
||||
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
}
|
||||
}
|
||||
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::arcPosture ) )
|
||||
{
|
||||
if( clockwise )
|
||||
aGraphic->SetAngle( aGraphic->GetAngle() - 3600.0 );
|
||||
else
|
||||
aGraphic->SetAngle( aGraphic->GetAngle() + 3600.0 );
|
||||
|
||||
clockwise = !clockwise;
|
||||
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
}
|
||||
}
|
||||
|
||||
m_controls->ShowCursor( false );
|
||||
|
|
Loading…
Reference in New Issue