+Sun Apr 24 01:07:27 2005 Jonathan Blandford <jrb@redhat.com>
+
+ * shell/ev-view.c: (find_page_at_location),
+ (get_link_at_location),
+ (ev_view_set_show_border), (ev_view_set_spacing),
+ (ev_view_zoom_for_size_continuous_and_dual_page),
+ (ev_view_zoom_for_size_continuous): Fix links for dual/continuous.
+ Also, add a quick fix measuring of widths. Also, removed
+ ev_view_set_spacing and ev_view_set_show_border.
+
+ * shell/ev-window.c: (ev_window_unfullscreen),
+ (ev_window_cmd_view_fullscreen): Don't adjust the border/spacing.
+
2005-04-24 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
* shell/ev-view.c: (view_update_range_and_current_page),
g_free (text);
}
-void
-ev_view_set_show_border (EvView *view, gboolean show_border)
-{
- g_return_if_fail (EV_IS_VIEW (view));
-
- view->show_border = show_border;
-
- gtk_widget_queue_resize (GTK_WIDGET (view));
-}
-
static void
ev_view_primary_get_cb (GtkClipboard *clipboard,
GtkSelectionData *selection_data,
gint *x_offset,
gint *y_offset)
{
- gint width, height;
+ int i;
- ev_page_cache_get_size (view->page_cache,
- view->current_page,
- view->scale,
- &width, &height);
+ if (view->document == NULL)
+ return;
- x -= (view->border.left + view->spacing);
- y -= (view->border.top + view->spacing);
+ g_assert (page);
+ g_assert (x_offset);
+ g_assert (y_offset);
- if ((x < 0) || (y < 0) ||
- (x >= width) || (y >= height)) {
- *page = -1;
- return;
+ for (i = view->start_page; i <= view->end_page; i++) {
+ GdkRectangle page_area;
+ GtkBorder border;
+
+ if (! get_page_extents (view, i, &page_area, &border))
+ continue;
+
+ if ((x >= page_area.x + border.left) &&
+ (x < page_area.x + page_area.width - border.right) &&
+ (y >= page_area.y + border.top) &&
+ (y < page_area.y + page_area.height - border.bottom)) {
+ *page = i;
+ *x_offset = x - (page_area.x + border.left);
+ *y_offset = y - (page_area.y + border.top);
+ return;
+ }
}
- *page = view->current_page;
- *x_offset = (gint) x;
- *y_offset = (gint) y;
+
+ *page = -1;
}
static EvLink *
gdouble x,
gdouble y)
{
- gint page;
- gint x_offset, y_offset;
+ gint page = -1;
+ gint x_offset = 0, y_offset = 0;
GList *link_mapping;
find_page_at_location (view, x, y, &page, &x_offset, &y_offset);
+
if (page == -1)
return NULL;
link_mapping = ev_pixbuf_cache_get_link_mapping (view->pixbuf_cache, page);
- return ev_link_mapping_find (link_mapping, x_offset /view->scale, y_offset /view->scale);
+ if (link_mapping)
+ return ev_link_mapping_find (link_mapping, x_offset / view->scale, y_offset / view->scale);
+ else
+ return NULL;
}
add_scroll_binding_shifted (binding_set, GDK_BackSpace, EV_SCROLL_PAGE_BACKWARD, EV_SCROLL_PAGE_FORWARD, FALSE);
}
-void
-ev_view_set_spacing (EvView *view,
- int spacing)
-{
- g_return_if_fail (EV_IS_VIEW (view));
-
- view->spacing = spacing;
-
- if (view->document) {
- gtk_widget_queue_resize (GTK_WIDGET (view));
- }
-}
-
static void
ev_view_init (EvView *view)
{
compute_border (view, doc_width, doc_height, &border);
doc_width = doc_width * 2;
- width -= ((border.left + border.right)* 2 + 3 * view->spacing);
+ width -= (2 * (border.left + border.right) + 3 * view->spacing);
height -= (border.top + border.bottom + 2 * view->spacing);
- /* FIXME: We really need to calculat the overall height here, not the
+ /* FIXME: We really need to calculate the overall height here, not the
* page height. We assume there's always a vertical scrollbar for
* now. We need to fix this. */
if (view->sizing_mode == EV_SIZING_FIT_WIDTH)
width -= (border.left + border.right + 2 * view->spacing);
height -= (border.top + border.bottom + 2 * view->spacing);
+ /* FIXME: We really need to calculate the overall height here, not the
+ * page height. We assume there's always a vertical scrollbar for
+ * now. We need to fix this. */
if (view->sizing_mode == EV_SIZING_FIT_WIDTH)
- scale = zoom_for_size_fit_width (doc_width, doc_height, width, height, vsb_width);
+ scale = zoom_for_size_fit_width (doc_width, doc_height, width - vsb_width, height, 0);
else if (view->sizing_mode == EV_SIZING_BEST_FIT)
- scale = zoom_for_size_best_fit (doc_width, doc_height, width, height, vsb_width, hsb_height);
+ scale = zoom_for_size_best_fit (doc_width, doc_height, width - vsb_width, height, 0, hsb_height);
else
g_assert_not_reached ();
#define GCONF_SIDEBAR_SIZE "/apps/evince/sidebar_size"
#define SIDEBAR_DEFAULT_SIZE 132
-#define VIEW_SPACING 10
static void ev_window_update_fullscreen_popup (EvWindow *window);
static void ev_window_sidebar_visibility_changed_cb (EvSidebar *ev_sidebar, GParamSpec *pspec,
(gpointer) fullscreen_motion_notify_cb,
window);
- ev_view_set_show_border (view, TRUE);
- ev_view_set_spacing (view, VIEW_SPACING);
+ g_object_set (G_OBJECT (view),
+ "full-screen", FALSE,
+ NULL);
update_chrome_visibility (window);
}
gtk_window_unfullscreen (GTK_WINDOW (window));
}
- ev_view_set_show_border (view, FALSE);
- ev_view_set_spacing (view, 0);
+ g_object_set (G_OBJECT (view),
+ "full-screen", TRUE,
+ NULL);
}
static gboolean
ev_window->priv->scrolled_window);
ev_window->priv->view = ev_view_new ();
- ev_view_set_spacing (EV_VIEW (ev_window->priv->view), VIEW_SPACING);
ev_window->priv->password_view = ev_password_view_new ();
g_signal_connect_swapped (ev_window->priv->password_view,
"unlock",