+2005-05-22 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
+
+ * cut-n-paste/zoom-control/ephy-zoom.c:
+ (ephy_zoom_get_changed_zoom_level):
+ * cut-n-paste/zoom-control/ephy-zoom.h:
+ * shell/ev-view.c: (ev_view_scroll_event), (ev_view_set_property),
+ (ev_view_get_property), (ev_view_class_init), (ev_view_set_zoom):
+ * shell/ev-window.c: (ev_window_cmd_view_zoom_in),
+ (ev_window_cmd_view_zoom_out), (ev_window_zoom_changed_cb),
+ (zoom_control_changed_cb), (ev_window_init):
+
+ Fix minor points related to moving best fit up. Introduce
+ "zoom" property and make zoom control change it's value on
+ notify::zoom signals. Fix for 305080.
+
2005-05-22 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
* data/evince-ui.xml:
guint index;
index = ephy_zoom_get_zoom_level_index (level);
- return zoom_levels[CLAMP(index + steps, 0, n_zoom_levels - 1)].level;
+ return zoom_levels[CLAMP(index + steps, 3, n_zoom_levels - 1)].level;
}
float ephy_zoom_get_nearest_zoom_level (float level)
static const guint n_zoom_levels = G_N_ELEMENTS (zoom_levels);
#define ZOOM_MINIMAL (EPHY_ZOOM_SEPARATOR)
-#define ZOOM_MAXIMAL (zoom_levels[n_zoom_levels - 4].level)
+#define ZOOM_MAXIMAL (zoom_levels[n_zoom_levels - 1].level)
#define ZOOM_IN (-1.0)
#define ZOOM_OUT (-2.0)
PROP_FULLSCREEN,
PROP_PRESENTATION,
PROP_SIZING_MODE,
+ PROP_ZOOM,
};
enum {
#define ZOOM_OUT_FACTOR (1.0/ZOOM_IN_FACTOR)
#define MIN_SCALE 0.05409
-#define MAX_SCALE 6.0
+#define MAX_SCALE 4.0
typedef struct {
EvRectangle rect;
ev_view_set_sizing_mode (view, EV_SIZING_FREE);
- if ((event->direction == GDK_SCROLL_UP ||
- event->direction == GDK_SCROLL_LEFT) &&
- ev_view_can_zoom_in (view)) {
- ev_view_zoom_in (view);
- } else if (ev_view_can_zoom_out (view)) {
- ev_view_zoom_out (view);
- }
-
+ if (event->direction == GDK_SCROLL_UP ||
+ event->direction == GDK_SCROLL_LEFT) {
+ if (ev_view_can_zoom_in (view)) {
+ ev_view_zoom_in (view);
+ }
+ } else {
+ if (ev_view_can_zoom_out (view)) {
+ ev_view_zoom_out (view);
+ }
+ }
return TRUE;
}
case PROP_SIZING_MODE:
ev_view_set_sizing_mode (view, g_value_get_enum (value));
break;
+ case PROP_ZOOM:
+ ev_view_set_zoom (view, g_value_get_double (value), FALSE);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
case PROP_SIZING_MODE:
g_value_set_enum (value, view->sizing_mode);
break;
+ case PROP_ZOOM:
+ g_value_set_double (value, view->scale);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
EV_SIZING_FIT_WIDTH,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_ZOOM,
+ g_param_spec_double ("zoom",
+ "Zoom factor",
+ "Zoom factor",
+ MIN_SCALE,
+ MAX_SCALE,
+ 1.0,
+ G_PARAM_READWRITE));
+
binding_set = gtk_binding_set_by_class (class);
add_scroll_binding_keypad (binding_set, GDK_Left, GTK_SCROLL_STEP_BACKWARD, TRUE);
if (ABS (view->scale - scale) < EPSILON)
return;
+
view->scale = scale;
view->pending_resize = TRUE;
-
+
gtk_widget_queue_resize (GTK_WIDGET (view));
+
+ g_object_notify (G_OBJECT (view), "zoom");
}
double
static void ev_window_sizing_mode_changed_cb (EvView *view,
GParamSpec *pspec,
EvWindow *ev_window);
+static void ev_window_zoom_changed_cb (EvView *view,
+ GParamSpec *pspec,
+ EvWindow *ev_window);
static void ev_window_add_recent (EvWindow *window,
const char *filename);
static void ev_window_fullscreen (EvWindow *window);
ev_view_set_sizing_mode (EV_VIEW (ev_window->priv->view), EV_SIZING_FREE);
ev_view_zoom_in (EV_VIEW (ev_window->priv->view));
- update_action_sensitivity (ev_window);
}
static void
ev_view_set_sizing_mode (EV_VIEW (ev_window->priv->view), EV_SIZING_FREE);
ev_view_zoom_out (EV_VIEW (ev_window->priv->view));
- update_action_sensitivity (ev_window);
}
static void
update_sizing_buttons (ev_window);
}
+static void
+ev_window_zoom_changed_cb (EvView *view, GParamSpec *pspec,
+ EvWindow *ev_window)
+{
+ update_action_sensitivity (ev_window);
+}
+
static char *
build_comments_string (void)
{
}
ev_view_set_sizing_mode (EV_VIEW (ev_window->priv->view), mode);
- update_action_sensitivity (ev_window);
}
static void
"notify::sizing-mode",
G_CALLBACK (ev_window_sizing_mode_changed_cb),
ev_window);
+ g_signal_connect (ev_window->priv->view,
+ "notify::zoom",
+ G_CALLBACK (ev_window_zoom_changed_cb),
+ ev_window);
ev_window->priv->statusbar = gtk_statusbar_new ();
gtk_box_pack_end (GTK_BOX (ev_window->priv->main_box),