From: mental Date: Mon, 31 Mar 2008 03:23:39 +0000 (+0000) Subject: implement filter toggle X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8cf9f2c8ffa320d2ea0b262d208ba1b1ceb2fff6;p=inkscape.git implement filter toggle --- diff --git a/src/desktop.cpp b/src/desktop.cpp index 657d42304..a899e76c9 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -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); + } } /** diff --git a/src/desktop.h b/src/desktop.h index 672cd2b5c..4e2a12180 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -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(); } diff --git a/src/display/rendermode.h b/src/display/rendermode.h index 3153a979c..1b59ae9bb 100644 --- a/src/display/rendermode.h +++ b/src/display/rendermode.h @@ -11,6 +11,7 @@ namespace Inkscape { enum RenderMode { RENDERMODE_NORMAL, + RENDERMODE_NO_FILTERS, RENDERMODE_OUTLINE }; diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index 70c7f4ca2..e77b9e9be 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -108,6 +108,7 @@ static char const menus_skeleton[] = " \n" " \n" " \n" +" \n" " \n" " \n" " \n" diff --git a/src/verbs.cpp b/src/verbs.cpp index b32d0041b..9258aa547 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -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"), diff --git a/src/verbs.h b/src/verbs.h index 89e677ead..0a1826580 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -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,