diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index d36fe77a57..f65a59e3d2 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -613,7 +613,9 @@ bool PCB_VIA::FlashLayer( int aLayer ) const return false; if( !m_removeUnconnectedLayer ) + { return true; + } if( m_keepStartEndLayer && ( aLayer == m_layer || aLayer == m_bottomLayer ) ) return true; diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index f1dcf05a9a..521c481645 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1228,7 +1228,7 @@ bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB solid->SetShape( rectShape ); } else - solid->SetShape( aText->GetEffectiveTextShape()->Clone() ); + solid->SetShape( aText->GetEffectiveTextShape()->Clone() ); solid->SetRoutable( false ); @@ -1253,7 +1253,7 @@ bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB solid->SetRoutable( false ); aWorld->Add( std::move( solid ) ); return true; - */ + */ } @@ -1516,7 +1516,7 @@ void PNS_KICAD_IFACE_BASE::SetDebugDecorator( PNS::DEBUG_DECORATOR *aDec ) } -void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit ) +void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit, bool aIsHeadTrace ) { if( aItem->IsVirtual() ) return; @@ -1554,6 +1554,12 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool } } + if( aIsHeadTrace ) + { + pitem->SetIsHeadTrace( true ); + pitem->Update( aItem ); + } + m_previewItems->Add( pitem ); m_view->Update( m_previewItems ); } diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index 18950bbe28..554de5b7c3 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -59,7 +59,7 @@ public: bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const override; bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; }; void HideItem( PNS::ITEM* aItem ) override {} - void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false ) override {} + void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) override {} void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) override {} void AddItem( PNS::ITEM* aItem ) override; void UpdateItem( PNS::ITEM* aItem ) override; @@ -115,7 +115,7 @@ public: bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const override; bool IsItemVisible( const PNS::ITEM* aItem ) const override; void HideItem( PNS::ITEM* aItem ) override; - void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false ) override; + void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) override; void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) override; void Commit() override; void AddItem( PNS::ITEM* aItem ) override; diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 6350397300..bedb6af247 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -750,7 +750,7 @@ bool ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem ) const LINE* l = static_cast( item ); int clearance = GetRuleResolver()->Clearance( item, nullptr ); - m_iface->DisplayItem( l, clearance ); + m_iface->DisplayItem( l, clearance, false, true ); if( l->EndsWithVia() ) { @@ -761,7 +761,7 @@ bool ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem ) if( holeClearance + via.Drill() / 2 > viaClearance + via.Diameter() / 2 ) viaClearance = holeClearance + via.Drill() / 2 - via.Diameter() / 2; - m_iface->DisplayItem( &l->Via(), viaClearance ); + m_iface->DisplayItem( &l->Via(), viaClearance, false, true ); } } diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h index 90b5d6cbee..b996066982 100644 --- a/pcbnew/router/pns_router.h +++ b/pcbnew/router/pns_router.h @@ -96,7 +96,7 @@ enum DRAG_MODE virtual bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const = 0; virtual bool IsItemVisible( const PNS::ITEM* aItem ) const = 0; virtual bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const = 0; - virtual void DisplayItem( const ITEM* aItem, int aClearance, bool aEdit = false ) = 0; + virtual void DisplayItem( const ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) = 0; virtual void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) = 0; virtual void HideItem( ITEM* aItem ) = 0; virtual void Commit() = 0; diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp index c247ffe5a4..f93ec4e2eb 100644 --- a/pcbnew/router/router_preview_item.cpp +++ b/pcbnew/router/router_preview_item.cpp @@ -51,11 +51,10 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, KIGFX::VIEW* a m_showClearance = false; // initialize variables, overwritten by Update( aItem ), if aItem != NULL - m_router = nullptr; m_type = PR_SHAPE; - m_style = 0; m_width = 0; m_depth = 0; + m_isHeadTrace = false; if( aItem ) Update( aItem ); @@ -76,11 +75,10 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const SHAPE& aShape, KIGFX::VIEW* aVie m_showClearance = false; // initialize variables, overwritten by Update( aItem ), if aItem != NULL - m_router = nullptr; m_type = PR_SHAPE; - m_style = 0; m_width = 0; m_depth = 0; + m_isHeadTrace = false; } @@ -468,7 +466,14 @@ const COLOR4D ROUTER_PREVIEW_ITEM::getLayerColor( int aLayer ) const { auto settings = static_cast( m_view->GetPainter()->GetSettings() ); - return settings->GetLayerColor( aLayer ); + COLOR4D color = settings->GetLayerColor( aLayer ); + + if( m_isHeadTrace ) + { + return color.Saturate( 1.0 ); + } + + return color; } diff --git a/pcbnew/router/router_preview_item.h b/pcbnew/router/router_preview_item.h index 79f2a6a73e..637dd8cb28 100644 --- a/pcbnew/router/router_preview_item.h +++ b/pcbnew/router/router_preview_item.h @@ -76,6 +76,11 @@ public: m_showClearance = aEnabled; } + void SetIsHeadTrace( bool aIsHead ) + { + m_isHeadTrace = aIsHead; + } + #if defined(DEBUG) void Show( int aA, std::ostream& aB ) const override {} #endif @@ -109,13 +114,12 @@ private: private: KIGFX::VIEW* m_view; - PNS::ROUTER* m_router; SHAPE* m_shape; SHAPE* m_hole; ITEM_TYPE m_type; - int m_style; + bool m_isHeadTrace; int m_width; int m_layer; int m_originLayer; diff --git a/qa/tools/pns/pns_log_player.cpp b/qa/tools/pns/pns_log_player.cpp index 39af54b664..073b9a4c8d 100644 --- a/qa/tools/pns/pns_log_player.cpp +++ b/qa/tools/pns/pns_log_player.cpp @@ -262,7 +262,7 @@ void PNS_LOG_PLAYER_KICAD_IFACE::HideItem( PNS::ITEM* aItem ) m_viewTracker->HideItem( aItem ); } -void PNS_LOG_PLAYER_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit ) +void PNS_LOG_PLAYER_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit, bool aIsHeadTrace ) { //printf("DBG disp %p\n", aItem); m_viewTracker->DisplayItem( aItem ); diff --git a/qa/tools/pns/pns_log_player.h b/qa/tools/pns/pns_log_player.h index 086820ae1d..8c381b21ec 100644 --- a/qa/tools/pns/pns_log_player.h +++ b/qa/tools/pns/pns_log_player.h @@ -69,7 +69,7 @@ public: ~PNS_LOG_PLAYER_KICAD_IFACE(); void HideItem( PNS::ITEM* aItem ) override; - void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false ) override; + void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) override; private: PNS_LOG_VIEW_TRACKER *m_viewTracker;