Code

Warn user when attempting to put flowtext on path.
authoracspike <acspike@users.sourceforge.net>
Sun, 5 Feb 2006 21:39:41 +0000 (21:39 +0000)
committeracspike <acspike@users.sourceforge.net>
Sun, 5 Feb 2006 21:39:41 +0000 (21:39 +0000)
src/text-chemistry.cpp

index a61bbdf737a6314e78aa7a4f96dc017e8a9c85ea..549db62282d5354dfde6bd44e92f59e09d3f2c40 100644 (file)
@@ -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 <b>already put to a path</b>. Remove it from the path first. Use <b>Shift+D</b> to look up its path."));
+        SP_DT_MSGSTACK(desktop)->flash(Inkscape::ERROR_MESSAGE, _("This text object is <b>already put on a path</b>. Remove it from the path first. Use <b>Shift+D</b> 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;
     }