Fix lookup of stipple pattern before config is available

Fix a bug with the lookup of stipple pattern for default styles when the
config settings are not yet available (install/upgrade/first run). This
caused hidden lines to display as continuous rather than dashed.
pull/1035/head
robnee 2021-04-25 09:24:35 -04:00 committed by ruevs
parent 00533a0fb2
commit 709dc31f78
2 changed files with 9 additions and 4 deletions

View File

@ -924,6 +924,7 @@ public:
static double StippleScale(hStyle hs);
static double StippleScaleMm(hStyle hs);
static std::string StipplePatternName(hStyle hs);
static std::string StipplePatternName(StipplePattern stippleType);
static StipplePattern StipplePatternFromString(std::string name);
std::string DescriptionString() const;

View File

@ -114,7 +114,8 @@ void Style::FillDefaultStyle(Style *s, const Default *d, bool factory) {
s->stippleType = (factory)
? d->stippleType
: Style::StipplePatternFromString(
settings->ThawString(CnfStippleType(d->cnfPrefix), ""));
settings->ThawString(CnfStippleType(d->cnfPrefix),
StipplePatternName(d->stippleType)));
s->stippleScale = (factory)
? 15.0
: settings->ThawFloat(CnfStippleScale(d->cnfPrefix), 15.0);
@ -397,7 +398,11 @@ StipplePattern Style::PatternType(hStyle hs) {
std::string Style::StipplePatternName(hStyle hs) {
Style *s = Get(hs);
switch(s->stippleType) {
return StipplePatternName(s->stippleType);
}
std::string Style::StipplePatternName(StipplePattern stippleType) {
switch(stippleType) {
case StipplePattern::CONTINUOUS: return "Continuous";
case StipplePattern::SHORT_DASH: return "ShortDash";
case StipplePattern::DASH: return "Dash";
@ -409,10 +414,9 @@ std::string Style::StipplePatternName(hStyle hs) {
case StipplePattern::ZIGZAG: return "ZigZag";
}
return "CONTINUOUS";
return "Continuous";
}
double Style::StippleScale(hStyle hs) {
Style *s = Get(hs);
return s->stippleScale;