From af95235f47c397d772040b658178f3a4778d4965 Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Sun, 18 Oct 2020 23:00:33 +0200 Subject: [PATCH] router: report debug log events from DRAGGER --- pcbnew/router/pns_router.cpp | 19 +++++++++++++++---- pcbnew/router/pns_router.h | 6 +++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 7df980fcb5..661c134077 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -155,9 +155,16 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM m_dragger->SetMode( aDragMode ); m_dragger->SetWorld( m_world.get() ); m_dragger->SetLogger( m_logger ); - m_dragger->SetDebugDecorator( m_iface->GetDebugDecorator() ); + m_dragger->SetDebugDecorator ( m_iface->GetDebugDecorator () ); - if( m_dragger->Start( aP, aStartItems ) ) + m_logger->Clear(); + + if( m_logger && aStartItems.Size() ) + { + m_logger->Log( LOGGER::EVT_START_DRAG, aP, aStartItems[0] ); + } + + if( m_dragger->Start ( aP, aStartItems ) ) { m_state = DRAG_SEGMENT; } @@ -361,9 +368,11 @@ bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer ) m_placer->UpdateSizes( m_sizes ); m_placer->SetLayer( aLayer ); - m_placer->SetDebugDecorator( m_iface->GetDebugDecorator() ); + m_placer->SetDebugDecorator( m_iface->GetDebugDecorator () ); m_placer->SetLogger( m_logger ); + m_logger->Clear(); + if( m_logger ) m_logger->Log( LOGGER::EVT_START_ROUTE, aP, aStartItem ); @@ -513,7 +522,9 @@ void ROUTER::UpdateSizes( const SIZES_SETTINGS& aSizes ) // Change track/via size settings if( m_state == ROUTE_TRACK) + { m_placer->UpdateSizes( m_sizes ); + } } @@ -786,7 +797,7 @@ void ROUTER::BreakSegment( ITEM *aItem, const VECTOR2I& aP ) LINE_PLACER placer( this ); - if( placer.SplitAdjacentSegments( node, aItem, aP ) ) + if ( placer.SplitAdjacentSegments( node, aItem, aP ) ) { CommitRouting( node ); } diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h index 6c49920569..f72dfd86da 100644 --- a/pcbnew/router/pns_router.h +++ b/pcbnew/router/pns_router.h @@ -119,7 +119,7 @@ enum DRAG_MODE class ROUTER { -private: +public: enum RouterState { IDLE, @@ -135,6 +135,10 @@ public: void SetMode ( ROUTER_MODE aMode ); ROUTER_MODE Mode() const { return m_mode; } + RouterState GetState() const { return m_state; } + + DRAG_ALGO* GetDragger() { return m_dragger.get(); } + static ROUTER* GetInstance(); void ClearWorld();