Code

when applying LPE to rect, convert it to path first
authorjohanengelen <johanengelen@users.sourceforge.net>
Fri, 28 Mar 2008 20:49:55 +0000 (20:49 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Fri, 28 Mar 2008 20:49:55 +0000 (20:49 +0000)
src/path-chemistry.cpp
src/path-chemistry.h
src/ui/dialog/livepatheffect-editor.cpp

index 49c1a1063adeeda6235e0ba4ebdacbb7c768d276..cfdbc0b54d276472e500be1762e1ffb3e6047da8 100644 (file)
@@ -261,9 +261,13 @@ sp_selected_path_break_apart(void)
 
 /* This function is an entry point from GUI */
 void
-sp_selected_path_to_curves(void)
+sp_selected_path_to_curves(bool interactive)
 {
-    sp_selected_path_to_curves0(TRUE, SP_TOCURVE_INTERACTIVE);
+    if (interactive) {
+        sp_selected_path_to_curves0(TRUE, SP_TOCURVE_INTERACTIVE);
+    } else {
+        sp_selected_path_to_curves0(false, 0);
+    }
 }
 
 static void
index 52b3b189d31d4bb4cc89c4d8ecbd6ac41a5c3d06..a715833d052d2085a06623454169ae95fdfeace8 100644 (file)
@@ -17,7 +17,7 @@
 
 void sp_selected_path_combine (void);
 void sp_selected_path_break_apart (void);
-void sp_selected_path_to_curves (void);
+void sp_selected_path_to_curves (bool interactive = true);
 Inkscape::XML::Node *sp_selected_item_to_curved_repr(SPItem *item, guint32 text_grouping_policy);
 void sp_selected_path_reverse ();
 
index 2394adc6f03fc973cf0cf5ae983ec956b0c413e5..f62556d23ae64306b3f03509f33aa623431f8e34 100644 (file)
@@ -22,6 +22,8 @@
 #include "sp-shape.h"
 #include "sp-item-group.h"
 #include "sp-path.h"
+#include "sp-rect.h"
+#include "path-chemistry.h"
 #include "live_effects/effect.h"
 #include "live_effects/lpeobject.h"
 #include "gtkmm/widget.h"
@@ -229,6 +231,12 @@ LivePathEffectEditor::onApply()
             const Util::EnumData<LivePathEffect::EffectType>* data = combo_effecttype.get_active_data();
             if (!data) return;
 
+            // If item is a SPRect, convert it to path first:
+            if ( SP_IS_RECT(item) ) {
+                sp_selected_path_to_curves(false);
+                item = sel->singleItem(); // get new item
+            }
+
             // Path effect definition
             Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
             Inkscape::XML::Node *repr = xml_doc->createElement("inkscape:path-effect");