summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/select-tool.cpp
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-01-21 23:33:24 +0000
committerJabiertxof <jtx@jtx>2017-01-21 23:33:24 +0000
commiteeb5405c1b2734322ca9ed506e8a8e16a87c2a4f (patch)
tree5f98cdb1ee5633b69ec1f5c21d0d5e69f8770ad2 /src/ui/tools/select-tool.cpp
parentOrganize doeffect function (diff)
parentFix "swap fill and stroke" for multiple objects in selection (diff)
downloadinkscape-eeb5405c1b2734322ca9ed506e8a8e16a87c2a4f.tar.gz
inkscape-eeb5405c1b2734322ca9ed506e8a8e16a87c2a4f.zip
Update to trunk
(bzr r13645.1.165)
Diffstat (limited to 'src/ui/tools/select-tool.cpp')
-rw-r--r--src/ui/tools/select-tool.cpp92
1 files changed, 26 insertions, 66 deletions
diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp
index b5ec3d88e..6c450b3dc 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 <config.h>
#endif
#include <cstring>
#include <string>
@@ -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;
@@ -128,20 +126,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;
}
}
@@ -477,7 +467,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().front();
if (dynamic_cast<SPGroup *>(clicked_item) && !dynamic_cast<SPBox3D *>(clicked_item)) { // enter group if it's not a 3D box
desktop->setCurrentLayer(clicked_item);
@@ -912,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
}
}
@@ -935,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
}
}
@@ -958,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
}
}
@@ -981,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
}
}
@@ -1033,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;
@@ -1046,46 +1036,16 @@ 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);
- }
-
- 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);
+ selection->rotate(-180.0/snaps);
}
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()) {
@@ -1124,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;