105
|
1 /*
|
196
|
2 * Geeqie
|
105
|
3 * (C) 2006 John Ellis
|
|
4 *
|
|
5 * Author: John Ellis
|
|
6 *
|
|
7 * This software is released under the GNU General Public License (GNU GPL).
|
|
8 * Please read the included file COPYING for more information.
|
|
9 * This software comes with no warranty of any kind, use at your own risk!
|
|
10 */
|
|
11
|
|
12
|
|
13 #ifndef PAN_TYPES_H
|
|
14 #define PAN_TYPES_H
|
|
15
|
|
16 #include "cache.h"
|
|
17 #include "cache-loader.h"
|
|
18 #include "filelist.h"
|
|
19 #include "image.h"
|
|
20 #include "image-load.h"
|
|
21 #include "pixbuf_util.h"
|
|
22 #include "pixbuf-renderer.h"
|
|
23 #include "ui_misc.h"
|
|
24
|
|
25
|
|
26 /* thumbnail sizes and spacing */
|
|
27
|
|
28 #define PAN_THUMB_SIZE_DOTS 4
|
|
29 #define PAN_THUMB_SIZE_NONE 24
|
|
30 #define PAN_THUMB_SIZE_SMALL 64
|
|
31 #define PAN_THUMB_SIZE_NORMAL 128
|
|
32 #define PAN_THUMB_SIZE_LARGE 256
|
|
33 #define PAN_THUMB_SIZE pw->thumb_size
|
|
34
|
|
35 #define PAN_THUMB_GAP_DOTS 2
|
|
36 #define PAN_THUMB_GAP_SMALL 14
|
|
37 #define PAN_THUMB_GAP_NORMAL 30
|
|
38 #define PAN_THUMB_GAP_LARGE 40
|
|
39 #define PAN_THUMB_GAP_HUGE 50
|
|
40 #define PAN_THUMB_GAP pw->thumb_gap
|
|
41
|
|
42 /* basic sizes, colors, spacings */
|
|
43
|
|
44 #define PAN_SHADOW_OFFSET 6
|
|
45 #define PAN_SHADOW_FADE 5
|
|
46 #define PAN_SHADOW_COLOR 0, 0, 0
|
|
47 #define PAN_SHADOW_ALPHA 64
|
|
48
|
|
49 #define PAN_OUTLINE_THICKNESS 1
|
|
50 #define PAN_OUTLINE_COLOR_1 255, 255, 255
|
|
51 #define PAN_OUTLINE_COLOR_2 64, 64, 64
|
|
52 #define PAN_OUTLINE_ALPHA 180
|
|
53
|
|
54 #define PAN_BACKGROUND_COLOR 150, 150, 150
|
|
55
|
|
56 #define PAN_GRID_SIZE 60
|
|
57 #define PAN_GRID_COLOR 0, 0, 0
|
|
58 #define PAN_GRID_ALPHA 20
|
|
59
|
|
60 #define PAN_BOX_COLOR 255, 255, 255
|
|
61 #define PAN_BOX_ALPHA 100
|
|
62 #define PAN_BOX_BORDER 20
|
|
63
|
|
64 #define PAN_BOX_OUTLINE_THICKNESS 4
|
|
65 #define PAN_BOX_OUTLINE_COLOR 0, 0, 0
|
|
66 #define PAN_BOX_OUTLINE_ALPHA 128
|
|
67
|
|
68 #define PAN_TEXT_BORDER_SIZE 4
|
|
69 #define PAN_TEXT_COLOR 0, 0, 0
|
|
70
|
|
71 /* popup info box */
|
|
72
|
|
73 #define PAN_POPUP_COLOR 255, 255, 225
|
|
74 #define PAN_POPUP_ALPHA 255
|
|
75 #define PAN_POPUP_BORDER 1
|
|
76 #define PAN_POPUP_BORDER_COLOR 0, 0, 0
|
|
77 #define PAN_POPUP_TEXT_COLOR 0, 0, 0
|
|
78
|
|
79
|
|
80 #define PAN_GROUP_MAX 16
|
|
81
|
|
82
|
|
83
|
|
84 typedef enum {
|
|
85 PAN_LAYOUT_TIMELINE = 0,
|
|
86 PAN_LAYOUT_CALENDAR,
|
|
87 PAN_LAYOUT_FOLDERS_LINEAR,
|
|
88 PAN_LAYOUT_FOLDERS_FLOWER,
|
|
89 PAN_LAYOUT_GRID,
|
|
90 PAN_LAYOUT_COUNT
|
|
91 } PanLayoutType;
|
|
92
|
|
93 typedef enum {
|
|
94 PAN_IMAGE_SIZE_THUMB_DOTS = 0,
|
|
95 PAN_IMAGE_SIZE_THUMB_NONE,
|
|
96 PAN_IMAGE_SIZE_THUMB_SMALL,
|
|
97 PAN_IMAGE_SIZE_THUMB_NORMAL,
|
|
98 PAN_IMAGE_SIZE_THUMB_LARGE,
|
|
99 PAN_IMAGE_SIZE_10,
|
|
100 PAN_IMAGE_SIZE_25,
|
|
101 PAN_IMAGE_SIZE_33,
|
|
102 PAN_IMAGE_SIZE_50,
|
|
103 PAN_IMAGE_SIZE_100,
|
|
104 PAN_IMAGE_SIZE_COUNT
|
|
105 } PanImageSize;
|
|
106
|
|
107 typedef enum {
|
|
108 PAN_ITEM_NONE,
|
|
109 PAN_ITEM_THUMB,
|
|
110 PAN_ITEM_BOX,
|
|
111 PAN_ITEM_TRIANGLE,
|
|
112 PAN_ITEM_TEXT,
|
|
113 PAN_ITEM_IMAGE
|
|
114 } PanItemType;
|
|
115
|
|
116 typedef enum {
|
|
117 PAN_TEXT_ATTR_NONE = 0,
|
|
118 PAN_TEXT_ATTR_BOLD = 1 << 0,
|
|
119 PAN_TEXT_ATTR_HEADING = 1 << 1,
|
|
120 PAN_TEXT_ATTR_MARKUP = 1 << 2
|
|
121 } PanTextAttrType;
|
|
122
|
|
123 typedef enum {
|
|
124 PAN_BORDER_NONE = 0,
|
|
125 PAN_BORDER_1 = 1 << 0,
|
|
126 PAN_BORDER_2 = 1 << 1,
|
|
127 PAN_BORDER_3 = 1 << 2,
|
|
128 PAN_BORDER_4 = 1 << 3
|
|
129 } PanBorderType;
|
|
130
|
|
131 #define PAN_BORDER_TOP PAN_BORDER_1
|
|
132 #define PAN_BORDER_RIGHT PAN_BORDER_2
|
|
133 #define PAN_BORDER_BOTTOM PAN_BORDER_3
|
|
134 #define PAN_BORDER_LEFT PAN_BORDER_4
|
|
135
|
|
136
|
|
137 typedef struct _PanItem PanItem;
|
|
138 struct _PanItem {
|
|
139 PanItemType type;
|
|
140 gint x;
|
|
141 gint y;
|
|
142 gint width;
|
|
143 gint height;
|
|
144 gchar *key;
|
|
145
|
|
146 FileData *fd;
|
|
147
|
|
148 GdkPixbuf *pixbuf;
|
|
149 gint refcount;
|
|
150
|
|
151 gchar *text;
|
|
152 PanTextAttrType text_attr;
|
|
153
|
|
154 guint8 color_r;
|
|
155 guint8 color_g;
|
|
156 guint8 color_b;
|
|
157 guint8 color_a;
|
|
158
|
|
159 guint8 color2_r;
|
|
160 guint8 color2_g;
|
|
161 guint8 color2_b;
|
|
162 guint8 color2_a;
|
|
163 gint border;
|
|
164
|
|
165 gpointer data;
|
|
166
|
|
167 gint queued;
|
|
168 };
|
|
169
|
|
170 typedef struct _PanWindow PanWindow;
|
|
171 struct _PanWindow
|
|
172 {
|
|
173 GtkWidget *window;
|
|
174 ImageWindow *imd;
|
|
175 ImageWindow *imd_normal;
|
|
176 FullScreenData *fs;
|
|
177
|
|
178 GtkWidget *path_entry;
|
|
179
|
|
180 GtkWidget *label_message;
|
|
181 GtkWidget *label_zoom;
|
|
182
|
|
183 GtkWidget *search_box;
|
|
184 GtkWidget *search_entry;
|
|
185 GtkWidget *search_label;
|
|
186 GtkWidget *search_button;
|
|
187 GtkWidget *search_button_arrow;
|
|
188
|
|
189 GtkWidget *date_button;
|
|
190
|
|
191 GtkWidget *scrollbar_h;
|
|
192 GtkWidget *scrollbar_v;
|
|
193
|
|
194 gint overlay_id;
|
|
195
|
|
196 gchar *path;
|
|
197 PanLayoutType layout;
|
|
198 PanImageSize size;
|
|
199 gint thumb_size;
|
|
200 gint thumb_gap;
|
|
201 gint image_size;
|
|
202 gint exif_date_enable;
|
|
203
|
|
204 gint info_image_size;
|
|
205 gint info_includes_exif;
|
|
206
|
|
207 gint ignore_symlinks;
|
|
208
|
|
209 GList *list;
|
|
210 GList *list_static;
|
|
211 GList *list_grid;
|
|
212
|
|
213 GList *cache_list;
|
|
214 GList *cache_todo;
|
|
215 gint cache_count;
|
|
216 gint cache_total;
|
|
217 gint cache_tick;
|
|
218 CacheLoader *cache_cl;
|
|
219
|
|
220 ImageLoader *il;
|
|
221 ThumbLoader *tl;
|
|
222 PanItem *queue_pi;
|
|
223 GList *queue;
|
|
224
|
|
225 PanItem *click_pi;
|
|
226 PanItem *search_pi;
|
|
227
|
|
228 gint idle_id;
|
|
229 };
|
|
230
|
|
231 typedef struct _PanGrid PanGrid;
|
|
232 struct _PanGrid {
|
|
233 gint x;
|
|
234 gint y;
|
|
235 gint w;
|
|
236 gint h;
|
|
237 GList *list;
|
|
238 };
|
|
239
|
|
240 typedef struct _PanCacheData PanCacheData;
|
|
241 struct _PanCacheData {
|
138
|
242 FileData *fd;
|
105
|
243 CacheData *cd;
|
|
244 };
|
|
245
|
|
246
|
|
247 /* pan-view.c */
|
|
248
|
|
249 GList *pan_layout_intersect(PanWindow *pw, gint x, gint y, gint width, gint height);
|
|
250 void pan_layout_resize(PanWindow *pw);
|
|
251
|
|
252 void pan_cache_sync_date(PanWindow *pw, GList *list);
|
|
253
|
138
|
254 GList *pan_cache_sort(GList *list, SortType method, gint ascend);
|
105
|
255 /* pan-item.c */
|
|
256
|
|
257 void pan_item_free(PanItem *pi);
|
|
258
|
|
259 void pan_item_set_key(PanItem *pi, const gchar *key);
|
|
260 void pan_item_added(PanWindow *pw, PanItem *pi);
|
|
261 void pan_item_remove(PanWindow *pw, PanItem *pi);
|
|
262
|
|
263 void pan_item_size_by_item(PanItem *pi, PanItem *child, gint border);
|
|
264 void pan_item_size_coordinates(PanItem *pi, gint border, gint *w, gint *h);
|
|
265
|
|
266
|
|
267 PanItem *pan_item_find_by_key(PanWindow *pw, PanItemType type, const gchar *key);
|
|
268 GList *pan_item_find_by_path(PanWindow *pw, PanItemType type, const gchar *path,
|
|
269 gint ignore_case, gint partial);
|
|
270 PanItem *pan_item_find_by_coord(PanWindow *pw, PanItemType type,
|
|
271 gint x, gint y, const gchar *key);
|
|
272
|
|
273
|
|
274 PanItem *pan_item_box_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height,
|
|
275 gint border_size,
|
|
276 guint8 base_r, guint8 base_g, guint8 base_b, guint8 base_a,
|
|
277 guint8 bord_r, guint8 bord_g, guint8 bord_b, guint8 bord_a);
|
|
278 void pan_item_box_shadow(PanItem *pi, gint offset, gint fade);
|
|
279 gint pan_item_box_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
|
|
280 gint x, gint y, gint width, gint height);
|
|
281
|
|
282 PanItem *pan_item_tri_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height,
|
|
283 gint x1, gint y1, gint x2, gint y2, gint x3, gint y3,
|
|
284 guint8 r, guint8 g, guint8 b, guint8 a);
|
|
285 void pan_item_tri_border(PanItem *pi, gint borders,
|
|
286 guint8 r, guint8 g, guint8 b, guint8 a);
|
|
287 gint pan_item_tri_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
|
|
288 gint x, gint y, gint width, gint height);
|
|
289
|
|
290 PanItem *pan_item_text_new(PanWindow *pw, gint x, gint y, const gchar *text,
|
|
291 PanTextAttrType attr, PanBorderType border,
|
|
292 guint8 r, guint8 g, guint8 b, guint8 a);
|
|
293 gint pan_item_text_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
|
|
294 gint x, gint y, gint width, gint height);
|
|
295
|
|
296 PanItem *pan_item_thumb_new(PanWindow *pw, FileData *fd, gint x, gint y);
|
|
297 gint pan_item_thumb_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
|
|
298 gint x, gint y, gint width, gint height);
|
|
299
|
|
300 PanItem *pan_item_image_new(PanWindow *pw, FileData *fd, gint x, gint y, gint w, gint h);
|
|
301 gint pan_item_image_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
|
|
302 gint x, gint y, gint width, gint height);
|
|
303
|
|
304
|
|
305 typedef struct _PanTextAlignment PanTextAlignment;
|
|
306 struct _PanTextAlignment {
|
|
307 PanWindow *pw;
|
|
308
|
|
309 GList *column1;
|
|
310 GList *column2;
|
|
311
|
|
312 gint x;
|
|
313 gint y;
|
|
314 gchar *key;
|
|
315 };
|
|
316
|
|
317 PanTextAlignment *pan_text_alignment_new(PanWindow *pw, gint x, gint y, const gchar *key);
|
|
318 void pan_text_alignment_free(PanTextAlignment *ta);
|
|
319
|
|
320 PanItem *pan_text_alignment_add(PanTextAlignment *ta, const gchar *label, const gchar *text);
|
|
321 void pan_text_alignment_calc(PanTextAlignment *ta, PanItem *box);
|
|
322
|
|
323
|
|
324 /* utils in pan-util.c */
|
|
325
|
|
326 typedef enum {
|
|
327 PAN_DATE_LENGTH_EXACT,
|
|
328 PAN_DATE_LENGTH_HOUR,
|
|
329 PAN_DATE_LENGTH_DAY,
|
|
330 PAN_DATE_LENGTH_WEEK,
|
|
331 PAN_DATE_LENGTH_MONTH,
|
|
332 PAN_DATE_LENGTH_YEAR
|
|
333 } PanDateLengthType;
|
|
334
|
|
335 gint pan_date_compare(time_t a, time_t b, PanDateLengthType length);
|
|
336 gint pan_date_value(time_t d, PanDateLengthType length);
|
|
337 gchar *pan_date_value_string(time_t d, PanDateLengthType length);
|
|
338 time_t pan_date_to_time(gint year, gint month, gint day);
|
|
339
|
|
340 gint pan_is_link_loop(const gchar *s);
|
|
341 gint pan_is_ignored(const gchar *s, gint ignore_symlinks);
|
|
342 GList *pan_list_tree(const gchar *path, SortType sort, gint ascend,
|
|
343 gint ignore_symlinks);
|
|
344
|
|
345
|
|
346 /* the different view types */
|
|
347
|
|
348 void pan_calendar_update(PanWindow *pw, PanItem *pi_day);
|
|
349 void pan_calendar_compute(PanWindow *pw, const gchar *path, gint *width, gint *height);
|
|
350 void pan_flower_compute(PanWindow *pw, const gchar *path,
|
|
351 gint *width, gint *height,
|
|
352 gint *scroll_x, gint *scroll_y);
|
|
353 void pan_folder_tree_compute(PanWindow *pw, const gchar *path, gint *width, gint *height);
|
|
354 void pan_grid_compute(PanWindow *pw, const gchar *path, gint *width, gint *height);
|
|
355 void pan_timeline_compute(PanWindow *pw, const gchar *path, gint *width, gint *height);
|
|
356
|
|
357
|
|
358 #endif
|