summaryrefslogtreecommitdiffstats
path: root/src/sp-filter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp-filter.cpp')
-rw-r--r--src/sp-filter.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp
index 150033895..e020f6814 100644
--- a/src/sp-filter.cpp
+++ b/src/sp-filter.cpp
@@ -22,6 +22,8 @@
using std::map;
using std::pair;
+#include <gtkmm.h>
+
#include "attributes.h"
#include "document.h"
#include "sp-filter.h"
@@ -114,6 +116,7 @@ sp_filter_init(SPFilter *filter)
filter->_image_name = new std::map<gchar *, int, ltstr>;
filter->_image_name->clear();
+ filter->_image_number_next = 0;
filter->filterRes = NumberOptNumber();
@@ -476,6 +479,28 @@ int sp_filter_set_image_name(SPFilter *filter, gchar const *name) {
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;