diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp
index 150033895202aea50541345839874ed4431463a5..2a971ccc673745aac90c9edbc6bc3d282a2504a3 100644 (file)
--- a/src/sp-filter.cpp
+++ b/src/sp-filter.cpp
using std::map;
using std::pair;
+#include <gtkmm.h>
+
#include "attributes.h"
#include "document.h"
#include "sp-filter.h"
#define SP_MACROS_SILENT
#include "macros.h"
-#include "display/nr-filter.cpp"
+#include "display/nr-filter.h"
/* Filter base class */
Inkscape::XML::Node *child,
Inkscape::XML::Node *ref);
static void sp_filter_remove_child(SPObject *object, Inkscape::XML::Node *child);
-static Inkscape::XML::Node *sp_filter_write(SPObject *object, Inkscape::XML::Node *repr, guint flags);
+static Inkscape::XML::Node *sp_filter_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void filter_ref_changed(SPObject *old_ref, SPObject *ref, SPFilter *filter);
static void filter_ref_modified(SPObject *href, guint flags, SPFilter *filter);
filter->_image_name = new std::map<gchar *, int, ltstr>;
filter->_image_name->clear();
+ filter->_image_number_next = 0;
filter->filterRes = NumberOptNumber();
* Writes its settings to an incoming repr object, if any.
*/
static Inkscape::XML::Node *
-sp_filter_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
+sp_filter_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
{
SPFilter *filter = SP_FILTER(object);
if (!repr) {
- repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME
+ repr = SP_OBJECT_REPR(object)->duplicate(doc);
}
if ((flags & SP_OBJECT_WRITE_ALL) || filter->filterUnits_set) {
}
if (((SPObjectClass *) filter_parent_class)->write) {
- ((SPObjectClass *) filter_parent_class)->write(object, repr, flags);
+ ((SPObjectClass *) filter_parent_class)->write(object, doc, repr, flags);
}
return repr;
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
-void sp_filter_build_renderer(SPFilter *sp_filter, NR::Filter *nr_filter)
+void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr_filter)
{
g_assert(sp_filter != NULL);
g_assert(nr_filter != NULL);
return value;
}
+Glib::ustring sp_filter_get_new_result_name(SPFilter *filter) {
+ g_assert(filter != NULL);
+ int largest = 0;
+
+ SPObject *primitive_obj = filter->children;
+ while (primitive_obj) {
+ if (SP_IS_FILTER_PRIMITIVE(primitive_obj)) {
+ Inkscape::XML::Node *repr = SP_OBJECT_REPR(primitive_obj);
+ char const *result = repr->attribute("result");
+ int index;
+ if (result && sscanf(result, "result%d", &index) == 1) {
+ if (index > largest) {
+ largest = index;
+ }
+ }
+ }
+ primitive_obj = primitive_obj->next;
+ }
+
+ return "result" + Glib::Ascii::dtostr(largest + 1);
+}
+
bool ltstr::operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) < 0;