From cd477aa9d480d06e1c3328f5e66d26a91c7db772 Mon Sep 17 00:00:00 2001 From: acspike Date: Sun, 5 Feb 2006 21:39:41 +0000 Subject: [PATCH] Warn user when attempting to put flowtext on path. --- src/text-chemistry.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index a61bbdf73..549db6228 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -54,6 +54,18 @@ flowtext_in_selection(Inkscape::Selection *selection) return NULL; } +SPItem * +text_or_flowtext_in_selection(Inkscape::Selection *selection) +{ + for (GSList *items = (GSList *) selection->itemList(); + items != NULL; + items = items->next) { + if (SP_IS_TEXT(items->data) || SP_IS_FLOWTEXT(items->data)) + return ((SPItem *) items->data); + } + return NULL; +} + SPItem * shape_in_selection(Inkscape::Selection *selection) { @@ -75,7 +87,7 @@ text_put_on_path() Inkscape::Selection *selection = SP_DT_SELECTION(desktop); - SPItem *text = text_in_selection(selection); + SPItem *text = text_or_flowtext_in_selection(selection); SPItem *shape = shape_in_selection(selection); if (!text || !shape || g_slist_length((GSList *) selection->itemList()) != 2) { @@ -84,7 +96,12 @@ text_put_on_path() } if (SP_IS_TEXT_TEXTPATH(text)) { - SP_DT_MSGSTACK(desktop)->flash(Inkscape::ERROR_MESSAGE, _("This text object is already put to a path. Remove it from the path first. Use Shift+D to look up its path.")); + SP_DT_MSGSTACK(desktop)->flash(Inkscape::ERROR_MESSAGE, _("This text object is already put on a path. Remove it from the path first. Use Shift+D to look up its path.")); + return; + } + + if (SP_IS_FLOWTEXT(text)) { + SP_DT_MSGSTACK(desktop)->flash(Inkscape::ERROR_MESSAGE, _("You cannot put flowtext on a path. Convert flowtext to text first.")); return; } -- 2.30.2