annotations.h 11.4 KB
Newer Older
Moritz Lipp's avatar
Moritz Lipp committed
1
2
3
4
5
6
/* See LICENSE file for license and copyright information */

#ifndef ANNOTATION_H
#define ANNOTATION_H

#include <time.h>
7
#include <stdbool.h>
Moritz Lipp's avatar
Moritz Lipp committed
8

9
#include "page.h"
10
#include "types.h"
11

Moritz Lipp's avatar
Moritz Lipp committed
12
typedef struct zathura_annotation_s zathura_annotation_t;
13
typedef struct zathura_annotation_popup_s zathura_annotation_popup_t;
Moritz Lipp's avatar
Moritz Lipp committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

typedef enum zathura_annotation_type_s {
  ZATHURA_ANNOTATION_UNKNOWN,
  ZATHURA_ANNOTATION_TEXT,
  ZATHURA_ANNOTATION_LINK,
  ZATHURA_ANNOTATION_FREE_TEXT,
  ZATHURA_ANNOTATION_LINE,
  ZATHURA_ANNOTATION_SQUARE,
  ZATHURA_ANNOTATION_CIRCLE,
  ZATHURA_ANNOTATION_POLYGON,
  ZATHURA_ANNOTATION_POLY_LINE,
  ZATHURA_ANNOTATION_HIGHLIGHT,
  ZATHURA_ANNOTATION_UNDERLINE,
  ZATHURA_ANNOTATION_SQUIGGLY,
  ZATHURA_ANNOTATION_STRIKE_OUT,
  ZATHURA_ANNOTATION_STAMP,
  ZATHURA_ANNOTATION_CARET,
  ZATHURA_ANNOTATION_INK,
  ZATHURA_ANNOTATION_POPUP,
  ZATHURA_ANNOTATION_FILE_ATTACHMENT,
  ZATHURA_ANNOTATION_SOUND,
  ZATHURA_ANNOTATION_MOVIE,
  ZATHURA_ANNOTATION_WIDGET,
  ZATHURA_ANNOTATION_SCREEN,
  ZATHURA_ANNOTATION_PRINTER_MARK,
  ZATHURA_ANNOTATION_TRAP_NET,
  ZATHURA_ANNOTATION_WATERMARK,
41
42
  ZATHURA_ANNOTATION_3D,
  ZATHURA_ANNOTATION_MARKUP
Moritz Lipp's avatar
Moritz Lipp committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
} zathura_annotation_type_t;

typedef enum zathura_annotation_flag_s {
  ZATHURA_ANNOTATION_FLAG_UNKNOWN         = 0,
  ZATHURA_ANNOTATION_FLAG_INVISIBLE       = 1 << 0,
  ZATHURA_ANNOTATION_FLAG_HIDDEN          = 1 << 1,
  ZATHURA_ANNOTATION_FLAG_PRINT           = 1 << 2,
  ZATHURA_ANNOTATION_FLAG_NO_ZOOM         = 1 << 3,
  ZATHURA_ANNOTATION_FLAG_NO_ROTATE       = 1 << 4,
  ZATHURA_ANNOTATION_FLAG_NO_VIEW         = 1 << 5,
  ZATHURA_ANNOTATION_FLAG_READ_ONLY       = 1 << 6,
  ZATHURA_ANNOTATION_FLAG_LOCKED          = 1 << 7,
  ZATHURA_ANNOTATION_FLAG_TOGGLE_NO_VIEW  = 1 << 8,
  ZATHURA_ANNOTATION_FLAG_LOCKED_CONTENTS = 1 << 9,
} zathura_annotation_flag_t;

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
typedef enum zathura_annotation_text_icon_s {
  ZATHURA_ANNOTATION_TEXT_ICON_UNKNOWN,
  ZATHURA_ANNOTATION_TEXT_ICON_NOTE,
  ZATHURA_ANNOTATION_TEXT_ICON_COMMENT,
  ZATHURA_ANNOTATION_TEXT_ICON_KEY,
  ZATHURA_ANNOTATION_TEXT_ICON_HELP,
  ZATHURA_ANNOTATION_TEXT_ICON_NEW_PARAGRAPH,
  ZATHURA_ANNOTATION_TEXT_ICON_PARAGRAPH,
  ZATHURA_ANNOTATION_TEXT_ICON_INSERT,
  ZATHURA_ANNOTATION_TEXT_ICON_CROSS,
  ZATHURA_ANNOTATION_TEXT_ICON_CIRCLE
} zathura_annotation_text_icon_t;

typedef enum zathura_annotation_text_state_s {
  ZATHURA_ANNOTATION_TEXT_STATE_UNKNOWN,
  ZATHURA_ANNOTATION_TEXT_STATE_NONE,
  ZATHURA_ANNOTATION_TEXT_STATE_MARKED,
  ZATHURA_ANNOTATION_TEXT_STATE_UNMARKED,
  ZATHURA_ANNOTATION_TEXT_STATE_ACCEPTED,
  ZATHURA_ANNOTATION_TEXT_STATE_REJECTED,
  ZATHURA_ANNOTATION_TEXT_STATE_CANCELLED,
  ZATHURA_ANNOTATION_TEXT_STATE_COMPLETED
} zathura_annotation_text_state_t;

