From ca0836cb912f3b88834cae97774079314727c6e2 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Wed, 22 Dec 2004 20:54:22 +0000 Subject: Add thumbnail support. 2004-12-22 Anders Carlsson * backend/Makefile.am: * backend/ev-document-thumbnails.c: (ev_document_thumbnails_get_type), (ev_document_thumbnails_get_thumbnail): * backend/ev-document-thumbnails.h: * pixbuf/pixbuf-document.c: (G_DEFINE_TYPE_WITH_CODE), (pixbuf_document_thumbnails_get_thumbnail), (pixbuf_document_document_thumbnails_iface_init): * shell/Makefile.am: * shell/ev-sidebar-thumbnails.c: (ev_sidebar_thumbnails_destroy), (ev_sidebar_thumbnails_class_init), (ev_sidebar_thumbnails_init), (populate_thumbnails), (ev_sidebar_thumbnails_set_document): * shell/ev-sidebar-thumbnails.h: * shell/ev-sidebar.c: (ev_sidebar_init), (ev_sidebar_add_page), (ev_sidebar_set_document): * shell/ev-utils.c: (gaussian), (create_blur_filter), (create_shadow), (ev_pixbuf_add_shadow): * shell/ev-utils.h: Add thumbnail support. --- (limited to 'backend') diff --git a/backend/Makefile.am b/backend/Makefile.am index 4450297..2f54157 100644 --- a/backend/Makefile.am +++ b/backend/Makefile.am @@ -13,6 +13,8 @@ libevbackend_la_SOURCES= \ ev-backend-marshal.c \ ev-document.c \ ev-document.h \ + ev-document-thumbnails.c \ + ev-document-thumbnails.h \ ev-document-bookmarks.c \ ev-document-bookmarks.h \ $(NULL) diff --git a/backend/ev-document-thumbnails.c b/backend/ev-document-thumbnails.c new file mode 100644 index 0000000..e9c53ab --- /dev/null +++ b/backend/ev-document-thumbnails.c @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */ +/* + * Copyright (C) 2004 Anders Carlsson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" + +#include "ev-document-thumbnails.h" + +GType +ev_document_thumbnails_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) + { + static const GTypeInfo our_info = + { + sizeof (EvDocumentThumbnailsIface), + NULL, + NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, + "EvDocumentThumbnails", + &our_info, (GTypeFlags)0); + } + + return type; +} + +GdkPixbuf * +ev_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, + gint page, + gint width) +{ + EvDocumentThumbnailsIface *iface = EV_DOCUMENT_THUMBNAILS_GET_IFACE (document); + + return iface->get_thumbnail (document, page, width); +} diff --git a/backend/ev-document-thumbnails.h b/backend/ev-document-thumbnails.h new file mode 100644 index 0000000..fdc1e80 --- /dev/null +++ b/backend/ev-document-thumbnails.h @@ -0,0 +1,56 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */ +/* + * Copyright (C) 2004 Anders Carlsson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef EV_DOCUMENT_THUMBNAILS_H +#define EV_DOCUMENT_THUMBNAILS_H + +#include + +G_BEGIN_DECLS + +#define EV_TYPE_DOCUMENT_THUMBNAILS (ev_document_thumbnails_get_type ()) +#define EV_DOCUMENT_THUMBNAILS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT_THUMBNAILS, EvDocumentThumbnails)) +#define EV_DOCUMENT_THUMBNAILS_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT_THUMBNAILS, EvDocumentThumbnailsIface)) +#define EV_IS_DOCUMENT_THUMBNAILS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT_THUMBNAILS)) +#define EV_IS_DOCUMENT_THUMBNAILS_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT_THUMBNAILS)) +#define EV_DOCUMENT_THUMBNAILS_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT_THUMBNAILS, EvDocumentThumbnailsIface)) + +typedef struct _EvDocumentThumbnails EvDocumentThumbnails; +typedef struct _EvDocumentThumbnailsIface EvDocumentThumbnailsIface; + +struct _EvDocumentThumbnailsIface +{ + GTypeInterface base_iface; + + /* Methods */ + GdkPixbuf * (* get_thumbnail) (EvDocumentThumbnails *document, + gint page, + gint width); +}; + +GType ev_document_thumbnails_get_type (void); + +GdkPixbuf *ev_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, + gint page, + gint width); + +G_END_DECLS + +#endif -- cgit v0.9.1