Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

static void sp_style_clear ( SPStyle style  )  [static]

Reset all style properties.

Todo:
fixme: Do that text manipulation via parents

Definition at line 2443 of file style.cpp.

References SPITextDecoration::blink, SPStyle::block_progression, SPIPaint::clear(), SPStyle::color, SPILengthOrNormal::computed, SPILength::computed, SPIEnum::computed, SPIFontSize::computed, NRVpathDash::dash, SPStyle::direction, SPStyle::display, SPStyle::document, SPStyle::enable_background, SPStyle::fill, SPStyle::fill_opacity, SPStyle::fill_rule, SPStyle::filter, SPTextStyle::font, SPTextStyle::font_family, SPStyle::font_size, SPTextStyle::font_specification, SPStyle::font_stretch, SPStyle::font_style, SPStyle::font_variant, SPStyle::font_weight, SPIFilter::href, SPIPaint::href, SPIEnum::inherit, SPStyle::letter_spacing, SPStyle::line_height, SPITextDecoration::line_through, SPStyle::marker, NRVpathDash::n_dash, SPILengthOrNormal::normal, SPStyle::object, NRVpathDash::offset, SPStyle::opacity, SPStyle::overflow, SPITextDecoration::overline, SPStyle::refcount, SPIFloat::set, SPILengthOrNormal::set, SPITextDecoration::set, SPILength::set, SPIEnum::set, SPIFontSize::set, SPIString::set, SPIPaint::setColor(), sp_style_fill_paint_server_ref_changed(), sp_style_filter_clear(), sp_style_filter_ref_changed(), sp_style_stroke_paint_server_ref_changed(), SPStyle::stroke, SPStyle::stroke_dash, SPStyle::stroke_linecap, SPStyle::stroke_linejoin, SPStyle::stroke_miterlimit, SPStyle::stroke_opacity, SPStyle::stroke_width, SPStyle::text, SPStyle::text_align, SPStyle::text_anchor, SPStyle::text_decoration, SPStyle::text_indent, SPStyle::text_private, SPStyle::text_transform, SPIFontSize::type, SPITextDecoration::underline, SPILengthOrNormal::unit, SPILength::unit, SPIString::value, SPIFloat::value, SPIScale24::value, SPILengthOrNormal::value, SPIEnum::value, SPIFontSize::value, SPIPaint::value, SPStyle::visibility, SPStyle::word_spacing, and SPStyle::writing_mode.

Referenced by sp_style_new(), and sp_style_read().

