Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2005-04-24 05:16:30 (GMT)
committer Jonathan Blandford <jrb@src.gnome.org>2005-04-24 05:16:30 (GMT)
commitd90349e5e8acdb07bb56e22fd7923206465ae47b (patch)
treeab1baf9496d82b20d3fc27edf6dff422755a3d66
parent70c085a3aa91a8f3b76f1b579c40e470599e9b1a (diff)
Fix links for dual/continuous. Also, add a quick fix measuring of widths.
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.
-rw-r--r--ChangeLog13
-rw-r--r--backend/ev-link.c1
-rw-r--r--shell/ev-view.c82
-rw-r--r--shell/ev-view.h4
-rw-r--r--shell/ev-window.c12
5 files changed, 58 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index e6924dd..056c2d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+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),
diff --git a/backend/ev-link.c b/backend/ev-link.c
index 7e26a58..48ffca5 100644
--- a/backend/ev-link.c
+++ b/backend/ev-link.c
@@ -346,6 +346,7 @@ ev_link_mapping_find (GList *link_mapping,
int i;
i = 0;
+
for (list = link_mapping; list; list = list->next) {
EvLinkMapping *mapping = list->data;
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 07a71ea..8a3dd26 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -1001,16 +1001,6 @@ ev_view_copy (EvView *ev_view)
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,
@@ -1200,24 +1190,34 @@ find_page_at_location (EvView *view,
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 *
@@ -1225,17 +1225,21 @@ get_link_at_location (EvView *view,
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;
}
@@ -1684,19 +1688,6 @@ ev_view_class_init (EvViewClass *class)
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)
{
@@ -2164,10 +2155,10 @@ ev_view_zoom_for_size_continuous_and_dual_page (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)
@@ -2202,10 +2193,13 @@ ev_view_zoom_for_size_continuous (EvView *view,
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 ();
diff --git a/shell/ev-view.h b/shell/ev-view.h
index 3c4fdbb..b87d345 100644
--- a/shell/ev-view.h
+++ b/shell/ev-view.h
@@ -82,10 +82,6 @@ void ev_view_zoom_normal (EvView *view);
void ev_view_set_size (EvView *view,
int width,
int height);
-void ev_view_set_spacing (EvView *view,
- int spacing);
-void ev_view_set_show_border (EvView *view,
- gboolean show_border);
/* Find */
gboolean ev_view_can_find_next (EvView *view);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 8b54d27..b7b172d 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -135,7 +135,6 @@ static const GtkTargetEntry ev_drop_types[] = {
#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,
@@ -1378,8 +1377,9 @@ ev_window_unfullscreen (EvWindow *window)
(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);
}
@@ -1400,8 +1400,9 @@ ev_window_cmd_view_fullscreen (GtkAction *action, EvWindow *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
@@ -2470,7 +2471,6 @@ ev_window_init (EvWindow *ev_window)
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",