]> www.fi.muni.cz Git - evince.git/commitdiff
Add optional content (layers) interface.
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 15 Nov 2008 10:08:26 +0000 (10:08 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Sat, 15 Nov 2008 10:08:26 +0000 (10:08 +0000)
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.

svn path=/trunk/; revision=3264

ChangeLog
libdocument/Makefile.am
libdocument/ev-document-layers.c [new file with mode: 0644]
libdocument/ev-document-layers.h [new file with mode: 0644]
libdocument/ev-layer.c [new file with mode: 0644]
libdocument/ev-layer.h [new file with mode: 0644]

index 01ab939885f44a29acc66d67b1584ce4aa7abfdc..dc0d9c208c2aede4c7b45423284e9885ec277661 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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.
+       
 2008-11-12  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * cut-n-paste/toolbar-editor/eggtreemultidnd.c:
index c1a900a975cafb49c876740dc9e8c55cdfa10809..3f32f1aa67594bb0e973a2042e301ebbdd937543 100644 (file)
@@ -27,6 +27,7 @@ INST_H_FILES =                                        \
        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 @@ INST_H_FILES =                                        \
        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 @@ libevbackend_la_SOURCES=                      \
        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 @@ libevbackend_la_SOURCES=                      \
        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                  \
diff --git a/libdocument/ev-document-layers.c b/libdocument/ev-document-layers.c
new file mode 100644 (file)
index 0000000..f203565
--- /dev/null
@@ -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);
+}
diff --git a/libdocument/ev-document-layers.h b/libdocument/ev-document-layers.h
new file mode 100644 (file)
index 0000000..506808b
--- /dev/null
@@ -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 */
diff --git a/libdocument/ev-layer.c b/libdocument/ev-layer.c
new file mode 100644 (file)
index 0000000..40a3c85
--- /dev/null
@@ -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;
+}
diff --git a/libdocument/ev-layer.h b/libdocument/ev-layer.h
new file mode 100644 (file)
index 0000000..86fc403
--- /dev/null
@@ -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__ */