Code

implement filter toggle
authormental <mental@users.sourceforge.net>
Mon, 31 Mar 2008 03:23:39 +0000 (03:23 +0000)
committermental <mental@users.sourceforge.net>
Mon, 31 Mar 2008 03:23:39 +0000 (03:23 +0000)
src/desktop.cpp
src/desktop.h
src/display/rendermode.h
src/menus-skeleton.h
src/verbs.cpp
src/verbs.h

index 657d423048bd2f692c39853650c1d0d7ca76e453..a899e76c9904c4441c5fedc54e6c57ae49e94c5c 100644 (file)
@@ -145,9 +145,10 @@ SPDesktop::SPDesktop() :
     gr_point_type( 0 ),
     gr_point_i( 0 ),
     gr_fill_or_stroke( true ),
-    displayMode(Inkscape::RENDERMODE_NORMAL),
     _layer_hierarchy( 0 ),
     _reconstruction_old_layer_id( 0 ),
+    _display_mode(Inkscape::RENDERMODE_NORMAL),
+    _saved_display_mode(Inkscape::RENDERMODE_NORMAL),
     _widget( 0 ),
     _inkscape( 0 ),
     _guides_message_context( 0 ),
@@ -414,30 +415,23 @@ SPDesktop::remove_temporary_canvasitem (Inkscape::Display::TemporaryItem * tempi
     }
 }
 
-void SPDesktop::setDisplayModeNormal()
-{
-    SP_CANVAS_ARENA (drawing)->arena->rendermode = Inkscape::RENDERMODE_NORMAL;
-    canvas->rendermode = Inkscape::RENDERMODE_NORMAL; // canvas needs that for choosing the best buffer size
-    displayMode = Inkscape::RENDERMODE_NORMAL;
-    sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw
-    _widget->setTitle(SP_DOCUMENT_NAME(sp_desktop_document(this)));
-}
-
-void SPDesktop::setDisplayModeOutline()
-{
-    SP_CANVAS_ARENA (drawing)->arena->rendermode = Inkscape::RENDERMODE_OUTLINE;
-    canvas->rendermode = Inkscape::RENDERMODE_OUTLINE; // canvas needs that for choosing the best buffer size
-    displayMode = Inkscape::RENDERMODE_OUTLINE;
+void SPDesktop::_setDisplayMode(Inkscape::RenderMode mode) {
+    SP_CANVAS_ARENA (drawing)->arena->rendermode = mode;
+    canvas->rendermode = mode;
+    _display_mode = mode;
+    if (mode != Inkscape::RENDERMODE_OUTLINE) {
+        _saved_display_mode = _display_mode;
+    }
     sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw
     _widget->setTitle(SP_DOCUMENT_NAME(sp_desktop_document(this)));
 }
 
-void SPDesktop::displayModeToggle()
-{
-    if (displayMode == Inkscape::RENDERMODE_OUTLINE)
-        setDisplayModeNormal();
-    else
-        setDisplayModeOutline();
+void SPDesktop::displayModeToggle() {
+    if (_display_mode == Inkscape::RENDERMODE_OUTLINE) {
+        _setDisplayMode(_saved_display_mode);
+    } else {
+        _setDisplayMode(Inkscape::RENDERMODE_OUTLINE);
+    }
 }
 
 /**
index 672cd2b5c6a80ea89649ad7fd95c4ca54478eb46..4e2a12180a1a24701fa4fc42b1141a84847ab372 100644 (file)
@@ -187,11 +187,20 @@ struct SPDesktop : public Inkscape::UI::View::View
     Inkscape::Display::TemporaryItem * add_temporary_canvasitem (SPCanvasItem *item, guint lifetime);
     void remove_temporary_canvasitem (Inkscape::Display::TemporaryItem * tempitem);
 
-    void setDisplayModeNormal();
-    void setDisplayModeOutline();
+    void _setDisplayMode(Inkscape::RenderMode mode);
+    void setDisplayModeNormal() {
+        _setDisplayMode(Inkscape::RENDERMODE_NORMAL);
+    }
+    void setDisplayModeNoFilters() {
+        _setDisplayMode(Inkscape::RENDERMODE_NO_FILTERS);
+    }
+    void setDisplayModeOutline() {
+        _setDisplayMode(Inkscape::RENDERMODE_OUTLINE);
+    }
     void displayModeToggle();
-    Inkscape::RenderMode displayMode;
-    Inkscape::RenderMode getMode() const { return displayMode; }
+    Inkscape::RenderMode _display_mode;
+    Inkscape::RenderMode _saved_display_mode;
+    Inkscape::RenderMode getMode() const { return _display_mode; }
 
     Inkscape::UI::Widget::Dock* getDock() { return _widget->getDock(); }
 
index 3153a979c184aa3d512f45a4e3b65e497a8cd217..1b59ae9bbdf92e4cef3976ae6ad978230b5f6c12 100644 (file)
@@ -11,6 +11,7 @@ namespace Inkscape {
 
 enum RenderMode {
     RENDERMODE_NORMAL,
+    RENDERMODE_NO_FILTERS,
     RENDERMODE_OUTLINE
 };
 
index 70c7f4ca2a7ca92eb8120c89e6de11169098adcf..e77b9e9be8b605dff74fd2c0e0c3ad96c2396742 100644 (file)
@@ -108,6 +108,7 @@ static char const menus_skeleton[] =
 "       <submenu name=\"" N_("_Display mode") "\">\n"
 "         <verb verb-id=\"ViewModeToggle\"/>\n"
 "         <verb verb-id=\"ViewModeNormal\" radio=\"yes\" default=\"yes\"/>\n"
+"         <verb verb-id=\"ViewModeNoFilters\" radio=\"yes\"/>\n"
 "         <verb verb-id=\"ViewModeOutline\" radio=\"yes\"/>\n"
 "       </submenu>\n"
 "       <separator/>\n"
index b32d0041b0760be8e341b865726dc7f1ca4421f8..9258aa5474f775186413f71ab74824e0aca5cd21 100644 (file)
@@ -1651,6 +1651,9 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
         case SP_VERB_VIEW_MODE_NORMAL:
             dt->setDisplayModeNormal();
             break;
+        case SP_VERB_VIEW_MODE_NO_FILTERS:
+            dt->setDisplayModeNoFilters();
+            break;
         case SP_VERB_VIEW_MODE_OUTLINE:
             dt->setDisplayModeOutline();
             break;
@@ -2496,6 +2499,8 @@ Verb *Verb::_base_verbs[] = {
 
     new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"),
                  N_("Switch to normal display mode"), NULL),
+    new ZoomVerb(SP_VERB_VIEW_MODE_NO_FILTERS, "ViewModeNoFilters", N_("No _Filters"),
+                 N_("Switch to normal display without filters"), NULL),
     new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"),
                  N_("Switch to outline (wireframe) display mode"), NULL),
     new ZoomVerb(SP_VERB_VIEW_MODE_TOGGLE, "ViewModeToggle", N_("_Toggle"),
index 89e677ead7149a248c50df55cfc45b14f6aceda2..0a1826580c30b48774f6436bfbfebc10760cd7be 100644 (file)
@@ -200,6 +200,7 @@ enum {
     SP_VERB_VIEW_NEW,
     SP_VERB_VIEW_NEW_PREVIEW,
     SP_VERB_VIEW_MODE_NORMAL,
+    SP_VERB_VIEW_MODE_NO_FILTERS,
     SP_VERB_VIEW_MODE_OUTLINE,
     SP_VERB_VIEW_MODE_TOGGLE,
     SP_VERB_VIEW_CMS_TOGGLE,