From 297c60923e447ca48b81d1ecbf981a5a56c0ab9b Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Fri, 3 Jun 2022 23:02:32 +0200 Subject: [PATCH] router: return routing status from ROUTER::Move() --- pcbnew/router/pns_router.cpp | 19 ++++++++++--------- pcbnew/router/pns_router.h | 6 +++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 20967bcb3b..fc8e967f04 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -445,7 +445,7 @@ bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer ) } -void ROUTER::Move( const VECTOR2I& aP, ITEM* endItem ) +bool ROUTER::Move( const VECTOR2I& aP, ITEM* endItem ) { if( m_logger ) m_logger->Log( LOGGER::EVT_MOVE, aP, endItem ); @@ -453,13 +453,11 @@ void ROUTER::Move( const VECTOR2I& aP, ITEM* endItem ) switch( m_state ) { case ROUTE_TRACK: - movePlacing( aP, endItem ); - break; + return movePlacing( aP, endItem ); case DRAG_SEGMENT: case DRAG_COMPONENT: - moveDragging( aP, endItem ); - break; + return moveDragging( aP, endItem ); default: break; @@ -467,14 +465,15 @@ void ROUTER::Move( const VECTOR2I& aP, ITEM* endItem ) } -void ROUTER::moveDragging( const VECTOR2I& aP, ITEM* aEndItem ) +bool ROUTER::moveDragging( const VECTOR2I& aP, ITEM* aEndItem ) { m_iface->EraseView(); - m_dragger->Drag( aP ); + bool ret = m_dragger->Drag( aP ); ITEM_SET dragged = m_dragger->Traces(); updateView( m_dragger->CurrentNode(), dragged, true ); + return ret; } @@ -599,11 +598,11 @@ void ROUTER::UpdateSizes( const SIZES_SETTINGS& aSizes ) } -void ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem ) +bool ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem ) { m_iface->EraseView(); - m_placer->Move( aP, aEndItem ); + bool ret = m_placer->Move( aP, aEndItem ); ITEM_SET current = m_placer->Traces(); for( const ITEM* item : current.CItems() ) @@ -632,6 +631,8 @@ void ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem ) //ITEM_SET tmp( ¤t ); updateView( m_placer->CurrentNode( true ), current ); + + return ret; } diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h index 5b47cdad97..6e54f6c043 100644 --- a/pcbnew/router/pns_router.h +++ b/pcbnew/router/pns_router.h @@ -142,7 +142,7 @@ public: bool RoutingInProgress() const; bool StartRouting( const VECTOR2I& aP, ITEM* aItem, int aLayer ); - void Move( const VECTOR2I& aP, ITEM* aItem ); + bool Move( const VECTOR2I& aP, ITEM* aItem ); bool FixRoute( const VECTOR2I& aP, ITEM* aItem, bool aForceFinish = false ); void BreakSegment( ITEM *aItem, const VECTOR2I& aP ); @@ -211,8 +211,8 @@ public: const BOX2I& VisibleViewArea() const { return m_visibleViewArea; } private: - void movePlacing( const VECTOR2I& aP, ITEM* aItem ); - void moveDragging( const VECTOR2I& aP, ITEM* aItem ); + bool movePlacing( const VECTOR2I& aP, ITEM* aItem ); + bool moveDragging( const VECTOR2I& aP, ITEM* aItem ); void updateView( NODE* aNode, ITEM_SET& aCurrent, bool aDragging = false );