diff --git a/src/style.cpp b/src/style.cpp
index deffba366670dca9018b8e66ba5ed195e7142511..bd880b857cb4760adaa117b8dd3cf59eb4072643 100644 (file)
--- a/src/style.cpp
+++ b/src/style.cpp
#include "svg/svg.h"
#include "svg/svg-color.h"
+#include "svg/svg-icc-color.h"
#include "display/canvas-bpath.h"
#include "attributes.h"
#include "unit-constants.h"
#include "isnan.h"
+#include <sigc++/functors/ptr_fun.h>
+#include <sigc++/adaptors/bind.h>
+
+using Inkscape::CSSOStringStream;
+using std::vector;
+
namespace Inkscape {
/**
static void sp_style_merge_property(SPStyle *style, gint id, gchar const *val);
static void sp_style_merge_ipaint(SPStyle *style, SPIPaint *paint, SPIPaint const *parent);
+static void sp_style_merge_ifilter(SPStyle *style, SPIFilter *child, SPIFilter const *parent);
static void sp_style_read_dash(SPStyle *style, gchar const *str);
static SPTextStyle *sp_text_style_new(void);
@@ -130,6 +138,7 @@ static void sp_style_read_itextdecoration(SPITextDecoration *val, gchar const *s
static void sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document);
static void sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document);
static void sp_style_read_ifontsize(SPIFontSize *val, gchar const *str);
+static void sp_style_read_ifilter(SPIFilter *f, gchar const *str, SPStyle *style, SPDocument *document);
static void sp_style_read_penum(SPIEnum *val, Inkscape::XML::Node *repr, gchar const *key, SPStyleEnum const *dict, bool can_explicitly_inherit);
static void sp_style_read_plength(SPILength *val, Inkscape::XML::Node *repr, gchar const *key);
@@ -145,10 +154,13 @@ static gint sp_style_write_ipaint(gchar *b, gint len, gchar const *key, SPIPaint
static gint sp_style_write_ifontsize(gchar *p, gint len, gchar const *key, SPIFontSize const *val, SPIFontSize const *base, guint flags);
static gint sp_style_write_ilengthornormal(gchar *p, gint const len, gchar const *const key, SPILengthOrNormal const *const val, SPILengthOrNormal const *const base, guint const flags);
static gint sp_style_write_itextdecoration(gchar *p, gint const len, gchar const *const key, SPITextDecoration const *const val, SPITextDecoration const *const base, guint const flags);
+static gint sp_style_write_ifilter(gchar *b, gint len, gchar const *key, SPIFilter const *filter, SPIFilter const *base, guint flags);
static void css2_unescape_unquote(SPIString *val);
-static void sp_style_paint_clear(SPStyle *style, SPIPaint *paint, unsigned hunref, unsigned unset);
+static void sp_style_paint_clear(SPStyle *style, SPIPaint *paint);
+
+static void sp_style_filter_clear(SPStyle *style, SPIFilter *filter);
#define SPS_READ_IENUM_IF_UNSET(v,s,d,i) if (!(v)->set) {sp_style_read_ienum((v), (s), (d), (i));}
#define SPS_READ_PENUM_IF_UNSET(v,r,k,d,i) if (!(v)->set) {sp_style_read_penum((v), (r), (k), (d), (i));}
{NULL, -1}
};
+static SPStyleEnum const enum_enable_background[] = {
+ {"accumulate", SP_CSS_BACKGROUND_ACCUMULATE},
+ {"new", SP_CSS_BACKGROUND_NEW},
+ {NULL, -1}
+};
+
/**
* Release callback.
*/
style->cloned = false;
- style->color_hreffed = false;
style->fill_hreffed = false;
style->stroke_hreffed = false;
+ style->filter_hreffed = false;
- style->color_listening = false;
- style->fill_listening = false;
- style->stroke_listening = false;
+ new (&style->release_connection) sigc::connection();
+
+ new (&style->fill_release_connection) sigc::connection();
+ new (&style->fill_modified_connection) sigc::connection();
+
+ new (&style->stroke_release_connection) sigc::connection();
+ new (&style->stroke_modified_connection) sigc::connection();
return style;
}
SPStyle *style = sp_style_new();
style->object = object;
- g_signal_connect(G_OBJECT(object), "release", G_CALLBACK(sp_style_object_release), style);
+ style->release_connection = object->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_style_object_release), style));
if (object && SP_OBJECT_IS_CLONED(object)) {
style->cloned = true;
style->refcount -= 1;
if (style->refcount < 1) {
- if (style->object)
- g_signal_handlers_disconnect_matched(G_OBJECT(style->object),
- G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, style);
+ style->release_connection.disconnect();
+ style->release_connection.~connection();
if (style->text) sp_text_style_unref(style->text);
- sp_style_paint_clear(style, &style->fill, TRUE, FALSE);
- sp_style_paint_clear(style, &style->stroke, TRUE, FALSE);
+ sp_style_paint_clear(style, &style->fill);
+ sp_style_paint_clear(style, &style->stroke);
+ sp_style_filter_clear(style, &style->filter);
+ style->fill_release_connection.disconnect();
+ style->fill_release_connection.~connection();
+ style->fill_modified_connection.disconnect();
+ style->fill_modified_connection.~connection();
+ style->stroke_release_connection.disconnect();
+ style->stroke_release_connection.~connection();
+ style->stroke_modified_connection.disconnect();
+ style->stroke_modified_connection.~connection();
g_free(style->stroke_dash.dash);
g_free(style);
}
}
}
+ /* filter effects */
+ if (!style->filter.set) {
+ val = repr->attribute("filter");
+ if (val) {
+ sp_style_read_ifilter(&style->filter, val, style, (object) ? SP_OBJECT_DOCUMENT(object) : NULL);
+ }
+ }
+ SPS_READ_PENUM_IF_UNSET(&style->enable_background, repr,
+ "enable-background", enum_enable_background, true);
+
/* 3. Merge from parent */
if (object) {
if (object->parent) {
sp_style_read_iscale24(&style->opacity, val);
}
break;
- /* Filter */
case SP_PROP_ENABLE_BACKGROUND:
- g_warning("Unimplemented style property SP_PROP_ENABLE_BACKGROUND: value: %s", val);
+ SPS_READ_IENUM_IF_UNSET(&style->enable_background, val,
+ enum_enable_background, true);
break;
+ /* Filter */
case SP_PROP_FILTER:
- g_warning("Unimplemented style property SP_PROP_FILTER: value: %s", val);
+ if (!style->filter.set && !style->filter.inherit) {
+ sp_style_read_ifilter(&style->filter, val, style, (style->object) ? SP_OBJECT_DOCUMENT(style->object) : NULL);
+ }
break;
case SP_PROP_FLOOD_COLOR:
g_warning("Unimplemented style property SP_PROP_FLOOD_COLOR: value: %s", val);
@@ -1413,6 +1456,15 @@ sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const parent)
style->marker[i].value = g_strdup(parent->marker[i].value);
}
}
+
+ /* Filter effects */
+ if(style->filter.set && style->filter.inherit) {
+ sp_style_merge_ifilter(style, &style->filter, &parent->filter);
+ }
+
+ if(style->enable_background.inherit) {
+ style->enable_background.value = parent->enable_background.value;
+ }
}
template <typename T>
@@ -1866,6 +1918,18 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare
/* Leave as is. (display doesn't inherit by default.) */
}
+ /* enable-background - this is rather complicated, because
+ * it is valid only when applied to container elements.
+ * Let's check a simple case anyhow. */
+ if (parent->enable_background.set
+ && !parent->enable_background.inherit
+ && style->enable_background.inherit)
+ {
+ style->enable_background.set = true;
+ style->enable_background.inherit = false;
+ style->enable_background.value = parent->enable_background.value;
+ }
+
/** \todo
* fixme: Check that we correctly handle all properties that don't
* inherit by default (as shown in
@@ -1923,6 +1987,8 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare
* represent it as a normal SPILength; though will need to do something about existing
* users of stroke_dash.offset and stroke_dashoffset_set. */
}
+
+ /* TODO: deal with filters */
}
@@ -1931,18 +1997,19 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare
* Disconnects from possible fill and stroke paint servers.
*/
static void
-sp_style_paint_server_release(SPPaintServer *server, SPStyle *style)
+sp_style_paint_server_release(SPObject *obj, SPStyle *style)
{
+ SPPaintServer *server=static_cast<SPPaintServer *>(obj);
if ((style->fill.type == SP_PAINT_TYPE_PAINTSERVER)
&& (server == style->fill.value.paint.server))
{
- sp_style_paint_clear(style, &style->fill, TRUE, FALSE);
+ sp_style_paint_clear(style, &style->fill);
}
if ((style->stroke.type == SP_PAINT_TYPE_PAINTSERVER)
&& (server == style->stroke.value.paint.server))
{
- sp_style_paint_clear(style, &style->stroke, TRUE, FALSE);
+ sp_style_paint_clear(style, &style->stroke);
}
}
* or stroke paint server.
*/
static void
-sp_style_paint_server_modified(SPPaintServer *server, guint flags, SPStyle *style)
+sp_style_paint_server_modified(SPObject *obj, guint flags, SPStyle *style)
{
+ SPPaintServer *server = static_cast<SPPaintServer *>(obj);
if ((style->fill.type == SP_PAINT_TYPE_PAINTSERVER)
&& (server == style->fill.value.paint.server))
{
@@ -1990,7 +2058,7 @@ sp_style_paint_server_modified(SPPaintServer *server, guint flags, SPStyle *styl
static void
sp_style_merge_ipaint(SPStyle *style, SPIPaint *paint, SPIPaint const *parent)
{
- sp_style_paint_clear(style, paint, TRUE, FALSE);
+ sp_style_paint_clear(style, paint);
if ((paint->set && paint->currentcolor) || parent->currentcolor) {
paint->currentcolor = TRUE;
@@ -2012,23 +2080,24 @@ sp_style_merge_ipaint(SPStyle *style, SPIPaint *paint, SPIPaint const *parent)
sp_object_href(SP_OBJECT(paint->value.paint.server), style);
if (paint == &style->fill) {
style->fill_hreffed = true;
- } else if (paint == &style->stroke) {
+ } else {
+ assert(paint == &style->stroke);
style->stroke_hreffed = true;
- } else if (paint == &style->color) {
- style->color_hreffed = true;
}
}
if (style->object || style->cloned) { // connect to signals for style of real objects or clones (this excludes temp styles)
- g_signal_connect(G_OBJECT(paint->value.paint.server), "release",
- G_CALLBACK(sp_style_paint_server_release), style);
- g_signal_connect(G_OBJECT(paint->value.paint.server), "modified",
- G_CALLBACK(sp_style_paint_server_modified), style);
+ SPObject *server = paint->value.paint.server;
+ sigc::connection release_connection
+ = server->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_style_paint_server_release), style));
+ sigc::connection modified_connection
+ = server->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_style_paint_server_modified), style));
if (paint == &style->fill) {
- style->fill_listening = true;
- } else if (paint == &style->stroke) {
- style->stroke_listening = true;
- } else if (paint == &style->color) {
- style->color_listening = true;
+ style->fill_release_connection = release_connection;
+ style->fill_modified_connection = modified_connection;
+ } else {
+ assert(paint == &style->stroke);
+ style->stroke_release_connection = release_connection;
+ style->stroke_modified_connection = modified_connection;
}
}
}
@@ -2042,6 +2111,22 @@ sp_style_merge_ipaint(SPStyle *style, SPIPaint *paint, SPIPaint const *parent)
}
+/**
+ * Merge filter style from parent.
+ * Filter effects do not inherit by default
+ */
+static void
+sp_style_merge_ifilter(SPStyle *style, SPIFilter *child, SPIFilter const *parent)
+{
+ sp_style_filter_clear(style, child);
+ child->set = parent->set;
+ child->inherit = parent->inherit;
+ child->filter = parent->filter;
+ child->uri = parent->uri;
+ sp_object_href(SP_OBJECT(child), style);
+ style->filter_hreffed = true;
+}
+
/**
* Dumps the style to a CSS string, with either SP_STYLE_FLAG_IFSET or
* SP_STYLE_FLAG_ALWAYS flags. Used with Always for copying an object's
p += sp_style_write_ienum(p, c + BMAX - p, "display", enum_display, &style->display, NULL, flags);
p += sp_style_write_ienum(p, c + BMAX - p, "overflow", enum_overflow, &style->overflow, NULL, flags);
+ /* filter: */
+ p += sp_style_write_ifilter(p, c + BMAX - p, "filter", &style->filter, NULL, flags);
+
+ p += sp_style_write_ienum(p, c + BMAX - p, "enable-background", enum_enable_background, &style->enable_background, NULL, flags);
+
/* fixme: */
p += sp_text_style_write(p, c + BMAX - p, style->text, flags);
@@ -2277,6 +2367,11 @@ sp_style_write_difference(SPStyle const *const from, SPStyle const *const to)
p += sp_style_write_ienum(p, c + BMAX - p, "display", enum_display, &from->display, &to->display, SP_STYLE_FLAG_IFSET);
p += sp_style_write_ienum(p, c + BMAX - p, "overflow", enum_overflow, &from->overflow, &to->overflow, SP_STYLE_FLAG_IFSET);
+ /* filter: */
+ p += sp_style_write_ifilter(p, c + BMAX - p, "filter", &from->filter, &to->filter, SP_STYLE_FLAG_IFDIFF);
+
+ p += sp_style_write_ienum(p, c + BMAX - p, "enable-background", enum_enable_background, &from->enable_background, &to->enable_background, SP_STYLE_FLAG_IFSET);
+
p += sp_text_style_write(p, c + BMAX - p, from->text, SP_STYLE_FLAG_IFDIFF);
/** \todo
{
g_return_if_fail(style != NULL);
- sp_style_paint_clear(style, &style->fill, TRUE, FALSE);
- sp_style_paint_clear(style, &style->stroke, TRUE, FALSE);
+ sp_style_paint_clear(style, &style->fill);
+ sp_style_paint_clear(style, &style->stroke);
+ sp_style_filter_clear(style, &style->filter);
if (style->stroke_dash.dash) {
g_free(style->stroke_dash.dash);
}
g_free(style->marker[i].value);
style->marker[i].set = FALSE;
}
+
+ style->filter.set = FALSE;
+ //Are these really needed?
+ style->filter.inherit = FALSE;
+ style->filter.uri = NULL;
+ style->filter.filter = FALSE;
+
+ style->enable_background.value = SP_CSS_BACKGROUND_ACCUMULATE;
+ style->enable_background.set = false;
+ style->enable_background.inherit = false;
}
@@ -2838,6 +2944,8 @@ sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume
/**
* Set SPIPaint object from string.
+ *
+ * \pre paint == \&style.fill || paint == \&style.stroke.
*/
static void
sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document)
@@ -2850,16 +2958,16 @@ sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume
paint->set = TRUE;
paint->inherit = TRUE;
paint->currentcolor = FALSE;
- } else if (streq(str, "currentColor")) {
+ } else if (streq(str, "currentColor") && paint != &style->color) {
paint->set = TRUE;
paint->inherit = FALSE;
paint->currentcolor = TRUE;
- } else if (streq(str, "none")) {
+ } else if (streq(str, "none") && paint != &style->color) {
paint->type = SP_PAINT_TYPE_NONE;
paint->set = TRUE;
paint->inherit = FALSE;
paint->currentcolor = FALSE;
- } else if (strneq(str, "url", 3)) {
+ } else if (strneq(str, "url", 3) && paint != &style->color) {
// this is alloc'd uri, but seems to be shared with a parent
// potentially, so it's not any easy g_free case...
paint->value.paint.uri = extract_uri(str);
@@ -2879,23 +2987,24 @@ sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume
sp_object_href(SP_OBJECT(paint->value.paint.server), style);
if (paint == &style->fill) {
style->fill_hreffed = true;
- } else if (paint == &style->stroke) {
+ } else {
+ assert(paint == &style->stroke);
style->stroke_hreffed = true;
- } else if (paint == &style->color) {
- style->color_hreffed = true;
}
}
if (style->object || style->cloned) {
- g_signal_connect(G_OBJECT(paint->value.paint.server), "release",
- G_CALLBACK(sp_style_paint_server_release), style);
- g_signal_connect(G_OBJECT(paint->value.paint.server), "modified",
- G_CALLBACK(sp_style_paint_server_modified), style);
+ SPObject *server = paint->value.paint.server;
+ sigc::connection release_connection
+ = server->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_style_paint_server_release), style));
+ sigc::connection modified_connection
+ = server->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_style_paint_server_modified), style));
if (paint == &style->fill) {
- style->fill_listening = true;
- } else if (paint == &style->stroke) {
- style->stroke_listening = true;
- } else if (paint == &style->color) {
- style->color_listening = true;
+ style->fill_release_connection = release_connection;
+ style->fill_modified_connection = modified_connection;
+ } else {
+ assert(paint == &style->stroke);
+ style->stroke_release_connection = release_connection;
+ style->stroke_modified_connection = modified_connection;
}
}
} else {
@@ -2903,13 +3012,25 @@ sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume
}
}
} else {
- guint32 const rgb0 = sp_svg_read_color(str, 0xff);
+ guint32 const rgb0 = sp_svg_read_color(str, &str, 0xff);
if (rgb0 != 0xff) {
paint->type = SP_PAINT_TYPE_COLOR;
sp_color_set_rgb_rgba32(&paint->value.color, rgb0);
paint->set = TRUE;
paint->inherit = FALSE;
paint->currentcolor = FALSE;
+
+ while (g_ascii_isspace(*str)) {
+ ++str;
+ }
+ if (strneq(str, "icc-color(", 10)) {
+ SVGICCColor* tmp = new SVGICCColor();
+ if ( ! sp_svg_read_icc_color( str, &str, tmp ) ) {
+ delete tmp;
+ tmp = 0;
+ }
+ paint->iccColor = tmp;
+ }
}
}
}
+/**
+ * Set SPIFilter object from string.
+ */
+static void
+sp_style_read_ifilter( SPIFilter *f, gchar const *str, SPStyle * style, SPDocument *document)
+{
+ /* Try all possible values: inherit, none, uri */
+ if (streq(str, "inherit")) {
+ f->set = TRUE;
+ f->inherit = TRUE;
+ f->filter = NULL;
+ } else if(streq(str, "none")) {
+ f->set = TRUE;
+ f->inherit = FALSE;
+ f->filter = NULL;
+ } else if (strneq(str, "url", 3)) {
+ f->uri = extract_uri(str);
+ if(f->uri == NULL || f->uri[0] == '\0') {
+ g_warning("Specified filter url is empty");
+ f->set = TRUE;
+ f->inherit = FALSE;
+ f->filter = NULL;
+ return;
+ }
+ f->set = TRUE;
+ f->inherit = FALSE;
+ f->filter = NULL;
+ if (document) {
+ SPObject *obj;
+ obj = sp_uri_reference_resolve(document, str);
+ if (SP_IS_FILTER(obj)) {
+ f->filter = SP_FILTER(obj);
+ sp_object_href(SP_OBJECT(f->filter), style);
+ style->filter_hreffed = true;
+ //g_signal_connect(G_OBJECT(f->filter), "release",
+ // G_CALLBACK(sp_style_filter_release), style);
+ //g_signal_connect(G_OBJECT(f->filter), "modified",
+ // G_CALLBACK(sp_style_filter_modified), style);
+ } else {
+ g_warning("Element '%s' not found or is not a filter", f->uri);
+ }
+ }
+
+ } else {
+ /* We shouldn't reach this if SVG input is well-formed */
+ f->set = FALSE;
+ f->inherit = FALSE;
+ f->filter = NULL;
+ f->uri = NULL;
+ }
+}
+
/**
* Set SPIEnum object from repr attribute.
*/
if (a->type != b->type)
return true;
if (a->type == SP_PAINT_TYPE_COLOR)
- return !sp_color_is_equal(&a->value.color, &b->value.color);
+ return !(sp_color_is_equal(&a->value.color, &b->value.color)
+ && ((a->iccColor == b->iccColor)
+ || (a->iccColor && b->iccColor
+ && (a->iccColor->colorProfile == b->iccColor->colorProfile)
+ && (a->iccColor->colors == b->iccColor->colors))));
+ /* todo: Allow for epsilon differences in iccColor->colors, e.g. changes small enough not to show up
+ * in the string representation. */
if (a->type == SP_PAINT_TYPE_PAINTSERVER)
return (a->value.paint.server != b->value.paint.server);
return false;
case SP_PAINT_TYPE_COLOR: {
char color_buf[8];
sp_svg_write_color(color_buf, sizeof(color_buf), sp_color_get_rgba32_ualpha(&paint->value.color, 0));
- return g_snprintf(b, len, "%s:%s;", key, color_buf);
+ if (paint->iccColor) {
+ CSSOStringStream css;
+ css << color_buf << " icc-color(" << paint->iccColor->colorProfile;
+ for (vector<double>::const_iterator i(paint->iccColor->colors.begin()),
+ iEnd(paint->iccColor->colors.end());
+ i != iEnd; ++i) {
+ css << ", " << *i;
+ }
+ css << ')';
+ return g_snprintf(b, len, "%s:%s;", key, css.gcharp());
+ } else {
+ return g_snprintf(b, len, "%s:%s;", key, color_buf);
+ }
}
case SP_PAINT_TYPE_PAINTSERVER:
return g_snprintf(b, len, "%s:url(%s);", key, paint->value.paint.uri);
/**
- * Clear paint object; conditionally disconnect style from paintserver.
+ * Write SPIFilter object into string.
+ */
+static gint
+sp_style_write_ifilter(gchar *p, gint const len, gchar const *key,
+ SPIFilter const *const val, SPIFilter const *const base,
+ guint const flags)
+{
+ if ((flags & SP_STYLE_FLAG_ALWAYS)
+ || ((flags & SP_STYLE_FLAG_IFSET) && val->set)
+ || ((flags & SP_STYLE_FLAG_IFDIFF) && val->set))
+ {
+ if (val->inherit) {
+ return g_snprintf(p, len, "%s:inherit;", key);
+ } else if (val->uri) {
+ return g_snprintf(p, len, "%s:url(%s);", key, val->uri);
+ }
+ }
+
+
+ return 0;
+}
+
+
+/**
+ * Clear paint object, and disconnect style from paintserver (if present).
*/
static void
-sp_style_paint_clear(SPStyle *style, SPIPaint *paint,
- unsigned hunref, unsigned unset)
+sp_style_paint_clear(SPStyle *style, SPIPaint *paint)
{
- if (hunref && (paint->type == SP_PAINT_TYPE_PAINTSERVER) && paint->value.paint.server) {
+ if ((paint->type == SP_PAINT_TYPE_PAINTSERVER) && paint->value.paint.server) {
if (paint == &style->fill) {
if (style->fill_hreffed) {
sp_object_hunref(SP_OBJECT(paint->value.paint.server), style);
style->fill_hreffed = false;
}
- if (style->fill_listening) {
- g_signal_handlers_disconnect_matched(G_OBJECT(paint->value.paint.server),
- G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, style);
- style->fill_listening = false;
- }
- } else if (paint == &style->stroke) {
+ style->fill_release_connection.disconnect();
+ style->fill_modified_connection.disconnect();
+ } else {
+ assert(paint == &style->stroke); // Only fill & stroke can have a paint server.
if (style->stroke_hreffed) {
sp_object_hunref(SP_OBJECT(paint->value.paint.server), style);
style->stroke_hreffed = false;
}
- if (style->stroke_listening) {
- g_signal_handlers_disconnect_matched(G_OBJECT(paint->value.paint.server),
- G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, style);
- style->stroke_listening = false;
- }
- } else if (paint == &style->color) {
- if (style->color_hreffed) {
- sp_object_hunref(SP_OBJECT(paint->value.paint.server), style);
- style->color_hreffed = false;
- }
- if (style->color_listening) {
- g_signal_handlers_disconnect_matched(G_OBJECT(paint->value.paint.server),
- G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, style);
- style->color_listening = false;
- }
+ style->stroke_release_connection.disconnect();
+ style->stroke_modified_connection.disconnect();
}
paint->value.paint.server = NULL;
- paint->value.paint.uri = NULL;
- paint->type = SP_PAINT_TYPE_NONE;
}
+ paint->value.paint.uri = NULL;
+ paint->type = SP_PAINT_TYPE_NONE;
+ delete paint->iccColor;
+ paint->iccColor = NULL;
+}
- if (unset) {
- paint->set = FALSE;
- paint->inherit = FALSE;
+
+/**
+ * Clear filter object, and disconnect style from paintserver (if present).
+ */
+static void
+sp_style_filter_clear(SPStyle *style, SPIFilter *f)
+{
+
+ if (style->filter_hreffed) {
+ sp_object_hunref(SP_OBJECT(f->filter), style);
+ style->filter_hreffed = false;
}
+ //style->fill_release_connection.disconnect();
+ //style->fill_modified_connection.disconnect();
+
+ f->filter = NULL;
+
}
+
/**
* Clear all style property attributes in object.
*/
if (style->writing_mode.set) {
repr->setAttribute("writing_mode", NULL);
}
+ if (style->filter.set) {
+ repr->setAttribute("filter", NULL);
+ }
+ if (style->enable_background.set) {
+ repr->setAttribute("enable-background", NULL);
+ }
}
/**