evince r3264 - in trunk: . libdocument



Author: carlosgc
Date: Sat Nov 15 10:08:26 2008
New Revision: 3264
URL: http://svn.gnome.org/viewvc/evince?rev=3264&view=rev

Log:
2008-11-15  Carlos Garcia Campos  <carlosgc gnome org>

	* libdocument/Makefile.am:
	* libdocument/ev-document-layers.[ch]:
	* libdocument/ev-layer.[ch]:

	Add optional content (layers) interface.

Added:
   trunk/libdocument/ev-document-layers.c
   trunk/libdocument/ev-document-layers.h
   trunk/libdocument/ev-layer.c
   trunk/libdocument/ev-layer.h
Modified:
   trunk/ChangeLog
   trunk/libdocument/Makefile.am

Modified: trunk/libdocument/Makefile.am
==============================================================================
--- trunk/libdocument/Makefile.am	(original)
+++ trunk/libdocument/Makefile.am	Sat Nov 15 10:08:26 2008
@@ -27,6 +27,7 @@
 	ev-document.h				\
 	ev-document-images.h			\
 	ev-document-info.h			\
+	ev-document-layers.h			\
 	ev-document-links.h			\
 	ev-document-misc.h			\
 	ev-document-security.h			\
@@ -36,6 +37,7 @@
 	ev-file-helpers.h			\
 	ev-form-field.h				\
 	ev-image.h				\
+	ev-layer.h				\
 	ev-link-action.h			\
 	ev-link-dest.h				\
 	ev-link.h				\
@@ -52,6 +54,7 @@
 	ev-attachment.c				\
 	ev-backends-manager.c			\
 	ev-backend-marshal.c			\
+	ev-layer.c				\
 	ev-link.c				\
 	ev-link-action.c			\
 	ev-link-dest.c				\
@@ -60,6 +63,7 @@
 	ev-document-factory.c			\
 	ev-document-thumbnails.c		\
 	ev-document-fonts.c                     \
+	ev-document-layers.c			\
 	ev-document-links.c			\
 	ev-document-images.c			\
 	ev-document-security.c			\

