void Style::FreezeDefaultStyles(void) { const Default *d; for(d = &(Defaults[0]); d->h.v; d++) { CnfFreezeColor(Color(d->h), CnfColor(d->cnfPrefix)); CnfFreezeFloat((float)Width(d->h), CnfWidth(d->cnfPrefix)); } }
void Style::CreateDefaultStyle(hStyle h) { bool isDefaultStyle = true; const Default *d; for(d = &(Defaults[0]); d->h.v; d++) { if(d->h.v == h.v) break; } if(!d->h.v) { // Not a default style; so just create it the same as our default // active group entity style. d = &(Defaults[0]); isDefaultStyle = false; } Style ns; ZERO(&ns); ns.color = CnfThawColor(d->color, CnfColor(d->cnfPrefix)); ns.width = CnfThawFloat((float)(d->width), CnfWidth(d->cnfPrefix)); ns.widthAs = UNITS_AS_PIXELS; ns.textHeight = DEFAULT_TEXT_HEIGHT; ns.textHeightAs = UNITS_AS_PIXELS; ns.textOrigin = 0; ns.textAngle = 0; ns.visible = true; ns.exportable = true; ns.filled = false; ns.fillColor = RGBf(0.3, 0.3, 0.3); ns.h = h; if(isDefaultStyle) { ns.name.strcpy(CnfPrefixToName(d->cnfPrefix)); } else { ns.name.strcpy("new-custom-style"); } SK.style.Add(&ns); }
void Style::FillDefaultStyle(Style *s, const Default *d, bool factory) { if(d == NULL) d = &Defaults[0]; s->color = (factory) ? d->color : CnfThawColor(d->color, CnfColor(d->cnfPrefix)); s->width = (factory) ? d->width : CnfThawFloat((float)(d->width), CnfWidth(d->cnfPrefix)); s->widthAs = UnitsAs::PIXELS; s->textHeight = (factory) ? DEFAULT_TEXT_HEIGHT : CnfThawFloat(DEFAULT_TEXT_HEIGHT, CnfTextHeight(d->cnfPrefix)); s->textHeightAs = UnitsAs::PIXELS; s->textOrigin = TextOrigin::NONE; s->textAngle = 0; s->visible = true; s->exportable = true; s->filled = false; s->fillColor = RGBf(0.3, 0.3, 0.3); s->stippleType = (d->h.v == Style::HIDDEN_EDGE) ? StipplePattern::DASH : StipplePattern::CONTINUOUS; s->stippleScale = 15.0; s->zIndex = d->zIndex; }