From 201e34f6d50d5a099e7c1e8f17d35ae2149283a5 Mon Sep 17 00:00:00 2001 From: dvlierop2 Date: Tue, 18 Dec 2007 21:23:15 +0000 Subject: [PATCH] Introduce verb, menu item and shortcut for the global snapping toggle --- share/keys/default.xml | 9 +++++---- share/keys/inkscape.xml | 9 +++++---- src/menus-skeleton.h | 1 + src/snap.h | 4 ++++ src/verbs.cpp | 4 ++++ src/verbs.h | 1 + 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/share/keys/default.xml b/share/keys/default.xml index acf45b311..74f7682ed 100644 --- a/share/keys/default.xml +++ b/share/keys/default.xml @@ -121,10 +121,7 @@ override) the bindings in the main default.xml. - - - - + @@ -232,6 +229,10 @@ override) the bindings in the main default.xml. + + + + diff --git a/share/keys/inkscape.xml b/share/keys/inkscape.xml index e877c344b..b39b02e9f 100644 --- a/share/keys/inkscape.xml +++ b/share/keys/inkscape.xml @@ -121,10 +121,7 @@ override) the bindings in the main default.xml. - - - - + @@ -233,6 +230,10 @@ override) the bindings in the main default.xml. + + + + diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index 7bff62c29..c039dcefd 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -118,6 +118,7 @@ static char const menus_skeleton[] = " \n" " \n" " \n" +" \n" " \n" " \n" " \n" diff --git a/src/snap.h b/src/snap.h index 1f2b85974..f7882fc61 100644 --- a/src/snap.h +++ b/src/snap.h @@ -148,6 +148,10 @@ public: bool getSnapEnabledGlobally() const { return _snap_enabled_globally; } + + void toggleSnapEnabledGlobally() { + _snap_enabled_globally = !_snap_enabled_globally; + } protected: SPNamedView const *_named_view; diff --git a/src/verbs.cpp b/src/verbs.cpp index f5ff45a0b..2c2da7093 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1611,6 +1611,9 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/) case SP_VERB_TOGGLE_GUIDES: sp_namedview_toggle_guides(doc, repr); break; + case SP_VERB_TOGGLE_SNAPPING: + dt->namedview->snap_manager.toggleSnapEnabledGlobally(); + break; case SP_VERB_TOGGLE_GRID: dt->toggleGrids(); break; @@ -2439,6 +2442,7 @@ Verb *Verb::_base_verbs[] = { new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), "scrollbars"), new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), "grid"), new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), "guides"), + new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapping", N_("Snap"), N_("Toggle snapping on or off"), NULL), new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"), "zoom_next"), new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"), diff --git a/src/verbs.h b/src/verbs.h index a9abc02ed..fce826c8f 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -182,6 +182,7 @@ enum { SP_VERB_TOGGLE_SCROLLBARS, SP_VERB_TOGGLE_GRID, SP_VERB_TOGGLE_GUIDES, + SP_VERB_TOGGLE_SNAPPING, SP_VERB_ZOOM_NEXT, SP_VERB_ZOOM_PREV, SP_VERB_ZOOM_1_1, -- 2.30.2