From ae22ad7adc4a7a418e71f5dbab8c1f0f7f464562 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Fri, 28 Mar 2008 20:49:55 +0000 Subject: [PATCH] when applying LPE to rect, convert it to path first --- src/path-chemistry.cpp | 8 ++++++-- src/path-chemistry.h | 2 +- src/ui/dialog/livepatheffect-editor.cpp | 8 ++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 49c1a1063..cfdbc0b54 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -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 diff --git a/src/path-chemistry.h b/src/path-chemistry.h index 52b3b189d..a715833d0 100644 --- a/src/path-chemistry.h +++ b/src/path-chemistry.h @@ -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 (); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 2394adc6f..f62556d23 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -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* 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"); -- 2.30.2