From 86f9ed1dd93bfb70c73b2d8276789f3ded4ac108 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 6 Jan 2020 18:11:01 +0100 Subject: [PATCH] Allows pad property only by the kicad_advanced feature. pad property is allowed if "UsePadProperty=1" is found in kicad_advanced. --- common/advanced_config.cpp | 13 +++++++++++-- include/advanced_config.h | 5 +++++ pcbnew/dialogs/dialog_pad_properties.cpp | 9 +++++++++ pcbnew/kicad_plugin.cpp | 5 +++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/common/advanced_config.cpp b/common/advanced_config.cpp index 929efdc862..f1bf844586 100644 --- a/common/advanced_config.cpp +++ b/common/advanced_config.cpp @@ -59,11 +59,16 @@ namespace AC_STACK */ namespace AC_KEYS { +/** + * In Pcbnew, pads can have a fabrication property + * Because this feature adds a new keyword in *.kicad_pcb and *.kicad_modfiles, + * this is an advanced feature until it is fully finalized + */ +static const wxChar UsePadProperty[] = wxT( "UsePadProperty" ); /** * In Pcbnew, pads can handle a pin function info (this is the schematic pin name) - * Because this feature needs some fixes (how to retrieve the info in netlist) - * and because it adds a new keyword in *.kicad_pcb files, this is an advanced feature + * Because this feature adds a new keyword in *.kicad_pcb files, this is an advanced feature * until it is fully finalized */ static const wxChar UsePinFunction[] = wxT( "UsePinFunction" ); @@ -165,6 +170,7 @@ ADVANCED_CFG::ADVANCED_CFG() // Init defaults - this is done in case the config doesn't exist, // then the values will remain as set here. + m_EnableUsePadProperty = false; m_EnableUsePinFunction = false; m_allowLegacyCanvasInGtk3 = false; m_realTimeConnectivity = true; @@ -202,6 +208,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg ) { PARAM_CFG_ARRAY configParams; + configParams.push_back( + new PARAM_CFG_BOOL( true, AC_KEYS::UsePadProperty, &m_EnableUsePadProperty, false ) ); + configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UsePinFunction, &m_EnableUsePinFunction, false ) ); diff --git a/include/advanced_config.h b/include/advanced_config.h index 5f31ee2f9e..398c1eb7e7 100644 --- a/include/advanced_config.h +++ b/include/advanced_config.h @@ -73,6 +73,11 @@ public: */ bool m_EnableUsePinFunction; + /** + * Enable pad property handling in pcbnew. + */ + bool m_EnableUsePadProperty; + /** * Do real-time connectivity */ diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 189162cb35..05391bc44d 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -41,6 +41,8 @@ #include #include // for enum RECT_CHAMFER_POSITIONS definition +#include // for pad property feature management + // list of pad shapes, ordered like the pad shape wxChoice in dialog. static PAD_SHAPE_T code_shape[] = @@ -124,6 +126,13 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP m_board = m_parent->GetBoard(); + // Disable the pad property if not allowed in advanced config + if( !ADVANCED_CFG::GetCfg().m_EnableUsePadProperty ) + { + m_staticTextFabProperty->Show( false ); + m_choiceFabProperty->Show( false ); + } + m_PadNetSelector->SetNetInfo( &m_board->GetNetInfo() ); m_OrientValidator.SetRange( -360.0, 360.0 ); diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 0897f05eee..34f5db62cf 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -52,7 +52,7 @@ #include // for enum RECT_CHAMFER_POSITIONS definition #include -#include // for pad pin function feature management +#include // for pad pin function and pad property feature management using namespace PCB_KEYS_T; @@ -1380,8 +1380,9 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const m_out->Print( 0, ")" ); } - if( property ) + if( property && ADVANCED_CFG::GetCfg().m_EnableUsePadProperty ) { + // Add pad property, if exists. m_out->Print( 0, " (property %s)", property ); }