Logo Search packages:      
Sourcecode: inkscape version File versions

int objects_query_strokejoin ( GSList *  objects,
SPStyle style_res 
)

Write to style_res the stroke join of a list of objects.

Definition at line 757 of file desktop-style.cpp.

References SPIEnum::set, SPStyle::stroke, SPStyle::stroke_linejoin, SPIPaint::type, and SPIEnum::value.

Referenced by sp_desktop_query_style_from_list().

{
    if (g_slist_length(objects) == 0) {
        /* No objects, set empty */
        return QUERY_STYLE_NOTHING;
    }

    int join = -1;
    gdouble prev_join = -1;
    bool same_join = true;
    int n_stroked = 0;

    for (GSList const *i = objects; i != NULL; i = i->next) {
        SPObject *obj = SP_OBJECT (i->data);
        if (!SP_IS_ITEM(obj)) continue;
        SPStyle *style = SP_OBJECT_STYLE (obj);
        if (!style) continue;

        if ( style->stroke.type == SP_PAINT_TYPE_NONE ) {
            continue;
        }

        n_stroked ++;

        if (prev_join != -1 && style->stroke_linejoin.value != prev_join)
            same_join = false;
        prev_join = style->stroke_linejoin.value;

        join = style->stroke_linejoin.value;
    }

    style_res->stroke_linejoin.value = join;
    style_res->stroke_linejoin.set = true;

    if (n_stroked == 0) {
        return QUERY_STYLE_NOTHING;
    } else if (n_stroked == 1) {
        return QUERY_STYLE_SINGLE;
    } else {
        if (same_join)
            return QUERY_STYLE_MULTIPLE_SAME;
        else
            return QUERY_STYLE_MULTIPLE_DIFFERENT;
    }
}


Generated by  Doxygen 1.6.0   Back to index