iface->find_text = djvu_document_find_find_text;
}
-static GList *
+static EvMappingList *
djvu_document_links_get_links (EvDocumentLinks *document_links,
EvPage *page)
{
#include "djvu-links.h"
#include "djvu-document-private.h"
#include "ev-document-links.h"
-#include "ev-mapping.h"
+#include "ev-mapping-list.h"
static gboolean number_from_miniexp(miniexp_t sexp, int *number)
{
return FALSE;
}
-GList *
+EvMappingList *
djvu_links_get_links (EvDocumentLinks *document_links,
gint page,
double scale_factor)
ddjvu_miniexp_release (djvu_document->d_document, page_annotations);
}
- return retval;
+ return ev_mapping_list_new (page, retval, (GDestroyNotify)g_object_unref);
}
EvLinkDest *
#include <glib.h>
-GtkTreeModel *djvu_links_get_links_model (EvDocumentLinks *document_links);
-GList *djvu_links_get_links (EvDocumentLinks *document_links,
- gint page,
- double scale_factor);
-EvLinkDest *djvu_links_find_link_dest (EvDocumentLinks *document_links,
- const gchar *link_name);
-gboolean djvu_links_has_document_links (EvDocumentLinks *document_links);
+GtkTreeModel *djvu_links_get_links_model (EvDocumentLinks *document_links);
+EvMappingList *djvu_links_get_links (EvDocumentLinks *document_links,
+ gint page,
+ double scale_factor);
+EvLinkDest *djvu_links_find_link_dest (EvDocumentLinks *document_links,
+ const gchar *link_name);
+gboolean djvu_links_has_document_links (EvDocumentLinks *document_links);
#endif /* __DJVU_LINK_H__ */
#include "ev-poppler.h"
#include "ev-file-exporter.h"
-#include "ev-mapping.h"
#include "ev-document-find.h"
#include "ev-document-misc.h"
#include "ev-document-links.h"
return model;
}
-static GList *
+static EvMappingList *
pdf_document_links_get_links (EvDocumentLinks *document_links,
EvPage *page)
{
poppler_page_free_link_mapping (mapping_list);
- return g_list_reverse (retval);
+ return ev_mapping_list_new (page->index, g_list_reverse (retval), (GDestroyNotify)g_object_unref);
}
static EvLinkDest *
iface->find_link_dest = pdf_document_links_find_link_dest;
}
-static GList *
+static EvMappingList *
pdf_document_images_get_image_mapping (EvDocumentImages *document_images,
EvPage *page)
{
poppler_page_free_image_mapping (mapping_list);
- return g_list_reverse (retval);
+ return ev_mapping_list_new (page->index, g_list_reverse (retval), (GDestroyNotify)g_object_unref);
}
GdkPixbuf *
return ev_field;
}
-static GList *
+static EvMappingList *
pdf_document_forms_get_form_fields (EvDocumentForms *document,
EvPage *page)
{
poppler_page_free_form_field_mapping (fields);
- return g_list_reverse (retval);
+ return retval ? ev_mapping_list_new (page->index,
+ g_list_reverse (retval),
+ (GDestroyNotify)g_object_unref) : NULL;
}
static gchar *
return ev_annot;
}
-static GList *
+static EvMappingList *
pdf_document_annotations_get_annotations (EvDocumentAnnotations *document_annotations,
EvPage *page)
{
poppler_page_free_annot_mapping (annots);
- return g_list_reverse (retval);
+ return ev_mapping_list_new (page->index, g_list_reverse (retval), (GDestroyNotify)g_object_unref);
}
static void
#include <libdocument/ev-link-action.h>
#include <libdocument/ev-link-dest.h>
#include <libdocument/ev-link.h>
+#include <libdocument/ev-mapping-list.h>
#include <libdocument/ev-page.h>
#include <libdocument/ev-render-context.h>
#include <libdocument/ev-selection.h>
ev-link-action.h \
ev-link-dest.h \
ev-link.h \
- ev-mapping.h \
+ ev-mapping-list.h \
ev-page.h \
ev-render-context.h \
ev-selection.h \
ev-debug.c \
ev-file-exporter.c \
ev-file-helpers.c \
- ev-mapping.c \
+ ev-mapping-list.c \
ev-module.c \
ev-page.c \
ev-render-context.c \
{
}
-GList *
+EvMappingList *
ev_document_annotations_get_annotations (EvDocumentAnnotations *document_annots,
EvPage *page)
{
#include "ev-document.h"
#include "ev-annotation.h"
+#include "ev-mapping-list.h"
G_BEGIN_DECLS
GTypeInterface base_iface;
/* Methods */
- GList *(* get_annotations) (EvDocumentAnnotations *document_annots,
- EvPage *page);
- void (* annotation_set_contents) (EvDocumentAnnotations *document_annots,
- EvAnnotation *annot,
- const gchar *contents);
+ EvMappingList *(* get_annotations) (EvDocumentAnnotations *document_annots,
+ EvPage *page);
+ void (* annotation_set_contents) (EvDocumentAnnotations *document_annots,
+ EvAnnotation *annot,
+ const gchar *contents);
};
-GType ev_document_annotations_get_type (void) G_GNUC_CONST;
-GList *ev_document_annotations_get_annotations (EvDocumentAnnotations *document_annots,
- EvPage *page);
+GType ev_document_annotations_get_type (void) G_GNUC_CONST;
+EvMappingList *ev_document_annotations_get_annotations (EvDocumentAnnotations *document_annots,
+ EvPage *page);
-void ev_document_annotations_annotation_set_contents (EvDocumentAnnotations *document_annots,
- EvAnnotation *annot,
- const gchar *contents);
+void ev_document_annotations_annotation_set_contents (EvDocumentAnnotations *document_annots,
+ EvAnnotation *annot,
+ const gchar *contents);
G_END_DECLS
{
}
-GList *
+EvMappingList *
ev_document_forms_get_form_fields (EvDocumentForms *document_forms,
EvPage *page)
{
#include "ev-document.h"
#include "ev-form-field.h"
+#include "ev-mapping-list.h"
G_BEGIN_DECLS
GTypeInterface base_iface;
/* Methods */
- GList *(* get_form_fields) (EvDocumentForms *document_forms,
- EvPage *page);
- gchar *(* form_field_text_get_text) (EvDocumentForms *document_forms,
- EvFormField *field);
- void (* form_field_text_set_text) (EvDocumentForms *document_forms,
- EvFormField *field,
- const gchar *text);
- gboolean (* form_field_button_get_state) (EvDocumentForms *document_forms,
- EvFormField *field);
- void (* form_field_button_set_state) (EvDocumentForms *document_forms,
- EvFormField *field,
- gboolean state);
- gchar *(* form_field_choice_get_item) (EvDocumentForms *document_forms,
- EvFormField *field,
- gint index);
- gint (* form_field_choice_get_n_items) (EvDocumentForms *document_forms,
- EvFormField *field);
- gboolean (* form_field_choice_is_item_selected) (EvDocumentForms *document_forms,
- EvFormField *field,
- gint index);
- void (* form_field_choice_select_item) (EvDocumentForms *document_forms,
- EvFormField *field,
- gint index);
- void (* form_field_choice_toggle_item) (EvDocumentForms *document_forms,
- EvFormField *field,
- gint index);
- void (* form_field_choice_unselect_all) (EvDocumentForms *document_forms,
- EvFormField *field);
- void (* form_field_choice_set_text) (EvDocumentForms *document_forms,
- EvFormField *field,
- const gchar *text);
- gchar *(* form_field_choice_get_text) (EvDocumentForms *document_forms,
- EvFormField *field);
+ EvMappingList *(* get_form_fields) (EvDocumentForms *document_forms,
+ EvPage *page);
+ gchar *(* form_field_text_get_text) (EvDocumentForms *document_forms,
+ EvFormField *field);
+ void (* form_field_text_set_text) (EvDocumentForms *document_forms,
+ EvFormField *field,
+ const gchar *text);
+ gboolean (* form_field_button_get_state) (EvDocumentForms *document_forms,
+ EvFormField *field);
+ void (* form_field_button_set_state) (EvDocumentForms *document_forms,
+ EvFormField *field,
+ gboolean state);
+ gchar *(* form_field_choice_get_item) (EvDocumentForms *document_forms,
+ EvFormField *field,
+ gint index);
+ gint (* form_field_choice_get_n_items) (EvDocumentForms *document_forms,
+ EvFormField *field);
+ gboolean (* form_field_choice_is_item_selected) (EvDocumentForms *document_forms,
+ EvFormField *field,
+ gint index);
+ void (* form_field_choice_select_item) (EvDocumentForms *document_forms,
+ EvFormField *field,
+ gint index);
+ void (* form_field_choice_toggle_item) (EvDocumentForms *document_forms,
+ EvFormField *field,
+ gint index);
+ void (* form_field_choice_unselect_all) (EvDocumentForms *document_forms,
+ EvFormField *field);
+ void (* form_field_choice_set_text) (EvDocumentForms *document_forms,
+ EvFormField *field,
+ const gchar *text);
+ gchar *(* form_field_choice_get_text) (EvDocumentForms *document_forms,
+ EvFormField *field);
};
-GType ev_document_forms_get_type (void) G_GNUC_CONST;
-GList *ev_document_forms_get_form_fields (EvDocumentForms *document_forms,
- EvPage *page);
+GType ev_document_forms_get_type (void) G_GNUC_CONST;
+EvMappingList *ev_document_forms_get_form_fields (EvDocumentForms *document_forms,
+ EvPage *page);
-gchar *ev_document_forms_form_field_text_get_text (EvDocumentForms *document_forms,
- EvFormField *field);
-void ev_document_forms_form_field_text_set_text (EvDocumentForms *document_forms,
- EvFormField *field,
- const gchar *text);
+gchar *ev_document_forms_form_field_text_get_text (EvDocumentForms *document_forms,
+ EvFormField *field);
+void ev_document_forms_form_field_text_set_text (EvDocumentForms *document_forms,
+ EvFormField *field,
+ const gchar *text);
-gboolean ev_document_forms_form_field_button_get_state (EvDocumentForms *document_forms,
- EvFormField *field);
-void ev_document_forms_form_field_button_set_state (EvDocumentForms *document_forms,
- EvFormField *field,
- gboolean state);
+gboolean ev_document_forms_form_field_button_get_state (EvDocumentForms *document_forms,
+ EvFormField *field);
+void ev_document_forms_form_field_button_set_state (EvDocumentForms *document_forms,
+ EvFormField *field,
+ gboolean state);
-gchar *ev_document_forms_form_field_choice_get_item (EvDocumentForms *document_forms,
- EvFormField *field,
- gint index);
-gint ev_document_forms_form_field_choice_get_n_items (EvDocumentForms *document_forms,
- EvFormField *field);
-gboolean ev_document_forms_form_field_choice_is_item_selected (EvDocumentForms *document_forms,
- EvFormField *field,
- gint index);
-void ev_document_forms_form_field_choice_select_item (EvDocumentForms *document_forms,
- EvFormField *field,
- gint index);
-void ev_document_forms_form_field_choice_toggle_item (EvDocumentForms *document_forms,
- EvFormField *field,
- gint index);
-void ev_document_forms_form_field_choice_unselect_all (EvDocumentForms *document_forms,
- EvFormField *field);
-void ev_document_forms_form_field_choice_set_text (EvDocumentForms *document_forms,
- EvFormField *field,
- const gchar *text);
-gchar *ev_document_forms_form_field_choice_get_text (EvDocumentForms *document_forms,
- EvFormField *field);
+gchar *ev_document_forms_form_field_choice_get_item (EvDocumentForms *document_forms,
+ EvFormField *field,
+ gint index);
+gint ev_document_forms_form_field_choice_get_n_items (EvDocumentForms *document_forms,
+ EvFormField *field);
+gboolean ev_document_forms_form_field_choice_is_item_selected (EvDocumentForms *document_forms,
+ EvFormField *field,
+ gint index);
+void ev_document_forms_form_field_choice_select_item (EvDocumentForms *document_forms,
+ EvFormField *field,
+ gint index);
+void ev_document_forms_form_field_choice_toggle_item (EvDocumentForms *document_forms,
+ EvFormField *field,
+ gint index);
+void ev_document_forms_form_field_choice_unselect_all (EvDocumentForms *document_forms,
+ EvFormField *field);
+void ev_document_forms_form_field_choice_set_text (EvDocumentForms *document_forms,
+ EvFormField *field,
+ const gchar *text);
+gchar *ev_document_forms_form_field_choice_get_text (EvDocumentForms *document_forms,
+ EvFormField *field);
G_END_DECLS
{
}
-GList *
+EvMappingList *
ev_document_images_get_image_mapping (EvDocumentImages *document_images,
EvPage *page)
{
#include "ev-document.h"
#include "ev-image.h"
+#include "ev-mapping-list.h"
G_BEGIN_DECLS
GTypeInterface base_iface;
/* Methods */
- GList *(* get_image_mapping) (EvDocumentImages *document_images,
- EvPage *page);
- GdkPixbuf *(* get_image) (EvDocumentImages *document_images,
- EvImage *image);
+ EvMappingList *(* get_image_mapping) (EvDocumentImages *document_images,
+ EvPage *page);
+ GdkPixbuf *(* get_image) (EvDocumentImages *document_images,
+ EvImage *image);
};
-GType ev_document_images_get_type (void) G_GNUC_CONST;
-GList *ev_document_images_get_image_mapping (EvDocumentImages *document_images,
- EvPage *page);
-GdkPixbuf *ev_document_images_get_image (EvDocumentImages *document_images,
- EvImage *image);
+GType ev_document_images_get_type (void) G_GNUC_CONST;
+EvMappingList *ev_document_images_get_image_mapping (EvDocumentImages *document_images,
+ EvPage *page);
+GdkPixbuf *ev_document_images_get_image (EvDocumentImages *document_images,
+ EvImage *image);
G_END_DECLS
return retval;
}
-GList *
+EvMappingList *
ev_document_links_get_links (EvDocumentLinks *document_links,
EvPage *page)
{
EvDocumentLinksInterface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links);
- GList *retval;
- retval = iface->get_links (document_links, page);
-
- return retval;
+ return iface->get_links (document_links, page);
}
EvLinkDest *
#include "ev-document.h"
#include "ev-link.h"
+#include "ev-mapping-list.h"
G_BEGIN_DECLS
GTypeInterface base_iface;
/* Methods */
- gboolean (* has_document_links) (EvDocumentLinks *document_links);
- GtkTreeModel *(* get_links_model) (EvDocumentLinks *document_links);
- GList *(* get_links) (EvDocumentLinks *document_links,
- EvPage *page);
- EvLinkDest *(* find_link_dest) (EvDocumentLinks *document_links,
- const gchar *link_name);
+ gboolean (* has_document_links) (EvDocumentLinks *document_links);
+ GtkTreeModel *(* get_links_model) (EvDocumentLinks *document_links);
+ EvMappingList *(* get_links) (EvDocumentLinks *document_links,
+ EvPage *page);
+ EvLinkDest *(* find_link_dest) (EvDocumentLinks *document_links,
+ const gchar *link_name);
};
-GType ev_document_links_get_type (void);
-gboolean ev_document_links_has_document_links (EvDocumentLinks *document_links);
-GtkTreeModel *ev_document_links_get_links_model (EvDocumentLinks *document_links);
+GType ev_document_links_get_type (void) G_GNUC_CONST;
+gboolean ev_document_links_has_document_links (EvDocumentLinks *document_links);
+GtkTreeModel *ev_document_links_get_links_model (EvDocumentLinks *document_links);
-GList *ev_document_links_get_links (EvDocumentLinks *document_links,
- EvPage *page);
-EvLinkDest *ev_document_links_find_link_dest (EvDocumentLinks *document_links,
- const gchar *link_name);
-gint ev_document_links_get_dest_page (EvDocumentLinks *document_links,
- EvLinkDest *dest);
-gchar *ev_document_links_get_dest_page_label(EvDocumentLinks *document_links,
- EvLinkDest *dest);
+EvMappingList *ev_document_links_get_links (EvDocumentLinks *document_links,
+ EvPage *page);
+EvLinkDest *ev_document_links_find_link_dest (EvDocumentLinks *document_links,
+ const gchar *link_name);
+gint ev_document_links_get_dest_page (EvDocumentLinks *document_links,
+ EvLinkDest *dest);
+gchar *ev_document_links_get_dest_page_label (EvDocumentLinks *document_links,
+ EvLinkDest *dest);
G_END_DECLS
--- /dev/null
+/* ev-mapping.c
+ * this file is part of evince, a gnome document viewer
+ *
+ * Copyright (C) 2009 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "ev-mapping-list.h"
+
+struct _EvMappingList {
+ guint page;
+ GList *list;
+ GDestroyNotify data_destroy_func;
+ volatile gint ref_count;
+};
+
+EvMapping *
+ev_mapping_list_find (EvMappingList *mapping_list,
+ gconstpointer data)
+{
+ GList *list;
+
+ for (list = mapping_list->list; list; list = list->next) {
+ EvMapping *mapping = list->data;
+
+ if (mapping->data == data)
+ return mapping;
+ }
+
+ return NULL;
+}
+
+EvMapping *
+ev_mapping_list_find_custom (EvMappingList *mapping_list,
+ gconstpointer data,
+ GCompareFunc func)
+{
+ GList *list;
+
+ for (list = mapping_list->list; list; list = list->next) {
+ EvMapping *mapping = list->data;
+
+ if (!func (mapping->data, data))
+ return mapping;
+ }
+
+ return NULL;
+}
+
+gpointer
+ev_mapping_list_get_data (EvMappingList *mapping_list,
+ gdouble x,
+ gdouble y)
+{
+ GList *list;
+
+ for (list = mapping_list->list; list; list = list->next) {
+ EvMapping *mapping = list->data;
+
+ if ((x >= mapping->area.x1) &&
+ (y >= mapping->area.y1) &&
+ (x <= mapping->area.x2) &&
+ (y <= mapping->area.y2)) {
+ return mapping->data;
+ }
+ }
+
+ return NULL;
+}
+
+GList *
+ev_mapping_list_get_list (EvMappingList *mapping_list)
+{
+ return mapping_list ? mapping_list->list : NULL;
+}
+
+guint
+ev_mapping_list_get_page (EvMappingList *mapping_list)
+{
+ return mapping_list->page;
+}
+
+EvMappingList *
+ev_mapping_list_new (guint page,
+ GList *list,
+ GDestroyNotify data_destroy_func)
+{
+ EvMappingList *mapping_list;
+
+ g_return_val_if_fail (data_destroy_func != NULL, NULL);
+
+ mapping_list = g_slice_new (EvMappingList);
+ mapping_list->page = page;
+ mapping_list->list = list;
+ mapping_list->data_destroy_func = data_destroy_func;
+ mapping_list->ref_count = 1;
+
+ return mapping_list;
+}
+
+EvMappingList *
+ev_mapping_list_ref (EvMappingList *mapping_list)
+{
+ g_return_val_if_fail (mapping_list != NULL, NULL);
+ g_return_val_if_fail (mapping_list->ref_count > 0, mapping_list);
+
+ g_atomic_int_add (&mapping_list->ref_count, 1);
+
+ return mapping_list;
+}
+
+static void
+mapping_list_free_foreach (EvMapping *mapping,
+ GDestroyNotify destroy_func)
+{
+ destroy_func (mapping->data);
+ g_free (mapping);
+}
+
+void
+ev_mapping_list_unref (EvMappingList *mapping_list)
+{
+ g_return_if_fail (mapping_list != NULL);
+ g_return_if_fail (mapping_list->ref_count > 0);
+
+ if (g_atomic_int_exchange_and_add (&mapping_list->ref_count, -1) - 1 == 0) {
+ g_list_foreach (mapping_list->list,
+ (GFunc)mapping_list_free_foreach,
+ mapping_list->data_destroy_func);
+ g_list_free (mapping_list->list);
+ g_slice_free (EvMappingList, mapping_list);
+ }
+}
#error "Only <evince-document.h> can be included directly."
#endif
-#ifndef EV_MAPPING_H
-#define EV_MAPPING_H
+#ifndef EV_MAPPING_LIST_H
+#define EV_MAPPING_LIST_H
#include "ev-document.h"
G_BEGIN_DECLS
-EvMapping *ev_mapping_list_find (GList *mapping_list,
- gconstpointer data);
-EvMapping *ev_mapping_list_find_custom (GList *mapping_list,
- gconstpointer data,
- GCompareFunc func);
-gpointer ev_mapping_list_get_data (GList *mapping_list,
- gdouble x,
- gdouble y);
-void ev_mapping_list_free (GList *mapping_list,
- GDestroyNotify destroy_func);
+typedef struct _EvMappingList EvMappingList;
+
+EvMappingList *ev_mapping_list_new (guint page,
+ GList *list,
+ GDestroyNotify data_destroy_func);
+EvMappingList *ev_mapping_list_ref (EvMappingList *mapping_list);
+void ev_mapping_list_unref (EvMappingList *mapping_list);
+
+guint ev_mapping_list_get_page (EvMappingList *mapping_list);
+GList *ev_mapping_list_get_list (EvMappingList *mapping_list);
+EvMapping *ev_mapping_list_find (EvMappingList *mapping_list,
+ gconstpointer data);
+EvMapping *ev_mapping_list_find_custom (EvMappingList *mapping_list,
+ gconstpointer data,
+ GCompareFunc func);
+gpointer ev_mapping_list_get_data (EvMappingList *mapping_list,
+ gdouble x,
+ gdouble y);
G_END_DECLS
-#endif /* EV_MAPPING_H */
+#endif /* EV_MAPPING_LIST_H */
+++ /dev/null
-/* ev-mapping.c
- * this file is part of evince, a gnome document viewer
- *
- * Copyright (C) 2009 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "ev-mapping.h"
-
-EvMapping *
-ev_mapping_list_find (GList *mapping_list,
- gconstpointer data)
-{
- GList *list;
-
- for (list = mapping_list; list; list = list->next) {
- EvMapping *mapping = list->data;
-
- if (mapping->data == data)
- return mapping;
- }
-
- return NULL;
-}
-
-EvMapping *
-ev_mapping_list_find_custom (GList *mapping_list,
- gconstpointer data,
- GCompareFunc func)
-{
- GList *list;
-
- for (list = mapping_list; list; list = list->next) {
- EvMapping *mapping = list->data;
-
- if (!func (mapping->data, data))
- return mapping;
- }
-
- return NULL;
-}
-
-gpointer
-ev_mapping_list_get_data (GList *mapping_list,
- gdouble x,
- gdouble y)
-{
- GList *list;
-
- for (list = mapping_list; list; list = list->next) {
- EvMapping *mapping = list->data;
-
- if ((x >= mapping->area.x1) &&
- (y >= mapping->area.y1) &&
- (x <= mapping->area.x2) &&
- (y <= mapping->area.y2)) {
- return mapping->data;
- }
- }
-
- return NULL;
-}
-
-static void
-mapping_list_free_foreach (EvMapping *mapping,
- GDestroyNotify destroy_func)
-{
- destroy_func (mapping->data);
- g_free (mapping);
-}
-
-void
-ev_mapping_list_free (GList *mapping_list,
- GDestroyNotify destroy_func)
-{
- g_list_foreach (mapping_list,
- (GFunc)mapping_list_free_foreach,
- destroy_func);
- g_list_free (mapping_list);
-}
gint page;
EvJobPageDataFlags flags;
- GList *link_mapping;
- GList *image_mapping;
- GList *form_field_mapping;
- GList *annot_mapping;
+ EvMappingList *link_mapping;
+ EvMappingList *image_mapping;
+ EvMappingList *form_field_mapping;
+ EvMappingList *annot_mapping;
cairo_region_t *text_mapping;
gchar *text;
EvRectangle *text_layout;
#include <glib.h>
#include "ev-jobs.h"
#include "ev-job-scheduler.h"
-#include "ev-mapping.h"
+#include "ev-mapping-list.h"
#include "ev-selection.h"
#include "ev-document-links.h"
#include "ev-document-forms.h"
EvJob *job;
gboolean done : 1;
- GList *link_mapping;
- GList *image_mapping;
- GList *form_field_mapping;
- GList *annot_mapping;
+ EvMappingList *link_mapping;
+ EvMappingList *image_mapping;
+ EvMappingList *form_field_mapping;
+ EvMappingList *annot_mapping;
cairo_region_t *text_mapping;
EvRectangle *text_layout;
guint text_layout_length;
}
if (data->link_mapping) {
- ev_mapping_list_free (data->link_mapping, g_object_unref);
+ ev_mapping_list_unref (data->link_mapping);
data->link_mapping = NULL;
}
if (data->image_mapping) {
- ev_mapping_list_free (data->image_mapping, g_object_unref);
+ ev_mapping_list_unref (data->image_mapping);
data->image_mapping = NULL;
}
if (data->form_field_mapping) {
- ev_mapping_list_free (data->form_field_mapping, g_object_unref);
+ ev_mapping_list_unref (data->form_field_mapping);
data->form_field_mapping = NULL;
}
if (data->annot_mapping) {
- ev_mapping_list_free (data->annot_mapping, g_object_unref);
+ ev_mapping_list_unref (data->annot_mapping);
data->annot_mapping = NULL;
}
cache->flags = flags;
}
-GList *
+EvMappingList *
ev_page_cache_get_link_mapping (EvPageCache *cache,
gint page)
{
return data->link_mapping;
}
-GList *
+EvMappingList *
ev_page_cache_get_image_mapping (EvPageCache *cache,
gint page)
{
return data->image_mapping;
}
-GList *
+EvMappingList *
ev_page_cache_get_form_field_mapping (EvPageCache *cache,
gint page)
{
return data->form_field_mapping;
}
-GList *
+EvMappingList *
ev_page_cache_get_annot_mapping (EvPageCache *cache,
gint page)
{
EvJobPageDataFlags ev_page_cache_get_flags (EvPageCache *cache);
void ev_page_cache_set_flags (EvPageCache *cache,
EvJobPageDataFlags flags);
-GList *ev_page_cache_get_link_mapping (EvPageCache *cache,
+EvMappingList *ev_page_cache_get_link_mapping (EvPageCache *cache,
gint page);
-GList *ev_page_cache_get_image_mapping (EvPageCache *cache,
+EvMappingList *ev_page_cache_get_image_mapping (EvPageCache *cache,
gint page);
-GList *ev_page_cache_get_form_field_mapping (EvPageCache *cache,
+EvMappingList *ev_page_cache_get_form_field_mapping (EvPageCache *cache,
gint page);
-GList *ev_page_cache_get_annot_mapping (EvPageCache *cache,
+EvMappingList *ev_page_cache_get_annot_mapping (EvPageCache *cache,
gint page);
cairo_region_t *ev_page_cache_get_text_mapping (EvPageCache *cache,
gint page);
#include <config.h>
#include "ev-pixbuf-cache.h"
#include "ev-job-scheduler.h"
-#include "ev-mapping.h"
-#include "ev-document-forms.h"
-#include "ev-document-images.h"
-#include "ev-document-annotations.h"
#include "ev-view-private.h"
typedef struct _CacheJobInfo
#include "ev-page-cache.h"
#include "ev-view-accessible.h"
#include "ev-view-private.h"
-#include "ev-mapping.h"
#define EV_TYPE_VIEW_ACCESSIBLE (ev_view_accessible_get_type ())
#define EV_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_VIEW_ACCESSIBLE, EvViewAccessible))
#include "ev-transition-animation.h"
#include "ev-view-cursor.h"
#include "ev-page-cache.h"
-#include "ev-mapping.h"
enum {
PROP_0,
gdouble x,
gdouble y)
{
- GdkRectangle page_area;
- GList *link_mapping;
- EvLink *link;
- gdouble width, height;
- gdouble new_x, new_y;
- gdouble scale;
+ GdkRectangle page_area;
+ EvMappingList *link_mapping;
+ EvLink *link;
+ gdouble width, height;
+ gdouble new_x, new_y;
+ gdouble scale;
if (!pview->page_cache)
return NULL;
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
-#include "ev-mapping.h"
+#include "ev-mapping-list.h"
#include "ev-document-forms.h"
#include "ev-document-images.h"
#include "ev-document-links.h"
}
static void
-ev_view_get_area_from_mapping (EvView *view,
- guint page,
- GList *mapping_list,
- gconstpointer data,
- GdkRectangle *area)
+ev_view_get_area_from_mapping (EvView *view,
+ guint page,
+ EvMappingList *mapping_list,
+ gconstpointer data,
+ GdkRectangle *area)
{
EvMapping *mapping;
{
gint page = -1;
gint x_new = 0, y_new = 0;
- GList *link_mapping;
+ EvMappingList *link_mapping;
if (!EV_IS_DOCUMENT_LINKS (view->document))
return NULL;
{
gint page = -1;
gint x_new = 0, y_new = 0;
- GList *image_mapping;
+ EvMappingList *image_mapping;
if (!EV_IS_DOCUMENT_IMAGES (view->document))
return NULL;
{
gint page = -1;
gint x_new = 0, y_new = 0;
- GList *forms_mapping;
+ EvMappingList *forms_mapping;
if (!EV_IS_DOCUMENT_FORMS (view->document))
return NULL;
ev_view_form_field_get_region (EvView *view,
EvFormField *field)
{
- GdkRectangle view_area;
- GList *forms_mapping;
+ GdkRectangle view_area;
+ EvMappingList *forms_mapping;
forms_mapping = ev_page_cache_get_form_field_mapping (view->page_cache,
field->page->index);
return NULL;
case EV_FORM_FIELD_BUTTON_CHECK:
case EV_FORM_FIELD_BUTTON_RADIO: {
- gboolean state;
- GList *forms_mapping, *l;
+ gboolean state;
+ EvMappingList *forms_mapping;
+ GList *l;
state = ev_document_forms_form_field_button_get_state (EV_DOCUMENT_FORMS (view->document),
field);
*/
forms_mapping = ev_page_cache_get_form_field_mapping (view->page_cache,
field->page->index);
- for (l = forms_mapping; l; l = g_list_next (l)) {
+ for (l = ev_mapping_list_get_list (forms_mapping); l; l = g_list_next (l)) {
EvFormField *button = ((EvMapping *)(l->data))->data;
cairo_region_t *button_region;
gdouble x,
gdouble y)
{
- GtkWidget *field_widget = NULL;
- GList *form_field_mapping;
- GdkRectangle view_area;
+ GtkWidget *field_widget = NULL;
+ EvMappingList *form_field_mapping;
+ GdkRectangle view_area;
if (field->is_read_only)
return;
show_annotation_windows (EvView *view,
gint page)
{
- GList *annots, *l;
- GtkWindow *parent;
+ EvMappingList *annots;
+ GList *l;
+ GtkWindow *parent;
parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
annots = ev_page_cache_get_annot_mapping (view->page_cache, page);
- for (l = annots; l && l->data; l = g_list_next (l)) {
+ for (l = ev_mapping_list_get_list (annots); l && l->data; l = g_list_next (l)) {
EvAnnotation *annot;
EvViewWindowChild *child;
GtkWidget *window;
hide_annotation_windows (EvView *view,
gint page)
{
- GList *annots, *l;
+ EvMappingList *annots;
+ GList *l;
annots = ev_page_cache_get_annot_mapping (view->page_cache, page);
- for (l = annots; l && l->data; l = g_list_next (l)) {
+ for (l = ev_mapping_list_get_list (annots); l && l->data; l = g_list_next (l)) {
EvAnnotation *annot;
GtkWidget *window;
{
gint page = -1;
gint x_new = 0, y_new = 0;
- GList *annotations_mapping;
+ EvMappingList *annotations_mapping;
if (!EV_IS_DOCUMENT_ANNOTATIONS (view->document))
return NULL;
for (l = children; l && l->data; l = g_list_next (l)) {
EvFormField *field;
GdkRectangle view_area;
- GList *form_field_mapping;
+ EvMappingList *form_field_mapping;
GtkAllocation child_allocation;
GtkRequisition child_requisition;
GtkWidget *child = (GtkWidget *)l->data;
EvLink *link,
GdkRectangle *area)
{
- GList *link_mapping;
- gint page;
- gint x_offset = 0, y_offset = 0;
+ EvMappingList *link_mapping;
+ gint page;
+ gint x_offset = 0, y_offset = 0;
x += view->scroll_x;
y += view->scroll_y;
EvAnnotation *annot,
GdkRectangle *area)
{
- GList *annot_mapping;
- gint page;
- gint x_offset = 0, y_offset = 0;
+ EvMappingList *annot_mapping;
+ gint page;
+ gint x_offset = 0, y_offset = 0;
x += view->scroll_x;
y += view->scroll_y;