Visibility control is for *filled* shapes.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20635
This commit is contained in:
Jeff Young 2025-04-13 13:12:11 +01:00
parent f1718370c4
commit ecb5c5e0d4
9 changed files with 46 additions and 52 deletions

View File

@ -813,7 +813,7 @@ GAL_SET GAL_SET::DefaultVisible()
LAYER_DRAW_BITMAPS,
LAYER_PADS,
LAYER_ZONES,
LAYER_SHAPES,
LAYER_FILLED_SHAPES,
LAYER_LOCKED_ITEM_SHADOW,
LAYER_CONFLICTS_SHADOW
};

View File

@ -439,14 +439,14 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
registerMigration( 3, 4,
[&]()
{
// Schema version 3 to 4: LAYER_SHAPES added to visibility controls
// Schema version 3 to 4: LAYER_FILLED_SHAPES added to visibility controls
std::string ptr( "board.visible_items" );
if( Contains( ptr ) )
{
if( At( ptr ).is_array() )
At( ptr ).push_back( LAYER_SHAPES - GAL_LAYER_ID_START );
At( ptr ).push_back( LAYER_FILLED_SHAPES - GAL_LAYER_ID_START );
else
At( "board" ).erase( "visible_items" );

View File

@ -31,7 +31,7 @@ GAL_SET UserVisbilityLayers()
LAYER_VIAS,
LAYER_PADS,
LAYER_ZONES,
LAYER_SHAPES,
LAYER_FILLED_SHAPES,
LAYER_DRAW_BITMAPS,
LAYER_FOOTPRINTS_FR,
LAYER_FOOTPRINTS_BK,
@ -62,7 +62,7 @@ GAL_LAYER_ID RenderLayerFromVisibilityLayer( VISIBILITY_LAYER aLayer )
case VISIBILITY_LAYER::VIAS: return LAYER_VIAS;
case VISIBILITY_LAYER::PADS: return LAYER_PADS;
case VISIBILITY_LAYER::ZONES: return LAYER_ZONES;
case VISIBILITY_LAYER::SHAPES: return LAYER_SHAPES;
case VISIBILITY_LAYER::FILLED_SHAPES: return LAYER_FILLED_SHAPES;
case VISIBILITY_LAYER::BITMAPS: return LAYER_DRAW_BITMAPS;
case VISIBILITY_LAYER::FOOTPRINTS_FRONT: return LAYER_FOOTPRINTS_FR;
case VISIBILITY_LAYER::FOOTPRINTS_BACK: return LAYER_FOOTPRINTS_BK;
@ -92,7 +92,7 @@ std::optional<VISIBILITY_LAYER> VisibilityLayerFromRenderLayer( GAL_LAYER_ID aLa
case LAYER_VIAS: return VISIBILITY_LAYER::VIAS;
case LAYER_PADS: return VISIBILITY_LAYER::PADS;
case LAYER_ZONES: return VISIBILITY_LAYER::ZONES;
case LAYER_SHAPES: return VISIBILITY_LAYER::SHAPES;
case LAYER_FILLED_SHAPES: return VISIBILITY_LAYER::FILLED_SHAPES;
case LAYER_DRAW_BITMAPS: return VISIBILITY_LAYER::BITMAPS;
case LAYER_FOOTPRINTS_FR: return VISIBILITY_LAYER::FOOTPRINTS_FRONT;
case LAYER_FOOTPRINTS_BK: return VISIBILITY_LAYER::FOOTPRINTS_BACK;

View File

@ -309,7 +309,7 @@ enum GAL_LAYER_ID: int
LAYER_CONFLICTS_SHADOW = GAL_LAYER_ID_START + 40,
/// Copper graphic shape opacity/visibility (color ignored).
LAYER_SHAPES = GAL_LAYER_ID_START + 41,
LAYER_FILLED_SHAPES = GAL_LAYER_ID_START + 41,
LAYER_DRC_SHAPE1 = GAL_LAYER_ID_START + 42, ///< Custom shape for DRC marker.
LAYER_DRC_SHAPE2 = GAL_LAYER_ID_START + 43, ///< Custom shape for DRC marker.

View File

@ -35,7 +35,7 @@ enum class VISIBILITY_LAYER
VIAS,
PADS,
ZONES,
SHAPES,
FILLED_SHAPES,
BITMAPS,
FOOTPRINTS_FRONT,
FOOTPRINTS_BACK,

View File

@ -187,7 +187,7 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
setVisibility( LAYER_VIA_BBLIND );
setVisibility( LAYER_VIA_THROUGH );
setVisibility( LAYER_ZONES );
setVisibility( LAYER_SHAPES );
setVisibility( LAYER_FILLED_SHAPES );
setVisibility( LAYER_DRC_WARNING );
setVisibility( LAYER_DRC_ERROR );
@ -217,7 +217,7 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
LAYER_FP_TEXT, LAYER_FP_VALUES, LAYER_FP_REFERENCES,
LAYER_FOOTPRINTS_FR, LAYER_FOOTPRINTS_BK,
LAYER_TRACKS, LAYER_VIAS,
LAYER_ZONES, LAYER_SHAPES,
LAYER_ZONES, LAYER_FILLED_SHAPES,
LAYER_PADS
};

View File

@ -1916,7 +1916,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
}
// Turn shapes on if they are off, so that the created object will be visible after completion
m_frame->SetObjectVisible( LAYER_SHAPES );
m_frame->SetObjectVisible( LAYER_FILLED_SHAPES );
if( !m_view->IsLayerVisible( layer ) )
{
@ -2178,7 +2178,7 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
}
// Turn shapes on if they are off, so that the created object will be visible after completion
m_frame->SetObjectVisible( LAYER_SHAPES );
m_frame->SetObjectVisible( LAYER_FILLED_SHAPES );
// geometric construction manager
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPointMgr;
@ -2578,9 +2578,6 @@ bool DRAWING_TOOL::drawArc( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
}
// Turn shapes on if they are off, so that the created object will be visible after completion
m_frame->SetObjectVisible( LAYER_SHAPES );
// Arc geometric construction manager
KIGFX::PREVIEW::ARC_GEOM_MANAGER arcManager;
@ -2884,9 +2881,6 @@ std::unique_ptr<PCB_SHAPE> DRAWING_TOOL::drawOneBezier( const TOOL_EVENT& aToo
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
}
// Turn shapes on if they are off, so that the created object will be visible after completion
m_frame->SetObjectVisible( LAYER_SHAPES );
// Arc geometric construction manager
KIGFX::PREVIEW::BEZIER_GEOM_MANAGER bezierManager;

View File

@ -3036,10 +3036,7 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili
KI_FALLTHROUGH;
case PCB_SHAPE_T:
// Note: LAYER_SHAPES does not control the visibility of a PCB_SHAPE_T, only
// the opacity of filled areas
// The visibility is managed by the item layer
if( options.m_FilledShapeOpacity == 0.0 )
if( options.m_FilledShapeOpacity == 0.0 && static_cast<const PCB_SHAPE*>( aItem )->IsAnyFill() )
return false;
KI_FALLTHROUGH;

View File

@ -327,30 +327,33 @@ const APPEARANCE_CONTROLS::APPEARANCE_SETTING APPEARANCE_CONTROLS::s_objectSetti
#define RR APPEARANCE_CONTROLS::APPEARANCE_SETTING // Render Row abbreviation to reduce source width
// text id tooltip opacity slider visibility checkbox
RR( _HKI( "Tracks" ), LAYER_TRACKS, _HKI( "Show tracks" ), true ),
RR( _HKI( "Vias" ), LAYER_VIAS, _HKI( "Show all vias" ), true ),
RR( _HKI( "Pads" ), LAYER_PADS, _HKI( "Show all pads" ), true ),
RR( _HKI( "Zones" ), LAYER_ZONES, _HKI( "Show copper zones" ), true ),
RR( _HKI( "Filled Shapes" ), LAYER_SHAPES, _HKI( "Opacity of filled shapes" ), true, false ),
RR( _HKI( "Images" ), LAYER_DRAW_BITMAPS, _HKI( "Show user images" ), true ),
// clang-format off
// text id tooltip opacity slider visibility checkbox
RR( _HKI( "Tracks" ), LAYER_TRACKS, _HKI( "Show tracks" ), true ),
RR( _HKI( "Vias" ), LAYER_VIAS, _HKI( "Show all vias" ), true ),
RR( _HKI( "Pads" ), LAYER_PADS, _HKI( "Show all pads" ), true ),
RR( _HKI( "Zones" ), LAYER_ZONES, _HKI( "Show copper zones" ), true ),
RR( _HKI( "Filled Shapes" ), LAYER_FILLED_SHAPES, _HKI( "Opacity of filled shapes" ), true, false ),
RR( _HKI( "Images" ), LAYER_DRAW_BITMAPS, _HKI( "Show user images" ), true ),
RR(),
RR( _HKI( "Footprints Front" ), LAYER_FOOTPRINTS_FR, _HKI( "Show footprints that are on board's front" ) ),
RR( _HKI( "Footprints Back" ), LAYER_FOOTPRINTS_BK, _HKI( "Show footprints that are on board's back" ) ),
RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ),
RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ),
RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ),
RR( _HKI( "Footprints Front" ), LAYER_FOOTPRINTS_FR, _HKI( "Show footprints that are on board's front" ) ),
RR( _HKI( "Footprints Back" ), LAYER_FOOTPRINTS_BK, _HKI( "Show footprints that are on board's back" ) ),
RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ),
RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ),
RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ),
RR(),
RR(),
RR( _HKI( "Ratsnest" ), LAYER_RATSNEST, _HKI( "Show unconnected nets as a ratsnest") ),
RR( _HKI( "DRC Warnings" ), LAYER_DRC_WARNING, _HKI( "DRC violations with a Warning severity" ) ),
RR( _HKI( "DRC Errors" ), LAYER_DRC_ERROR, _HKI( "DRC violations with an Error severity" ) ),
RR( _HKI( "DRC Exclusions" ), LAYER_DRC_EXCLUSION, _HKI( "DRC violations which have been individually excluded" ) ),
RR( _HKI( "Anchors" ), LAYER_ANCHOR, _HKI( "Show footprint and text origins as a cross" ) ),
RR( _HKI( "Locked Item Shadow" ), LAYER_LOCKED_ITEM_SHADOW, _HKI( "Show a shadow marker on locked items" ) ),
RR( _HKI( "Conflict Footprint Shadow" ), LAYER_CONFLICTS_SHADOW, _HKI( "Show a shadow marker on conflicting footprints" ) ),
RR( _HKI( "Drawing Sheet" ), LAYER_DRAWINGSHEET, _HKI( "Show drawing sheet borders and title block" ) ),
RR( _HKI( "Grid" ), LAYER_GRID, _HKI( "Show the (x,y) grid dots" ) )
RR( _HKI( "Ratsnest" ), LAYER_RATSNEST, _HKI( "Show unconnected nets as a ratsnest") ),
RR( _HKI( "DRC Warnings" ), LAYER_DRC_WARNING, _HKI( "DRC violations with a Warning severity" ) ),
RR( _HKI( "DRC Errors" ), LAYER_DRC_ERROR, _HKI( "DRC violations with an Error severity" ) ),
RR( _HKI( "DRC Exclusions" ), LAYER_DRC_EXCLUSION, _HKI( "DRC violations which have been individually excluded" ) ),
RR( _HKI( "Anchors" ), LAYER_ANCHOR, _HKI( "Show footprint and text origins as a cross" ) ),
RR( _HKI( "Locked Item Shadow" ), LAYER_LOCKED_ITEM_SHADOW, _HKI( "Show a shadow on locked items" ) ),
RR( _HKI( "Colliding Courtyards" ), LAYER_CONFLICTS_SHADOW, _HKI( "Show colliding footprint courtyards" ) ),
RR( _HKI( "Drawing Sheet" ), LAYER_DRAWINGSHEET, _HKI( "Show drawing sheet borders and title block" ) ),
RR( _HKI( "Grid" ), LAYER_GRID, _HKI( "Show the (x,y) grid dots" ) )
// clang-format on
};
/// These GAL layers are shown in the Objects tab in the footprint editor
@ -360,7 +363,7 @@ static std::set<int> s_allowedInFpEditor =
LAYER_VIAS,
LAYER_PADS,
LAYER_ZONES,
LAYER_SHAPES,
LAYER_FILLED_SHAPES,
LAYER_FP_VALUES,
LAYER_FP_REFERENCES,
LAYER_FP_TEXT,
@ -2400,14 +2403,14 @@ void APPEARANCE_CONTROLS::syncObjectSettings()
&& m_objectSettingsMap.count( LAYER_PADS )
&& m_objectSettingsMap.count( LAYER_ZONES )
&& m_objectSettingsMap.count( LAYER_DRAW_BITMAPS )
&& m_objectSettingsMap.count( LAYER_SHAPES ) );
&& m_objectSettingsMap.count( LAYER_FILLED_SHAPES ) );
m_objectSettingsMap[LAYER_TRACKS]->ctl_opacity->SetValue( opts.m_TrackOpacity * 100 );
m_objectSettingsMap[LAYER_VIAS]->ctl_opacity->SetValue( opts.m_ViaOpacity * 100 );
m_objectSettingsMap[LAYER_PADS]->ctl_opacity->SetValue( opts.m_PadOpacity * 100 );
m_objectSettingsMap[LAYER_ZONES]->ctl_opacity->SetValue( opts.m_ZoneOpacity * 100 );
m_objectSettingsMap[LAYER_DRAW_BITMAPS]->ctl_opacity->SetValue( opts.m_ImageOpacity * 100 );
m_objectSettingsMap[LAYER_SHAPES]->ctl_opacity->SetValue( opts.m_FilledShapeOpacity * 100 );
m_objectSettingsMap[LAYER_FILLED_SHAPES]->ctl_opacity->SetValue( opts.m_FilledShapeOpacity * 100 );
}
@ -3113,12 +3116,12 @@ void APPEARANCE_CONTROLS::onObjectOpacitySlider( int aLayer, float aOpacity )
switch( aLayer )
{
case static_cast<int>( LAYER_TRACKS ): options.m_TrackOpacity = aOpacity; break;
case static_cast<int>( LAYER_VIAS ): options.m_ViaOpacity = aOpacity; break;
case static_cast<int>( LAYER_PADS ): options.m_PadOpacity = aOpacity; break;
case static_cast<int>( LAYER_ZONES ): options.m_ZoneOpacity = aOpacity; break;
case static_cast<int>( LAYER_DRAW_BITMAPS ): options.m_ImageOpacity = aOpacity; break;
case static_cast<int>( LAYER_SHAPES ): options.m_FilledShapeOpacity = aOpacity; break;
case static_cast<int>( LAYER_TRACKS ): options.m_TrackOpacity = aOpacity; break;
case static_cast<int>( LAYER_VIAS ): options.m_ViaOpacity = aOpacity; break;
case static_cast<int>( LAYER_PADS ): options.m_PadOpacity = aOpacity; break;
case static_cast<int>( LAYER_ZONES ): options.m_ZoneOpacity = aOpacity; break;
case static_cast<int>( LAYER_DRAW_BITMAPS ): options.m_ImageOpacity = aOpacity; break;
case static_cast<int>( LAYER_FILLED_SHAPES ): options.m_FilledShapeOpacity = aOpacity; break;
default: return;
}