Commit 242d42cf authored by Maciej Suminski's avatar Maciej Suminski

Changed 'line width change' & 'change arc posture' to TOOL_ACTIONs.

parent cdffdc39
...@@ -109,6 +109,18 @@ TOOL_ACTION COMMON_ACTIONS::setAnchor( "pcbnew.InteractiveDrawing.setAnchor", ...@@ -109,6 +109,18 @@ TOOL_ACTION COMMON_ACTIONS::setAnchor( "pcbnew.InteractiveDrawing.setAnchor",
"Place the footprint anchor", "Place the footprint anchor", "Place the footprint anchor", "Place the footprint anchor",
AF_ACTIVATE ); 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 // View Controls
TOOL_ACTION COMMON_ACTIONS::zoomIn( "pcbnew.Control.zoomIn", TOOL_ACTION COMMON_ACTIONS::zoomIn( "pcbnew.Control.zoomIn",
......
...@@ -96,6 +96,15 @@ public: ...@@ -96,6 +96,15 @@ public:
/// Activation of the drawing tool (placing the footprint anchor) /// Activation of the drawing tool (placing the footprint anchor)
static TOOL_ACTION setAnchor; 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 // Push and Shove Router Tool
/// Activation of the Push and Shove router /// Activation of the Push and Shove router
static TOOL_ACTION routerActivate; static TOOL_ACTION routerActivate;
......
...@@ -941,19 +941,6 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, ...@@ -941,19 +941,6 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
break; 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 ) ) else if( evt->IsClick( BUT_LEFT ) )
{ {
if( !started ) if( !started )
...@@ -1014,6 +1001,23 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, ...@@ -1014,6 +1001,23 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
updatePreview = true; 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 ) if( updatePreview )
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
} }
...@@ -1071,28 +1075,6 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic ) ...@@ -1071,28 +1075,6 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
break; 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 ) ) else if( evt->IsClick( BUT_LEFT ) )
{ {
switch( step ) switch( step )
...@@ -1191,6 +1173,34 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic ) ...@@ -1191,6 +1173,34 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
// Show a preview of the item // Show a preview of the item
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); 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 ); m_controls->ShowCursor( false );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment