diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2007-12-18 21:23:15 +0000 |
|---|---|---|
| committer | dvlierop2 <dvlierop2@users.sourceforge.net> | 2007-12-18 21:23:15 +0000 |
| commit | 6cf30abe97fc637ab143b34263111aeb9076ab30 (patch) | |
| tree | 69f7acab1cb183bd41a67d890384d93c2d8a7f6a /src | |
| parent | speedify zooming by keys (diff) | |
| download | inkscape-6cf30abe97fc637ab143b34263111aeb9076ab30.tar.gz inkscape-6cf30abe97fc637ab143b34263111aeb9076ab30.zip | |
Introduce verb, menu item and shortcut for the global snapping toggle
(bzr r4256)
Diffstat (limited to 'src')
| -rw-r--r-- | src/menus-skeleton.h | 1 | ||||
| -rw-r--r-- | src/snap.h | 4 | ||||
| -rw-r--r-- | src/verbs.cpp | 4 | ||||
| -rw-r--r-- | src/verbs.h | 1 |
4 files changed, 10 insertions, 0 deletions
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[] = " <separator/>\n" " <verb verb-id=\"ToggleGrid\" />\n" " <verb verb-id=\"ToggleGuides\" />\n" +" <verb verb-id=\"ToggleSnapping\" />\n" " <verb verb-id=\"ViewCmsToggle\" />\n" " <separator/>\n" " <submenu name=\"" N_("Show/Hide") "\">\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, |
