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

void sp_desktop_set_style ( SPDesktop desktop,
SPCSSAttr *  css,
bool  change 
)

Apply style on selection on desktop.

Todo:
FIXME: in set_style, compensate pattern and gradient fills, stroke width, rect corners, font size for the object's own transform so that pasting fills does not depend on preserve/optimize.

Todo:
if the style is text-only, apply only to texts?

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

References SPDesktop::_set_style_signal, SPDesktop::current, Inkscape::Selection::itemList(), SPDesktop::selection, sp_css_attr_unset_uris(), and sp_desktop_apply_css_recursive().

Referenced by sp_desktop_set_color().

{
// 1. Set internal value
    sp_repr_css_merge(desktop->current, css);

// 1a. Write to prefs; make a copy and unset any URIs first
    SPCSSAttr *css_write = sp_repr_css_attr_new();
    sp_repr_css_merge(css_write, css);
    sp_css_attr_unset_uris(css_write);
    sp_repr_css_change(inkscape_get_repr(INKSCAPE, "desktop"), css_write, "style");
    sp_repr_css_attr_unref(css_write);

    if (!change)
        return;

// 2. Emit signal
    bool intercepted = desktop->_set_style_signal.emit(css);

/** \todo
 * FIXME: in set_style, compensate pattern and gradient fills, stroke width, 
 * rect corners, font size for the object's own transform so that pasting 
 * fills does not depend on preserve/optimize.
 */

// 3. If nobody has intercepted the signal, apply the style to the selection
    if (!intercepted) {
        for (GSList const *i = desktop->selection->itemList(); i != NULL; i = i->next) {
            /// \todo if the style is text-only, apply only to texts?
            sp_desktop_apply_css_recursive(SP_OBJECT(i->data), css, true);
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index