mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Add a new GAL layer for shape backgrounds
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12393
This commit is contained in:
parent
65a2d95282
commit
96082a63a8
@ -130,6 +130,7 @@ wxString LayerName( int aLayer )
|
||||
case LAYER_RULE_AREAS: return _( "Rule areas" );
|
||||
case LAYER_DEVICE: return _( "Symbol body outlines" );
|
||||
case LAYER_DEVICE_BACKGROUND: return _( "Symbol body fills" );
|
||||
case LAYER_SHAPES_BACKGROUND: return _( "Shape fills" );
|
||||
case LAYER_NOTES: return _( "Schematic text && graphics" );
|
||||
case LAYER_PRIVATE_NOTES: return _( "Symbol private text && graphics" );
|
||||
case LAYER_NOTES_BACKGROUND: return _( "Schematic text && graphics backgrounds" );
|
||||
|
@ -364,7 +364,8 @@ COLOR4D SCH_PAINTER::getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDr
|
||||
{
|
||||
const SCH_SHAPE* shape = static_cast<const SCH_SHAPE*>( aItem );
|
||||
|
||||
if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND )
|
||||
if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND
|
||||
|| aLayer == LAYER_SHAPES_BACKGROUND )
|
||||
{
|
||||
if( !isSymbolChild || shape->GetFillColor() != COLOR4D::UNSPECIFIED )
|
||||
color = shape->GetFillColor();
|
||||
@ -410,7 +411,8 @@ COLOR4D SCH_PAINTER::getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDr
|
||||
{
|
||||
const SCH_TEXTBOX* textBox = dynamic_cast<const SCH_TEXTBOX*>( aItem );
|
||||
|
||||
if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND )
|
||||
if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND
|
||||
|| aLayer == LAYER_SHAPES_BACKGROUND )
|
||||
color = textBox->GetFillColor();
|
||||
else if( !isSymbolChild || textBox->GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = textBox->GetTextColor();
|
||||
@ -436,7 +438,8 @@ COLOR4D SCH_PAINTER::getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDr
|
||||
else
|
||||
color = color.WithAlpha( 0.15 );
|
||||
}
|
||||
else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_SHEET_BACKGROUND )
|
||||
else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_SHEET_BACKGROUND
|
||||
|| aLayer == LAYER_SHAPES_BACKGROUND )
|
||||
{
|
||||
color = color.WithAlpha( 0.2 );
|
||||
}
|
||||
@ -445,9 +448,9 @@ COLOR4D SCH_PAINTER::getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDr
|
||||
{
|
||||
color = m_schSettings.GetLayerColor( LAYER_SELECTION_SHADOWS );
|
||||
}
|
||||
else if( aItem->IsSelected() && ( aLayer == LAYER_DEVICE_BACKGROUND
|
||||
|| aLayer == LAYER_SHEET_BACKGROUND
|
||||
|| aLayer == LAYER_NOTES_BACKGROUND ) )
|
||||
else if( aItem->IsSelected()
|
||||
&& ( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_SHEET_BACKGROUND
|
||||
|| aLayer == LAYER_NOTES_BACKGROUND || aLayer == LAYER_SHAPES_BACKGROUND ) )
|
||||
{
|
||||
// Selected items will be painted over all other items, so make backgrounds translucent so
|
||||
// that non-selected overlapping objects are visible
|
||||
@ -1552,7 +1555,8 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer, bool aDimmed )
|
||||
|
||||
drawShape( aShape );
|
||||
}
|
||||
else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND )
|
||||
else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND
|
||||
|| aLayer == LAYER_SHAPES_BACKGROUND )
|
||||
{
|
||||
switch( aShape->GetFillMode() )
|
||||
{
|
||||
@ -1943,7 +1947,8 @@ void SCH_PAINTER::draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed )
|
||||
|
||||
m_gal->DrawRectangle( aTextBox->GetPosition(), aTextBox->GetEnd() );
|
||||
}
|
||||
else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND )
|
||||
else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND
|
||||
|| aLayer == LAYER_SHAPES_BACKGROUND )
|
||||
{
|
||||
// Do not fill the shape in B&W print mode, to avoid to visible items
|
||||
// inside the shape
|
||||
|
@ -575,11 +575,20 @@ std::vector<int> SCH_SHAPE::ViewGetLayers() const
|
||||
layers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : m_layer;
|
||||
|
||||
if( m_layer == LAYER_PRIVATE_NOTES )
|
||||
layers[1] = LAYER_NOTES_BACKGROUND;
|
||||
{
|
||||
layers[1] = LAYER_SHAPES_BACKGROUND;
|
||||
}
|
||||
else if( m_layer == LAYER_DEVICE )
|
||||
layers[1] = LAYER_DEVICE_BACKGROUND;
|
||||
{
|
||||
if( m_fill == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
layers[1] = LAYER_DEVICE_BACKGROUND;
|
||||
else
|
||||
layers[1] = LAYER_SHAPES_BACKGROUND;
|
||||
}
|
||||
else
|
||||
layers[1] = LAYER_NOTES_BACKGROUND;
|
||||
{
|
||||
layers[1] = LAYER_SHAPES_BACKGROUND;
|
||||
}
|
||||
|
||||
layers[2] = LAYER_SELECTION_SHADOWS;
|
||||
|
||||
|
@ -42,28 +42,45 @@ class DS_PROXY_VIEW_ITEM;
|
||||
// Eeschema 100nm as the internal units
|
||||
constexpr double SCH_WORLD_UNIT ( 1e-7 / 0.0254 );
|
||||
|
||||
static const int SCH_LAYER_ORDER[] =
|
||||
{
|
||||
LAYER_GP_OVERLAY, LAYER_SELECT_OVERLAY,
|
||||
LAYER_ERC_ERR, LAYER_ERC_WARN, LAYER_ERC_EXCLUSION, LAYER_DANGLING,
|
||||
LAYER_OP_VOLTAGES, LAYER_OP_CURRENTS,
|
||||
LAYER_REFERENCEPART, LAYER_VALUEPART, LAYER_FIELDS,
|
||||
LAYER_PINNUM, LAYER_PINNAM,
|
||||
LAYER_INTERSHEET_REFS, LAYER_NETCLASS_REFS, LAYER_RULE_AREAS,
|
||||
LAYER_BUS_JUNCTION, LAYER_JUNCTION, LAYER_NOCONNECT,
|
||||
LAYER_HIERLABEL, LAYER_GLOBLABEL, LAYER_LOCLABEL,
|
||||
LAYER_SHEETFILENAME, LAYER_SHEETNAME, LAYER_SHEETLABEL, LAYER_SHEETFIELDS,
|
||||
LAYER_NOTES, LAYER_PRIVATE_NOTES,
|
||||
LAYER_WIRE, LAYER_BUS,
|
||||
LAYER_DEVICE,
|
||||
LAYER_SHEET,
|
||||
LAYER_SELECTION_SHADOWS,
|
||||
LAYER_DRAW_BITMAPS,
|
||||
LAYER_DEVICE_BACKGROUND,
|
||||
LAYER_SHEET_BACKGROUND,
|
||||
LAYER_NOTES_BACKGROUND,
|
||||
LAYER_DRAWINGSHEET
|
||||
};
|
||||
static const int SCH_LAYER_ORDER[] = { LAYER_GP_OVERLAY,
|
||||
LAYER_SELECT_OVERLAY,
|
||||
LAYER_ERC_ERR,
|
||||
LAYER_ERC_WARN,
|
||||
LAYER_ERC_EXCLUSION,
|
||||
LAYER_DANGLING,
|
||||
LAYER_OP_VOLTAGES,
|
||||
LAYER_OP_CURRENTS,
|
||||
LAYER_REFERENCEPART,
|
||||
LAYER_VALUEPART,
|
||||
LAYER_FIELDS,
|
||||
LAYER_PINNUM,
|
||||
LAYER_PINNAM,
|
||||
LAYER_INTERSHEET_REFS,
|
||||
LAYER_NETCLASS_REFS,
|
||||
LAYER_RULE_AREAS,
|
||||
LAYER_BUS_JUNCTION,
|
||||
LAYER_JUNCTION,
|
||||
LAYER_NOCONNECT,
|
||||
LAYER_HIERLABEL,
|
||||
LAYER_GLOBLABEL,
|
||||
LAYER_LOCLABEL,
|
||||
LAYER_SHEETFILENAME,
|
||||
LAYER_SHEETNAME,
|
||||
LAYER_SHEETLABEL,
|
||||
LAYER_SHEETFIELDS,
|
||||
LAYER_NOTES,
|
||||
LAYER_PRIVATE_NOTES,
|
||||
LAYER_WIRE,
|
||||
LAYER_BUS,
|
||||
LAYER_DEVICE,
|
||||
LAYER_SHEET,
|
||||
LAYER_SELECTION_SHADOWS,
|
||||
LAYER_DRAW_BITMAPS,
|
||||
LAYER_SHAPES_BACKGROUND,
|
||||
LAYER_DEVICE_BACKGROUND,
|
||||
LAYER_SHEET_BACKGROUND,
|
||||
LAYER_NOTES_BACKGROUND,
|
||||
LAYER_DRAWINGSHEET };
|
||||
|
||||
|
||||
namespace KIGFX
|
||||
|
@ -29,20 +29,27 @@ std::vector<int> SYMBOL::ViewGetLayers() const
|
||||
// Pins and op point currents are drawn by their parent symbol,
|
||||
// so the parent must draw to LAYER_DANGLING and LAYER_OP_CURRENTS
|
||||
if( Type() == SCH_SYMBOL_T )
|
||||
return { LAYER_DANGLING, LAYER_OP_CURRENTS, LAYER_DEVICE,
|
||||
LAYER_REFERENCEPART, LAYER_VALUEPART, LAYER_FIELDS,
|
||||
LAYER_DEVICE_BACKGROUND, LAYER_NOTES_BACKGROUND, LAYER_SELECTION_SHADOWS };
|
||||
return { LAYER_DANGLING, LAYER_OP_CURRENTS, LAYER_DEVICE,
|
||||
LAYER_REFERENCEPART, LAYER_VALUEPART, LAYER_FIELDS,
|
||||
LAYER_DEVICE_BACKGROUND, LAYER_SHAPES_BACKGROUND, LAYER_NOTES_BACKGROUND,
|
||||
LAYER_SELECTION_SHADOWS };
|
||||
|
||||
// Library symbols must include LAYER_PRIVATE_NOTES
|
||||
if( Type() == LIB_SYMBOL_T )
|
||||
return { LAYER_DEVICE, LAYER_REFERENCEPART, LAYER_VALUEPART,
|
||||
LAYER_FIELDS, LAYER_PRIVATE_NOTES, LAYER_DEVICE_BACKGROUND,
|
||||
LAYER_NOTES_BACKGROUND, LAYER_SELECTION_SHADOWS };
|
||||
return { LAYER_DEVICE,
|
||||
LAYER_REFERENCEPART,
|
||||
LAYER_VALUEPART,
|
||||
LAYER_FIELDS,
|
||||
LAYER_PRIVATE_NOTES,
|
||||
LAYER_DEVICE_BACKGROUND,
|
||||
LAYER_SHAPES_BACKGROUND,
|
||||
LAYER_NOTES_BACKGROUND,
|
||||
LAYER_SELECTION_SHADOWS };
|
||||
|
||||
// This should never happen but if it does, return a reasonable default
|
||||
return { LAYER_DEVICE, LAYER_REFERENCEPART, LAYER_VALUEPART,
|
||||
LAYER_FIELDS, LAYER_DEVICE_BACKGROUND, LAYER_NOTES_BACKGROUND,
|
||||
LAYER_SELECTION_SHADOWS };
|
||||
LAYER_FIELDS, LAYER_DEVICE_BACKGROUND, LAYER_SHAPES_BACKGROUND,
|
||||
LAYER_NOTES_BACKGROUND, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -400,6 +400,7 @@ enum SCH_LAYER_ID : int
|
||||
LAYER_ERC_ERR,
|
||||
LAYER_ERC_EXCLUSION,
|
||||
LAYER_EXCLUDED_FROM_SIM,
|
||||
LAYER_SHAPES_BACKGROUND,
|
||||
LAYER_DEVICE_BACKGROUND,
|
||||
LAYER_SHEET_BACKGROUND,
|
||||
LAYER_SCHEMATIC_GRID,
|
||||
|
Loading…
x
Reference in New Issue
Block a user