From 5f71c9d03745c5896a2e84cd203e2e6646b9ae06 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Mon, 9 Jun 2008 05:48:13 +0000 Subject: [PATCH] remove filters verb and command --- src/menus-skeleton.h | 4 +++- src/selection-chemistry.cpp | 36 +++++++++++++++++++++++++++++++++--- src/selection-chemistry.h | 2 ++ src/verbs.cpp | 5 +++++ src/verbs.h | 1 + 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index e77b9e9be..02c81adcf 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -155,9 +155,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 9c826c949..91c518766 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -27,7 +27,7 @@ #include "svg/svg.h" #include "inkscape.h" #include "desktop.h" -//#include "desktop-style.h" +#include "desktop-style.h" #include "selection.h" #include "tools-switch.h" #include "desktop-handles.h" @@ -917,10 +917,33 @@ void sp_selection_remove_livepatheffect() } - sp_document_done(sp_desktop_document (desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, + sp_document_done(sp_desktop_document (desktop), SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, _("Remove live path effect")); } +void sp_selection_remove_filter () +{ + 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 filters from.")); + return; + } + + SPCSSAttr *css = sp_repr_css_attr_new(); + sp_repr_css_unset_property(css, "filter"); + sp_desktop_set_style(desktop, css); + sp_repr_css_attr_unref(css); + + sp_document_done(sp_desktop_document (desktop), SP_VERB_EDIT_REMOVE_FILTER, + _("Remove filter")); +} + + void sp_selection_paste_size (bool apply_x, bool apply_y) { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); @@ -2342,11 +2365,16 @@ sp_selection_create_bitmap_copy () return; } + desktop->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Rendering bitmap...")); + // set "busy" cursor + desktop->setWaitingCursor(); + // Get the bounding box of the selection NRRect bbox; sp_document_ensure_up_to_date (document); selection->bounds(&bbox); if (NR_RECT_DFLS_TEST_EMPTY(&bbox)) { + desktop->clearWaitingCursor(); return; // exceptional situation, so not bother with a translatable error message, just quit quietly } @@ -2410,7 +2438,7 @@ sp_selection_create_bitmap_copy () unsigned width = (unsigned) floor ((bbox.x1 - bbox.x0) * res / PX_PER_IN); unsigned height =(unsigned) floor ((bbox.y1 - bbox.y0) * res / PX_PER_IN); - // Find out if we have to run a filter + // Find out if we have to run an external filter gchar const *run = NULL; gchar const *filter = prefs_get_string_attribute ("options.createbitmap", "filter"); if (filter) { @@ -2502,6 +2530,8 @@ sp_selection_create_bitmap_copy () _("Create bitmap")); } + desktop->clearWaitingCursor(); + g_free (filename); g_free (filepath); } diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 9a7567446..e5b2d9ef1 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -64,6 +64,8 @@ void sp_selection_paste_style(); void sp_selection_paste_livepatheffect(); void sp_selection_remove_livepatheffect(); +void sp_selection_remove_filter(); + void sp_set_style_clipboard (SPCSSAttr *css); void sp_selection_paste_size(bool apply_x, bool apply_y); diff --git a/src/verbs.cpp b/src/verbs.cpp index 8ac2bec8b..509dff087 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -881,6 +881,9 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/) case SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT: sp_selection_remove_livepatheffect(); break; + case SP_VERB_EDIT_REMOVE_FILTER: + sp_selection_remove_filter(); + break; case SP_VERB_EDIT_DELETE: sp_selection_delete(); break; @@ -2217,6 +2220,8 @@ Verb *Verb::_base_verbs[] = { 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_REMOVE_FILTER, "RemoveFilter", N_("Remove Filter"), + N_("Remove any filters 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 605cc732b..6447bbadd 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -65,6 +65,7 @@ enum { SP_VERB_EDIT_PASTE_IN_PLACE, SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, + SP_VERB_EDIT_REMOVE_FILTER, SP_VERB_EDIT_DELETE, SP_VERB_EDIT_DUPLICATE, SP_VERB_EDIT_CLONE, -- 2.30.2