summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: af7b97a)
raw | patch | inline | side by side (parent: af7b97a)
author | mental <mental@users.sourceforge.net> | |
Sat, 22 Jul 2006 22:22:09 +0000 (22:22 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Sat, 22 Jul 2006 22:22:09 +0000 (22:22 +0000) |
ChangeLog | patch | blob | history | |
src/splivarot.cpp | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index 229842698f319c4f10a0a1b70a3f8794e29d1453..a3a4a352d12e79391d46ed06128a4be721ce4919 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-07-21 MenTaLguY <mental@rydia.net>
+
+ * src/splivarot.cpp:
+
+ patch from John Bintz, adding pref to simplify multiple
+ paths separately
+
2006-07-21 MenTaLguY <mental@rydia.net>
* configure.ac: first shot at implementing --enable-lsb
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 5734c9f101511e6587ba2c8cf832ad27c3aac18b..87ad24800c95a4b164e7b895d52078a1c28fae0c 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
}
+static bool
+sp_selected_path_simplify_items(SPDesktop *desktop,
+ Inkscape::Selection *selection, GSList *items,
+ float threshold, bool justCoalesce,
+ float angleLimit, bool breakableAngles,
+ bool modifySelection);
+
//return true if we changed something, else false
bool
-sp_selected_path_simplify_item(SPDesktop *desktop, Inkscape::Selection *selection, SPItem *item,
+sp_selected_path_simplify_item(SPDesktop *desktop,
+ Inkscape::Selection *selection, SPItem *item,
float threshold, bool justCoalesce,
float angleLimit, bool breakableAngles,
gdouble size, bool modifySelection)
@@ -1366,18 +1374,12 @@ sp_selected_path_simplify_item(SPDesktop *desktop, Inkscape::Selection *selectio
//If this is a group, do the children instead
if (SP_IS_GROUP(item)) {
-
- bool didSomething = false;
-
- for ( GSList *children = sp_item_group_item_list(SP_GROUP(item));
- children ; children = children->next) {
-
- SPItem *child = (SPItem *) children->data;
- didSomething |= sp_selected_path_simplify_item(desktop, selection, child, threshold, justCoalesce,
- angleLimit, breakableAngles, size, false);
- }
-
- return didSomething;
+ GSList *items = sp_item_group_item_list(SP_GROUP(item));
+
+ return sp_selected_path_simplify_items(desktop, selection, items,
+ threshold, justCoalesce,
+ angleLimit, breakableAngles,
+ false);
}
@@ -1470,6 +1472,41 @@ sp_selected_path_simplify_item(SPDesktop *desktop, Inkscape::Selection *selectio
}
+bool
+sp_selected_path_simplify_items(SPDesktop *desktop,
+ Inkscape::Selection *selection, GSList *items,
+ float threshold, bool justCoalesce,
+ float angleLimit, bool breakableAngles,
+ bool modifySelection)
+{
+ bool simplifyIndividualPaths =
+ (bool) prefs_get_int_attribute("options.simplifyindividualpaths", "value", 0);
+
+ bool didSomething = false;
+
+ NR::Rect selectionBbox = selection->bounds();
+ gdouble selectionSize = L2(selectionBbox.dimensions());
+
+ gdouble simplifySize = selectionSize;
+
+ for (; items != NULL; items = items->next) {
+ SPItem *item = (SPItem *) items->data;
+
+ if (!(SP_IS_GROUP(item) || SP_IS_SHAPE(item) || SP_IS_TEXT(item)))
+ continue;
+
+ if (simplifyIndividualPaths) {
+ NR::Rect itemBbox = item->invokeBbox(sp_item_i2d_affine(item));
+ simplifySize = L2(itemBbox.dimensions());
+ }
+
+ didSomething |= sp_selected_path_simplify_item(desktop, selection, item,
+ threshold, justCoalesce, angleLimit, breakableAngles, simplifySize, modifySelection);
+ }
+
+ return didSomething;
+}
+
void
sp_selected_path_simplify_selection(float threshold, bool justCoalesce,
float angleLimit, bool breakableAngles)
return;
}
- // remember selection size
- NR::Rect bbox = selection->bounds();
- gdouble size = L2(bbox.dimensions());
-
- bool didSomething = false;
-
- //Loop through all of the items in the selection
- for (GSList *items = g_slist_copy((GSList *) selection->itemList());
- items != NULL; items = items->next) {
-
- SPItem *item = (SPItem *) items->data;
-
- if (!(SP_IS_GROUP(item) || SP_IS_SHAPE(item) || SP_IS_TEXT(item)))
- continue;
-
- didSomething |= sp_selected_path_simplify_item(desktop, selection, item,
- threshold, justCoalesce, angleLimit, breakableAngles, size, true);
- }
+ GSList *items = g_slist_copy((GSList *) selection->itemList());
+ bool didSomething = sp_selected_path_simplify_items(desktop, selection,
+ items, threshold,
+ justCoalesce,
+ angleLimit,
+ breakableAngles, true);
if (didSomething)
sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_SIMPLIFY,