Fix flipped boolean in teardrop serialization

Also change to explicit bools

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16552
This commit is contained in:
Jon Evans 2024-01-08 18:43:57 -05:00
parent b57626807d
commit 8c7d126ced
3 changed files with 14 additions and 9 deletions

View File

@ -762,18 +762,22 @@ bool isDefaultTeardropParameters( const TEARDROP_PARAMETERS& tdParams )
void PCB_IO_KICAD_SEXPR::formatTeardropParameters( const TEARDROP_PARAMETERS& tdParams,
int aNestLevel ) const
{
m_out->Print( aNestLevel, "(teardrops%s%s%s (best_length_ratio %s) (max_length %s) "
m_out->Print( aNestLevel, "(teardrops (best_length_ratio %s) (max_length %s) "
"(best_width_ratio %s) (max_width %s) (curve_points %d) "
"(filter_ratio %s))\n",
tdParams.m_Enabled ? " enabled" : "",
tdParams.m_AllowUseTwoTracks ? " allow_two_segments" : "",
tdParams.m_TdOnPadsInZones ? " prefer_zone_connections" : "",
"(filter_ratio %s)",
FormatDouble2Str( tdParams.m_BestLengthRatio ).c_str(),
formatInternalUnits( tdParams.m_TdMaxLen ).c_str(),
FormatDouble2Str( tdParams.m_BestWidthRatio ).c_str(),
formatInternalUnits( tdParams.m_TdMaxWidth ).c_str(),
tdParams.m_CurveSegCount,
FormatDouble2Str( tdParams.m_WidthtoSizeFilterRatio ).c_str() );
KICAD_FORMAT::FormatBool( m_out, aNestLevel, "enabled", tdParams.m_Enabled );
KICAD_FORMAT::FormatBool( m_out, aNestLevel, "allow_two_segments",
tdParams.m_AllowUseTwoTracks );
KICAD_FORMAT::FormatBool( m_out, aNestLevel, "prefer_zone_connections",
!tdParams.m_TdOnPadsInZones );
m_out->Print( aNestLevel, ")" );
}

View File

@ -147,7 +147,8 @@ class PCB_IO_KICAD_SEXPR; // forward decl
//#define SEXPR_BOARD_FILE_VERSION 20231007 // Generative objects
//#define SEXPR_BOARD_FILE_VERSION 20231014 // V8 file format normalization
//#define SEXPR_BOARD_FILE_VERSION 20231212 // Reference image locking/UUIDs, footprint boolean format
#define SEXPR_BOARD_FILE_VERSION 20231231 // Use 'uuid' rather than 'id' for generators and groups
//#define SEXPR_BOARD_FILE_VERSION 20231231 // Use 'uuid' rather than 'id' for generators and groups
#define SEXPR_BOARD_FILE_VERSION 20240108 // Convert teardrop parameters to explicit bools
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag
#define LEGACY_ARC_FORMATTING 20210925 ///< These were the last to use old arc formatting

View File

@ -433,15 +433,15 @@ void PCB_IO_KICAD_SEXPR_PARSER::parseTEARDROP_PARAMETERS( TEARDROP_PARAMETERS* t
switch( token )
{
case T_enabled:
tdParams->m_Enabled = true;
tdParams->m_Enabled = parseMaybeAbsentBool( true );
break;
case T_allow_two_segments:
tdParams->m_AllowUseTwoTracks = true;
tdParams->m_AllowUseTwoTracks = parseMaybeAbsentBool( true );
break;
case T_prefer_zone_connections:
tdParams->m_TdOnPadsInZones = false;
tdParams->m_TdOnPadsInZones = !parseMaybeAbsentBool( false );
break;
case T_best_length_ratio: