Code

remove filters verb and command
authorbuliabyak <buliabyak@users.sourceforge.net>
Mon, 9 Jun 2008 05:48:13 +0000 (05:48 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Mon, 9 Jun 2008 05:48:13 +0000 (05:48 +0000)
src/menus-skeleton.h
src/selection-chemistry.cpp
src/selection-chemistry.h
src/verbs.cpp
src/verbs.h

index e77b9e9be8b605dff74fd2c0e0c3ad96c2396742..02c81adcf5cad0c5e196081fb21d73c0c632eb20 100644 (file)
@@ -155,9 +155,11 @@ static char const menus_skeleton[] =
 "   </submenu>\n"
 "   <submenu name=\"" N_("_Object") "\">\n"
 "       <verb verb-id=\"DialogFillStroke\" />\n"
-"       <verb verb-id=\"DialogFilterEffects\" />\n"
 "       <verb verb-id=\"DialogObjectProperties\" />\n"
 "       <separator/>\n"
+"       <verb verb-id=\"DialogFilterEffects\" />\n"
+"       <verb verb-id=\"RemoveFilter\" />\n"
+"       <separator/>\n"
 "       <verb verb-id=\"SelectionGroup\" />\n"
 "       <verb verb-id=\"SelectionUnGroup\" />\n"
 "       <separator/>\n"
index 9c826c949a8ad38706e8f6341213dcd697a102c8..91c518766f4fa339dd12f827b3227897795c288b 100644 (file)
@@ -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 <b>object(s)</b> 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);
 }
index 9a7567446d8a119f6ec44a4a842e0bf405f8bfcc..e5b2d9ef1d6af901f829b0866e023cf10bd12578 100644 (file)
@@ -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);
index 8ac2bec8b255b5bb157bd5088231f1980ee62ad9..509dff087c0cfe63be06d42769ba349d4be4ccfc 100644 (file)
@@ -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"),
index 605cc732b4f45dd18d22482b1de6f1c7c14b4549..6447bbadd45a7801b145568419421bb63a4f62c1 100644 (file)
@@ -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,