diff options
| author | Aaron Spike <aaron@ekips.org> | 2006-05-18 15:36:46 +0000 |
|---|---|---|
| committer | acspike <acspike@users.sourceforge.net> | 2006-05-18 15:36:46 +0000 |
| commit | eb3fef0b54164afbd04e89ff2ef63b547d26d7cd (patch) | |
| tree | ef57d11f42330a43710e34adc3248f926e60d081 /src/desktop-style.cpp | |
| parent | * Properly deal with setting the style using the text toolbar (diff) | |
| download | inkscape-eb3fef0b54164afbd04e89ff2ef63b547d26d7cd.tar.gz inkscape-eb3fef0b54164afbd04e89ff2ef63b547d26d7cd.zip | |
adding fill-opacity to dyna-draw
(bzr r875)
Diffstat (limited to 'src/desktop-style.cpp')
| -rw-r--r-- | src/desktop-style.cpp | 28 |
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) { |
