summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 50218af)
raw | patch | inline | side by side (parent: 50218af)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Sat, 26 Jul 2008 19:33:42 +0000 (19:33 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Sat, 26 Jul 2008 19:33:42 +0000 (19:33 +0000) |
src/desktop-style.cpp | patch | blob | history | |
src/desktop-style.h | patch | blob | history |
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index 4f4344f9b6f5244941e75915a3a205bea72a251a..5eaa902fd380cd46945dc724bfe21aa729c7d9a7 100644 (file)
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
}
double
-sp_desktop_get_master_opacity_tool(SPDesktop *desktop, char const *tool)
+sp_desktop_get_master_opacity_tool(SPDesktop *desktop, char const *tool, bool *has_opacity)
{
SPCSSAttr *css = NULL;
gfloat value = 1.0; // default if nothing else found
+ if (has_opacity)
+ *has_opacity = false;
if (prefs_get_double_attribute(tool, "usecurrent", 0) != 0) {
css = sp_desktop_get_style(desktop, true);
} else {
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
+ } else {
+ if (has_opacity)
+ *has_opacity = false;
}
}
@@ -298,11 +303,14 @@ sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool is_fill)
return value;
}
+
guint32
-sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill)
+sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill, bool *has_color)
{
SPCSSAttr *css = NULL;
guint32 r = 0; // if there's no color, return black
+ if (has_color)
+ *has_color = false;
if (prefs_get_int_attribute(tool, "usecurrent", 0) != 0) {
css = sp_desktop_get_style(desktop, true);
} else {
gchar const *property = sp_repr_css_property(css, is_fill ? "fill" : "stroke", "#000");
if (desktop->current && property) { // if there is style and the property in it,
- if (strncmp(property, "url", 3)) { // and if it's not url,
+ if (strncmp(property, "url", 3) && strncmp(property, "none", 4)) { // and if it's not url or none,
// read it
r = sp_svg_read_color(property, r);
+ if (has_color)
+ *has_color = true;
}
}
return r | 0xff;
}
+
/**
* Apply the desktop's current style or the tool style to repr.
*/
diff --git a/src/desktop-style.h b/src/desktop-style.h
index b99f12fde972289caaf8c3263f6ae8b6611954f1..57d8e0ae1b2b15c49762ce48dbae1b1cf534743f 100644 (file)
--- a/src/desktop-style.h
+++ b/src/desktop-style.h
void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change = true, bool write_current = true);
SPCSSAttr *sp_desktop_get_style(SPDesktop *desktop, bool with_text);
guint32 sp_desktop_get_color (SPDesktop *desktop, bool is_fill);
-double sp_desktop_get_master_opacity_tool(SPDesktop *desktop, char const *tool);
+double sp_desktop_get_master_opacity_tool(SPDesktop *desktop, char const *tool, bool* has_opacity = NULL);
double sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool is_fill);
-guint32 sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill);
+guint32 sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill, bool* has_color = NULL);
double sp_desktop_get_font_size_tool (SPDesktop *desktop);
void sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, char const *tool, bool with_text);