summaryrefslogtreecommitdiffstats
path: root/src/desktop-style.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/desktop-style.cpp')
-rw-r--r--src/desktop-style.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index cf8f67442..062607fbf 100644
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
@@ -222,7 +222,7 @@ sp_desktop_get_color(SPDesktop *desktop, bool is_fill)
}
double
-sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool)
+sp_desktop_get_master_opacity_tool(SPDesktop *desktop, char const *tool)
{
SPCSSAttr *css = NULL;
gfloat value = 1.0; // default if nothing else found
@@ -247,6 +247,32 @@ sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool)
return value;
}
+double
+sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool is_fill)
+{
+ SPCSSAttr *css = NULL;
+ gfloat value = 1.0; // default if nothing else found
+ if (prefs_get_double_attribute(tool, "usecurrent", 0) != 0) {
+ css = sp_desktop_get_style(desktop, true);
+ } else {
+ Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
+ css = sp_repr_css_attr_inherited(tool_repr, "style");
+ }
+
+ gchar const *property = css ? sp_repr_css_property(css, is_fill ? "fill-opacity": "stroke-opacity", "1.000") : 0;
+
+ if (desktop->current && property) { // if there is style and the property in it,
+ if ( !sp_svg_number_read_f(property, &value) ) {
+ value = 1.0; // things failed. set back to the default
+ }
+ }
+
+ if (css) {
+ sp_repr_css_attr_unref(css);
+ }
+
+ return value;
+}
guint32
sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill)
{