Make pin function in pads an advanced feature.

Mainly because it creates a new keyword a new keyword in *.kicad_pcb files,
and needs some tests, this is currently a advanced feature.
Enable it by adding "UsePinFunction=1" in "kicad_advanced" config file.

Note also "UsePinFunction=1" only enable saving this info in *.kicad_pcb
and kicad_mod files.
This commit is contained in:
jean-pierre charras 2019-11-22 20:04:56 +01:00
parent 71cd8c57bf
commit f7159e4692
3 changed files with 20 additions and 17 deletions

View File

@ -61,14 +61,12 @@ namespace AC_KEYS
{
/**
* SVG needs some enhancements.
*
* Especially, all SVG shapes are imported as curves and converted to a lot of segments.
* A better approach is to convert to polylines (not yet existing in Pcbnew) and keep
* arcs and circles as primitives (not yet possible with tinysvg library.
* So, until these issues are solved, keep disabling SVG import option available.
* 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
* until it is fully finalized
*/
static const wxChar EnableSvgImport[] = wxT( "EnableSvgImport" );
static const wxChar UsePinFunction[] = wxT( "UsePinFunction" );
/**
* Testing mode for new connectivity algorithm. Setting this to on will cause all modifications
@ -167,7 +165,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_enableSvgImport = false;
m_EnableUsePinFunction = false;
m_allowLegacyCanvasInGtk3 = false;
m_realTimeConnectivity = true;
m_coroutineStackSize = AC_STACK::default_stack;
@ -205,7 +203,7 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
PARAM_CFG_ARRAY configParams;
configParams.push_back(
new PARAM_CFG_BOOL( true, AC_KEYS::EnableSvgImport, &m_enableSvgImport, false ) );
new PARAM_CFG_BOOL( true, AC_KEYS::UsePinFunction, &m_EnableUsePinFunction, false ) );
configParams.push_back( new PARAM_CFG_BOOL(
true, AC_KEYS::AllowLegacyCanvasInGtk3, &m_allowLegacyCanvasInGtk3, false ) );

View File

@ -69,9 +69,9 @@ public:
static const ADVANCED_CFG& GetCfg();
/**
* Enable SVG import.
* Enable pad pin function handling in pcbnew.
*/
bool m_enableSvgImport;
bool m_EnableUsePinFunction;
/**
* Do real-time connectivity

View File

@ -52,6 +52,8 @@
#include <convert_basic_shapes_to_polygon.h> // for enum RECT_CHAMFER_POSITIONS definition
#include <kiface_i.h>
#include <advanced_config.h> // for pad pin function feature management
using namespace PCB_KEYS_T;
@ -1399,12 +1401,15 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
StrPrintf( &output, " (net %d %s)", m_mapping->Translate( aPad->GetNetCode() ),
m_out->Quotew( aPad->GetNetname() ).c_str() );
// Add pinfunction, if exists.
// Pin function is closely related to nets, so if CTL_OMIT_NETS is set,
// omit also pin function (for instance when saved from library editor)
if( !(m_ctl & CTL_OMIT_NETS) && !aPad->GetPinFunction().IsEmpty() )
StrPrintf( &output, " (pinfunction %s)",
m_out->Quotew( aPad->GetPinFunction() ).c_str() );
if( ADVANCED_CFG::GetCfg().m_EnableUsePinFunction )
{
// Add pinfunction, if exists.
// Pin function is closely related to nets, so if CTL_OMIT_NETS is set,
// omit also pin function (for instance when saved from library editor)
if( !(m_ctl & CTL_OMIT_NETS) && !aPad->GetPinFunction().IsEmpty() )
StrPrintf( &output, " (pinfunction %s)",
m_out->Quotew( aPad->GetPinFunction() ).c_str() );
}
if( aPad->GetPadToDieLength() != 0 )
StrPrintf( &output, " (die_length %s)",