From 7d3eee8cf9c7d1ebb491aa224fa0287cebc1c576 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 23 Sep 2020 10:35:13 +0100 Subject: [PATCH] Move DebugZoneFiller to advanced config. This will hopefully keep it from accidentally getting checked in again. --- common/advanced_config.cpp | 7 +++++++ include/advanced_config.h | 14 +++++++++----- pcbnew/class_zone.cpp | 5 ++--- pcbnew/zone_filler.cpp | 10 ++++++---- pcbnew/zone_filler.h | 4 ++-- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/common/advanced_config.cpp b/common/advanced_config.cpp index 53c5b110fb..fbe68ada99 100644 --- a/common/advanced_config.cpp +++ b/common/advanced_config.cpp @@ -138,6 +138,8 @@ static const wxChar PluginAltiumSch[] = wxT( "PluginAltiumSch" ); */ static const wxChar MinPlotPenWidth[] = wxT( "MinPlotPenWidth" ); +static const wxChar DebugZoneFiller[] = wxT( "DebugZoneFiller" ); + } // namespace KEYS @@ -233,6 +235,8 @@ ADVANCED_CFG::ADVANCED_CFG() m_MinPlotPenWidth = 0.0212; // 1 pixel at 1200dpi. + m_DebugZoneFiller = false; + loadFromConfigFile(); } @@ -307,6 +311,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg ) configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MinPlotPenWidth, &m_MinPlotPenWidth, 0.0212, 0.0, 1.0 ) ); + configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DebugZoneFiller, + &m_DebugZoneFiller, false ) ); + wxConfigLoadSetups( &aCfg, configParams ); for( PARAM_CFG* param : configParams ) diff --git a/include/advanced_config.h b/include/advanced_config.h index 7e03308d78..039aab871e 100644 --- a/include/advanced_config.h +++ b/include/advanced_config.h @@ -62,16 +62,15 @@ public: * Get the singleton instance's config, which is shared by all * consumers of advanced config. * - * This configuration is read-only - to set options, users should - * add the parameters to their config files at ~/.config/kicad/advanced, or the - * platform equivalent. + * This configuration is read-only - to set options, users should add the parameters to + * their config files at ~/.config/kicad/advanced, or the platform equivalent. */ static const ADVANCED_CFG& GetCfg(); /** * For drawsegments - arcs. - * Distance from an arc end point and the estimated end point, - * when rotating from the start point to the end point. + * Distance from an arc end point and the estimated end point, when rotating from the + * start point to the end point. */ double m_drawArcAccuracy; @@ -138,6 +137,11 @@ public: */ double m_MinPlotPenWidth; + /** + * A mode that dumps the various stages of a F_Cu fill into In1_Cu through In9_Cu. + */ + bool m_DebugZoneFiller; + private: ADVANCED_CFG(); diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 144cdcc914..c9f283e8ee 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -27,7 +27,7 @@ #include #include #include - +#include #include #include #include @@ -36,7 +36,6 @@ #include #include #include -#include "zone_filler.h" ZONE_CONTAINER::ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent, bool aInModule ) : BOARD_CONNECTED_ITEM( aParent, aInModule ? PCB_MODULE_ZONE_AREA_T : PCB_ZONE_AREA_T ), @@ -365,7 +364,7 @@ void ZONE_CONTAINER::SetCornerRadius( unsigned int aRadius ) bool ZONE_CONTAINER::GetFilledPolysUseThickness( PCB_LAYER_ID aLayer ) const { - if( ZONE_FILLER::s_DumpZonesWhenFilling && LSET::InternalCuMask().Contains( aLayer ) ) + if( ADVANCED_CFG::GetCfg().m_DebugZoneFiller && LSET::InternalCuMask().Contains( aLayer ) ) return false; return GetFilledPolysUseThickness(); diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 470e6c7d25..b78fbe37fc 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -58,6 +58,8 @@ ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) : m_progressReporter( nullptr ), m_maxError( ARC_HIGH_DEF ) { + // To enable add "DebugZoneFiller=true" to kicad_advanced settings file. + m_debugZoneFiller = ADVANCED_CFG::GetCfg().m_DebugZoneFiller; } @@ -322,7 +324,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin { for( PCB_LAYER_ID layer : zone.m_zone->GetLayerSet().Seq() ) { - if( s_DumpZonesWhenFilling && LSET::InternalCuMask().Contains( layer ) ) + if( m_debugZoneFiller && LSET::InternalCuMask().Contains( layer ) ) continue; if( !zone.m_islands.count( layer ) ) @@ -363,7 +365,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWin { for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() ) { - if( s_DumpZonesWhenFilling && LSET::InternalCuMask().Contains( layer ) ) + if( m_debugZoneFiller && LSET::InternalCuMask().Contains( layer ) ) continue; SHAPE_POLY_SET poly = zone->GetFilledPolysList( layer ); @@ -898,7 +900,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA #define DUMP_POLYS_TO_COPPER_LAYER( a, b, c ) \ - { if( s_DumpZonesWhenFilling && dumpLayer == b ) \ + { if( m_debugZoneFiller && dumpLayer == b ) \ { \ m_board->SetLayerName( b, c ); \ a.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); \ @@ -927,7 +929,7 @@ void ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, PCB_LAYER_I { PCB_LAYER_ID dumpLayer = aLayer; - if( s_DumpZonesWhenFilling && LSET::InternalCuMask().Contains( aLayer ) ) + if( m_debugZoneFiller && LSET::InternalCuMask().Contains( aLayer ) ) aLayer = F_Cu; m_maxError = m_board->GetDesignSettings().m_MaxError; diff --git a/pcbnew/zone_filler.h b/pcbnew/zone_filler.h index 273251eee2..fc9ebe8b90 100644 --- a/pcbnew/zone_filler.h +++ b/pcbnew/zone_filler.h @@ -47,8 +47,6 @@ public: bool Fill( std::vector& aZones, bool aCheck = false, wxWindow* aParent = nullptr ); - static const bool s_DumpZonesWhenFilling = false; - private: void addKnockout( D_PAD* aPad, PCB_LAYER_ID aLayer, int aGap, SHAPE_POLY_SET& aHoles ); @@ -120,6 +118,8 @@ private: std::unique_ptr m_uniqueReporter; int m_maxError; + + bool m_debugZoneFiller; }; #endif