Merge lp:~bratsche/oif/smooth-zooming into lp:~oif-team/oif/evince-gestures-trunk

Proposed by Cody Russell
Status: Merged
Merged at revision: 4205
Proposed branch: lp:~bratsche/oif/smooth-zooming
Merge into: lp:~oif-team/oif/evince-gestures-trunk
Diff against target: 107 lines (+36/-18)
3 files modified
libview/ev-view.c (+20/-8)
libview/ev-view.h (+2/-0)
shell/ev-window.c (+14/-10)
To merge this branch: bzr merge lp:~bratsche/oif/smooth-zooming
Reviewer Review Type Date Requested Status
Mohamed IKBEL Boulabiar (community) Approve
Duncan McGreggor (community) Approve
Review via email: mp+41107@code.launchpad.net

Description of the change

Add smooth zooming.

To post a comment you must log in.
Revision history for this message
Duncan McGreggor (oubiwann) wrote :

This looks great, Cody. Well done! Smooth zooming is total ROCK!

Let's get a code review done on this branch and get it merged :-)

review: Approve
Revision history for this message
Mohamed IKBEL Boulabiar (boulabiar) wrote :

Works fine, and keeps moving between the predefined Evince zooming levels, so maintains a good compatibility with the standard Evince.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libview/ev-view.c'
--- libview/ev-view.c 2010-09-15 15:05:47 +0000
+++ libview/ev-view.c 2010-11-17 22:07:11 +0000
@@ -5297,27 +5297,39 @@
5297}5297}
52985298
5299void5299void
5300ev_view_zoom_in_smooth (EvView *view, float factor)
5301{
5302 gdouble scale;
5303
5304 g_return_if_fail (view->sizing_mode == EV_SIZING_FREE);
5305
5306 view->pending_scroll = SCROLL_TO_CENTER;
5307 scale = ev_document_model_get_scale (view->model) * factor;
5308 ev_document_model_set_scale (view->model, scale);
5309}
5310
5311void
5300ev_view_zoom_in (EvView *view)5312ev_view_zoom_in (EvView *view)
5301{5313{
5314 ev_view_zoom_in_smooth (view, ZOOM_IN_FACTOR);
5315}
5316
5317void
5318ev_view_zoom_out_smooth (EvView *view, float factor)
5319{
5302 gdouble scale;5320 gdouble scale;
53035321
5304 g_return_if_fail (view->sizing_mode == EV_SIZING_FREE);5322 g_return_if_fail (view->sizing_mode == EV_SIZING_FREE);
53055323
5306 view->pending_scroll = SCROLL_TO_CENTER;5324 view->pending_scroll = SCROLL_TO_CENTER;
5307 scale = ev_document_model_get_scale (view->model) * ZOOM_IN_FACTOR;5325 scale = ev_document_model_get_scale (view->model) * factor;
5308 ev_document_model_set_scale (view->model, scale);5326 ev_document_model_set_scale (view->model, scale);
5309}5327}
53105328
5311void5329void
5312ev_view_zoom_out (EvView *view)5330ev_view_zoom_out (EvView *view)
5313{5331{
5314 gdouble scale;5332 ev_view_zoom_out_smooth (view, ZOOM_OUT_FACTOR);
5315
5316 g_return_if_fail (view->sizing_mode == EV_SIZING_FREE);
5317
5318 view->pending_scroll = SCROLL_TO_CENTER;
5319 scale = ev_document_model_get_scale (view->model) * ZOOM_OUT_FACTOR;
5320 ev_document_model_set_scale (view->model, scale);
5321}5333}
53225334
5323static double5335static double
53245336
=== modified file 'libview/ev-view.h'
--- libview/ev-view.h 2010-07-20 15:07:40 +0000
+++ libview/ev-view.h 2010-11-17 22:07:11 +0000
@@ -65,8 +65,10 @@
65/* Page size */65/* Page size */
66gboolean ev_view_can_zoom_in (EvView *view);66gboolean ev_view_can_zoom_in (EvView *view);
67void ev_view_zoom_in (EvView *view);67void ev_view_zoom_in (EvView *view);
68void ev_view_zoom_in_smooth (EvView *view, float factor);
68gboolean ev_view_can_zoom_out (EvView *view);69gboolean ev_view_can_zoom_out (EvView *view);
69void ev_view_zoom_out (EvView *view);70void ev_view_zoom_out (EvView *view);
71void ev_view_zoom_out_smooth (EvView *view, float factor);
7072
71/* Find */73/* Find */
72void ev_view_find_next (EvView *view);74void ev_view_find_next (EvView *view);
7375
=== modified file 'shell/ev-window.c'
--- shell/ev-window.c 2010-10-12 18:00:39 +0000
+++ shell/ev-window.c 2010-11-17 22:07:11 +0000
@@ -5448,22 +5448,26 @@
5448ev_pinch_gesture_update (GtkWindow *window,5448ev_pinch_gesture_update (GtkWindow *window,
5449 IdoGestureEvent *event)5449 IdoGestureEvent *event)
5450{5450{
5451 IdoEventGesturePinch *pinch = (IdoEventGesturePinch *)event;
5452 EvWindowPrivate *priv = EV_WINDOW (window)->priv;
5453 gdouble increment = pinch->radius_delta * 0.01;
5454
5455 if (increment < 0.0) increment = -increment;
5456 increment += 1.0;
5457
5458 if (pinch->radius_delta < 0.0) {
5459 ev_document_model_set_sizing_mode (priv->model, EV_SIZING_FREE);
5460 ev_view_zoom_out_smooth (priv->view, (1.0 / increment));
5461 } else if (pinch->radius_delta > 0.0) {
5462 ev_document_model_set_sizing_mode (priv->model, EV_SIZING_FREE);
5463 ev_view_zoom_in_smooth (priv->view, increment);
5464 }
5451}5465}
54525466
5453static void5467static void
5454ev_pinch_gesture_end (GtkWindow *window,5468ev_pinch_gesture_end (GtkWindow *window,
5455 IdoGestureEvent *event)5469 IdoGestureEvent *event)
5456{5470{
5457 IdoEventGesturePinch *pinch = (IdoEventGesturePinch *)event;
5458 EvWindowPrivate *priv = EV_WINDOW (window)->priv;
5459
5460 gdouble diff = pinch->radius - priv->pinch_start_radius;
5461
5462 if (diff <= -100) {
5463 ev_window_cmd_view_zoom_out (NULL, EV_WINDOW (window));
5464 } else if (diff >= 100) {
5465 ev_window_cmd_view_zoom_in (NULL, EV_WINDOW (window));
5466 }
5467}5471}
54685472
5469static void5473static void

Subscribers

People subscribed via source and target branches