Fix a few issues when changing a color in render, in GAL mode.
Now colors of ratsnest, vias, not plated holes and anchors can be set. However not plated holes still have a color issue.
This commit is contained in:
parent
23a8741b5e
commit
bf21640ae5
|
@ -167,16 +167,16 @@ enum GAL_LAYER_ID: int
|
||||||
GAL_LAYER_ID_START = NETNAMES_LAYER_ID_END,
|
GAL_LAYER_ID_START = NETNAMES_LAYER_ID_END,
|
||||||
|
|
||||||
LAYER_VIAS = GAL_LAYER_ID_START,
|
LAYER_VIAS = GAL_LAYER_ID_START,
|
||||||
LAYER_VIA_MICROVIA,
|
LAYER_VIA_MICROVIA, ///< to draw micro vias
|
||||||
LAYER_VIA_BBLIND,
|
LAYER_VIA_BBLIND, ///< to draw blind/buried vias
|
||||||
LAYER_VIA_THROUGH,
|
LAYER_VIA_THROUGH, ///< to draw usual through hole vias
|
||||||
LAYER_NON_PLATED,
|
LAYER_NON_PLATED, ///< handle color for not plated holes
|
||||||
LAYER_MOD_TEXT_FR,
|
LAYER_MOD_TEXT_FR,
|
||||||
LAYER_MOD_TEXT_BK,
|
LAYER_MOD_TEXT_BK,
|
||||||
LAYER_MOD_TEXT_INVISIBLE, ///< text marked as invisible
|
LAYER_MOD_TEXT_INVISIBLE, ///< text marked as invisible
|
||||||
LAYER_ANCHOR,
|
LAYER_ANCHOR, ///< anchor of items having an anchor point (texts, footprints)
|
||||||
LAYER_PAD_FR,
|
LAYER_PAD_FR, ///< smd pads, front layer
|
||||||
LAYER_PAD_BK,
|
LAYER_PAD_BK, ///< smd pads, back layer
|
||||||
LAYER_RATSNEST,
|
LAYER_RATSNEST,
|
||||||
LAYER_GRID,
|
LAYER_GRID,
|
||||||
LAYER_GRID_AXES,
|
LAYER_GRID_AXES,
|
||||||
|
@ -187,8 +187,8 @@ enum GAL_LAYER_ID: int
|
||||||
LAYER_MOD_REFERENCES, ///< show modules references (when texts are visibles)
|
LAYER_MOD_REFERENCES, ///< show modules references (when texts are visibles)
|
||||||
LAYER_TRACKS,
|
LAYER_TRACKS,
|
||||||
LAYER_PADS, ///< multilayer pads, usually with holes
|
LAYER_PADS, ///< multilayer pads, usually with holes
|
||||||
LAYER_PADS_HOLES,
|
LAYER_PADS_HOLES, ///< to draw pad holes (plated or not plated)
|
||||||
LAYER_VIAS_HOLES,
|
LAYER_VIAS_HOLES, ///< to draw via holes (pad holes do not use this layer)
|
||||||
LAYER_DRC, ///< drc markers
|
LAYER_DRC, ///< drc markers
|
||||||
LAYER_WORKSHEET, ///< worksheet frame
|
LAYER_WORKSHEET, ///< worksheet frame
|
||||||
LAYER_GP_OVERLAY, ///< general purpose overlay
|
LAYER_GP_OVERLAY, ///< general purpose overlay
|
||||||
|
|
|
@ -61,7 +61,7 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
|
||||||
RR( _( "Through Via" ), LAYER_VIA_THROUGH, WHITE, _( "Show through vias" ) ),
|
RR( _( "Through Via" ), LAYER_VIA_THROUGH, WHITE, _( "Show through vias" ) ),
|
||||||
RR( _( "Bl/Buried Via" ), LAYER_VIA_BBLIND, WHITE, _( "Show blind or buried vias" ) ),
|
RR( _( "Bl/Buried Via" ), LAYER_VIA_BBLIND, WHITE, _( "Show blind or buried vias" ) ),
|
||||||
RR( _( "Micro Via" ), LAYER_VIA_MICROVIA, WHITE, _( "Show micro vias") ),
|
RR( _( "Micro Via" ), LAYER_VIA_MICROVIA, WHITE, _( "Show micro vias") ),
|
||||||
RR( _( "Non Plated" ), LAYER_NON_PLATED, WHITE, _( "Show non plated holes") ),
|
RR( _( "Non Plated Holes" ),LAYER_NON_PLATED, WHITE, _( "Show non plated holes in specific color") ),
|
||||||
RR( _( "Ratsnest" ), LAYER_RATSNEST, WHITE, _( "Show unconnected nets as a ratsnest") ),
|
RR( _( "Ratsnest" ), LAYER_RATSNEST, WHITE, _( "Show unconnected nets as a ratsnest") ),
|
||||||
|
|
||||||
RR( _( "Pads Front" ), LAYER_PAD_FR, WHITE, _( "Show footprint pads on board's front" ) ),
|
RR( _( "Pads Front" ), LAYER_PAD_FR, WHITE, _( "Show footprint pads on board's front" ) ),
|
||||||
|
@ -518,14 +518,17 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
|
||||||
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
|
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
|
||||||
{
|
{
|
||||||
wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
|
wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
|
||||||
myframe->GetBoard()->SetVisibleElementColor( static_cast<GAL_LAYER_ID>( aId ), aColor );
|
|
||||||
|
BOARD* brd = myframe->GetBoard();
|
||||||
|
brd->SetVisibleElementColor( static_cast<GAL_LAYER_ID>( aId ), aColor );
|
||||||
|
|
||||||
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
|
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
|
||||||
|
|
||||||
if( galCanvas && myframe->IsGalCanvasActive() )
|
if( galCanvas && myframe->IsGalCanvasActive() )
|
||||||
{
|
{
|
||||||
KIGFX::VIEW* view = galCanvas->GetView();
|
KIGFX::VIEW* view = galCanvas->GetView();
|
||||||
view->GetPainter()->GetSettings()->ImportLegacyColors( myframe->GetBoard()->GetColorsSettings() );
|
view->GetPainter()->GetSettings()->ImportLegacyColors( brd->GetColorsSettings() );
|
||||||
|
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // useful to update rastnest
|
||||||
view->UpdateLayerColor( aId );
|
view->UpdateLayerColor( aId );
|
||||||
galCanvas->Refresh();
|
galCanvas->Refresh();
|
||||||
}
|
}
|
||||||
|
@ -560,8 +563,8 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
|
||||||
|
|
||||||
galCanvas->Refresh();
|
galCanvas->Refresh();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
myframe->GetCanvas()->Refresh();
|
myframe->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----</LAYER_WIDGET callbacks>------------------------------------------
|
//-----</LAYER_WIDGET callbacks>------------------------------------------
|
||||||
|
|
|
@ -50,7 +50,7 @@ const LAYER_NUM GAL_LAYER_ORDER[] =
|
||||||
LAYER_MOD_REFERENCES, LAYER_MOD_VALUES,
|
LAYER_MOD_REFERENCES, LAYER_MOD_VALUES,
|
||||||
|
|
||||||
LAYER_RATSNEST, LAYER_ANCHOR,
|
LAYER_RATSNEST, LAYER_ANCHOR,
|
||||||
LAYER_VIAS_HOLES, LAYER_PADS_HOLES,
|
LAYER_VIAS_HOLES, LAYER_PADS_HOLES, LAYER_NON_PLATED,
|
||||||
LAYER_VIA_THROUGH, LAYER_VIA_BBLIND,
|
LAYER_VIA_THROUGH, LAYER_VIA_BBLIND,
|
||||||
LAYER_VIA_MICROVIA, LAYER_PADS,
|
LAYER_VIA_MICROVIA, LAYER_PADS,
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( PCB_LAYER_ID aLayer )
|
||||||
LAYER_NUM layers[] = {
|
LAYER_NUM layers[] = {
|
||||||
GetNetnameLayer( aLayer ), LAYER_VIA_THROUGH,
|
GetNetnameLayer( aLayer ), LAYER_VIA_THROUGH,
|
||||||
LAYER_VIAS_HOLES, LAYER_PADS,
|
LAYER_VIAS_HOLES, LAYER_PADS,
|
||||||
LAYER_PADS_HOLES, LAYER_PADS_NETNAMES,
|
LAYER_PADS_HOLES, LAYER_NON_PLATED, LAYER_PADS_NETNAMES,
|
||||||
LAYER_GP_OVERLAY, LAYER_RATSNEST
|
LAYER_GP_OVERLAY, LAYER_RATSNEST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( PCB_LAYER_ID aLayer )
|
||||||
const LAYER_NUM layers[] = {
|
const LAYER_NUM layers[] = {
|
||||||
LAYER_VIA_THROUGH,
|
LAYER_VIA_THROUGH,
|
||||||
LAYER_VIAS_HOLES, LAYER_PADS,
|
LAYER_VIAS_HOLES, LAYER_PADS,
|
||||||
LAYER_PADS_HOLES, LAYER_PADS_NETNAMES,
|
LAYER_PADS_HOLES, LAYER_NON_PLATED, LAYER_PADS_NETNAMES,
|
||||||
LAYER_GP_OVERLAY, LAYER_RATSNEST, Dwgs_User,
|
LAYER_GP_OVERLAY, LAYER_RATSNEST, Dwgs_User,
|
||||||
LAYER_DRC
|
LAYER_DRC
|
||||||
};
|
};
|
||||||
|
@ -401,6 +401,7 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
|
||||||
// Some more required layers settings
|
// Some more required layers settings
|
||||||
m_view->SetRequired( LAYER_VIAS_HOLES, LAYER_VIA_THROUGH );
|
m_view->SetRequired( LAYER_VIAS_HOLES, LAYER_VIA_THROUGH );
|
||||||
m_view->SetRequired( LAYER_PADS_HOLES, LAYER_PADS );
|
m_view->SetRequired( LAYER_PADS_HOLES, LAYER_PADS );
|
||||||
|
m_view->SetRequired( LAYER_NON_PLATED, LAYER_PADS );
|
||||||
m_view->SetRequired( LAYER_PADS_NETNAMES, LAYER_PADS );
|
m_view->SetRequired( LAYER_PADS_NETNAMES, LAYER_PADS );
|
||||||
|
|
||||||
// Front modules
|
// Front modules
|
||||||
|
|
|
@ -65,32 +65,34 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
|
||||||
|
|
||||||
void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSettings )
|
void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSettings )
|
||||||
{
|
{
|
||||||
|
// Init board layers colors:
|
||||||
for( int i = 0; i < PCB_LAYER_ID_COUNT; i++ )
|
for( int i = 0; i < PCB_LAYER_ID_COUNT; i++ )
|
||||||
{
|
{
|
||||||
m_layerColors[i] = aSettings->GetLayerColor( i );
|
m_layerColors[i] = aSettings->GetLayerColor( i );
|
||||||
m_layerColors[i].a = 0.8; // slightly transparent
|
m_layerColors[i].a = 0.8; // slightly transparent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Init specific graphic layers colors:
|
||||||
for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
|
for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
|
||||||
m_layerColors[i] = aSettings->GetItemColor( i );
|
m_layerColors[i] = aSettings->GetItemColor( i );
|
||||||
|
|
||||||
m_layerColors[LAYER_MOD_TEXT_FR] = m_layerColors[F_SilkS];
|
// Default colors for specific layers (not really board layers).
|
||||||
m_layerColors[LAYER_MOD_TEXT_BK] = m_layerColors[B_SilkS];
|
m_layerColors[LAYER_VIAS_HOLES] = COLOR4D( 0.5, 0.4, 0.0, 0.8 );
|
||||||
|
m_layerColors[LAYER_PADS_HOLES] = COLOR4D( 0.0, 0.0, 0.0, 1.0 );
|
||||||
|
m_layerColors[LAYER_PADS] = COLOR4D( 0.6, 0.6, 0.0, 0.8 );
|
||||||
|
m_layerColors[LAYER_PADS_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
||||||
|
m_layerColors[LAYER_PAD_FR_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
||||||
|
m_layerColors[LAYER_PAD_BK_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
||||||
|
m_layerColors[LAYER_WORKSHEET] = COLOR4D( 0.5, 0.0, 0.0, 0.8 );
|
||||||
|
m_layerColors[LAYER_DRC] = COLOR4D( 1.0, 0.0, 0.0, 0.8 );
|
||||||
|
|
||||||
// Default colors for specific layers
|
// LAYER_NON_PLATED, LAYER_ANCHOR],LAYER_RATSNEST,
|
||||||
m_layerColors[LAYER_VIAS_HOLES] = COLOR4D( 0.5, 0.4, 0.0, 0.8 );
|
// LAYER_VIA_THROUGH], LAYER_VIA_BBLIND, LAYER_VIA_MICROVIA
|
||||||
m_layerColors[LAYER_PADS_HOLES] = COLOR4D( 0.0, 0.5, 0.5, 0.8 );
|
// are initialized from aSettings
|
||||||
m_layerColors[LAYER_VIA_THROUGH] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
|
|
||||||
m_layerColors[LAYER_VIA_BBLIND] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
|
// These colors are not actually used. Set just in case...
|
||||||
m_layerColors[LAYER_VIA_MICROVIA] = COLOR4D( 0.4, 0.4, 0.8, 0.8 );
|
m_layerColors[LAYER_MOD_TEXT_FR] = m_layerColors[F_SilkS];
|
||||||
m_layerColors[LAYER_PADS] = COLOR4D( 0.6, 0.6, 0.6, 0.8 );
|
m_layerColors[LAYER_MOD_TEXT_BK] = m_layerColors[B_SilkS];
|
||||||
m_layerColors[LAYER_PADS_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
|
||||||
m_layerColors[LAYER_PAD_FR_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
|
||||||
m_layerColors[LAYER_PAD_BK_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
|
||||||
m_layerColors[LAYER_ANCHOR] = COLOR4D( 0.3, 0.3, 1.0, 0.9 );
|
|
||||||
m_layerColors[LAYER_RATSNEST] = COLOR4D( 0.4, 0.4, 0.4, 0.8 );
|
|
||||||
m_layerColors[LAYER_WORKSHEET] = COLOR4D( 0.5, 0.0, 0.0, 0.8 );
|
|
||||||
m_layerColors[LAYER_DRC] = COLOR4D( 1.0, 0.0, 0.0, 0.8 );
|
|
||||||
|
|
||||||
// Make ratsnest lines slightly transparent
|
// Make ratsnest lines slightly transparent
|
||||||
m_layerColors[LAYER_RATSNEST].a = 0.8;
|
m_layerColors[LAYER_RATSNEST].a = 0.8;
|
||||||
|
@ -599,7 +601,20 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pad drawing
|
// Pad drawing
|
||||||
const COLOR4D& color = m_pcbSettings.GetColor( aPad, aLayer );
|
COLOR4D color = m_pcbSettings.GetColor( aPad, aLayer );
|
||||||
|
|
||||||
|
// Pad holes color is specific
|
||||||
|
if( aLayer == LAYER_PADS_HOLES || aLayer == LAYER_NON_PLATED )
|
||||||
|
{
|
||||||
|
// Hole color is the background color for plated holes, but a specific color
|
||||||
|
// for not plated holes (LAYER_NON_PLATED color layer )
|
||||||
|
if( aPad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED /*&&
|
||||||
|
brd->IsElementVisible( LAYER_NON_PLATED )*/ )
|
||||||
|
color = m_pcbSettings.GetColor( nullptr, LAYER_NON_PLATED );
|
||||||
|
else
|
||||||
|
color = m_pcbSettings.GetBackgroundColor();
|
||||||
|
}
|
||||||
|
|
||||||
VECTOR2D size;
|
VECTOR2D size;
|
||||||
|
|
||||||
if( m_pcbSettings.m_sketchMode[LAYER_PADS] )
|
if( m_pcbSettings.m_sketchMode[LAYER_PADS] )
|
||||||
|
@ -623,7 +638,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
||||||
m_gal->Rotate( -aPad->GetOrientationRadians() );
|
m_gal->Rotate( -aPad->GetOrientationRadians() );
|
||||||
|
|
||||||
// Choose drawing settings depending on if we are drawing a pad itself or a hole
|
// Choose drawing settings depending on if we are drawing a pad itself or a hole
|
||||||
if( aLayer == LAYER_PADS_HOLES )
|
if( aLayer == LAYER_PADS_HOLES || aLayer == LAYER_NON_PLATED )
|
||||||
{
|
{
|
||||||
// Drawing hole: has same shape as PAD_CIRCLE or PAD_OVAL
|
// Drawing hole: has same shape as PAD_CIRCLE or PAD_OVAL
|
||||||
size = VECTOR2D( aPad->GetDrillSize() ) / 2.0;
|
size = VECTOR2D( aPad->GetDrillSize() ) / 2.0;
|
||||||
|
|
Loading…
Reference in New Issue