Code

add delete lpe verb, rearrange menu to collect all lpe commands under path
authorbuliabyak <buliabyak@users.sourceforge.net>
Wed, 19 Mar 2008 08:54:26 +0000 (08:54 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Wed, 19 Mar 2008 08:54:26 +0000 (08:54 +0000)
src/menus-skeleton.h
src/selection-chemistry.cpp
src/selection-chemistry.h
src/verbs.cpp
src/verbs.h

index ced61031ef0803dc8365e952e3c470bc6c4839b4..6e4285311d97eb600072e14afe2ff624208b60c5 100644 (file)
@@ -56,7 +56,6 @@ static char const menus_skeleton[] =
 "       <verb verb-id=\"EditPaste\" />\n"
 "       <verb verb-id=\"EditPasteInPlace\" />\n"
 "       <verb verb-id=\"EditPasteStyle\" />\n"
-"       <verb verb-id=\"EditPasteLivePathEffect\" />\n"
 "       <submenu name=\"" N_("Paste Si_ze") "\">\n"
 "           <verb verb-id=\"EditPasteSize\" />\n"
 "           <verb verb-id=\"EditPasteWidth\" />\n"
@@ -215,7 +214,11 @@ static char const menus_skeleton[] =
 "       <verb verb-id=\"SelectionSimplify\" />\n"
 "       <verb verb-id=\"SelectionReverse\" />\n"
 "       <separator/>\n"
-"       <verb verb-id=\"DialogLivePathEffect\" />\n"
+"       <submenu name=\"" N_("Path Effects") "\">\n"
+"           <verb verb-id=\"DialogLivePathEffect\" />\n"
+"           <verb verb-id=\"PasteLivePathEffect\" />\n"
+"           <verb verb-id=\"RemoveLivePathEffect\" />\n"
+"       </submenu>\n"
 "   </submenu>\n"
 "   <submenu name=\"" N_("_Text") "\">\n"
 "       <verb verb-id=\"DialogText\" />\n"
index 3a79565952ea5d61919d7d7425eda82d8fc81c16..501f334a2c103a4f887257e82a9d070e85cf4740 100644 (file)
@@ -1382,6 +1382,44 @@ void sp_selection_paste_livepatheffect()
                      _("Paste live path effect"));
 }
 
+
+void sp_selection_remove_livepatheffect_impl(SPItem *item)
+{
+    if ( item && SP_IS_SHAPE(item) ) {
+        sp_shape_remove_path_effect(SP_SHAPE(item));
+   } else if (item && SP_IS_GROUP (item)) {
+        for (SPObject *child = sp_object_first_child(SP_OBJECT(item)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
+            if (!SP_IS_ITEM (child))
+                continue;
+            sp_selection_remove_livepatheffect_impl (SP_ITEM(child));
+        }
+    }
+}
+
+void sp_selection_remove_livepatheffect()
+{
+    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+    if (desktop == NULL) return;
+
+    Inkscape::Selection *selection = sp_desktop_selection(desktop);
+
+    // check if something is selected
+    if (selection->isEmpty()) {
+        desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to remove live path effects from."));
+        return;
+    }
+
+    for ( GSList const *itemlist = selection->itemList(); itemlist != NULL; itemlist = g_slist_next(itemlist) ) {
+        SPItem *item = reinterpret_cast<SPItem*>(itemlist->data);
+
+        sp_selection_remove_livepatheffect_impl(item);
+
+    }
+
+    sp_document_done(sp_desktop_document (desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT,
+                     _("Remove live path effect"));
+}
+
 void sp_selection_paste_size (bool apply_x, bool apply_y)
 {
     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
index 9307fe5c06c75b227352f386d59223521f5dfb7e..86edc90916e043003970ab0b5a1beb8a6098a88f 100644 (file)
@@ -63,6 +63,7 @@ void sp_selection_copy_lpe_pathparam(Inkscape::LivePathEffect::PathParam * pathp
 void sp_selection_paste(bool in_place);
 void sp_selection_paste_style();
 void sp_selection_paste_livepatheffect();
+void sp_selection_remove_livepatheffect();
 
 void sp_set_style_clipboard (SPCSSAttr *css);
 
index 7bd17575506cede95b653d1df062c25c6fac42d0..060f6aae33360b66468fa6bd32a31bdf3d339227 100644 (file)
@@ -879,6 +879,9 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
         case SP_VERB_EDIT_PASTE_LIVEPATHEFFECT:
             sp_selection_paste_livepatheffect();
             break;
+        case SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT:
+            sp_selection_remove_livepatheffect();
+            break;
         case SP_VERB_EDIT_DELETE:
             sp_selection_delete();
             break;
@@ -2201,8 +2204,10 @@ Verb *Verb::_base_verbs[] = {
                  N_("Scale each selected object vertically to match the height of the copied object"), NULL),
     new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"),
                  N_("Paste objects from clipboard to the original location"), "selection_paste_in_place"),
-    new EditVerb(SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, "EditPasteLivePathEffect", N_("Paste Path _Effect"),
+    new EditVerb(SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, "PasteLivePathEffect", N_("Paste Path _Effect"),
                  N_("Apply the path effect of the copied object to selection"), NULL),
+    new EditVerb(SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, "RemoveLivePathEffect", N_("Remove Path _Effect"),
+                 N_("Remove any path effects from selected objects"), NULL),
     new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"),
                  N_("Delete selection"), GTK_STOCK_DELETE),
     new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"),
index 6924a4bfd0c725b630d8999ea8194edc31d9de4d..dc09636f6be63dee35adcee7bbaa70be1acf2c18 100644 (file)
@@ -64,6 +64,7 @@ enum {
     SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y,
     SP_VERB_EDIT_PASTE_IN_PLACE,
     SP_VERB_EDIT_PASTE_LIVEPATHEFFECT,
+    SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT,
     SP_VERB_EDIT_DELETE,
     SP_VERB_EDIT_DUPLICATE,
     SP_VERB_EDIT_CLONE,