Commit 9a1a3b31 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

Redo rotation (again). prepare for 0.4.0

Thu Aug 25 02:32:32 2005  Jonathan Blandford  <jrb@redhat.com>

        * backend/ev-document-misc.c:
        (ev_document_misc_get_thumbnail_frame):
        * backend/ev-document-misc.h:
        * configure.ac:
        * pdf/ev-poppler.cc:
        * shell/Makefile.am:
        * shell/ev-sidebar-thumbnails.c: (add_range),
        (ev_sidebar_thumbnails_set_loading_icon),
        (ev_sidebar_thumbnails_refresh),
        (ev_sidebar_thumbnails_set_document):
        * shell/ev-sidebar-thumbnails.h:
        * shell/ev-view.c: (ev_view_motion_notify_event),
        (ev_view_set_property), (ev_view_get_property),
        (ev_view_class_init), (ev_view_set_rotation):
        * shell/ev-window.c: (ev_window_cmd_edit_rotate_left),
        (ev_window_cmd_edit_rotate_right), (ev_window_rotation_changed_cb),
        (ev_window_init):
        * tiff/tiff-document.c: (tiff_document_thumbnails_get_thumbnail):
        Redo rotation (again).  prepare for 0.4.0
parent ebe3e0a8
Thu Aug 25 02:32:32 2005 Jonathan Blandford <jrb@redhat.com>
* backend/ev-document-misc.c:
(ev_document_misc_get_thumbnail_frame):
* backend/ev-document-misc.h:
* configure.ac:
* pdf/ev-poppler.cc:
* shell/Makefile.am:
* shell/ev-sidebar-thumbnails.c: (add_range),
(ev_sidebar_thumbnails_set_loading_icon),
(ev_sidebar_thumbnails_refresh),
(ev_sidebar_thumbnails_set_document):
* shell/ev-sidebar-thumbnails.h:
* shell/ev-view.c: (ev_view_motion_notify_event),
(ev_view_set_property), (ev_view_get_property),
(ev_view_class_init), (ev_view_set_rotation):
* shell/ev-window.c: (ev_window_cmd_edit_rotate_left),
(ev_window_cmd_edit_rotate_right), (ev_window_rotation_changed_cb),
(ev_window_init):
* tiff/tiff-document.c: (tiff_document_thumbnails_get_thumbnail):
Redo rotation (again). prepare for 0.4.0
2005-08-24 Kristian Høgsberg <krh@redhat.com>
* configure.ac: Bump poppler requirement to 0.4.1.
......
......@@ -12,54 +12,69 @@
GdkPixbuf *
ev_document_misc_get_thumbnail_frame (int width,
int height,
int rotation,
GdkPixbuf *source_pixbuf)
{
GdkPixbuf *retval;
guchar *data;
gint rowstride;
int i;
int width_r, height_r;
rotation = rotation % 360;
if (source_pixbuf)
g_return_val_if_fail (GDK_IS_PIXBUF (source_pixbuf), NULL);
if (source_pixbuf) {
width = gdk_pixbuf_get_width (source_pixbuf);
height = gdk_pixbuf_get_height (source_pixbuf);
width_r = gdk_pixbuf_get_width (source_pixbuf);
height_r = gdk_pixbuf_get_height (source_pixbuf);
} else {
if (rotation == 0 || rotation == 180) {
width_r = width;
height_r = height;
} else if (rotation == 90 || rotation == 270) {
width_r = height;
height_r = width;
} else {
g_assert_not_reached ();
}
}
/* make sure no one is passing us garbage */
g_assert (width >= 0 && height >= 0);
g_assert (width_r >= 0 && height_r >= 0);
retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
TRUE, 8,
width + 4,
height + 4);
width_r + 4,
height_r + 4);
/* make it black and fill in the middle */
data = gdk_pixbuf_get_pixels (retval);
rowstride = gdk_pixbuf_get_rowstride (retval);
gdk_pixbuf_fill (retval, 0x000000ff);
for (i = 1; i < height + 1; i++)
memset (data + (rowstride * i) + 4, 0xffffffff, width * 4);
for (i = 1; i < height_r + 1; i++)
memset (data + (rowstride * i) + 4, 0xffffffff, width_r * 4);
/* copy the source pixbuf */
if (source_pixbuf)
gdk_pixbuf_copy_area (source_pixbuf, 0, 0,
width,
height,
width_r,
height_r,
retval,
1, 1);
/* Add the corner */
data [(width + 2) * 4 + 3] = 0;
data [(width + 3) * 4 + 3] = 0;
data [(width + 2) * 4 + (rowstride * 1) + 3] = 0;
data [(width + 3) * 4 + (rowstride * 1) + 3] = 0;
data [(height + 2) * rowstride + 3] = 0;
data [(height + 3) * rowstride + 3] = 0;
data [(height + 2) * rowstride + 4 + 3] = 0;
data [(height + 3) * rowstride + 4 + 3] = 0;
data [(width_r + 2) * 4 + 3] = 0;
data [(width_r + 3) * 4 + 3] = 0;
data [(width_r + 2) * 4 + (rowstride * 1) + 3] = 0;
data [(width_r + 3) * 4 + (rowstride * 1) + 3] = 0;
data [(height_r + 2) * rowstride + 3] = 0;
data [(height_r + 3) * rowstride + 3] = 0;
data [(height_r + 2) * rowstride + 4 + 3] = 0;
data [(height_r + 3) * rowstride + 4 + 3] = 0;
return retval;
}
......
......@@ -31,6 +31,7 @@ G_BEGIN_DECLS
GdkPixbuf *ev_document_misc_get_thumbnail_frame (int width,
int height,
int rotation,
GdkPixbuf *source_pixbuf);
void ev_document_misc_get_page_border_size (gint page_width,
gint page_height,
......
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_INIT(evince, 0.3.4)
AC_INIT(evince, 0.4.0)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
......
Thu Aug 25 02:32:54 2005 Jonathan Blandford <jrb@redhat.com>
* Makefile.am:
* sr/sr.po: Remove uk.po from the help pages as I can't get it to
validate.
2005-08-18 Maxim Dziumanenko <mvd@mylinux.ua>
* uk.po: Added Ukrainian translation.
......
......@@ -6,4 +6,4 @@ DOC_ENTITIES = legal.xml
DOC_INCLUDES =
DOC_FIGURES = figures/evince_start_window.png
DOC_LINGUAS = el es sr uk
DOC_LINGUAS = el es sr
This diff is collapsed.
......@@ -809,12 +809,22 @@ make_thumbnail_for_size (PdfDocument *pdf_document,
scale = width / unscaled_width;
if (border) {
pixbuf = ev_document_misc_get_thumbnail_frame (width, height, NULL);
pixbuf = ev_document_misc_get_thumbnail_frame (width, height, rotation, NULL);
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
sub_pixbuf = gdk_pixbuf_new_subpixbuf (pixbuf,
1, 1,
width - 1, height - 1);
} else {
/* rotate */
if (rotation == 90 || rotation == 270) {
int temp;
temp = width;
width = height;
height = temp;
}
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
width, height);
gdk_pixbuf_fill (pixbuf, 0xffffffff);
......@@ -856,7 +866,7 @@ pdf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document_thumbnails
if (border) {
GdkPixbuf *real_pixbuf;
real_pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, pixbuf);
real_pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, rotation, pixbuf);
g_object_unref (pixbuf);
pixbuf = real_pixbuf;
}
......
......@@ -93,6 +93,9 @@ ev-marshal.c: ev-marshal.list
echo '#include "ev-marshal.h"' > ev-marshal.c
glib-genmarshal --prefix=ev_marshal ev-marshal.list --body >> ev-marshal.c
DISTCLEANFILES= \
ev-application-service.h
if DBUS_TOOL_NO_PREFIX
ev-application-service.h: $(srcdir)/ev-application-service.xml
dbus-binding-tool --mode=glib-server --output=ev-application-service.h $(srcdir)/ev-application-service.xml
......
......@@ -57,6 +57,8 @@ struct _EvSidebarThumbnailsPrivate {
gint n_pages, pages_done;
int rotation;
/* Visible pages */
gint start_page, end_page;
};
......@@ -230,7 +232,7 @@ add_range (EvSidebarThumbnails *sidebar_thumbnails,
if (job == NULL && !thumbnail_set) {
/* FIXME: Need rotation */
job = (EvJobThumbnail *)ev_job_thumbnail_new (priv->document, page, 0, THUMBNAIL_WIDTH);
job = (EvJobThumbnail *)ev_job_thumbnail_new (priv->document, page, priv->rotation, THUMBNAIL_WIDTH);
ev_job_queue_add_job (EV_JOB (job), EV_JOB_PRIORITY_HIGH);
g_object_set_data_full (G_OBJECT (job), "tree_iter",
gtk_tree_iter_copy (&iter),
......@@ -355,11 +357,47 @@ ev_sidebar_thumbnails_fill_model (EvSidebarThumbnails *sidebar_thumbnails)
}
}
static void
ev_sidebar_thumbnails_set_loading_icon (EvSidebarThumbnails *sidebar_thumbnails)
{
gint width = THUMBNAIL_WIDTH;
gint height = THUMBNAIL_WIDTH;
if (sidebar_thumbnails->priv->loading_icon)
g_object_unref (sidebar_thumbnails->priv->loading_icon);
if (sidebar_thumbnails->priv->document) {
/* We get the dimensions of the first doc so that we can make a blank
* icon. */
ev_document_doc_mutex_lock ();
ev_document_thumbnails_get_dimensions (EV_DOCUMENT_THUMBNAILS (sidebar_thumbnails->priv->document),
0, THUMBNAIL_WIDTH, &width, &height);
ev_document_doc_mutex_unlock ();
sidebar_thumbnails->priv->loading_icon =
ev_document_misc_get_thumbnail_frame (width, height, sidebar_thumbnails->priv->rotation, NULL);
} else {
sidebar_thumbnails->priv->loading_icon = NULL;
}
}
void
ev_sidebar_thumbnails_refresh (EvSidebarThumbnails *sidebar_thumbnails)
ev_sidebar_thumbnails_refresh (EvSidebarThumbnails *sidebar_thumbnails,
int rotation)
{
sidebar_thumbnails->priv->rotation = rotation;
ev_sidebar_thumbnails_set_loading_icon (sidebar_thumbnails);
if (sidebar_thumbnails->priv->document == NULL)
return;
ev_sidebar_thumbnails_clear_model (sidebar_thumbnails);
ev_sidebar_thumbnails_fill_model (sidebar_thumbnails);
/* Trigger a redraw */
sidebar_thumbnails->priv->start_page = 0;
sidebar_thumbnails->priv->end_page = 0;
adjustment_changed_cb (sidebar_thumbnails);
}
......@@ -545,8 +583,6 @@ ev_sidebar_thumbnails_set_document (EvSidebarPage *sidebar_page,
EvDocument *document)
{
EvSidebarThumbnails *sidebar_thumbnails = EV_SIDEBAR_THUMBNAILS (sidebar_page);
gint width = THUMBNAIL_WIDTH;
gint height = THUMBNAIL_WIDTH;
EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv;
......@@ -556,16 +592,7 @@ ev_sidebar_thumbnails_set_document (EvSidebarPage *sidebar_page,
priv->document = document;
priv->n_pages = ev_page_cache_get_n_pages (priv->page_cache);
/* We get the dimensions of the first doc so that we can make a blank
* icon. */
ev_document_doc_mutex_lock ();
ev_document_thumbnails_get_dimensions (EV_DOCUMENT_THUMBNAILS (priv->document),
0, THUMBNAIL_WIDTH, &width, &height);
ev_document_doc_mutex_unlock ();
if (priv->loading_icon)
g_object_unref (priv->loading_icon);
priv->loading_icon = ev_document_misc_get_thumbnail_frame (width, height, NULL);
ev_sidebar_thumbnails_set_loading_icon (sidebar_thumbnails);
ev_sidebar_thumbnails_clear_model (sidebar_thumbnails);
ev_sidebar_thumbnails_fill_model (sidebar_thumbnails);
......@@ -595,6 +622,8 @@ ev_sidebar_thumbnails_set_document (EvSidebarPage *sidebar_page,
/* Connect to the signal and trigger a fake callback */
g_signal_connect (priv->page_cache, "page-changed", G_CALLBACK (page_changed_cb), sidebar_thumbnails);
sidebar_thumbnails->priv->start_page = 0;
sidebar_thumbnails->priv->end_page = 0;
adjustment_changed_cb (sidebar_thumbnails);
}
......
......@@ -53,7 +53,8 @@ struct _EvSidebarThumbnailsClass {
GType ev_sidebar_thumbnails_get_type (void);
GtkWidget *ev_sidebar_thumbnails_new (void);
void ev_sidebar_thumbnails_refresh (EvSidebarThumbnails *sidebar_thumbnails);
void ev_sidebar_thumbnails_refresh (EvSidebarThumbnails *sidebar_thumbnails,
int rotation);
G_END_DECLS
......
......@@ -53,6 +53,7 @@ enum {
PROP_PRESENTATION,
PROP_SIZING_MODE,
PROP_ZOOM,
PROP_ROTATION,
};
enum {
......@@ -1465,7 +1466,11 @@ ev_view_motion_notify_event (GtkWidget *widget,
if (!view->document)
return FALSE;
if (view->pressed_button == 1) {
/* For the Evince 0.4.x release, we limit selection to un-rotated
* documents only.
*/
if (view->pressed_button == 1 &&
view->rotation == 0) {
view->selection_info.in_selection = TRUE;
view->motion_x = event->x + view->scroll_x;
view->motion_y = event->y + view->scroll_y;
......@@ -1515,7 +1520,11 @@ ev_view_motion_notify_event (GtkWidget *widget,
return TRUE;
}
} else if (view->pressed_button <= 0) {
/* For the Evince 0.4.x release, we limit links to un-rotated documents
* only.
*/
} else if (view->pressed_button <= 0 &&
view->rotation == 0) {
EvLink *link;
link = get_link_at_location (view, event->x + view->scroll_x, event->y + view->scroll_y);
......@@ -1856,6 +1865,9 @@ ev_view_set_property (GObject *object,
case PROP_ZOOM:
ev_view_set_zoom (view, g_value_get_double (value), FALSE);
break;
case PROP_ROTATION:
ev_view_set_rotation (view, g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
......@@ -1895,6 +1907,9 @@ ev_view_get_property (GObject *object,
case PROP_ZOOM:
g_value_set_double (value, view->scale);
break;
case PROP_ROTATION:
g_value_set_int (value, view->rotation);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
......@@ -2023,6 +2038,15 @@ ev_view_class_init (EvViewClass *class)
MAX_SCALE,
1.0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_ROTATION,
g_param_spec_double ("rotation",
"Rotation",
"Rotation",
0,
360,
0,
G_PARAM_READWRITE));
binding_set = gtk_binding_set_by_class (class);
......@@ -2432,6 +2456,8 @@ ev_view_set_rotation (EvView *view, int rotation)
ev_pixbuf_cache_clear (view->pixbuf_cache);
gtk_widget_queue_resize (GTK_WIDGET (view));
}
g_object_notify (G_OBJECT (view), "rotation");
}
int
......
......@@ -2060,35 +2060,16 @@ ev_window_cmd_edit_toolbar_cb (GtkDialog *dialog, gint response, gpointer data)
gtk_widget_destroy (GTK_WIDGET (dialog));
}
/* should these be hooked up to properties?? */
static void
save_rotation_to_file (EvWindow *window)
{
int rotation;
if (window->priv->uri) {
rotation = ev_view_get_rotation (EV_VIEW (window->priv->view));
ev_metadata_manager_set_int (window->priv->uri, "rotation",
rotation);
}
}
static void
ev_window_cmd_edit_rotate_left (GtkAction *action, EvWindow *ev_window)
{
ev_view_rotate_left (EV_VIEW (ev_window->priv->view));
ev_sidebar_thumbnails_refresh (EV_SIDEBAR_THUMBNAILS (ev_window->priv->sidebar_thumbs));
save_rotation_to_file (ev_window);
}
static void
ev_window_cmd_edit_rotate_right (GtkAction *action, EvWindow *ev_window)
{
ev_view_rotate_right (EV_VIEW (ev_window->priv->view));
ev_sidebar_thumbnails_refresh (EV_SIDEBAR_THUMBNAILS (ev_window->priv->sidebar_thumbs));
save_rotation_to_file (ev_window);
}
static void
......@@ -2420,6 +2401,22 @@ ev_window_continuous_changed_cb (EvView *view, GParamSpec *pspec, EvWindow *ev_w
ev_view_get_continuous (EV_VIEW (ev_window->priv->view)));
}
static void
ev_window_rotation_changed_cb (EvView *view, GParamSpec *pspec, EvWindow *window)
{
int rotation;
rotation = ev_view_get_rotation (EV_VIEW (window->priv->view));
if (window->priv->uri) {
ev_metadata_manager_set_int (window->priv->uri, "rotation",
rotation);
}
ev_sidebar_thumbnails_refresh (EV_SIDEBAR_THUMBNAILS (window->priv->sidebar_thumbs),
rotation);
}
static void
ev_window_dual_mode_changed_cb (EvView *view, GParamSpec *pspec, EvWindow *ev_window)
{
......@@ -3513,6 +3510,10 @@ ev_window_init (EvWindow *ev_window)
"notify::continuous",
G_CALLBACK (ev_window_continuous_changed_cb),
ev_window);
g_signal_connect (ev_window->priv->view,
"notify::rotation",
G_CALLBACK (ev_window_rotation_changed_cb),
ev_window);
ev_window->priv->statusbar = ev_statusbar_new ();
gtk_box_pack_end (GTK_BOX (ev_window->priv->main_box),
......
......@@ -332,7 +332,7 @@ tiff_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
if (border)
{
GdkPixbuf *tmp_pixbuf = pixbuf;
pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, tmp_pixbuf);
pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, 0, tmp_pixbuf);
g_object_unref (tmp_pixbuf);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment