router: allow placing tracks/diff pairs without continuing routing by Shift+L-Click

Fixes: lp:1777688
* https://bugs.launchpad.net/kicad/+bug/1777688
This commit is contained in:
Tomasz Wlostowski 2018-06-19 19:29:36 +02:00
parent 462549fc84
commit f6f726acab
12 changed files with 22 additions and 17 deletions

View File

@ -737,7 +737,7 @@ void DIFF_PAIR_PLACER::UpdateSizes( const SIZES_SETTINGS& aSizes )
} }
bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish )
{ {
if( !m_fitOk ) if( !m_fitOk )
return false; return false;
@ -751,7 +751,7 @@ bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
TOPOLOGY topo( m_lastNode ); TOPOLOGY topo( m_lastNode );
if( !m_snapOnTarget && !m_currentTrace.EndsWithVias() ) if( !m_snapOnTarget && !m_currentTrace.EndsWithVias() && !aForceFinish )
{ {
SHAPE_LINE_CHAIN newP( m_currentTrace.CP() ); SHAPE_LINE_CHAIN newP( m_currentTrace.CP() );
SHAPE_LINE_CHAIN newN( m_currentTrace.CN() ); SHAPE_LINE_CHAIN newN( m_currentTrace.CN() );
@ -773,7 +773,7 @@ bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
} }
else else
{ {
m_chainedPlacement = !m_snapOnTarget; m_chainedPlacement = !m_snapOnTarget && !aForceFinish;
} }
LINE lineP( m_currentTrace.PLine() ); LINE lineP( m_currentTrace.PLine() );
@ -792,7 +792,7 @@ bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
m_lastNode = NULL; m_lastNode = NULL;
m_placingVia = false; m_placingVia = false;
if( m_snapOnTarget ) if( m_snapOnTarget || aForceFinish )
{ {
m_idle = true; m_idle = true;
return true; return true;

View File

@ -84,7 +84,7 @@ public:
* result is violating design rules - in such case, the track is only committed * result is violating design rules - in such case, the track is only committed
* if Settings.CanViolateDRC() is on. * if Settings.CanViolateDRC() is on.
*/ */
bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) override; bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish ) override;
/** /**
* Function ToggleVia() * Function ToggleVia()

View File

@ -300,7 +300,7 @@ bool DP_MEANDER_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem )
} }
bool DP_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) bool DP_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish )
{ {
LINE lP( m_originPair.PLine(), m_finalShapeP ); LINE lP( m_originPair.PLine(), m_finalShapeP );
LINE lN( m_originPair.NLine(), m_finalShapeN ); LINE lN( m_originPair.NLine(), m_finalShapeN );

View File

@ -78,7 +78,7 @@ public:
* result is violating design rules - in such case, the track is only committed * result is violating design rules - in such case, the track is only committed
* if Settings.CanViolateDRC() is on. * if Settings.CanViolateDRC() is on.
*/ */
bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) override; bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish = false ) override;
const LINE Trace() const; const LINE Trace() const;

View File

@ -951,7 +951,7 @@ bool LINE_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem )
} }
bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish )
{ {
bool realEnd = false; bool realEnd = false;
int lastV; int lastV;
@ -1009,6 +1009,9 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
if( aEndItem && m_currentNet >= 0 && m_currentNet == aEndItem->Net() ) if( aEndItem && m_currentNet >= 0 && m_currentNet == aEndItem->Net() )
realEnd = true; realEnd = true;
if( aForceFinish )
realEnd = true;
if( realEnd || m_placingVia ) if( realEnd || m_placingVia )
lastV = l.SegmentCount(); lastV = l.SegmentCount();
else else

View File

@ -81,7 +81,7 @@ public:
* result is violating design rules - in such case, the track is only committed * result is violating design rules - in such case, the track is only committed
* if Settings.CanViolateDRC() is on. * if Settings.CanViolateDRC() is on.
*/ */
bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) override; bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish ) override;
/** /**
* Function ToggleVia() * Function ToggleVia()

View File

@ -188,7 +188,7 @@ bool MEANDER_PLACER::doMove( const VECTOR2I& aP, ITEM* aEndItem, int aTargetLeng
} }
bool MEANDER_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) bool MEANDER_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish )
{ {
if( !m_currentNode ) if( !m_currentNode )
return false; return false;

View File

@ -59,7 +59,7 @@ public:
virtual bool Move( const VECTOR2I& aP, ITEM* aEndItem ) override; virtual bool Move( const VECTOR2I& aP, ITEM* aEndItem ) override;
/// @copydoc PLACEMENT_ALGO::FixRoute() /// @copydoc PLACEMENT_ALGO::FixRoute()
virtual bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) override; virtual bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish = false ) override;
/// @copydoc PLACEMENT_ALGO::CurrentNode() /// @copydoc PLACEMENT_ALGO::CurrentNode()
NODE* CurrentNode( bool aLoopsRemoved = false ) const override; NODE* CurrentNode( bool aLoopsRemoved = false ) const override;

View File

@ -76,7 +76,7 @@ public:
* result is violating design rules - in such case, the track is only committed * result is violating design rules - in such case, the track is only committed
* if Settings.CanViolateDRC() is on. * if Settings.CanViolateDRC() is on.
*/ */
virtual bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) = 0; virtual bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish = false ) = 0;
/** /**
* Function ToggleVia() * Function ToggleVia()

View File

@ -361,14 +361,14 @@ void ROUTER::CommitRouting( NODE* aNode )
} }
bool ROUTER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) bool ROUTER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish )
{ {
bool rv = false; bool rv = false;
switch( m_state ) switch( m_state )
{ {
case ROUTE_TRACK: case ROUTE_TRACK:
rv = m_placer->FixRoute( aP, aEndItem ); rv = m_placer->FixRoute( aP, aEndItem, aForceFinish );
break; break;
case DRAG_SEGMENT: case DRAG_SEGMENT:

View File

@ -133,7 +133,7 @@ public:
bool RoutingInProgress() const; bool RoutingInProgress() const;
bool StartRouting( const VECTOR2I& aP, ITEM* aItem, int aLayer ); bool StartRouting( const VECTOR2I& aP, ITEM* aItem, int aLayer );
void Move( const VECTOR2I& aP, ITEM* aItem ); void Move( const VECTOR2I& aP, ITEM* aItem );
bool FixRoute( const VECTOR2I& aP, ITEM* aItem ); bool FixRoute( const VECTOR2I& aP, ITEM* aItem, bool aForceFinish = false );
void BreakSegment( ITEM *aItem, const VECTOR2I& aP ); void BreakSegment( ITEM *aItem, const VECTOR2I& aP );
void StopRouting(); void StopRouting();

View File

@ -728,10 +728,12 @@ void ROUTER_TOOL::performRouting()
{ {
updateEndItem( *evt ); updateEndItem( *evt );
bool needLayerSwitch = m_router->IsPlacingVia(); bool needLayerSwitch = m_router->IsPlacingVia();
bool forceFinish = evt->Modifier( MD_SHIFT );
if( m_router->FixRoute( m_endSnapPoint, m_endItem ) )
if( m_router->FixRoute( m_endSnapPoint, m_endItem, forceFinish ) )
break; break;
if( needLayerSwitch ) if( needLayerSwitch )
switchLayerOnViaPlacement(); switchLayerOnViaPlacement();