From 8dbefd373324afb54a8784b3ad8974f1132b17eb Mon Sep 17 00:00:00 2001 From: johncoswell Date: Sun, 13 Aug 2006 18:48:37 +0000 Subject: [PATCH] inform user of progress during long-running simplify operations --- src/splivarot.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 87ad24800..2fd01cb69 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -1482,6 +1482,13 @@ sp_selected_path_simplify_items(SPDesktop *desktop, bool simplifyIndividualPaths = (bool) prefs_get_int_attribute("options.simplifyindividualpaths", "value", 0); + gchar *simplificationType; + if (simplifyIndividualPaths) { + simplificationType = "individual paths"; + } else { + simplificationType = "as a group"; + } + bool didSomething = false; NR::Rect selectionBbox = selection->bounds(); @@ -1489,6 +1496,11 @@ sp_selected_path_simplify_items(SPDesktop *desktop, gdouble simplifySize = selectionSize; + int pathsSimplified = 0; + int totalPathCount = g_slist_length(items); + + desktop->disableInteraction(); + for (; items != NULL; items = items->next) { SPItem *item = (SPItem *) items->data; @@ -1500,10 +1512,25 @@ sp_selected_path_simplify_items(SPDesktop *desktop, simplifySize = L2(itemBbox.dimensions()); } + + pathsSimplified++; + + if (pathsSimplified % 20 == 0) { + gchar *message = g_strdup_printf(_("Simplifying %s - %d of %d paths simplified..."), simplificationType, pathsSimplified, totalPathCount); + desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message); + desktop->updateCanvasNow(); + } + didSomething |= sp_selected_path_simplify_item(desktop, selection, item, threshold, justCoalesce, angleLimit, breakableAngles, simplifySize, modifySelection); } + desktop->enableInteraction(); + + if (pathsSimplified > 20) { + desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, g_strdup_printf(_("Done - %d paths simplified."), pathsSimplified)); + } + return didSomething; } -- 2.30.2