From 425108aeb0731b11a5751b04f8e029b7a48ad0ab Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 16 Jun 2016 14:01:16 +0200 Subject: Fix z-cycling (alt+mousewheel) behavior Fixed bugs: - https://launchpad.net/bugs/1589420 (bzr r14988) --- src/ui/tools/select-tool.cpp | 199 ++++++++++++++++++------------------------- 1 file changed, 83 insertions(+), 116 deletions(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 905e38f2b..5b48d65be 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -111,7 +111,6 @@ SelectTool::SelectTool() //static gint tolerance = 0; //static bool within_tolerance = false; static bool is_cycling = false; -static bool moved_while_cycling = false; SelectTool::~SelectTool() { @@ -386,54 +385,68 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { } void SelectTool::sp_select_context_cycle_through_items(Inkscape::Selection *selection, GdkEventScroll *scroll_event, bool shift_pressed) { - if (this->cycling_cur_item == this->cycling_items.end()) { + if ( this->cycling_items.empty() ) return; - } Inkscape::DrawingItem *arenaitem; - SPItem *item = *cycling_cur_item; - g_assert(item != NULL); - // Deactivate current item - if (std::find(cycling_items_selected_before.begin(), cycling_items_selected_before.end(), item) == cycling_items_selected_before.end() && selection->includes(item)) { - selection->remove(item); + if(cycling_cur_item) { + arenaitem = cycling_cur_item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(0.3); } - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(0.3); - // Find next item and activate it - std::vector::iterator next = this->cycling_cur_item; + + + std::vector::iterator next = cycling_items.end(); + if (scroll_event->direction == GDK_SCROLL_UP) { - ++next; - if (next == this->cycling_items.end() && this->cycling_wrap) { - next = this->cycling_items.begin(); + if (! cycling_cur_item) { + next = cycling_items.begin(); + } else { + next = std::find( cycling_items.begin(), cycling_items.end(), cycling_cur_item ); + g_assert (next != cycling_items.end()); + next++; + if (next == cycling_items.end()) + if ( cycling_wrap ) + next = cycling_items.begin(); + else + next--; } - } else { - if(next == this->cycling_items.begin()) { - next = this->cycling_items.end(); + } else { + if (! cycling_cur_item) { + next = cycling_items.end(); + next--; + } else { + next = std::find( cycling_items.begin(), cycling_items.end(), cycling_cur_item ); + g_assert (next != cycling_items.end()); + if (next == cycling_items.begin()){ + if ( cycling_wrap ) { + next = cycling_items.end(); + next--; + } + } else { + next--; + } } - --next; } - if (next!=this->cycling_items.end()) { - this->cycling_cur_item = next; - item = *next; - g_assert(item != NULL); - } + this->cycling_cur_item = *next; + g_assert(next != cycling_items.end()); + g_assert(cycling_cur_item != NULL); - arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem = cycling_cur_item->get_arenaitem(desktop->dkey); arenaitem->setOpacity(1.0); if (shift_pressed) { - selection->add(item); + selection->add(cycling_cur_item); } else { - selection->set(item); + selection->set(cycling_cur_item); } } void SelectTool::sp_select_context_reset_opacities() { - for (std::vector::const_iterator l = this->cycling_items.begin(); l != this->cycling_items.end(); ++l ) { + for (std::vector::const_iterator l = this->cycling_items_cmp.begin(); l != this->cycling_items_cmp.end(); ++l ) { SPItem *item = *l; if (item) { Inkscape::DrawingItem *arenaitem = item->get_arenaitem(desktop->dkey); @@ -443,10 +456,8 @@ void SelectTool::sp_select_context_reset_opacities() { } } - this->cycling_items.clear(); - this->cycling_items_selected_before.clear(); - this->cycling_cur_item = this->cycling_items.end(); this->cycling_items_cmp.clear(); + this->cycling_cur_item = NULL; } bool SelectTool::root_handler(GdkEvent* event) { @@ -533,11 +544,7 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_MOTION_NOTIFY: { - if (is_cycling) { - moved_while_cycling = true; - } - - tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); + tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); if ((event->motion.state & GDK_BUTTON1_MASK) && !this->space_panning) { Geom::Point const motion_pt(event->motion.x, event->motion.y); @@ -796,98 +803,58 @@ bool SelectTool::root_handler(GdkEvent* event) { break; case GDK_SCROLL: { - GdkEventScroll *scroll_event = (GdkEventScroll*) event; - - if (scroll_event->state & GDK_MOD1_MASK) { // alt modified pressed - if (moved_while_cycling) { - moved_while_cycling = false; - this->sp_select_context_reset_opacities(); - } - is_cycling = true; - - bool shift_pressed = scroll_event->state & GDK_SHIFT_MASK; - - /* Rebuild list of items underneath the mouse pointer */ - Geom::Point p = desktop->d2w(desktop->point()); - SPItem *item = desktop->getItemAtPoint(p, true, NULL); - - // Save pointer to current cycle-item so that we can find it again later, in the freshly built list - SPItem *tmp_cur_item = this->cycling_cur_item!=this->cycling_items.end() ? (*(this->cycling_cur_item)) : NULL; - this->cycling_items.clear(); - this->cycling_cur_item = this->cycling_items.end(); - while(item != NULL) { - this->cycling_items.push_back(item); - item = desktop->getItemAtPoint(p, true, item); - } - - /* Compare current item list with item list during previous scroll ... */ - bool item_lists_differ = this->cycling_items != this->cycling_items_cmp; - - /* If list of items under mouse pointer hasn't changed ... */ - if (!item_lists_differ) { - // ... find current item in the freshly built list and continue cycling ... - // TODO: This wouldn't be necessary if cycling_cur_item pointed to an element of cycling_items_cmp instead - this->cycling_cur_item = std::find(this->cycling_items.begin(), this->cycling_items.end(), tmp_cur_item); - g_assert(this->cycling_cur_item != this->cycling_items.end() || this->cycling_items.empty()); - } else { - // ... otherwise reset opacities for outdated items ... - Inkscape::DrawingItem *arenaitem; - - for (std::vector::const_iterator l = this->cycling_items_cmp.begin(); l != this->cycling_items_cmp.end(); ++l) { - SPItem *item = *l; - if (item) { - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(1.0); - //if (!shift_pressed && !g_list_find(this->cycling_items_selected_before, item) && selection->includes(item)) - if (std::find(this->cycling_items_selected_before.begin(),this->cycling_items_selected_before.end(), item)==this->cycling_items_selected_before.end() && selection->includes(item)) { - selection->remove(item); - } - } - } + GdkEventScroll *scroll_event = (GdkEventScroll*) event; - // ... clear the lists ... + if ( ! (scroll_event->state & GDK_MOD1_MASK)) // do nothing specific if alt was not pressed + break; - this->cycling_items_cmp.clear(); - this->cycling_items_selected_before.clear(); - this->cycling_cur_item = this->cycling_items.end(); + bool shift_pressed = scroll_event->state & GDK_SHIFT_MASK; + is_cycling = true; - // ... and rebuild them with the new items. - this->cycling_items_cmp = (this->cycling_items); + /* Rebuild list of items underneath the mouse pointer */ + Geom::Point p = desktop->d2w(desktop->point()); + SPItem *item = desktop->getItemAtPoint(p, true, NULL); + this->cycling_items.clear(); - for(std::vector::const_iterator l = this->cycling_items.begin(); l != this->cycling_items.end(); ++l) { - SPItem *item =*l; - if (item) { - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(0.3); + SPItem *tmp = NULL; + while(item != NULL) { + this->cycling_items.push_back(item); + item = desktop->getItemAtPoint(p, true, item); + if (selection->includes(item)) tmp = item; + } - if (selection->includes(item)) { - // already selected items are stored separately, too - this->cycling_items_selected_before.push_back(item); - } - } else { - g_assert_not_reached(); - } + /* Compare current item list with item list during previous scroll ... */ + bool item_lists_differ = this->cycling_items != this->cycling_items_cmp; + + if(item_lists_differ) { + this->sp_select_context_reset_opacities(); + for (std::vector::const_iterator l = this->cycling_items_cmp.begin(); l != this->cycling_items_cmp.end(); ++l) + selection->remove(*l); // deselects the previous content of the cycling loop + this->cycling_items_cmp = (this->cycling_items); + + // set opacities in new stack + for(std::vector::const_iterator l = this->cycling_items.begin(); l != this->cycling_items.end(); ++l) { + SPItem *item =*l; + if (item) { + Inkscape::DrawingItem *arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(0.3); } - - // set the current item to the bottommost one so that the cycling step below re-starts at the top - this->cycling_cur_item = this->cycling_items.end(); - this->cycling_cur_item--; } + } + if(!cycling_cur_item) cycling_cur_item = tmp; - this->cycling_wrap = prefs->getBool("/options/selection/cycleWrap", true); + this->cycling_wrap = prefs->getBool("/options/selection/cycleWrap", true); - // Cycle through the items underneath the mouse pointer, one-by-one - this->sp_select_context_cycle_through_items(selection, scroll_event, shift_pressed); + // Cycle through the items underneath the mouse pointer, one-by-one + this->sp_select_context_cycle_through_items(selection, scroll_event, shift_pressed); - ret = TRUE; + ret = TRUE; - GtkWindow *w =GTK_WINDOW(gtk_widget_get_toplevel( GTK_WIDGET(desktop->canvas) )); - if (w) - { - gtk_window_present(w); - gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas)); - } + GtkWindow *w =GTK_WINDOW(gtk_widget_get_toplevel( GTK_WIDGET(desktop->canvas) )); + if (w) { + gtk_window_present(w); + gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas)); } break; } -- cgit v1.2.3 From f5eb74652e628b4424647e798da1d0c05d6f4b2f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 16 Jun 2016 14:07:58 +0200 Subject: remove tabs (bzr r14989) --- src/ui/tools/select-tool.cpp | 58 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 5b48d65be..b5ec3d88e 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -65,7 +65,7 @@ static gint rb_escaped = 0; // if non-zero, rubberband was canceled by esc, so t static gint drag_escaped = 0; // if non-zero, drag was canceled by esc const std::string& SelectTool::getPrefsPath() { - return SelectTool::prefsPath; + return SelectTool::prefsPath; } const std::string SelectTool::prefsPath = "/tools/select"; @@ -296,7 +296,7 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { } else { GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); - this->dragging = TRUE; + this->dragging = TRUE; this->moved = FALSE; gdk_window_set_cursor(window, CursorSelectDragging); @@ -346,11 +346,11 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { break; } case GDK_LEAVE_NOTIFY: - if (!desktop->isWaitingCursor() && !this->dragging) { + if (!desktop->isWaitingCursor() && !this->dragging) { GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, this->cursor); - } + } break; case GDK_KEY_PRESS: @@ -378,7 +378,7 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { } if (!ret) { - ret = ToolBase::item_handler(item, event); + ret = ToolBase::item_handler(item, event); } return ret; @@ -710,7 +710,7 @@ bool SelectTool::root_handler(GdkEvent* event) { if (r->is_started() && !within_tolerance) { // this was a rubberband drag - std::vector items; + std::vector items; if (r->getMode() == RUBBERBAND_MODE_RECT) { Geom::OptRect const b = r->getRectangle(); @@ -860,10 +860,10 @@ bool SelectTool::root_handler(GdkEvent* event) { } case GDK_KEY_PRESS: // keybindings for select context - { - { - guint keyval = get_group0_keyval(&event->key); - + { + { + guint keyval = get_group0_keyval(&event->key); + bool alt = ( MOD__ALT(event) || (keyval == GDK_KEY_Alt_L) || (keyval == GDK_KEY_Alt_R) @@ -891,7 +891,7 @@ bool SelectTool::root_handler(GdkEvent* event) { // if Alt and nonempty selection, show moving cursor ("move selected"): if (alt && !selection->isEmpty() && !desktop->isWaitingCursor()) { - GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); + GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, CursorSelectDragging); } @@ -912,15 +912,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift + sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift + sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift + sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift + sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift } } @@ -935,15 +935,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift + sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift + sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift } } @@ -958,15 +958,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift + sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift + sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift + sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift + sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift } } @@ -981,15 +981,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift + sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift + sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift } } @@ -1133,7 +1133,7 @@ bool SelectTool::root_handler(GdkEvent* event) { break; } break; - } + } case GDK_KEY_RELEASE: { guint keyval = get_group0_keyval(&event->key); if (key_is_a_modifier (keyval)) { @@ -1174,7 +1174,7 @@ bool SelectTool::root_handler(GdkEvent* event) { } if (!ret) { - ret = ToolBase::root_handler(event); + ret = ToolBase::root_handler(event); } return ret; -- cgit v1.2.3 From 1636c1dd1651780d01759676b194312529f211f7 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Sat, 25 Jun 2016 22:24:26 +0200 Subject: Moved next functions, added namespace, renamed range functions (bzr r14954.1.10) --- src/ui/tools/select-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index b5ec3d88e..676a41eaa 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -477,7 +477,7 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_2BUTTON_PRESS: if (event->button.button == 1) { if (!selection->isEmpty()) { - SPItem *clicked_item = selection->itemList()[0]; + SPItem *clicked_item = selection->items()[0]; if (dynamic_cast(clicked_item) && !dynamic_cast(clicked_item)) { // enter group if it's not a 3D box desktop->setCurrentLayer(clicked_item); -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/ui/tools/select-tool.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index b5ec3d88e..5d802d4da 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include #include @@ -40,14 +40,12 @@ #include "desktop.h" #include "sp-root.h" -#include "preferences.h" #include "ui/tools-switch.h" #include "message-stack.h" #include "selection-describer.h" #include "seltrans.h" #include "box3d.h" #include "display/sp-canvas.h" -#include "display/sp-canvas-item.h" #include "display/drawing-item.h" using Inkscape::DocumentUndo; -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/ui/tools/select-tool.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 5d802d4da..b5ec3d88e 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include #include @@ -40,12 +40,14 @@ #include "desktop.h" #include "sp-root.h" +#include "preferences.h" #include "ui/tools-switch.h" #include "message-stack.h" #include "selection-describer.h" #include "seltrans.h" #include "box3d.h" #include "display/sp-canvas.h" +#include "display/sp-canvas-item.h" #include "display/drawing-item.h" using Inkscape::DocumentUndo; -- cgit v1.2.3 From 49a7927ecf31ace696e9e5770e8d6543c356db7a Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 28 Jul 2016 19:15:34 +0100 Subject: Finish removing GTK+ 2 fallbacks (bzr r15023.2.8) --- src/ui/tools/select-tool.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index b5ec3d88e..b29fb6979 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -128,20 +128,12 @@ SelectTool::~SelectTool() { this->_describer = NULL; if (CursorSelectDragging) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(CursorSelectDragging); -#else - gdk_cursor_unref (CursorSelectDragging); -#endif CursorSelectDragging = NULL; } if (CursorSelectMouseover) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(CursorSelectMouseover); -#else - gdk_cursor_unref (CursorSelectMouseover); -#endif CursorSelectMouseover = NULL; } } -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/ui/tools/select-tool.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index b5ec3d88e..5d802d4da 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include #include @@ -40,14 +40,12 @@ #include "desktop.h" #include "sp-root.h" -#include "preferences.h" #include "ui/tools-switch.h" #include "message-stack.h" #include "selection-describer.h" #include "seltrans.h" #include "box3d.h" #include "display/sp-canvas.h" -#include "display/sp-canvas-item.h" #include "display/drawing-item.h" using Inkscape::DocumentUndo; -- cgit v1.2.3 From 7be3086bf70ba9bf28c5cfe06fd7a8e28e719bcc Mon Sep 17 00:00:00 2001 From: sandra-snan Date: Sat, 8 Oct 2016 08:16:53 +0200 Subject: [Bug #770681] KEY MAPPING: Comma and period hijacked by scaling. Fixed bugs: - https://launchpad.net/bugs/770681 (bzr r15155) --- src/ui/tools/select-tool.cpp | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 86a2dbed3..0cdeda0b6 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -1045,37 +1045,7 @@ bool SelectTool::root_handler(GdkEvent* event) { ret = TRUE; break; - - case GDK_KEY_less: - case GDK_KEY_comma: - if (MOD__ALT(event)) { - gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_scale_screen(selection, -2*mul); - } else if (MOD__CTRL(event)) { - sp_selection_scale_times(selection, 0.5); - } else { - gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_scale(selection, -offset*mul); - } - - ret = TRUE; - break; - - case GDK_KEY_greater: - case GDK_KEY_period: - if (MOD__ALT(event)) { - gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_scale_screen(selection, 2*mul); - } else if (MOD__CTRL(event)) { - sp_selection_scale_times(selection, 2); - } else { - gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_scale(selection, offset*mul); - } - - ret = TRUE; - break; - + case GDK_KEY_Return: if (MOD__CTRL_ONLY(event)) { if (selection->singleItem()) { -- cgit v1.2.3 From 532f77b14a76fc04e6bdeca3625f9a55b5f11bdf Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 25 Oct 2016 00:58:43 +0200 Subject: CPPification: almost all sp_object_set_whatever and sp_selection_whatever global functions are now methods of ObjectSet*, with these additional benefits: - They can now act on any SelectionSet, not just the current selection; - Whenever possible, they don't need a desktop anymore and can run if called from GUI. I hope I did not break too many things in the process. *: So instead of callink sp_selection_move(desktop,x,y), you call myobjectset->move(x,y) (bzr r15189) --- src/ui/tools/select-tool.cpp | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 0cdeda0b6..6c450b3dc 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -902,15 +902,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift + desktop->getSelection()->moveScreen(mul*-10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift + desktop->getSelection()->moveScreen(mul*-1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift + desktop->getSelection()->move(mul*-10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift + desktop->getSelection()->move(mul*-nudge, 0); // no shift } } @@ -925,15 +925,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift + desktop->getSelection()->moveScreen(0, mul*10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift + desktop->getSelection()->moveScreen(0, mul*1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift + desktop->getSelection()->move(0, mul*10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift + desktop->getSelection()->move(0, mul*nudge); // no shift } } @@ -948,15 +948,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift + desktop->getSelection()->moveScreen(mul*10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift + desktop->getSelection()->moveScreen(mul*1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift + desktop->getSelection()->move(mul*10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift + desktop->getSelection()->move(mul*nudge, 0); // no shift } } @@ -971,15 +971,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift + desktop->getSelection()->moveScreen(0, mul*-10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift + desktop->getSelection()->moveScreen(0, mul*-1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift + desktop->getSelection()->move(0, mul*-10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift + desktop->getSelection()->move(0, mul*-nudge); // no shift } } @@ -1023,11 +1023,11 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_KEY_bracketleft: if (MOD__ALT(event)) { gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_rotate_screen(selection, mul*1); + selection->rotateScreen(mul*1); } else if (MOD__CTRL(event)) { - sp_selection_rotate(selection, 90); + selection->rotate(90); } else if (snaps) { - sp_selection_rotate(selection, 180.0/snaps); + selection->rotate(180.0/snaps); } ret = TRUE; @@ -1036,11 +1036,11 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_KEY_bracketright: if (MOD__ALT(event)) { gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_rotate_screen(selection, -1*mul); + selection->rotateScreen(-1*mul); } else if (MOD__CTRL(event)) { - sp_selection_rotate(selection, -90); + selection->rotate(-90); } else if (snaps) { - sp_selection_rotate(selection, -180.0/snaps); + selection->rotate(-180.0/snaps); } ret = TRUE; @@ -1084,7 +1084,7 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_KEY_g: case GDK_KEY_G: if (MOD__SHIFT_ONLY(event)) { - sp_selection_to_guides(desktop); + desktop->selection->toGuides(); ret = true; } break; -- cgit v1.2.3 From 84be171bf42f23113f7c4bdf95a39c66505cdfe5 Mon Sep 17 00:00:00 2001 From: Alexandru-Daniel Roman Date: Fri, 3 Mar 2017 21:54:22 +0200 Subject: https://bugs.launchpad.net/inkscape/+bug/1496836 A simple change to selection tool status message. (bzr r15562) --- src/ui/tools/select-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tools/select-tool.cpp') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 6c450b3dc..bae1793ed 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -142,7 +142,7 @@ void SelectTool::setup() { this->_describer = new Inkscape::SelectionDescriber( desktop->selection, desktop->messageStack(), - _("Click selection to toggle scale/rotation handles"), + _("Click selection to toggle scale/rotation handles (or Shift+s)"), _("No objects selected. Click, Shift+click, Alt+scroll mouse on top of objects, or drag around objects to select.") ); -- cgit v1.2.3