mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Pcbnew: also show clearance outlines in FP editor
Not having these shown makes it easy to accidentally enable them without noticing.
This commit is contained in:
parent
06e0e16336
commit
ea12689e29
@ -289,8 +289,31 @@ COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor()
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
|
||||
{
|
||||
const PCB_LAYER_ID oldLayer = GetActiveLayer();
|
||||
|
||||
if( oldLayer == aLayer )
|
||||
return;
|
||||
|
||||
PCB_BASE_FRAME::SetActiveLayer( aLayer );
|
||||
|
||||
/*
|
||||
* Follow the PCB editor logic for showing/hiding clearance layers: show only for
|
||||
* the active copper layer or a front/back non-copper layer.
|
||||
*/
|
||||
const auto getClearanceLayerForActive = []( PCB_LAYER_ID aActiveLayer ) -> std::optional<int>
|
||||
{
|
||||
if( IsCopperLayer( aActiveLayer ) )
|
||||
return CLEARANCE_LAYER_FOR( aActiveLayer );
|
||||
|
||||
return std::nullopt;
|
||||
};
|
||||
|
||||
if( std::optional<int> oldClearanceLayer = getClearanceLayerForActive( oldLayer ) )
|
||||
GetCanvas()->GetView()->SetLayerVisible( *oldClearanceLayer, false );
|
||||
|
||||
if( std::optional<int> newClearanceLayer = getClearanceLayerForActive( aLayer ) )
|
||||
GetCanvas()->GetView()->SetLayerVisible( *newClearanceLayer, true );
|
||||
|
||||
m_appearancePanel->OnLayerChanged();
|
||||
|
||||
m_toolManager->RunAction( PCB_ACTIONS::layerChanged ); // notify other tools
|
||||
|
@ -1493,7 +1493,7 @@ void PCB_EDIT_FRAME::SetGridColor( const COLOR4D& aColor )
|
||||
|
||||
void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
|
||||
{
|
||||
PCB_LAYER_ID oldLayer = GetActiveLayer();
|
||||
const PCB_LAYER_ID oldLayer = GetActiveLayer();
|
||||
|
||||
if( oldLayer == aLayer )
|
||||
return;
|
||||
@ -1508,7 +1508,9 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
|
||||
|
||||
/*
|
||||
* Only show pad, via and track clearances when a copper layer is active
|
||||
* and then only show the clearance layer for that copper layer.
|
||||
* and then only show the clearance layer for that copper layer. For
|
||||
* front/back non-copper layers, show the clearance layer for the outer
|
||||
* layer on that side.
|
||||
*
|
||||
* For pads/vias, this is to avoid clutter when there are pad/via layers
|
||||
* that vary in flash (i.e. clearance from the hole or pad edge), padstack
|
||||
@ -1518,15 +1520,19 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
|
||||
* have their own set of independent clearance layers to allow track clearance
|
||||
* to be shown for more layers.
|
||||
*/
|
||||
if( IsCopperLayer( oldLayer ) )
|
||||
const auto getClearanceLayerForActive = []( PCB_LAYER_ID aActiveLayer ) -> std::optional<int>
|
||||
{
|
||||
GetCanvas()->GetView()->SetLayerVisible( CLEARANCE_LAYER_FOR( oldLayer ), false );
|
||||
}
|
||||
if( IsCopperLayer( aActiveLayer ) )
|
||||
return CLEARANCE_LAYER_FOR( aActiveLayer );
|
||||
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
{
|
||||
GetCanvas()->GetView()->SetLayerVisible( CLEARANCE_LAYER_FOR( aLayer ), true );
|
||||
}
|
||||
return std::nullopt;
|
||||
};
|
||||
|
||||
if( std::optional<int> oldClearanceLayer = getClearanceLayerForActive( oldLayer ) )
|
||||
GetCanvas()->GetView()->SetLayerVisible( *oldClearanceLayer, false );
|
||||
|
||||
if( std::optional<int> newClearanceLayer = getClearanceLayerForActive( aLayer ) )
|
||||
GetCanvas()->GetView()->SetLayerVisible( *newClearanceLayer, true );
|
||||
|
||||
GetCanvas()->GetView()->UpdateAllItemsConditionally(
|
||||
[&]( KIGFX::VIEW_ITEM* aItem ) -> int
|
||||
|
Loading…
x
Reference in New Issue
Block a user