From: buliabyak Date: Wed, 19 Mar 2008 08:54:26 +0000 (+0000) Subject: add delete lpe verb, rearrange menu to collect all lpe commands under path X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c3f24227306c3dfa09bf085abbbddd8b0baed10b;p=inkscape.git add delete lpe verb, rearrange menu to collect all lpe commands under path --- diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index ced61031e..6e4285311 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -56,7 +56,6 @@ static char const menus_skeleton[] = " \n" " \n" " \n" -" \n" " \n" " \n" " \n" @@ -215,7 +214,11 @@ static char const menus_skeleton[] = " \n" " \n" " \n" -" \n" +" \n" +" \n" +" \n" +" \n" +" \n" " \n" " \n" " \n" diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 3a7956595..501f334a2 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -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 object(s) to remove live path effects from.")); + return; + } + + for ( GSList const *itemlist = selection->itemList(); itemlist != NULL; itemlist = g_slist_next(itemlist) ) { + SPItem *item = reinterpret_cast(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; diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 9307fe5c0..86edc9091 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -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); diff --git a/src/verbs.cpp b/src/verbs.cpp index 7bd175755..060f6aae3 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -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"), diff --git a/src/verbs.h b/src/verbs.h index 6924a4bfd..dc09636f6 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -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,