summaryrefslogtreecommitdiffstats
path: root/src/display/sp-canvas.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-10-23 19:18:11 +0000
committerjabiertxof <info@marker.es>2016-10-23 19:18:11 +0000
commitb65d3fdc9c15af81c5e433d8f1b714ef4ab61487 (patch)
treeaf8cc5ec762018954d19001e2521d44c63ca7341 /src/display/sp-canvas.cpp
parentAdd right click rotation panning (diff)
downloadinkscape-b65d3fdc9c15af81c5e433d8f1b714ef4ab61487.tar.gz
inkscape-b65d3fdc9c15af81c5e433d8f1b714ef4ab61487.zip
Add right click rotation panning, some fixes
(bzr r15142.1.23)
Diffstat (limited to 'src/display/sp-canvas.cpp')
-rw-r--r--src/display/sp-canvas.cpp113
1 files changed, 60 insertions, 53 deletions
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 115b8c613..242a30248 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -2101,12 +2101,21 @@ void SPCanvas::clearRotateTo()
if (!started) {
return;
}
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(&_widget, &allocation);
+ cairo_surface_t *new_backing_store = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, allocation.width, allocation.height);
+ cairo_t *cr = cairo_create(new_backing_store);
+ cairo_set_source(cr, _background);
+ cairo_paint(cr);
+ cairo_destroy(cr);
+ cairo_surface_destroy(_backing_store);
+ _backing_store = new_backing_store;
gtk_widget_queue_draw(GTK_WIDGET(this));
dirtyAll();
addIdle();
}
-void SPCanvas::rotateTo(SPCanvasItem * item, double angle, bool widget)
+void SPCanvas::rotateTo(SPCanvasItem * item, double angle)
{
if (!_backing_store || !started) {
return;
@@ -2163,58 +2172,56 @@ void SPCanvas::rotateTo(SPCanvasItem * item, double angle, bool widget)
cairo_fill(cr);
cairo_translate(cr, half_w, half_h);
cairo_rotate(cr, -angle*(M_PI/180.));
- if (!widget) {
- cairo_select_font_face(cr, "sans-serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
- cairo_set_font_size(cr, 15.0);
- cairo_text_extents_t extents;
- std::ostringstream s;
- s << _("Original angle ") << std::fixed << std::setprecision(2) << start_angle << "º";
- cairo_text_extents(cr, s.str().c_str(), &extents);
- cairo_translate(cr, half_w - extents.width -15 ,-half_h + 25);
- cairo_set_source_rgba (cr, 1, 1, 1, 1);
- cairo_text_path(cr, s.str().c_str());
- cairo_fill(cr);
- cairo_translate(cr, (half_w - extents.width -15) *-1 ,(-half_h + 25) *-1);
- s.str("");
- s << _("New angle ") << std::fixed << std::setprecision(2) << angle << "º";
- cairo_text_extents(cr, s.str().c_str(), &extents);
- cairo_translate(cr, half_w - extents.width -15 ,-half_h + 45);
- cairo_text_path(cr, s.str().c_str());
- cairo_fill(cr);
- cairo_translate(cr, (half_w - extents.width -15) *-1 ,(-half_h + 45) *-1);
- s.str("");
- s << _("Gap ") << std::fixed << std::setprecision(2) << std::abs(start_angle-angle) << "º";
- cairo_text_extents(cr, s.str().c_str(), &extents);
- cairo_translate(cr, half_w - extents.width -15 ,-half_h + 65);
- cairo_text_path(cr, s.str().c_str());
- cairo_fill(cr);
- cairo_translate(cr, (half_w - extents.width -15) *-1 ,(-half_h + 65) *-1);
- cairo_translate(cr, -half_w + 10 ,-half_h + 25);
- s.str("");
- cairo_set_font_size(cr, 12.0);
- s << _("Normal mode, 1º round step");
- cairo_text_path(cr, s.str().c_str());
- cairo_fill(cr);
- cairo_translate(cr, (-half_w +10) * -1 ,(-half_h + 25) * -1);
- cairo_translate(cr, -half_w + 10 ,-half_h + 40);
- s.str("");
- s << _("+CTRL, Fractional degrees");
- cairo_text_path(cr, s.str().c_str());
- cairo_fill(cr);
- cairo_translate(cr, (-half_w + 10) * -1 ,(-half_h + 40) * -1);
- cairo_translate(cr, -half_w + 10 ,-half_h + 55);
- s.str("");
- s << _("+SHIFT, 5º round step");
- cairo_text_path(cr, s.str().c_str());
- cairo_fill(cr);
- cairo_translate(cr, (-half_w + 10) * -1 ,(-half_h + 55) * -1);
- cairo_translate(cr, -half_w + 10 ,-half_h + 70);
- s.str("");
- s << _("+CTRL+SHIFT, Reset");
- cairo_text_path(cr, s.str().c_str());
- cairo_fill(cr);
- //cairo_translate(cr, (-half_w + 10) * -1 ,(-half_h + 60) * -1);
- }
+ cairo_select_font_face(cr, "sans-serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+ cairo_set_font_size(cr, 15.0);
+ cairo_text_extents_t extents;
+ std::ostringstream s;
+ s << _("Original angle ") << std::fixed << std::setprecision(2) << start_angle << "º";
+ cairo_text_extents(cr, s.str().c_str(), &extents);
+ cairo_translate(cr, half_w - extents.width -15 ,-half_h + 25);
+ cairo_set_source_rgba (cr, 1, 1, 1, 1);
+ cairo_text_path(cr, s.str().c_str());
+ cairo_fill(cr);
+ cairo_translate(cr, (half_w - extents.width -15) *-1 ,(-half_h + 25) *-1);
+ s.str("");
+ s << _("New angle ") << std::fixed << std::setprecision(2) << angle << "º";
+ cairo_text_extents(cr, s.str().c_str(), &extents);
+ cairo_translate(cr, half_w - extents.width -15 ,-half_h + 45);
+ cairo_text_path(cr, s.str().c_str());
+ cairo_fill(cr);
+ cairo_translate(cr, (half_w - extents.width -15) *-1 ,(-half_h + 45) *-1);
+ s.str("");
+ s << _("Gap ") << std::fixed << std::setprecision(2) << std::abs(start_angle-angle) << "º";
+ cairo_text_extents(cr, s.str().c_str(), &extents);
+ cairo_translate(cr, half_w - extents.width -15 ,-half_h + 65);
+ cairo_text_path(cr, s.str().c_str());
+ cairo_fill(cr);
+ cairo_translate(cr, (half_w - extents.width -15) *-1 ,(-half_h + 65) *-1);
+ cairo_translate(cr, -half_w + 10 ,-half_h + 25);
+ s.str("");
+ cairo_set_font_size(cr, 12.0);
+ s << _("Normal mode, 1º round step");
+ cairo_text_path(cr, s.str().c_str());
+ cairo_fill(cr);
+ cairo_translate(cr, (-half_w +10) * -1 ,(-half_h + 25) * -1);
+ cairo_translate(cr, -half_w + 10 ,-half_h + 40);
+ s.str("");
+ s << _("+CTRL, Fractional degrees");
+ cairo_text_path(cr, s.str().c_str());
+ cairo_fill(cr);
+ cairo_translate(cr, (-half_w + 10) * -1 ,(-half_h + 40) * -1);
+ cairo_translate(cr, -half_w + 10 ,-half_h + 55);
+ s.str("");
+ s << _("+SHIFT, 5º round step");
+ cairo_text_path(cr, s.str().c_str());
+ cairo_fill(cr);
+ cairo_translate(cr, (-half_w + 10) * -1 ,(-half_h + 55) * -1);
+ cairo_translate(cr, -half_w + 10 ,-half_h + 70);
+ s.str("");
+ s << _("+CTRL+SHIFT, Reset");
+ cairo_text_path(cr, s.str().c_str());
+ cairo_fill(cr);
+ //cairo_translate(cr, (-half_w + 10) * -1 ,(-half_h + 60) * -1);
cairo_destroy(cr);
cairo_surface_destroy(_backing_store);
_backing_store = new_backing_store;