diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 16e90924f9..b2ebcac80d 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -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; diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp index 76bf66dca5..bdabe367d2 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp @@ -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(); diff --git a/pcbnew/dialogs/dialog_rule_area_properties.cpp b/pcbnew/dialogs/dialog_rule_area_properties.cpp index f110b777cc..31dcfeb751 100644 --- a/pcbnew/dialogs/dialog_rule_area_properties.cpp +++ b/pcbnew/dialogs/dialog_rule_area_properties.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck - * 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 #include #include -#include #include #include #include @@ -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( 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(); diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index d6fab3a76f..e74e52b45f 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -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() ); } diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index 5ad5448672..edffffc7fc 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -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& // 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( aFrame->GetScreen() ) ) - layer = dynamic_cast( 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 ) ); - } - } } diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index d211f67c7d..00800bffdb 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -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 ); diff --git a/pcbnew/zone_settings.h b/pcbnew/zone_settings.h index 69d3b4f386..3d48ea447f 100644 --- a/pcbnew/zone_settings.h +++ b/pcbnew/zone_settings.h @@ -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: