Loading pcbnew/tools/common_actions.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -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", Loading pcbnew/tools/common_actions.h +9 −0 Original line number Diff line number Diff line Loading @@ -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; Loading pcbnew/tools/drawing_tool.cpp +45 −35 Original line number Diff line number Diff line Loading @@ -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 ) Loading Loading @@ -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 ); } Loading Loading @@ -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 ) Loading Loading @@ -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 Loading
pcbnew/tools/common_actions.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -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", Loading
pcbnew/tools/common_actions.h +9 −0 Original line number Diff line number Diff line Loading @@ -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; Loading
pcbnew/tools/drawing_tool.cpp +45 −35 Original line number Diff line number Diff line Loading @@ -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 ) Loading Loading @@ -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 ); } Loading Loading @@ -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 ) Loading Loading @@ -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