Don't let pads that *should* be NPTHs get lost.

Borrow the hidden text colour so that they can be distinguished
from PTHs and correctly-marked NPTHs.

Fixes: lp:1494738
* https://bugs.launchpad.net/kicad/+bug/1494738
This commit is contained in:
Jeff Young 2018-02-04 09:46:38 +00:00 committed by Wayne Stambaugh
parent 864c152a5b
commit 60a4ce6623
4 changed files with 28 additions and 2 deletions

View File

@ -1213,6 +1213,13 @@ EDA_ITEM* D_PAD::Clone() const
}
bool D_PAD::PadShouldBeNPTH() const
{
return( m_Attribute == PAD_ATTRIB_STANDARD
&& m_Drill.x >= m_Size.x && m_Drill.y >= m_Size.y );
}
void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 0;

View File

@ -708,6 +708,13 @@ public:
return (D_PAD*) Clone();
}
/**
* A pad whose hole is the same size as the pad is a NPTH. However, if the user
* fails to mark this correctly then the pad will become invisible on the board.
* This check allows us to special-case this error-condition.
*/
bool PadShouldBeNPTH() const;
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
virtual unsigned int ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;

View File

@ -282,6 +282,12 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
drawInfo.m_ShowNotPlatedHole = true;
drawInfo.m_NPHoleColor = cds.GetItemColor( LAYER_NON_PLATEDHOLES );
}
// Don't let pads that *should* be NPTHs get lost
else if ( PadShouldBeNPTH() )
{
drawInfo.m_ShowNotPlatedHole = true;
drawInfo.m_NPHoleColor = cds.GetItemColor( LAYER_MOD_TEXT_INVISIBLE );
}
drawInfo.m_DrawMode = aDraw_mode;
drawInfo.m_Color = color;

View File

@ -222,6 +222,10 @@ const COLOR4D& PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer
return m_selectionCandidateColor;
}
// Don't let pads that *should* be NPTHs get lost
if( item->Type() == PCB_PAD_T && dyn_cast<const D_PAD*>( item )->PadShouldBeNPTH() )
aLayer = LAYER_MOD_TEXT_INVISIBLE;
if( item->IsSelected() )
{
return m_layerColorsSel[aLayer];
@ -674,9 +678,11 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
{
// Hole color is the background color for plated holes, but a specific color
// for not plated holes (LAYER_NON_PLATEDHOLES color layer )
if( aPad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED /*&&
brd->IsElementVisible( LAYER_NON_PLATEDHOLES )*/ )
if( aPad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
color = m_pcbSettings.GetColor( nullptr, LAYER_NON_PLATEDHOLES );
// Don't let pads that *should* be NPTH get lost
else if( aPad->PadShouldBeNPTH() )
color = m_pcbSettings.GetColor( aPad, aLayer );
else
color = m_pcbSettings.GetBackgroundColor();
}