summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-10-23 18:04:23 +0000
committerjabiertxof <info@marker.es>2016-10-23 18:04:23 +0000
commit74edf9fcbc3106cccddb2a293275748fefa08f0b (patch)
tree8c845140695374fe18bf2243a37883e5a4db1f6a /src
parentAdd doc rotate with panning (diff)
downloadinkscape-74edf9fcbc3106cccddb2a293275748fefa08f0b.tar.gz
inkscape-74edf9fcbc3106cccddb2a293275748fefa08f0b.zip
Add right click rotation panning
(bzr r15142.1.22)
Diffstat (limited to 'src')
-rw-r--r--src/display/sp-canvas.cpp19
-rw-r--r--src/display/sp-canvas.h2
-rw-r--r--src/ui/tools/tool-base.cpp11
3 files changed, 17 insertions, 15 deletions
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 2f6caadd3..115b8c613 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -2077,31 +2077,33 @@ void SPCanvas::startRotateTo(double angle)
cairo_paint(cr);
cairo_destroy(cr);
surface_origin = new_backing_store_grey;
- clearRotateTo(true);
+ gtk_widget_queue_draw(GTK_WIDGET(this));
+ dirtyAll();
+ addIdle();
}
bool SPCanvas::endRotateTo()
{
- if (!started) {
+ if (!_backing_store || !started) {
return false;
}
started = false;
surface_rotated = NULL;
surface_origin = NULL;
- clearRotateTo(true);
+ gtk_widget_queue_draw(GTK_WIDGET(this));
+ dirtyAll();
+ addIdle();
return true;
}
-void SPCanvas::clearRotateTo(bool clear)
+void SPCanvas::clearRotateTo()
{
if (!started) {
return;
}
gtk_widget_queue_draw(GTK_WIDGET(this));
dirtyAll();
- if (clear) {
- addIdle();
- }
+ addIdle();
}
void SPCanvas::rotateTo(SPCanvasItem * item, double angle, bool widget)
@@ -2217,7 +2219,8 @@ void SPCanvas::rotateTo(SPCanvasItem * item, double angle, bool widget)
cairo_surface_destroy(_backing_store);
_backing_store = new_backing_store;
cairo_pattern_destroy (source_pattern);
- clearRotateTo(false);
+ gtk_widget_queue_draw(GTK_WIDGET(this));
+ addIdle();
}
void SPCanvas::updateNow()
diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h
index 122cc2d8c..628bc74ca 100644
--- a/src/display/sp-canvas.h
+++ b/src/display/sp-canvas.h
@@ -75,7 +75,7 @@ struct SPCanvas {
void startRotateTo(double angle);
void rotateTo(SPCanvasItem * item, double angle, bool widget = false);
bool endRotateTo();
- void clearRotateTo(bool clear);
+ void clearRotateTo();
/// Synchronously updates the canvas if necessary.
void updateNow();
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp
index 87f808039..33c0492d7 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -334,7 +334,6 @@ bool ToolBase::root_handler(GdkEvent* event) {
/// @todo REmove redundant /value in preference keys
tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
bool allow_panning = prefs->getBool("/options/spacebarpans/value");
- bool clear = true;
gint ret = FALSE;
switch (event->type) {
@@ -346,7 +345,6 @@ bool ToolBase::root_handler(GdkEvent* event) {
} else {
/* sp_desktop_dialog(); */
}
- desktop->canvas->clearRotateTo();
break;
case GDK_BUTTON_PRESS:
@@ -434,14 +432,13 @@ bool ToolBase::root_handler(GdkEvent* event) {
| GDK_POINTER_MOTION_HINT_MASK, NULL,
event->motion.time - 1);
} else if (this->space_panning && event->motion.state & GDK_BUTTON3_MASK) {
- clear = false;
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time);
desktop->canvas->startRotateTo(desktop->namedview->document_rotation);
button_w = Geom::Point(event->motion.x, event->motion.y);
- Geom::Point const motion_dt(desktop->w2d(button_w));
+ Geom::Point const motion_dt(desktop->doc2dt(desktop->w2d(button_w)));
Geom::Rect view = desktop->get_display_area();
Geom::Point view_center = desktop->doc2dt(view.midpoint());
- Geom::Ray center_ray(view_center, motion_dt);
+ Geom::Ray center_ray(motion_dt, view_center);
desktop->canvas->startRotateTo(desktop->namedview->document_rotation);
angle = Geom::deg_from_rad(center_ray.angle()) - 90;
if (event->motion.state & GDK_SHIFT_MASK && event->motion.state & GDK_CONTROL_MASK) {
@@ -583,6 +580,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
ret = TRUE;
}
}
+ desktop->canvas->clearRotateTo();
break;
case GDK_KEY_PRESS: {
@@ -752,6 +750,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
switch (get_group0_keyval(&event->key)) {
case GDK_KEY_space:
+ desktop->canvas->clearRotateTo();
if (within_tolerance) {
// Space was pressed, but not panned
sp_toggle_selector(desktop);
@@ -773,6 +772,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
default:
break;
}
+ desktop->canvas->clearRotateTo();
break;
case GDK_SCROLL: {
@@ -856,7 +856,6 @@ bool ToolBase::root_handler(GdkEvent* event) {
default:
break;
}
- desktop->canvas->clearRotateTo(clear);
return ret;
}