Added: trunk/libdocument/ev-document-layers.c
==============================================================================
--- (empty file)
+++ trunk/libdocument/ev-document-layers.c	Sat Nov 15 10:08:26 2008
@@ -0,0 +1,86 @@
+/* ev-document-layers.c
+ *  this file is part of evince, a gnome document_links viewer
+ * 
+ * Copyright (C) 2008 Carlos Garcia Campos  <carlosgc gnome org>
+ *
+ * Evince 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 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince 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-layers.h"
+
+GType
+ev_document_layers_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		const GTypeInfo our_info = {
+			sizeof (EvDocumentLayersIface),
+			NULL,
+			NULL,
+		};
+
+		type = g_type_register_static (G_TYPE_INTERFACE,
+					       "EvDocumentLayers",
+					       &our_info, (GTypeFlags)0);
+	}
+
+	return type;
+}
+
+gboolean
+ev_document_layers_has_layers (EvDocumentLayers *document_layers)
+{
+	EvDocumentLayersIface *iface = EV_DOCUMENT_LAYERS_GET_IFACE (document_layers);
+
+	return iface->has_layers (document_layers);
+}
+
+GtkTreeModel *
+ev_document_layers_get_layers (EvDocumentLayers *document_layers)
+{
+	EvDocumentLayersIface *iface = EV_DOCUMENT_LAYERS_GET_IFACE (document_layers);
+
+	return iface->get_layers (document_layers);
+}
+
+void
+ev_document_layers_show_layer (EvDocumentLayers *document_layers,
+			       EvLayer          *layer)
+{
+	EvDocumentLayersIface *iface = EV_DOCUMENT_LAYERS_GET_IFACE (document_layers);
+
+	iface->show_layer (document_layers, layer);
+}
+
+void
+ev_document_layers_hide_layer (EvDocumentLayers *document_layers,
+			       EvLayer          *layer)
+{
+	EvDocumentLayersIface *iface = EV_DOCUMENT_LAYERS_GET_IFACE (document_layers);
+
+	iface->hide_layer (document_layers, layer);
+}
+
+gboolean
+ev_document_layers_layer_is_visible (EvDocumentLayers *document_layers,
+				     EvLayer          *layer)
+{
+	EvDocumentLayersIface *iface = EV_DOCUMENT_LAYERS_GET_IFACE (document_layers);
+
+	return iface->layer_is_visible (document_layers, layer);
+}

Added: trunk/libdocument/ev-document-layers.h
==============================================================================
--- (empty file)
+++ trunk/libdocument/ev-document-layers.h	Sat Nov 15 10:08:26 2008
@@ -0,0 +1,81 @@
+/* ev-document-layers.h
+ *  this file is part of evince, a gnome document viewer
+ * 
+ * Copyright (C) 2008 Carlos Garcia Campos  <carlosgc gnome org>
+ *
+ * Evince 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 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince 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_LAYERS_H
+#define EV_DOCUMENT_LAYERS_H
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "ev-layer.h"
+
+G_BEGIN_DECLS
+
+#define EV_TYPE_DOCUMENT_LAYERS		   (ev_document_layers_get_type ())
+#define EV_DOCUMENT_LAYERS(o)		   (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT_LAYERS, EvDocumentLayers))
+#define EV_DOCUMENT_LAYERS_IFACE(k)	   (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT_LAYERS, EvDocumentLayersIface))
+#define EV_IS_DOCUMENT_LAYERS(o)	   (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT_LAYERS))
+#define EV_IS_DOCUMENT_LAYERS_IFACE(k)	   (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT_LAYERS))
+#define EV_DOCUMENT_LAYERS_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT_LAYERS, EvDocumentLayersIface))
+
+typedef struct _EvDocumentLayers      EvDocumentLayers;
+typedef struct _EvDocumentLayersIface EvDocumentLayersIface;
+
+enum {
+	EV_DOCUMENT_LAYERS_COLUMN_TITLE,
+	EV_DOCUMENT_LAYERS_COLUMN_LAYER,
+	EV_DOCUMENT_LAYERS_COLUMN_VISIBLE,
+	EV_DOCUMENT_LAYERS_COLUMN_ENABLED,
+	EV_DOCUMENT_LAYERS_COLUMN_SHOWTOGGLE,
+	EV_DOCUMENT_LAYERS_COLUMN_RBGROUP,
+	EV_DOCUMENT_LAYERS_N_COLUMNS
+};
+
+struct _EvDocumentLayersIface
+{
+	GTypeInterface base_iface;
+
+	/* Methods  */
+	gboolean      (* has_layers)       (EvDocumentLayers *document_layers);
+	GtkTreeModel *(* get_layers)       (EvDocumentLayers *document_layers);
+
+	void          (* show_layer)       (EvDocumentLayers *document_layers,
+					    EvLayer          *layer);
+	void          (* hide_layer)       (EvDocumentLayers *document_layers,
+					    EvLayer          *layer);
+	gboolean      (* layer_is_visible) (EvDocumentLayers *document_layers,
+					    EvLayer          *layer);
+};
+
+GType         ev_document_layers_get_type         (void) G_GNUC_CONST;
+
+gboolean      ev_document_layers_has_layers       (EvDocumentLayers *document_layers);
+GtkTreeModel *ev_document_layers_get_layers       (EvDocumentLayers *document_layers);
+void          ev_document_layers_show_layer       (EvDocumentLayers *document_layers,
+						   EvLayer          *layer);
+void          ev_document_layers_hide_layer       (EvDocumentLayers *document_layers,
+						   EvLayer          *layer);
+gboolean      ev_document_layers_layer_is_visible (EvDocumentLayers *document_layers,
+						   EvLayer          *layer);
+
+G_END_DECLS
+
+#endif /* EV_DOCUMENT_LAYERS_H */

