X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libdocument%2Fev-document.h;h=d28289254df20796c7709d9aed0a6e3b42469e22;hb=b03015826c22cb2c28a0d0507963c23b9c9ddcb3;hp=74bd3bb7ebb0268bd652aff046e62ed1463c1742;hpb=75481a7c4d3b557da326c058d7b2d12958f8f018;p=evince.git diff --git a/libdocument/ev-document.h b/libdocument/ev-document.h index 74bd3bb7..d2828925 100644 --- a/libdocument/ev-document.h +++ b/libdocument/ev-document.h @@ -15,7 +15,7 @@ * * 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. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $Id$ */ @@ -47,8 +47,7 @@ G_BEGIN_DECLS typedef struct _EvDocument EvDocument; typedef struct _EvDocumentClass EvDocumentClass; -typedef struct _EvPageCache EvPageCache; -typedef struct _EvPageCacheClass EvPageCacheClass; +typedef struct _EvDocumentPrivate EvDocumentPrivate; #define EV_DOCUMENT_ERROR ev_document_error_quark () #define EV_DOC_MUTEX_LOCK (ev_document_doc_mutex_lock ()) @@ -66,10 +65,26 @@ typedef struct { } EvPoint; typedef struct _EvRectangle EvRectangle; +typedef struct _EvMapping EvMapping; + +typedef struct _EvDocumentBackendInfo EvDocumentBackendInfo; +struct _EvDocumentBackendInfo +{ + const gchar *name; + const gchar *version; +}; + +typedef struct { + const gchar *filename; + gint line; + gint col; +} EvSourceLink; struct _EvDocument { GObject base; + + EvDocumentPrivate *priv; }; struct _EvDocumentClass @@ -94,45 +109,80 @@ struct _EvDocumentClass EvPage *page); cairo_surface_t * (* render) (EvDocument *document, EvRenderContext *rc); + GdkPixbuf * (* get_thumbnail) (EvDocument *document, + EvRenderContext *rc); EvDocumentInfo * (* get_info) (EvDocument *document); + gboolean (* get_backend_info)(EvDocument *document, + EvDocumentBackendInfo *info); + gboolean (* support_synctex) (EvDocument *document); }; -GType ev_document_get_type (void) G_GNUC_CONST; -GQuark ev_document_error_quark (void); +GType ev_document_get_type (void) G_GNUC_CONST; +GQuark ev_document_error_quark (void); /* Document mutex */ -GMutex *ev_document_get_doc_mutex (void); -void ev_document_doc_mutex_lock (void); -void ev_document_doc_mutex_unlock (void); -gboolean ev_document_doc_mutex_trylock(void); +GMutex *ev_document_get_doc_mutex (void); +void ev_document_doc_mutex_lock (void); +void ev_document_doc_mutex_unlock (void); +gboolean ev_document_doc_mutex_trylock (void); /* FontConfig mutex */ -GMutex *ev_document_get_fc_mutex (void); -void ev_document_fc_mutex_lock (void); -void ev_document_fc_mutex_unlock (void); -gboolean ev_document_fc_mutex_trylock (void); +GMutex *ev_document_get_fc_mutex (void); +void ev_document_fc_mutex_lock (void); +void ev_document_fc_mutex_unlock (void); +gboolean ev_document_fc_mutex_trylock (void); -EvDocumentInfo *ev_document_get_info (EvDocument *document); -gboolean ev_document_load (EvDocument *document, - const char *uri, - GError **error); -gboolean ev_document_save (EvDocument *document, - const char *uri, - GError **error); -gint ev_document_get_n_pages (EvDocument *document); -EvPage *ev_document_get_page (EvDocument *document, - gint index); -void ev_document_get_page_size (EvDocument *document, - EvPage *page, - double *width, - double *height); -gchar *ev_document_get_page_label (EvDocument *document, - EvPage *page); -cairo_surface_t *ev_document_render (EvDocument *document, - EvRenderContext *rc); +EvDocumentInfo *ev_document_get_info (EvDocument *document); +gboolean ev_document_get_backend_info (EvDocument *document, + EvDocumentBackendInfo *info); +gboolean ev_document_load (EvDocument *document, + const char *uri, + GError **error); +gboolean ev_document_save (EvDocument *document, + const char *uri, + GError **error); +gint ev_document_get_n_pages (EvDocument *document); +EvPage *ev_document_get_page (EvDocument *document, + gint index); +void ev_document_get_page_size (EvDocument *document, + gint page_index, + double *width, + double *height); +gchar *ev_document_get_page_label (EvDocument *document, + gint page_index); +cairo_surface_t *ev_document_render (EvDocument *document, + EvRenderContext *rc); +GdkPixbuf *ev_document_get_thumbnail (EvDocument *document, + EvRenderContext *rc); +const gchar *ev_document_get_uri (EvDocument *document); +const gchar *ev_document_get_title (EvDocument *document); +gboolean ev_document_is_page_size_uniform (EvDocument *document); +void ev_document_get_max_page_size (EvDocument *document, + gdouble *width, + gdouble *height); +void ev_document_get_min_page_size (EvDocument *document, + gdouble *width, + gdouble *height); +gboolean ev_document_check_dimensions (EvDocument *document); +gint ev_document_get_max_label_len (EvDocument *document); +gboolean ev_document_has_text_page_labels (EvDocument *document); +gboolean ev_document_find_page_by_label (EvDocument *document, + const gchar *page_label, + gint *page_index); +gboolean ev_document_has_synctex (EvDocument *document); -gint ev_rect_cmp (EvRectangle *a, - EvRectangle *b); +EvSourceLink *ev_document_synctex_backward_search + (EvDocument *document, + gint page_index, + gfloat x, + gfloat y); + +EvMapping *ev_document_synctex_forward_search + (EvDocument *document, + EvSourceLink *source_link); + +gint ev_rect_cmp (EvRectangle *a, + EvRectangle *b); #define EV_TYPE_RECTANGLE (ev_rectangle_get_type ()) struct _EvRectangle @@ -148,6 +198,11 @@ EvRectangle *ev_rectangle_new (void); EvRectangle *ev_rectangle_copy (EvRectangle *ev_rect); void ev_rectangle_free (EvRectangle *ev_rect); +struct _EvMapping { + EvRectangle area; + gpointer data; +}; + /* convenience macro to ease interface addition in the CODE * section of EV_BACKEND_REGISTER_WITH_CODE (this macro relies on * the g_define_type_id present within EV_BACKEND_REGISTER_WITH_CODE()). @@ -247,56 +302,6 @@ type_name##_get_type (void) return g_define_type_id__volatile; \ } -/* A convenience macro for GTypeInterface definitions, which declares - * a default vtable initialization function and defines a *_get_type() - * function. - * - * The macro expects the interface initialization function to have the - * name t_n ## _default_init, and the interface - * structure to have the name TN ## Interface. - */ -#define EV_DEFINE_INTERFACE(TypeName, type_name, TYPE_PREREQ) \ -static void type_name##_class_init (TypeName##Iface *klass); \ - \ -GType \ -type_name##_get_type (void) \ -{ \ - static volatile gsize g_define_type_id__volatile = 0; \ - if (g_once_init_enter (&g_define_type_id__volatile)) { \ - GType g_define_type_id = \ - g_type_register_static_simple (G_TYPE_INTERFACE, \ - g_intern_static_string (#TypeName), \ - sizeof (TypeName##Iface), \ - (GClassInitFunc)type_name##_class_init, \ - 0, \ - (GInstanceInitFunc)NULL, \ - (GTypeFlags) 0); \ - if (TYPE_PREREQ) \ - g_type_interface_add_prerequisite (g_define_type_id, TYPE_PREREQ); \ - g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \ - } \ - return g_define_type_id__volatile; \ -} - -/* - * A convenience macro for boxed type implementations, which defines a - * type_name_get_type() function registering the boxed type. - */ -#define EV_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) \ -GType \ -type_name##_get_type (void) \ -{ \ - static volatile gsize g_define_type_id__volatile = 0; \ - if (g_once_init_enter (&g_define_type_id__volatile)) { \ - GType g_define_type_id = \ - g_boxed_type_register_static (g_intern_static_string (#TypeName), \ - (GBoxedCopyFunc) copy_func, \ - (GBoxedFreeFunc) free_func); \ - g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \ - } \ - return g_define_type_id__volatile; \ -} - G_END_DECLS #endif /* EV_DOCUMENT_H */