Allow Rule Areas on all physical layers.

Required to do things like modify silk_clearance rules.
This commit is contained in:
Jeff Young 2022-02-17 23:54:15 +00:00
parent 4966e2ebc2
commit 8f670552a6
7 changed files with 25 additions and 55 deletions

View File

@ -186,7 +186,9 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
m_ptr = aSettings;
m_settings = *aSettings;
m_settings.SetupLayersList( m_layers, m_Parent, true );
m_settings.SetupLayersList( m_layers, m_Parent,
LSET::AllCuMask( aParent->GetBoard()->GetCopperLayerCount() ),
false );
m_settingsExported = false;
m_currentlySelectedNetcode = INVALID_NET_CODE;

View File

@ -84,7 +84,10 @@ DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME*
m_ptr = aSettings;
m_settings = *aSettings;
m_settings.SetupLayersList( m_layers, m_parent, false );
bool fpEditorMode = m_parent->IsType( FRAME_FOOTPRINT_EDITOR );
m_settings.SetupLayersList( m_layers, m_parent, LSET::AllNonCuMask(), fpEditorMode );
SetupStandardButtons();

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -27,7 +27,6 @@
#include <confirm.h>
#include <pcb_edit_frame.h>
#include <pcbnew_settings.h>
#include <footprint_edit_frame.h>
#include <zone_settings.h>
#include <dialog_rule_area_properties_base.h>
#include <widgets/unit_binder.h>
@ -78,10 +77,12 @@ DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES( PCB_BASE_FRAME* aParen
m_ptr = aSettings;
m_zonesettings = *aSettings;
m_isFpEditor = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( aParent ) != nullptr;
m_isFpEditor = m_parent->IsType( FRAME_FOOTPRINT_EDITOR );
bool fpEditorMode = m_parent->IsType( FRAME_FOOTPRINT_EDITOR );
m_zonesettings.SetupLayersList( m_layers, m_parent, true, fpEditorMode );
BOARD* board = m_parent->GetBoard();
LSET layers = LSET::AllBoardTechMask() | LSET::AllCuMask( board->GetCopperLayerCount() );
m_zonesettings.SetupLayersList( m_layers, m_parent, layers, m_isFpEditor );
SetupStandardButtons();

View File

@ -568,12 +568,13 @@ bool calcIsInsideArea( BOARD_ITEM* aItem, const EDA_RECT& aItemBBox, PCB_EXPR_CO
}
else
{
if( aCtx->GetLayer() != UNDEFINED_LAYER
&& !( aArea->GetLayerSet().Contains( aCtx->GetLayer() ) ) )
PCB_LAYER_ID layer = aCtx->GetLayer();
if( layer != UNDEFINED_LAYER && !( aArea->GetLayerSet().Contains( layer ) ) )
return false;
if( !shape )
shape = aItem->GetEffectiveShape( aCtx->GetLayer() );
shape = aItem->GetEffectiveShape( layer );
return areaOutline.Collide( shape.get() );
}

View File

@ -233,12 +233,6 @@ void ZONE::SetLayer( PCB_LAYER_ID aLayer )
void ZONE::SetLayerSet( LSET aLayerSet )
{
if( GetIsRuleArea() )
{
// Rule areas can only exist on copper layers
aLayerSet &= LSET::AllCuMask();
}
if( aLayerSet.count() == 0 )
return;
@ -609,25 +603,6 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
// and filled polygons can explain the display and DRC calculation time:
msg.Printf( wxT( "%d" ), (int) m_borderHatchLines.size() );
aList.emplace_back( MSG_PANEL_ITEM( _( "HatchBorder Lines" ), msg ) );
PCB_LAYER_ID layer = m_layer;
if( dynamic_cast<PCB_SCREEN*>( aFrame->GetScreen() ) )
layer = dynamic_cast<PCB_SCREEN*>( aFrame->GetScreen() )->m_Active_Layer;
if( !GetIsRuleArea() )
{
auto layer_it = m_FilledPolysList.find( layer );
if( layer_it == m_FilledPolysList.end() )
layer_it = m_FilledPolysList.begin();
if( layer_it != m_FilledPolysList.end() )
{
msg.Printf( wxT( "%d" ), layer_it->second->TotalVertices() );
aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg ) );
}
}
}

View File

@ -194,16 +194,14 @@ const static wxSize CHECKERBOARD_SIZE( 8, 8 );
// A helper for setting up a dialog list for specifying zone layers. Used by all three
// zone settings dialogs.
void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame,
bool aShowCopper, bool aFpEditorMode )
LSET aLayers, bool aFpEditorMode )
{
BOARD* board = aFrame->GetBoard();
COLOR4D backgroundColor = aFrame->GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND );
LSET layers = aShowCopper ? LSET::AllCuMask( board->GetCopperLayerCount() )
: LSET::AllNonCuMask();
// In the Footprint Editor In1_Cu is used as a proxy for "all inner layers"
if( aFpEditorMode )
layers.set( In1_Cu );
aLayers.set( In1_Cu );
wxDataViewColumn* checkColumn = aList->AppendToggleColumn( wxEmptyString );
wxDataViewColumn* layerColumn = aList->AppendIconTextColumn( wxEmptyString );
@ -212,7 +210,7 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME*
int textWidth = 0;
for( LSEQ layer = layers.UIOrder(); layer; ++layer )
for( LSEQ layer = aLayers.UIOrder(); layer; ++layer )
{
PCB_LAYER_ID layerID = *layer;
wxString layerName = board->GetLayerName( layerID );

View File

@ -142,11 +142,10 @@ public:
* A helper routine for the various zone dialogs (copper, non-copper, keepout).
* @param aList the wxDataViewListCtrl to populate
* @param aFrame the parent editor frame
* @param aShowCopper indicates whether copper or technical layers should be shown
* @param aFpEditorMode true to show (when aShowCopper = true) the option: all inner layers
* @param aFpEditorMode true to show a single "Inner Layers" item for all inner copper layers
*/
void SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame,
bool aShowCopper, bool aFpEditorMode = false );
void SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame, LSET aLayers,
bool aFpEditorMode );
/**
* Function ExportSetting
@ -160,22 +159,13 @@ public:
void ExportSetting( ZONE& aTarget, bool aFullExport = true ) const;
void SetCornerSmoothingType( int aType) { m_cornerSmoothingType = aType; }
int GetCornerSmoothingType() const { return m_cornerSmoothingType; }
void SetCornerRadius( int aRadius );
unsigned int GetCornerRadius() const { return m_cornerRadius; }
ZONE_CONNECTION GetPadConnection() const
{
return m_padConnection;
}
void SetPadConnection( ZONE_CONNECTION aPadConnection )
{
m_padConnection = aPadConnection;
}
ZONE_CONNECTION GetPadConnection() const { return m_padConnection; }
void SetPadConnection( ZONE_CONNECTION aPadConnection ) { m_padConnection = aPadConnection; }
/**
* Accessors to parameters used in Rule Area zones: