From a0298fc94f0a032d3e193e774ac387ea548f641a Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 4 Aug 2014 10:42:20 +0200 Subject: [PATCH] Fixed module anchor drawing (GAL). --- pcbnew/pcb_painter.cpp | 25 ++++++++++++++----------- pcbnew/pcb_painter.h | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 3b01c0d902..c8df2b1243 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -235,7 +235,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) break; case PCB_MODULE_T: - draw( (MODULE*) item ); + draw( (MODULE*) item, aLayer ); break; case PCB_ZONE_AREA_T: @@ -771,20 +771,23 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer ) } -void PCB_PAINTER::draw( const MODULE* aModule ) +void PCB_PAINTER::draw( const MODULE* aModule, int aLayer ) { - const COLOR4D color = m_pcbSettings.GetColor( aModule, ITEM_GAL_LAYER( ANCHOR_VISIBLE ) ); + if( aLayer == ITEM_GAL_LAYER( ANCHOR_VISIBLE ) ) + { + const COLOR4D color = m_pcbSettings.GetColor( aModule, ITEM_GAL_LAYER( ANCHOR_VISIBLE ) ); - // Draw anchor - m_gal->SetStrokeColor( color ); - m_gal->SetLineWidth( 1.0 ); + // Draw anchor + m_gal->SetStrokeColor( color ); + m_gal->SetLineWidth( 1.0 ); - // Keep the size constant, not related to the scale - double anchorSize = 5.0 / m_gal->GetWorldScale(); + // Keep the size constant, not related to the scale + double anchorSize = 5.0 / m_gal->GetWorldScale(); - VECTOR2D center = aModule->GetPosition(); - m_gal->DrawLine( center - VECTOR2D( anchorSize, 0 ), center + VECTOR2D( anchorSize, 0 ) ); - m_gal->DrawLine( center - VECTOR2D( 0, anchorSize ), center + VECTOR2D( 0, anchorSize ) ); + VECTOR2D center = aModule->GetPosition(); + m_gal->DrawLine( center - VECTOR2D( anchorSize, 0 ), center + VECTOR2D( anchorSize, 0 ) ); + m_gal->DrawLine( center - VECTOR2D( 0, anchorSize ), center + VECTOR2D( 0, anchorSize ) ); + } } diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index 2b79696ec3..d2487d66eb 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -207,7 +207,7 @@ protected: void draw( const DRAWSEGMENT* aSegment, int aLayer ); void draw( const TEXTE_PCB* aText, int aLayer ); void draw( const TEXTE_MODULE* aText, int aLayer ); - void draw( const MODULE* aModule ); + void draw( const MODULE* aModule, int aLayer ); void draw( const ZONE_CONTAINER* aZone ); void draw( const DIMENSION* aDimension, int aLayer ); void draw( const PCB_TARGET* aTarget );