]> www.fi.muni.cz Git - evince.git/commitdiff
Fix minor points related to moving best fit up. Introduce
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sun, 22 May 2005 15:09:31 +0000 (15:09 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sun, 22 May 2005 15:09:31 +0000 (15:09 +0000)
"zoom" property and make zoom control change it's value on
notify::zoom signals. Fix for 305080.

ChangeLog
cut-n-paste/zoom-control/ephy-zoom.c
cut-n-paste/zoom-control/ephy-zoom.h
shell/ev-view.c
shell/ev-window.c

index 7a2df4d682709264ebb2986ec9710c4886bef8e0..69bc2721cbba8581c2445e9ca207332d7ecef652 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+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:
index ee91784622a8ef886d00700762d1a1bcd651fdd6..34e25ec566b283473c6a175e742bcc36273da027 100644 (file)
@@ -59,7 +59,7 @@ ephy_zoom_get_changed_zoom_level (float level, gint steps)
        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)
index 5632b4ff8f0545758c586496e957b0467415cd30..e8fb52ad2f8ff0e3640cd7f6e2e984b5929e03e9 100644 (file)
@@ -61,7 +61,7 @@ zoom_levels[] =
 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)
 
index ef0ddf48b8f739f5ab3426f003cdb01fd4a1a88a..9f66d8acba3b8ff9219ff7934072a454169899f9 100644 (file)
@@ -49,6 +49,7 @@ enum {
        PROP_FULLSCREEN,
        PROP_PRESENTATION,
        PROP_SIZING_MODE,
+       PROP_ZOOM,
 };
 
 enum {
@@ -86,7 +87,7 @@ typedef 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;
@@ -1303,14 +1304,16 @@ ev_view_scroll_event (GtkWidget *widget, GdkEventScroll *event)
 
                 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;
        }
        
@@ -1712,6 +1715,9 @@ ev_view_set_property (GObject      *object,
        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);
        }
@@ -1748,6 +1754,9 @@ ev_view_get_property (GObject *object,
        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);
        }
@@ -1863,6 +1872,16 @@ ev_view_class_init (EvViewClass *class)
                                                            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);
@@ -2008,10 +2027,13 @@ ev_view_set_zoom (EvView   *view,
 
        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
index 761599e1db4e2033bba0d9d8e548b97d7647eea9..4671e4edbd0d122e0b421b0f906450acf8795975 100644 (file)
@@ -158,6 +158,9 @@ static gboolean start_loading_document                  (EvWindow         *ev_wi
 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);
@@ -1726,7 +1729,6 @@ ev_window_cmd_view_zoom_in (GtkAction *action, EvWindow *ev_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
@@ -1736,7 +1738,6 @@ ev_window_cmd_view_zoom_out (GtkAction *action, EvWindow *ev_window)
 
        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
@@ -1923,6 +1924,13 @@ ev_window_sizing_mode_changed_cb (EvView *view, GParamSpec *pspec,
        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)
 {
@@ -2233,7 +2241,6 @@ zoom_control_changed_cb (EphyZoomAction *action,
        }
        
        ev_view_set_sizing_mode (EV_VIEW (ev_window->priv->view), mode);
-       update_action_sensitivity (ev_window);
 }
 
 static void
@@ -2881,6 +2888,10 @@ ev_window_init (EvWindow *ev_window)
                          "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),