Allow a 0 pin-symbol-size.

This is particularly important when reading legacy projects as 0 is
what signals the painter to use the old algorithm (1/2 pin name/number
size).

Fixes https://gitlab.com/kicad/code/kicad/issues/10100

(cherry picked from commit f089cf44a7)
This commit is contained in:
Jeff Young 2021-12-23 13:55:59 +00:00
parent 93c48b9d46
commit e7cc177d94
2 changed files with 15 additions and 9 deletions

View File

@ -235,16 +235,22 @@ bool PROJECT_FILE::MigrateFromLegacy( wxConfigBase* aCfg )
fromLegacy<int>( aCfg, "SubpartIdSeparator", "schematic.subpart_id_separator" );
fromLegacy<int>( aCfg, "SubpartFirstId", "schematic.subpart_first_id" );
fromLegacy<int>( aCfg, "LineThickness", "schematic.drawing.default_line_thickness" );
fromLegacy<int>( aCfg, "WireThickness", "schematic.drawing.default_wire_thickness" );
fromLegacy<int>( aCfg, "BusThickness", "schematic.drawing.default_bus_thickness" );
fromLegacy<int>( aCfg, "LabSize", "schematic.drawing.default_text_size" );
fromLegacy<int>( aCfg, "PinSymbolSize", "schematic.drawing.pin_symbol_size" );
fromLegacy<int>( aCfg, "JunctionSize", "schematic.drawing.default_junction_size" );
fromLegacy<int>( aCfg, "LineThickness", "schematic.drawing.default_line_thickness" );
fromLegacy<int>( aCfg, "WireThickness", "schematic.drawing.default_wire_thickness" );
fromLegacy<int>( aCfg, "BusThickness", "schematic.drawing.default_bus_thickness" );
fromLegacy<int>( aCfg, "LabSize", "schematic.drawing.default_text_size" );
fromLegacyString( aCfg, "FieldNameTemplates", "schematic.drawing.field_names" );
if( !fromLegacy<int>( aCfg, "PinSymbolSize", "schematic.drawing.pin_symbol_size" ) )
{
// Use the default symbol size algorithm of Eeschema V5 (based on pin name/number size)
Set( "schematic.drawing.pin_symbol_size", 0 );
}
if( !fromLegacy<double>( aCfg, "TextOffsetRatio", "schematic.drawing.text_offset_ratio" ) )
fromLegacy<int>( aCfg, "JunctionSize", "schematic.drawing.default_junction_size" );
fromLegacyString( aCfg, "FieldNameTemplates", "schematic.drawing.field_names" );
if( !fromLegacy<double>( aCfg, "TextOffsetRatio", "schematic.drawing.text_offset_ratio" ) )
{
// Use the spacing of Eeschema V5
Set( "schematic.drawing.text_offset_ratio", 0.08 );

View File

@ -104,7 +104,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
&m_LabelSizeRatio, DEFAULT_LABEL_SIZE_RATIO, 0.0, 2.0 ) );
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.pin_symbol_size",
&m_PinSymbolSize, Mils2iu( defaultPinSymbolSize ), Mils2iu( 5 ), Mils2iu( 1000 ),
&m_PinSymbolSize, Mils2iu( defaultPinSymbolSize ), Mils2iu( 0 ), Mils2iu( 1000 ),
1 / IU_PER_MILS ) );
// m_JunctionSize is only a run-time cache of the calculated size. Do not save it.