Moritz Lipp's avatar
Moritz Lipp committed
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/**
 * Creates a new annotation
 *
 * @param type The type of the annotation
 * @return Pointer to the created annotation object or NULL if an error occured
 */
zathura_annotation_t* zathura_annotation_new(zathura_annotation_type_t type);

/**
 * Frees the given annotation
 *
 * @param annotation The annotation
 */
void zathura_annotation_free(zathura_annotation_t* annotation);

/**
 * Returns the pointer to the custom data for the given annotation
 *
 * @param annotation The annotation
 * @return Pointer to the custom data or NULL
 */
void* zathura_annotation_get_data(zathura_annotation_t* annotation);

/**
 * Sets the custom data for the given annotation
 *
 * @param annotation The annotation
 * @param data Custom data
 */
void zathura_annotation_set_data(zathura_annotation_t* annotation, void* data);

/**
 * Returns the type of the annotation
 *
 * @param annotation The annotation
 * @return The type of the annotation (\ref zathura_annotation_type_t)
 */
zathura_annotation_type_t zathura_annotation_get_type(zathura_annotation_t* annotation);

/**
 * Returns the flags of the annotation
 *
 * @param annotation The annotation
 * @return The set flags of the annotation (\ref zathura_annotation_flag_t)
 */
zathura_annotation_flag_t zathura_annotation_get_flags(zathura_annotation_t* annotation);

/**
 * Sets the flags of the annotation
 *
 * @param annotation The annotation
 * @param flags The flags that should be set to the annotation
 */
void zathura_annotation_set_flags(zathura_annotation_t* annotation, zathura_annotation_flag_t flags);

/**
 * Returns the content of the annotation
 *
 * @param annotation The annotation
 * @return The content of the annotation or NULL
 */
char* zathura_annotation_get_content(zathura_annotation_t* annotation);

/**
 * Sets the content of the annotation
 *
 * @param annotation The annotation
 * @param content The new content of the annotation
 */
void zathura_annotation_set_content(zathura_annotation_t* annotation, char* content);

/**
 * Returns the name of the annotation
 *
 * @param annotation The annotation
 * @return The name of the annotation or NULL
 */
char* zathura_annotation_get_name(zathura_annotation_t* annotation);

/**
 * Sets the name of the annotation
 *
 * @param annotation The annotation
 * @param name The new name of the annotation
 */
void zathura_annotation_set_name(zathura_annotation_t* annotation, const char* name);

/**
 * Returns the modification date of the annotation
 *
 * @param annotation The annotation
 * @return The date on which the annotation has been modified the last time
 */
time_t zathura_annotation_get_modified(zathura_annotation_t* annotation);

/**
 * Sets the date on which the annotation has been modified the last time
 *
 * @param annotation The annotation
 * @param modification_date The modification date
 */
void zathura_annotation_set_modified(zathura_annotation_t* annotation, time_t modification_date);

/**
187
 * Returns the page of the annotation
Moritz Lipp's avatar
Moritz Lipp committed
188
189
 *
 * @param annotation The annotation
190
 * @return The page of the annotation
Moritz Lipp's avatar
Moritz Lipp committed
191
 */
192
zathura_page_t* zathura_annotation_get_page(zathura_annotation_t* annotation);
Moritz Lipp's avatar
Moritz Lipp committed
193
194

/**
195
 * Sets the page of the annotation
Moritz Lipp's avatar
Moritz Lipp committed
196
197
 *
 * @param annotation The annotation
198
 * @param page The page of the annotation
Moritz Lipp's avatar
Moritz Lipp committed
199
 */
200
void zathura_annotation_set_page_index(zathura_annotation_t* annotation, zathura_page_t* page);
Moritz Lipp's avatar
Moritz Lipp committed
201

202
203
204
205
206
/**
 * Retrieves the position of the annotation and saves it into the given
 * rectangle
 *
 * @param annotation The annotation
207
 * @return The position of the annotation
208
 */
209
zathura_rectangle_t zathura_annotation_get_position(zathura_annotation_t* annotation);
210
211
212
213
214
215
216

/**
 * Sets the new position of the annotation
 *
 * @param annotation The annotation
 * @param rectangle The rectangle containing the new position information
 */
217
void zathura_annotation_set_position(zathura_annotation_t* annotation, zathura_rectangle_t position);
218

219
220
221
222
223
224
/**
 * Gets the current label of the markup annotation
 *
 * @param annotation The annotation
 * @return The label or NULL
 */
225
char* zathura_annotation_markup_get_label(zathura_annotation_t* annotation);
226
227
228
229
230
231
232