{
    g_return_if_fail(style != NULL);

    style->fill.clear();
    style->stroke.clear();
    sp_style_filter_clear(style);

    if (style->fill.value.href)
        delete style->fill.value.href;
    if (style->stroke.value.href)
        delete style->stroke.value.href;
    if (style->filter.href)
        delete style->filter.href;

    if (style->stroke_dash.dash) {
        g_free(style->stroke_dash.dash);
    }

    /** \todo fixme: Do that text manipulation via parents */
    SPObject *object = style->object;
    SPDocument *document = style->document;
    gint const refcount = style->refcount;
    SPTextStyle *text = style->text;
    unsigned const text_private = style->text_private;

    memset(style, 0, sizeof(SPStyle));

    style->refcount = refcount;
    style->object = object;
    style->document = document;

    if (document) {
        style->filter.href = new SPFilterReference(document);
        style->filter.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_filter_ref_changed), style));

        style->fill.value.href = new SPPaintServerReference(document);
        style->fill.value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_fill_paint_server_ref_changed), style));

        style->stroke.value.href = new SPPaintServerReference(document);
        style->stroke.value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_stroke_paint_server_ref_changed), style));
    }

    style->text = text;
    style->text_private = text_private;

    style->text->font_specification.set = FALSE;
    style->text->font.set = FALSE;
    style->text->font_family.set = FALSE;

    style->font_size.set = FALSE;
    style->font_size.type = SP_FONT_SIZE_LITERAL;
    style->font_size.value = SP_CSS_FONT_SIZE_MEDIUM;
    style->font_size.computed = 12.0;
    style->font_style.set = FALSE;
    style->font_style.value = style->font_style.computed = SP_CSS_FONT_STYLE_NORMAL;
    style->font_variant.set = FALSE;
    style->font_variant.value = style->font_variant.computed = SP_CSS_FONT_VARIANT_NORMAL;
    style->font_weight.set = FALSE;
    style->font_weight.value = SP_CSS_FONT_WEIGHT_NORMAL;
    style->font_weight.computed = SP_CSS_FONT_WEIGHT_400;
    style->font_stretch.set = FALSE;
    style->font_stretch.value = style->font_stretch.computed = SP_CSS_FONT_STRETCH_NORMAL;

    /* text */
    style->text_indent.set = FALSE;
    style->text_indent.unit = SP_CSS_UNIT_NONE;
    style->text_indent.computed = 0.0;

    style->text_align.set = FALSE;
    style->text_align.value = style->text_align.computed = SP_CSS_TEXT_ALIGN_START;

    style->text_decoration.set = FALSE;
    style->text_decoration.underline = FALSE;
    style->text_decoration.overline = FALSE;
    style->text_decoration.line_through = FALSE;
    style->text_decoration.blink = FALSE;

    style->line_height.set = FALSE;
    style->line_height.unit = SP_CSS_UNIT_PERCENT;
    style->line_height.normal = TRUE;
    style->line_height.value = style->line_height.computed = 1.0;

    style->letter_spacing.set = FALSE;
    style->letter_spacing.unit = SP_CSS_UNIT_NONE;
    style->letter_spacing.normal = TRUE;
    style->letter_spacing.value = style->letter_spacing.computed = 0.0;

    style->word_spacing.set = FALSE;
    style->word_spacing.unit = SP_CSS_UNIT_NONE;
    style->word_spacing.normal = TRUE;
    style->word_spacing.value = style->word_spacing.computed = 0.0;

    style->text_transform.set = FALSE;
    style->text_transform.value = style->text_transform.computed = SP_CSS_TEXT_TRANSFORM_NONE;

    style->direction.set = FALSE;
    style->direction.value = style->direction.computed = SP_CSS_DIRECTION_LTR;

    style->block_progression.set = FALSE;
    style->block_progression.value = style->block_progression.computed = SP_CSS_BLOCK_PROGRESSION_TB;

    style->writing_mode.set = FALSE;
    style->writing_mode.value = style->writing_mode.computed = SP_CSS_WRITING_MODE_LR_TB;


    style->text_anchor.set = FALSE;
    style->text_anchor.value = style->text_anchor.computed = SP_CSS_TEXT_ANCHOR_START;


    style->opacity.value = SP_SCALE24_MAX;
    style->visibility.set = FALSE;
    style->visibility.value = style->visibility.computed = SP_CSS_VISIBILITY_VISIBLE;
    style->display.set = FALSE;
    style->display.value = style->display.computed = SP_CSS_DISPLAY_INLINE;
    style->overflow.set = FALSE;
    style->overflow.value = style->overflow.computed = SP_CSS_OVERFLOW_VISIBLE;

    style->color.clear();
    style->color.setColor(0.0, 0.0, 0.0);

    style->fill.clear();
    style->fill.setColor(0.0, 0.0, 0.0);
    style->fill_opacity.value = SP_SCALE24_MAX;
    style->fill_rule.value = style->fill_rule.computed = SP_WIND_RULE_NONZERO;

    style->stroke.clear();
    style->stroke_opacity.value = SP_SCALE24_MAX;

    style->stroke_width.set = FALSE;
    style->stroke_width.unit = SP_CSS_UNIT_NONE;
    style->stroke_width.computed = 1.0;

    style->stroke_linecap.set = FALSE;
    style->stroke_linecap.value = style->stroke_linecap.computed = SP_STROKE_LINECAP_BUTT;
    style->stroke_linejoin.set = FALSE;
    style->stroke_linejoin.value = style->stroke_linejoin.computed = SP_STROKE_LINEJOIN_MITER;

    style->stroke_miterlimit.set = FALSE;
    style->stroke_miterlimit.value = 4.0;

    style->stroke_dash.n_dash = 0;
    style->stroke_dash.dash = NULL;
    style->stroke_dash.offset = 0.0;

    for (unsigned i = SP_MARKER_LOC; i < SP_MARKER_LOC_QTY; i++) {
        g_free(style->marker[i].value);
        style->marker[i].set = FALSE;
    }

    style->enable_background.value = SP_CSS_BACKGROUND_ACCUMULATE;
    style->enable_background.set = false;
    style->enable_background.inherit = false;
}


Generated by  Doxygen 1.6.0   Back to index