Added: trunk/libdocument/ev-layer.c
==============================================================================
--- (empty file)
+++ trunk/libdocument/ev-layer.c	Sat Nov 15 10:08:26 2008
@@ -0,0 +1,86 @@
+/* this file is part of evince, a gnome document viewer
+ *
+ * Copyright (C) 2008 Carlos Garcia Campos <carlosgc gnome org>
+ *
+ * Evince 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 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince 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-layer.h"
+
+struct _EvLayerPrivate {
+	guint      id;
+	gboolean   is_parent;
+	gint       rb_group;
+};
+
+#define EV_LAYER_GET_PRIVATE(object) \
+                (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_LAYER, EvLayerPrivate))
+
+G_DEFINE_TYPE (EvLayer, ev_layer, G_TYPE_OBJECT)
+
+static void
+ev_layer_class_init (EvLayerClass *klass)
+{
+	GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
+
+	g_type_class_add_private (g_object_class, sizeof (EvLayerPrivate));
+}
+
+static void
+ev_layer_init (EvLayer *layer)
+{
+	layer->priv = EV_LAYER_GET_PRIVATE (layer);
+}
+
+EvLayer *
+ev_layer_new (guint    layer_id,
+	      gboolean is_parent,
+	      gint     rb_group)
+{
+	EvLayer *layer;
+
+	layer = EV_LAYER (g_object_new (EV_TYPE_LAYER, NULL));
+	layer->priv->id = layer_id;
+	layer->priv->is_parent = is_parent;
+	layer->priv->rb_group = rb_group;
+
+	return layer;
+}
+
+guint
+ev_layer_get_id (EvLayer *layer)
+{
+	g_return_val_if_fail (EV_IS_LAYER (layer), 0);
+
+	return layer->priv->id;
+}
+
+gboolean
+ev_layer_is_parent (EvLayer *layer)
+{
+	g_return_val_if_fail (EV_IS_LAYER (layer), FALSE);
+
+	return layer->priv->is_parent;
+}
+
+gint
+ev_layer_get_rb_group (EvLayer *layer)
+{
+	g_return_val_if_fail (EV_IS_LAYER (layer), 0);
+
+	return layer->priv->rb_group;
+}

Added: trunk/libdocument/ev-layer.h
==============================================================================
--- (empty file)
+++ trunk/libdocument/ev-layer.h	Sat Nov 15 10:08:26 2008
@@ -0,0 +1,58 @@
+/* this file is part of evince, a gnome document viewer
+ *
+ * Copyright (C) 2008 Carlos Garcia Campos <carlosgc gnome org>
+ *
+ * Evince 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 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince 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_LAYER_H__
+#define __EV_LAYER_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+typedef struct _EvLayer        EvLayer;
+typedef struct _EvLayerClass   EvLayerClass;
+typedef struct _EvLayerPrivate EvLayerPrivate;
+
+#define EV_TYPE_LAYER              (ev_layer_get_type())
+#define EV_LAYER(object)           (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_LAYER, EvLayer))
+#define EV_LAYER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_LAYER, EvLayerClass))
+#define EV_IS_LAYER(object)        (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_LAYER))
+#define EV_IS_LAYER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_LAYER))
+#define EV_LAYER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_LAYER, EvLayerClass))
+
+struct _EvLayer {
+	GObject base_instance;
+	
+	EvLayerPrivate *priv;
+};
+
+struct _EvLayerClass {
+	GObjectClass base_class;
+};
+
+GType     ev_layer_get_type     (void) G_GNUC_CONST;
+EvLayer  *ev_layer_new          (guint    layer_id,
+				 gboolean is_parent,
+				 gint     rb_group);
+guint     ev_layer_get_id       (EvLayer *layer);
+gboolean  ev_layer_is_parent    (EvLayer *layer);
+gint      ev_layer_get_rb_group (EvLayer *layer);
+
+G_END_DECLS
+
+#endif /* __EV_LAYER_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]