+2005-04-22 Marco Pesenti Gritti <mpg@redhat.com>
+
+ * shell/ev-view.c: (ev_view_can_zoom_in), (ev_view_can_zoom_out),
+ (ev_view_zoom_out), (ev_view_zoom_normal):
+ * shell/ev-view.h:
+ * shell/ev-window.c: (update_action_sensitivity),
+ (ev_window_cmd_view_best_fit), (ev_window_cmd_view_page_width),
+ (ev_window_cmd_view_zoom_in), (ev_window_cmd_view_zoom_out),
+ (ev_window_cmd_view_normal_size):
+
+ Fix normal size zoom. Make zoom in/zoom out unsensitive when
+ they are behyond the limits. Tweak MAX_ZOOM to 6, sucks but
+ better than oom.
+
2005-04-22 Marco Pesenti Gritti <mpg@redhat.com>
* configure.ac:
#define ZOOM_OUT_FACTOR (1.0/ZOOM_IN_FACTOR)
#define MIN_SCALE 0.05409
-#define MAX_SCALE 18.4884
+#define MAX_SCALE 6.0
struct _EvView {
GtkWidget parent_instance;
gtk_widget_queue_resize (GTK_WIDGET (view));
}
+gboolean
+ev_view_can_zoom_in (EvView *view)
+{
+ if (view->width != -1 || view->height != -1) {
+ return TRUE;
+ }
+
+ return view->scale * ZOOM_IN_FACTOR <= MAX_SCALE;
+}
+
+gboolean
+ev_view_can_zoom_out (EvView *view)
+{
+ if (view->width != -1 || view->height != -1) {
+ return TRUE;
+ }
+
+ return view->scale * ZOOM_OUT_FACTOR >= MIN_SCALE;
+}
+
void
ev_view_zoom_in (EvView *view)
{
ev_view_zoom (view, ZOOM_OUT_FACTOR, TRUE);
}
+void
+ev_view_zoom_normal (EvView *view)
+{
+ ev_view_zoom (view, 1.0, FALSE);
+}
+
void
ev_view_set_size (EvView *view,
int width,
static void
update_action_sensitivity (EvWindow *ev_window)
{
+ EvView *view;
EvDocument *document;
EvWindowPageMode page_mode;
gboolean sensitive, has_pages = FALSE, has_document;
int n_pages = 0, page = -1;
+ view = EV_VIEW (ev_window->priv->view);
document = ev_window->priv->document;
page_mode = ev_window->priv->page_mode;
has_document = document != NULL;
set_action_sensitive (ev_window, "EditFind",
has_pages && EV_IS_DOCUMENT_FIND (document));
set_action_sensitive (ev_window, "EditFindNext",
- ev_view_can_find_next (EV_VIEW (ev_window->priv->view)));
+ ev_view_can_find_next (view));
/* View menu */
- set_action_sensitive (ev_window, "ViewZoomIn", has_pages);
- set_action_sensitive (ev_window, "ViewZoomOut", has_pages);
+ set_action_sensitive (ev_window, "ViewZoomIn",
+ has_pages && ev_view_can_zoom_in (view));
+ set_action_sensitive (ev_window, "ViewZoomOut",
+ has_pages && ev_view_can_zoom_out (view));
set_action_sensitive (ev_window, "ViewNormalSize", has_pages);
set_action_sensitive (ev_window, "ViewBestFit", has_pages);
set_action_sensitive (ev_window, "ViewPageWidth", has_pages);
} else {
ev_window_set_sizing_mode (ev_window, EV_SIZING_FREE);
}
+ update_action_sensitivity (ev_window);
}
static void
} else {
ev_window_set_sizing_mode (ev_window, EV_SIZING_FREE);
}
+ update_action_sensitivity (ev_window);
}
static void
g_return_if_fail (EV_IS_WINDOW (ev_window));
ev_window_set_sizing_mode (ev_window, EV_SIZING_FREE);
-
ev_view_zoom_in (EV_VIEW (ev_window->priv->view));
+ update_action_sensitivity (ev_window);
}
static void
g_return_if_fail (EV_IS_WINDOW (ev_window));
ev_window_set_sizing_mode (ev_window, EV_SIZING_FREE);
-
ev_view_zoom_out (EV_VIEW (ev_window->priv->view));
+ update_action_sensitivity (ev_window);
}
static void
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
- ev_view_set_size (EV_VIEW (ev_window->priv->view), -1, -1);
+ ev_view_zoom_normal (EV_VIEW (ev_window->priv->view));
+ update_action_sensitivity (ev_window);
}
static void