+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.
+
2007-01-10 Carlos Garcia Campos <carlosgc@gnome.org>
* configure.ac:
gint end_page;
gint current_page;
- int rotation;
- double scale;
- int spacing;
+ gint rotation;
+ gdouble scale;
+ gint spacing;
+ gdouble dpi;
+ gdouble max_scale;
+ gdouble min_scale;
gboolean loading;
gboolean continuous;
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",
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;
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)
{
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
int height,
int vsb_width,
int hsb_height);
+void ev_view_set_screen_dpi (EvView *view,
+ gdouble dpi);
void ev_view_rotate_left (EvView *view);
void ev_view_rotate_right (EvView *view);
void ev_view_set_rotation (EvView *view,
window);
#endif
+ ev_view_set_screen_dpi (EV_VIEW (window->priv->view),
+ ev_window_get_screen_dpi (window));
+
if (GTK_WIDGET_CLASS (ev_window_parent_class)->screen_changed) {
GTK_WIDGET_CLASS (ev_window_parent_class)->screen_changed (widget, old_screen);
}
ev_window->priv->scrolled_window);
ev_window->priv->view = ev_view_new ();
+ ev_view_set_screen_dpi (EV_VIEW (ev_window->priv->view),
+ ev_window_get_screen_dpi (ev_window));
ev_window->priv->password_view = ev_password_view_new ();
g_signal_connect_swapped (ev_window->priv->password_view,
"unlock",