Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2005-05-29 07:27:23 (GMT)
committer Jonathan Blandford <jrb@src.gnome.org>2005-05-29 07:27:23 (GMT)
commit8e94fdff19bd0fec3d8932ec750b7386fc1c151b (patch)
treeec87cd61f0403bd6ad4e3895d81c42e683f8cd1e /shell
parent560a7e43fe1f899e72130cb4ab1175d325f8e43c (diff)
modify the expose handling to get the shadows.
Sat May 28 07:38:03 2005 Jonathan Blandford <jrb@redhat.com> * shell/ev-view.c (draw_one_page): modify the expose handling to get the shadows. * shell/ev-window.c (update_action_sensitivity): Respect permissions field. Kowtow to the man. * pdf/ev-poppler.cc: Get the permissions field. * tiff/*c: Make a tiny bit more robust.
Diffstat (limited to 'shell')
-rw-r--r--shell/Makefile.am1
-rw-r--r--shell/ev-pixbuf-cache.c2
-rw-r--r--shell/ev-view.c62
-rw-r--r--shell/ev-window.c23
4 files changed, 49 insertions, 39 deletions
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 3e1c2b7..bd104e8 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -96,6 +96,7 @@ evince_LDADD= \
$(top_builddir)/cut-n-paste/zoom-control/libephywidgets.la \
$(top_builddir)/cut-n-paste/toolbar-editor/libtoolbareditor.la \
$(top_builddir)/lib/libev.la \
+ -ltiff -lz \
libevbackendfactory.la \
$(NULL)
diff --git a/shell/ev-pixbuf-cache.c b/shell/ev-pixbuf-cache.c
index b5227ee..083825a 100644
--- a/shell/ev-pixbuf-cache.c
+++ b/shell/ev-pixbuf-cache.c
@@ -73,7 +73,7 @@ ev_pixbuf_cache_init (EvPixbufCache *pixbuf_cache)
pixbuf_cache->end_page = 0;
pixbuf_cache->job_list = g_new0 (CacheJobInfo, PAGE_CACHE_LEN (pixbuf_cache));
- pixbuf_cache->preload_cache_size = 1;
+ pixbuf_cache->preload_cache_size = 2;
pixbuf_cache->prev_job = g_new0 (CacheJobInfo, pixbuf_cache->preload_cache_size);
pixbuf_cache->next_job = g_new0 (CacheJobInfo, pixbuf_cache->preload_cache_size);
}
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 9f66d8a..3eea568 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -900,8 +900,8 @@ get_page_extents (EvView *view,
y = view->spacing;
/* Adjust for extra allocation */
- x = x + MAX (0, widget->allocation.width - (width + view->spacing * 2))/2;
- y = y + MAX (0, widget->allocation.height - (height + view->spacing * 2))/2;
+ x = x + MAX (0, widget->allocation.width - (width + border->left + border->right + view->spacing * 2))/2;
+ y = y + MAX (0, widget->allocation.height - (height + border->top + border->bottom + view->spacing * 2))/2;
}
page_area->x = x;
@@ -1607,11 +1607,12 @@ draw_one_page (EvView *view,
GdkRectangle real_page_area;
g_assert (view->document);
+ if (! gdk_rectangle_intersect (page_area, expose_area, &overlap))
+ return;
ev_page_cache_get_size (view->page_cache,
page, view->scale,
&width, &height);
-
/* Render the document itself */
real_page_area = *page_area;
@@ -1620,38 +1621,37 @@ draw_one_page (EvView *view,
real_page_area.width -= (border->left + border->right);
real_page_area.height -= (border->top + border->bottom);
- if (! gdk_rectangle_intersect (&real_page_area, expose_area, &overlap))
- return;
-
ev_document_misc_paint_one_page (GTK_WIDGET(view)->window,
GTK_WIDGET (view),
page_area, border);
- current_pixbuf = ev_pixbuf_cache_get_pixbuf (view->pixbuf_cache, page);
+ if (gdk_rectangle_intersect (&real_page_area, expose_area, &overlap)) {
+ current_pixbuf = ev_pixbuf_cache_get_pixbuf (view->pixbuf_cache, page);
- if (current_pixbuf == NULL)
- scaled_image = NULL;
- else if (width == gdk_pixbuf_get_width (current_pixbuf) &&
- height == gdk_pixbuf_get_height (current_pixbuf))
- scaled_image = g_object_ref (current_pixbuf);
- else
- /* FIXME: We don't want to scale the whole area, just the right
- * area of it */
- scaled_image = gdk_pixbuf_scale_simple (current_pixbuf,
- width, height,
- GDK_INTERP_NEAREST);
-
- if (scaled_image) {
- gdk_draw_pixbuf (GTK_WIDGET(view)->window,
- GTK_WIDGET (view)->style->fg_gc[GTK_STATE_NORMAL],
- scaled_image,
- overlap.x - real_page_area.x,
- overlap.y - real_page_area.y,
- overlap.x, overlap.y,
- overlap.width, overlap.height,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
- g_object_unref (scaled_image);
+ if (current_pixbuf == NULL)
+ scaled_image = NULL;
+ else if (width == gdk_pixbuf_get_width (current_pixbuf) &&
+ height == gdk_pixbuf_get_height (current_pixbuf))
+ scaled_image = g_object_ref (current_pixbuf);
+ else
+ /* FIXME: We don't want to scale the whole area, just the right
+ * area of it */
+ scaled_image = gdk_pixbuf_scale_simple (current_pixbuf,
+ width, height,
+ GDK_INTERP_NEAREST);
+
+ if (scaled_image) {
+ gdk_draw_pixbuf (GTK_WIDGET(view)->window,
+ GTK_WIDGET (view)->style->fg_gc[GTK_STATE_NORMAL],
+ scaled_image,
+ overlap.x - real_page_area.x,
+ overlap.y - real_page_area.y,
+ overlap.x, overlap.y,
+ overlap.width, overlap.height,
+ GDK_RGB_DITHER_NORMAL,
+ 0, 0);
+ g_object_unref (scaled_image);
+ }
}
}
@@ -1895,7 +1895,7 @@ ev_view_init (EvView *view)
{
GTK_WIDGET_SET_FLAGS (view, GTK_CAN_FOCUS);
- view->spacing = 10;
+ view->spacing = 5;
view->scale = 1.0;
view->current_page = 0;
view->pressed_button = -1;
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 4671e4e..c5cfac6 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -190,12 +190,17 @@ update_action_sensitivity (EvWindow *ev_window)
{
EvView *view;
EvDocument *document;
+ const EvDocumentInfo *info = NULL;
EvWindowPageMode page_mode;
gboolean sensitive, has_pages = FALSE, has_document;
int n_pages = 0, page = -1;
+ gboolean ok_to_print = TRUE;
+ gboolean ok_to_copy = TRUE;
view = EV_VIEW (ev_window->priv->view);
document = ev_window->priv->document;
+ if (document)
+ info = ev_page_cache_get_info (ev_window->priv->page_cache);
page_mode = ev_window->priv->page_mode;
has_document = document != NULL;
if (has_document && ev_window->priv->page_cache) {
@@ -204,17 +209,22 @@ update_action_sensitivity (EvWindow *ev_window)
has_pages = has_document && n_pages > 0;
}
+ if (info && info->fields_mask & EV_DOCUMENT_INFO_PERMISSIONS) {
+ ok_to_print = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_PRINT);
+ ok_to_copy = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_COPY);
+ }
+
/* File menu */
/* "FileOpen": always sensitive */
- set_action_sensitive (ev_window, "FileSaveAs", has_document);
- set_action_sensitive (ev_window, "FilePrint", has_pages);
+ set_action_sensitive (ev_window, "FileSaveAs", has_document && ok_to_copy);
+ set_action_sensitive (ev_window, "FilePrint", has_pages && ok_to_print);
/* "FileCloseWindow": always sensitive */
/* Edit menu */
sensitive = has_pages && ev_document_can_get_text (document);
- set_action_sensitive (ev_window, "EditCopy", sensitive);
- set_action_sensitive (ev_window, "EditSelectAll", sensitive);
+ set_action_sensitive (ev_window, "EditCopy", sensitive && ok_to_copy);
+ set_action_sensitive (ev_window, "EditSelectAll", sensitive && ok_to_copy);
set_action_sensitive (ev_window, "EditFind",
has_pages && EV_IS_DOCUMENT_FIND (document));
set_action_sensitive (ev_window, "Slash",
@@ -581,7 +591,7 @@ update_document_mode (EvWindow *window, EvDocumentMode mode)
static void
ev_window_setup_document (EvWindow *ev_window)
{
- EvDocumentInfo *info;
+ const EvDocumentInfo *info;
EvDocument *document;
EvView *view = EV_VIEW (ev_window->priv->view);
EvSidebar *sidebar = EV_SIDEBAR (ev_window->priv->sidebar);
@@ -615,9 +625,8 @@ ev_window_setup_document (EvWindow *ev_window)
ev_page_action_set_document (EV_PAGE_ACTION (action), document);
update_action_sensitivity (ev_window);
- info = ev_document_get_info (document);
+ info = ev_page_cache_get_info (ev_window->priv->page_cache);
update_document_mode (ev_window, info->mode);
- ev_document_info_free (info);
}
static void