From 532f77b14a76fc04e6bdeca3625f9a55b5f11bdf Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 25 Oct 2016 00:58:43 +0200 Subject: CPPification: almost all sp_object_set_whatever and sp_selection_whatever global functions are now methods of ObjectSet*, with these additional benefits: - They can now act on any SelectionSet, not just the current selection; - Whenever possible, they don't need a desktop anymore and can run if called from GUI. I hope I did not break too many things in the process. *: So instead of callink sp_selection_move(desktop,x,y), you call myobjectset->move(x,y) (bzr r15189) --- src/desktop-style.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 81aa95b48..65e511245 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -174,8 +174,12 @@ sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines) /** * Apply style on selection on desktop. */ + void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write_current){ + return sp_desktop_set_style(desktop->getSelection(), desktop, css, change, write_current); +} + void -sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write_current) +sp_desktop_set_style(Inkscape::ObjectSet *set, SPDesktop *desktop, SPCSSAttr *css, bool change, bool write_current) { if (write_current) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -187,7 +191,7 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write sp_repr_css_merge(css_write, css); sp_css_attr_unset_uris(css_write); prefs->mergeStyle("/desktop/style", css_write); - auto itemlist = desktop->selection->items(); + auto itemlist = set->items(); for (auto i = itemlist.begin(); i!= itemlist.end(); ++i) { /* last used styles for 3D box faces are stored separately */ SPObject *obj = *i; @@ -227,7 +231,7 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write sp_repr_css_merge(css_no_text, css); css_no_text = sp_css_attr_unset_text(css_no_text); - auto itemlist = desktop->selection->items(); + auto itemlist = set->items(); for (auto i = itemlist.begin(); i!= itemlist.end(); ++i) { SPItem *item = *i; -- cgit v1.2.3