diff options
Diffstat (limited to 'src/desktop.cpp')
| -rw-r--r-- | src/desktop.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp index d5e7974ea..3f9fc7806 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -90,6 +90,7 @@ #include "display/canvas-grid.h" #include "widgets/desktop-widget.h" #include "box3d-context.h" +#include "desktop-style.h" // TODO those includes are only for node tool quick zoom. Remove them after fixing it. #include "ui/tool/node-tool.h" @@ -961,6 +962,27 @@ SPDesktop::zoom_absolute_keep_point (double cx, double cy, double px, double py, } /** + * Apply the desktop's current style or the tool style to the object. + */ +void SPDesktop::applyCurrentOrToolStyle(SPObject *obj, Glib::ustring const &tool_path, bool with_text) +{ + SPCSSAttr *css_current = sp_desktop_get_style(this, with_text); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + if (prefs->getBool(tool_path + "/usecurrent") && css_current) { + sp_repr_css_set(obj->getRepr(), css_current, "style"); + } else { + SPCSSAttr *css = prefs->getInheritedStyle(tool_path + "/style"); + sp_repr_css_set(obj->getRepr(), css, "style"); + sp_repr_css_attr_unref(css); + } + if (css_current) { + sp_repr_css_attr_unref(css_current); + } + +} + +/** * Zoom to center with absolute zoom factor. */ void |
