]> www.fi.muni.cz Git - evince.git/blob - shell/ev-jobs.h
Massive changes. We now support text selection of pdfs, and not just
[evince.git] / shell / ev-jobs.h
1 /* this file is part of evince, a gnome document viewer
2  *
3  *  Copyright (C) 2005 Red Hat, Inc
4  *
5  * Evince is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * Evince is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __EV_JOBS_H__
21 #define __EV_JOBS_H__
22
23 #include <gtk/gtk.h>
24 #include "ev-document.h"
25
26 G_BEGIN_DECLS
27
28 typedef struct _EvJob EvJob;
29 typedef struct _EvJobClass EvJobClass;
30
31 typedef struct _EvJobRender EvJobRender;
32 typedef struct _EvJobRenderClass EvJobRenderClass;
33
34 typedef struct _EvJobThumbnail EvJobThumbnail;
35 typedef struct _EvJobThumbnailClass EvJobThumbnailClass;
36
37 typedef struct _EvJobLinks EvJobLinks;
38 typedef struct _EvJobLinksClass EvJobLinksClass;
39
40 typedef struct _EvJobLoad EvJobLoad;
41 typedef struct _EvJobLoadClass EvJobLoadClass;
42
43 typedef struct _EvJobFonts EvJobFonts;
44 typedef struct _EvJobFontsClass EvJobFontsClass;
45
46 #define EV_TYPE_JOB                          (ev_job_get_type())
47 #define EV_JOB(object)                       (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_JOB, EvJob))
48 #define EV_JOB_CLASS(klass)                  (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB, EvJobClass))
49 #define EV_IS_JOB(object)                    (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_JOB))
50
51 #define EV_TYPE_JOB_LINKS                    (ev_job_links_get_type())
52 #define EV_JOB_LINKS(object)                 (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_JOB_LINKS, EvJobLinks))
53 #define EV_JOB_LINKS_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_LINKS, EvJobLinksClass))
54 #define EV_IS_JOB_LINKS(object)              (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_JOB_LINKS))
55
56 #define EV_TYPE_JOB_RENDER                   (ev_job_render_get_type())
57 #define EV_JOB_RENDER(object)                (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_JOB_RENDER, EvJobRender))
58 #define EV_JOB_RENDER_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_RENDER, EvJobRenderClass))
59 #define EV_IS_JOB_RENDER(object)             (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_JOB_RENDER))
60
61 #define EV_TYPE_JOB_THUMBNAIL                (ev_job_thumbnail_get_type())
62 #define EV_JOB_THUMBNAIL(object)             (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_JOB_THUMBNAIL, EvJobThumbnail))
63 #define EV_JOB_THUMBNAIL_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_THUMBNAIL, EvJobThumbnailClass))
64 #define EV_IS_JOB_THUMBNAIL(object)          (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_JOB_THUMBNAIL))
65
66 #define EV_TYPE_JOB_LOAD                     (ev_job_load_get_type())
67 #define EV_JOB_LOAD(object)                  (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_JOB_LOAD, EvJobLoad))
68 #define EV_JOB_LOAD_CLASS(klass)             (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_LOAD, EvJobLoadClass))
69 #define EV_IS_JOB_LOAD(object)               (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_JOB_LOAD))
70
71 #define EV_TYPE_JOB_FONTS                    (ev_job_fonts_get_type())
72 #define EV_JOB_FONTS(object)                 (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_JOB_FONTS, EvJobFonts))
73 #define EV_JOB_FONTS_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_FONTS, EvJobFontsClass))
74 #define EV_IS_JOB_FONTS(object)              (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_JOB_FONTS))
75
76 typedef enum {
77         EV_JOB_PRIORITY_LOW,
78         EV_JOB_PRIORITY_HIGH,
79 } EvJobPriority;
80
81 struct _EvJob
82 {
83         GObject parent;
84         EvDocument *document;
85         gboolean finished;
86         gboolean async;
87 };
88
89 struct _EvJobClass
90 {
91         GObjectClass parent_class;
92
93         void    (* finished) (EvJob *job);
94 };
95
96 struct _EvJobLinks
97 {
98         EvJob parent;
99
100         GtkTreeModel *model;
101 };
102
103 struct _EvJobLinksClass
104 {
105         EvJobClass parent_class;
106 };
107
108 struct _EvJobRender
109 {
110         EvJob parent;
111
112         EvRenderContext *rc;
113         gint target_width;
114         gint target_height;
115         GdkPixbuf *pixbuf;
116
117         GList *link_mapping;
118
119         GdkPixbuf *selection;
120         EvRectangle selection_points;
121
122         gint include_links : 1;
123         gint include_selection : 1;
124 };
125
126 struct _EvJobRenderClass
127 {
128         EvJobClass parent_class;
129 };
130
131 struct _EvJobThumbnail
132 {
133         EvJob parent;
134
135         gint page;
136         gint requested_width;
137         GdkPixbuf *thumbnail;
138 };
139
140 struct _EvJobThumbnailClass
141 {
142         EvJobClass parent_class;
143 };
144
145 struct _EvJobLoad
146 {
147         EvJob parent;
148         GError *error;
149         gchar *uri;
150 };
151
152 struct _EvJobLoadClass
153 {
154         EvJobClass parent_class;
155 };
156
157 struct _EvJobFonts
158 {
159         EvJob parent;
160         gboolean scan_completed;
161 };
162
163 struct _EvJobFontsClass
164 {
165         EvJobClass parent_class;
166 };
167
168 /* Base job class */
169 GType           ev_job_get_type           (void);
170 void            ev_job_finished           (EvJob          *job);
171
172 /* EvJobLinks */
173 GType           ev_job_links_get_type     (void);
174 EvJob          *ev_job_links_new          (EvDocument     *document);
175 void            ev_job_links_run          (EvJobLinks     *thumbnail);
176
177 /* EvJobRender */
178 GType           ev_job_render_get_type    (void);
179 EvJob          *ev_job_render_new         (EvDocument      *document,
180                                            EvRenderContext *rc,
181                                            gint             width,
182                                            gint             height,
183                                            EvRectangle     *selection_points,
184                                            gboolean         include_links,
185                                            gboolean         include_selection);
186 void            ev_job_render_run         (EvJobRender     *thumbnail);
187
188 /* EvJobThumbnail */
189 GType           ev_job_thumbnail_get_type (void);
190 EvJob          *ev_job_thumbnail_new      (EvDocument     *document,
191                                            gint            page,
192                                            gint            requested_width);
193 void            ev_job_thumbnail_run      (EvJobThumbnail *thumbnail);
194
195 /* EvJobLoad */
196 GType           ev_job_load_get_type      (void);
197 EvJob          *ev_job_load_new           (EvDocument      *document,
198                                            const gchar     *uri);
199 void            ev_job_load_run           (EvJobLoad       *load);                                         
200
201 /* EvJobFonts */
202 GType           ev_job_fonts_get_type     (void);
203 EvJob          *ev_job_fonts_new          (EvDocument      *document);
204 void            ev_job_fonts_run          (EvJobFonts      *fonts);
205
206 G_END_DECLS
207
208 #endif /* __EV_JOBS_H__ */