summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 239c921)
raw | patch | inline | side by side (parent: 239c921)
author | kiirala <kiirala@users.sourceforge.net> | |
Wed, 26 Jul 2006 09:18:55 +0000 (09:18 +0000) | ||
committer | kiirala <kiirala@users.sourceforge.net> | |
Wed, 26 Jul 2006 09:18:55 +0000 (09:18 +0000) |
src/display/nr-arena-item.h | patch | blob | history | |
src/display/nr-filter.h | patch | blob | history | |
src/style.cpp | patch | blob | history | |
src/style.h | patch | blob | history |
index 7a6c676024e96cf18c03ab30e7c20addf36c75be..d38e44929269d10ee78d139052b68e363b4f7c49 100644 (file)
#include "gc-soft-ptr.h"
#include "nr-arena-forward.h"
#include "display/nr-filter.h"
-/* TODO: without this, gcc barfs on clause "NR::Filter *filter" later on.
- * Obviously we shouldn't need to have the next three rows */
-namespace NR {
-class Filter;
-}
// My testing shows that disabling cache reduces the amount
// of leaked memory when many documents are loaded one from the other,
index 15a852d10afc8603b23692aecb02eb8b41f205a9..c1012475c3bdb3bb2e715e616e1332422a3e98c4 100644 (file)
--- a/src/display/nr-filter.h
+++ b/src/display/nr-filter.h
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include "display/nr-arena-item.h"
+//#include "display/nr-arena-item.h"
#include "display/nr-filter-primitive.h"
#include "display/nr-filter-types.h"
#include "libnr/nr-pixblock.h"
#include "sp-filter-units.h"
#include "gc-managed.h"
+struct NRArenaItem;
+
namespace NR {
class Filter : public Inkscape::GC::Managed<> {
diff --git a/src/style.cpp b/src/style.cpp
index e0d6532d451a760b72f6b91e0f389e076e59ad28..6b5a953fd2e758526e67497be1afe979bab7116d 100644 (file)
--- a/src/style.cpp
+++ b/src/style.cpp
{NULL, -1}
};
+static SPStyleEnum const enum_enable_background[] = {
+ {"accumulate", SP_CSS_BACKGROUND_ACCUMULATE},
+ {"new", SP_CSS_BACKGROUND_NEW},
+ {NULL, -1}
+};
+
/**
* Release callback.
*/
if (!style->filter.set) {
val = repr->attribute("filter");
if (val) {
- sp_style_read_ifilter(&style->filter, val, (object) ? SP_OBJECT_DOCUMENT(object) : NULL);
+ sp_style_read_ifilter(&style->filter, val,
+ (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) {
}
break;
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:
@@ -1447,6 +1457,10 @@ sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const parent)
if(style->filter.set && style->filter.inherit) {
sp_style_merge_ifilter(&style->filter, &parent->filter);
}
+
+ if(style->enable_background.inherit) {
+ style->enable_background.value = parent->enable_background.value;
+ }
}
template <typename T>
@@ -1900,6 +1914,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
/* 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);
/* 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
}
style->filter.set = FALSE;
-//Are these really needed?
+ //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;
}
if (style->filter.set) {
repr->setAttribute("filter", NULL);
}
+ if (style->enable_background.set) {
+ repr->setAttribute("enable-background", NULL);
+ }
}
/**
diff --git a/src/style.h b/src/style.h
index ad1459a732d2989e001988b21a3f809c1037330d..9a70881de927a462d783b107eaaa720e14fd1bfe 100644 (file)
--- a/src/style.h
+++ b/src/style.h
/** Filter effect */
SPIFilter filter;
+ /** enable-background, used for defining where filter effects get
+ * their background image */
+ SPIEnum enable_background;
+
/// style belongs to a cloned object, must not href anything
bool cloned;
/// style has hreffed its fill/stroke paintservers, needs to release.
SP_CSS_DISPLAY_TABLE_CAPTION
};
+enum SPEnableBackground {
+ SP_CSS_BACKGROUND_ACCUMULATE,
+ SP_CSS_BACKGROUND_NEW
+};
+
/// An SPTextStyle has a refcount, a font family, and a font name.
struct SPTextStyle {
int refcount;