From 9c7757e7fc10db2004c188a7aff95ab54b0e80d6 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 21 Jul 2012 12:36:25 +0900 Subject: Fix for 816496 : Alt+mouse wheel z-order cycling, add option to cycle wrap (bzr r11561) --- src/select-context.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/select-context.cpp') diff --git a/src/select-context.cpp b/src/select-context.cpp index 91e0e6298..4555e51aa 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -122,6 +122,7 @@ sp_select_context_init(SPSelectContext *sc) sc->cycling_items_cmp = NULL; sc->cycling_items_selected_before = NULL; sc->cycling_cur_item = NULL; + sc->cycling_wrap = true; sc->_seltrans = NULL; sc->_describer = NULL; @@ -457,15 +458,17 @@ sp_select_context_cycle_through_items(SPSelectContext *sc, Inkscape::Selection * GList *next; if (scroll_event->direction == GDK_SCROLL_UP) { next = sc->cycling_cur_item->next; - if (next == NULL) + if (next == NULL && sc->cycling_wrap) next = sc->cycling_items; } else { next = sc->cycling_cur_item->prev; - if (next == NULL) + if (next == NULL && sc->cycling_wrap) next = g_list_last(sc->cycling_items); } - sc->cycling_cur_item = next; - item = SP_ITEM(sc->cycling_cur_item->data); + if (next) { + sc->cycling_cur_item = next; + item = SP_ITEM(sc->cycling_cur_item->data); + } arenaitem = item->get_arenaitem(desktop->dkey); arenaitem->setOpacity(1.0); @@ -856,6 +859,8 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) sc->cycling_cur_item = g_list_last(sc->cycling_items); } + sc->cycling_wrap = prefs->getBool("/options/selection/cycleWrap", true); + // Cycle through the items underneath the mouse pointer, one-by-one sp_select_context_cycle_through_items(sc, selection, scroll_event, shift_pressed); -- cgit v1.2.3