Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-view.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2007-01-11 16:58:45 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2007-01-11 16:58:45 (GMT)
commitfe8ea2226d06f58142a9c192960bc369ac442e20 (patch)
treebfccf13e3b8958407b159160e349dbb3d37b1c51 /shell/ev-view.c
parent7d113d1d39d05a1a7e9a53c031ae76c6805266c4 (diff)
Use max and min scale values in the view iby taking dpi into account.
2007-01-11 Carlos Garcia Campos <carlosgc@gnome.org> * shell/ev-view-private.h: * shell/ev-window.c: (ev_window_screen_changed), (ev_window_init): * shell/ev-view.[ch]: (ev_view_class_init), (ev_view_set_zoom), (ev_view_set_screen_dpi), (ev_view_can_zoom_in), (ev_view_can_zoom_out): Use max and min scale values in the view iby taking dpi into account. svn path=/trunk/; revision=2214
Diffstat (limited to 'shell/ev-view.c')
-rw-r--r--shell/ev-view.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 549c256..7353e7d 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -3252,20 +3252,20 @@ ev_view_class_init (EvViewClass *class)
PROP_ZOOM,
g_param_spec_double ("zoom",
"Zoom factor",
- "Zoom factor",
- MIN_SCALE,
- MAX_SCALE,
- 1.0,
- G_PARAM_READWRITE));
+ "Zoom factor",
+ 0,
+ G_MAXDOUBLE,
+ 1.0,
+ G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_ROTATION,
g_param_spec_double ("rotation",
"Rotation",
- "Rotation",
- 0,
- 360,
- 0,
- G_PARAM_READWRITE));
+ "Rotation",
+ 0,
+ 360,
+ 0,
+ G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_HAS_SELECTION,
g_param_spec_boolean ("has-selection",
@@ -3493,7 +3493,7 @@ ev_view_set_zoom (EvView *view,
else
scale = factor;
- scale = CLAMP (scale, MIN_SCALE, MAX_SCALE);
+ scale = CLAMP (scale, view->min_scale, view->max_scale);
if (ABS (view->scale - scale) < EPSILON)
return;
@@ -3512,6 +3512,18 @@ ev_view_get_zoom (EvView *view)
return view->scale;
}
+void
+ev_view_set_screen_dpi (EvView *view,
+ gdouble dpi)
+{
+ g_return_if_fail (EV_IS_VIEW (view));
+ g_return_if_fail (dpi > 0);
+
+ view->dpi = dpi;
+ view->min_scale = MIN_SCALE * dpi / 72.0;
+ view->max_scale = MAX_SCALE * dpi / 72.0;
+}
+
gboolean
ev_view_get_continuous (EvView *view)
{
@@ -3704,13 +3716,13 @@ ev_view_get_sizing_mode (EvView *view)
gboolean
ev_view_can_zoom_in (EvView *view)
{
- return view->scale * ZOOM_IN_FACTOR <= MAX_SCALE;
+ return view->scale * ZOOM_IN_FACTOR <= view->max_scale;
}
gboolean
ev_view_can_zoom_out (EvView *view)
{
- return view->scale * ZOOM_OUT_FACTOR >= MIN_SCALE;
+ return view->scale * ZOOM_OUT_FACTOR >= view->min_scale;
}
void