/**
 * Sets the label of the markup annotation
 *
 * @param annotation The annotation
 * @param label The new label of the markup annotation
 */
233
234
void zathura_annotation_markup_set_label(zathura_annotation_t* annotation, const char* label);

235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/**
 * Returns the subject of the markup annotation
 *
 * @param annotation The annotation
 * @return The subject or NULL
 */
char* zathura_annotation_markup_get_subject(zathura_annotation_t* annotation);

/**
 * Sets the new subject of the markup annotation
 *
 * @param annotation The annotation
 * @param subject The new subject of the markup annotation
 */
void zathura_annotation_markup_set_subject(zathura_annotation_t* annotation, const char* subject);

/**
 * Sets the annotation popup of the markup annotation
 *
 * @param annotation The annotation
 * @return The popup (if available) from the markup annotation
 */
zathura_annotation_popup_t* zathura_annotation_markup_get_popup(zathura_annotation_t* annotation);

/**
 * Sets the new popup for the markup annotation
 *
 * @param annotation The annotation
 * @param popup The new popup for the markup annotation
 */
void zathura_annotation_markup_set_popup(zathura_annotation_t* annotation, zathura_annotation_popup_t* popup);

267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
/**
 * Returns the creation date of the annotation
 *
 * @param annotation The annotation
 * @retun The creation date
 */
time_t zathura_annotation_markup_get_creation_date(zathura_annotation_t* annotation);

/**
 * Sets the creation date of the annotation
 *
 * @param annotation The annotation
 * @param creation_date The creation date
 */
void zathura_annotation_markup_set_creation_date(zathura_annotation_t* annotation, time_t creation_date);

/**
 * Returns the defined icon of the text annotation
 *
 * @param annotation The annotation
 * @return The set icon of the text annotation
 */
zathura_annotation_text_icon_t zathura_annotation_text_get_icon(zathura_annotation_t* annotation);

/**
 * Sets the icon of the text annotation
 *
 * @param annotation The annotation
 * @param icon The icon of the text annotation
 */
void zathura_annotation_text_set_icon(zathura_annotation_t* annotation, zathura_annotation_text_icon_t icon);

/**
 * Returns the state of the text annotation
 *
 * @param annotation The annotation
 * @return The state of the text annotation
 */
zathura_annotation_text_state_t zathura_annotation_text_get_state(zathura_annotation_t* annotation);

/**
 * Sets the state of the text annotation
 *
 * @param annotation The annotation
 * @param state The new state of the text annotation
 */
void zathura_annotation_text_set_state(zathura_annotation_t* annotation, zathura_annotation_text_state_t state);

/**
 * Returns whether the text annotation is open or not
 *
 * @param annotation The annotation
 * @return true if the annotation is open otherwise false
 */
bool zathura_annotation_text_get_open_status(zathura_annotation_t* annotation);

/**
 * Sets the text annotation open status
 *
 * @param annotation The annotation
 * @param opened The new open status
 */
void zathura_annotation_text_set_open_status(zathura_annotation_t* annotation, bool opened);

331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
/**
 * Creates a new annotation popup
 *
 * @return The popup or NULL if an error occured
 */
zathura_annotation_popup_t* zathura_annotation_popup_new();

/**
 * Frees the annotation popup
 *
 * @param popup The annotation popup
 */
void zathura_annotation_popup_free(zathura_annotation_popup_t* popup);

/**
 * Returns the position of the annotation popup
 *
 * @param popup The annotation popup
 * @return The position of the annotation popup
 */
zathura_rectangle_t zathura_annotation_popup_get_position(zathura_annotation_popup_t* popup);

/**
 * Sets the position of the annotation popup
 *
 * @param popup The annotation popup
 * @param position The new position of the annotation popup
 */
void zathura_annotation_popup_set_position(zathura_annotation_popup_t* popup, zathura_rectangle_t position);

/**
 * Returns the opacity of the annotation popup
 *
 * @param popup The annotation popup
 * @return The opacity of the annotation popup
 */
double zathura_annotation_popup_get_opacity(zathura_annotation_popup_t* popup);

/**
 * Sets the opacity of the annotation popup
 *
 * @param popup The annotation popup
 * @param opacity The new value for the opacity
 */
void zathura_annotation_popup_set_opacity(zathura_annotation_popup_t* popup, double opacity);

/**
 * Returns whether the popup is opened or not
 *
 * @param popup The annotation popup
 * @return true if the popup is opened otherwise false
 */
bool zathura_annotation_popup_get_open_status(zathura_annotation_popup_t* popup);

/**
 * Sets the open status of the popup
 *
 * @param popup The annotation popup
 * @param opened The new status
 */
void zathura_annotation_popup_set_open_status(zathura_annotation_popup_t* popup, bool opened);

Moritz Lipp's avatar
Moritz Lipp committed
393
#endif // ANNOTATION_H