From ad7275f0a394b020017c305ea9932c9837a7be55 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 7 Sep 2021 00:12:55 +0100 Subject: [PATCH] Repair saving of default line styles. Note that the file format version was NOT bumped because we were correctly reading the default, just no writing it. Fixes https://gitlab.com/kicad/code/kicad/issues/9045 --- eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index 2a8d9ef3ec..4dfff1788b 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -236,8 +236,8 @@ static wxString getLineStyleToken( PLOT_DASH_TYPE aStyle ) case PLOT_DASH_TYPE::DASH: token = "dash"; break; case PLOT_DASH_TYPE::DOT: token = "dot"; break; case PLOT_DASH_TYPE::DASHDOT: token = "dash_dot"; break; - case PLOT_DASH_TYPE::SOLID: - default: token = "solid"; break; + case PLOT_DASH_TYPE::SOLID: token = "solid"; break; + case PLOT_DASH_TYPE::DEFAULT: token = "default"; break; } return token; @@ -1214,16 +1214,8 @@ void SCH_SEXPR_PLUGIN::saveLine( SCH_LINE* aLine, int aNestLevel ) wxString lineType; - // Lines having the plot style == PLOT_DASH_TYPE::DEFAULT are saved in file - // as SOLID by formatStroke(). - // This is incorrect for graphic lines that use the DASH style for default - // So the plot style need adjustments to use the right style - // (TODO perhaps use "default" as keyword for line style in .kicad_sch file) STROKE_PARAMS line_stroke = aLine->GetStroke(); - if( line_stroke.GetPlotStyle() == PLOT_DASH_TYPE::DEFAULT ) - line_stroke.SetPlotStyle( aLine->GetDefaultStyle() ); - switch( aLine->GetLayer() ) { case LAYER_BUS: lineType = "bus"; break; @@ -1947,8 +1939,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveField( LIB_FIELD* aField, OUTPUTFORMATTER& aFor } -void SCH_SEXPR_PLUGIN_CACHE::savePin( LIB_PIN* aPin, OUTPUTFORMATTER& aFormatter, - int aNestLevel ) +void SCH_SEXPR_PLUGIN_CACHE::savePin( LIB_PIN* aPin, OUTPUTFORMATTER& aFormatter, int aNestLevel ) { wxCHECK_RET( aPin && aPin->Type() == LIB_PIN_T, "Invalid LIB_PIN object." );