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!
17 #include "cache-loader.h"
20 #include "image-load.h"
21 #include "pixbuf_util.h"
22 #include "pixbuf-renderer.h"
26 /* thumbnail sizes and spacing */
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
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
42 /* basic sizes, colors, spacings */
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
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
54 #define PAN_BACKGROUND_COLOR 150, 150, 150
56 #define PAN_GRID_SIZE 60
57 #define PAN_GRID_COLOR 0, 0, 0
58 #define PAN_GRID_ALPHA 20
60 #define PAN_BOX_COLOR 255, 255, 255
61 #define PAN_BOX_ALPHA 100
62 #define PAN_BOX_BORDER 20
64 #define PAN_BOX_OUTLINE_THICKNESS 4
65 #define PAN_BOX_OUTLINE_COLOR 0, 0, 0
66 #define PAN_BOX_OUTLINE_ALPHA 128
68 #define PAN_TEXT_BORDER_SIZE 4
69 #define PAN_TEXT_COLOR 0, 0, 0
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
80 #define PAN_GROUP_MAX 16
85 PAN_LAYOUT_TIMELINE = 0,
87 PAN_LAYOUT_FOLDERS_LINEAR,
88 PAN_LAYOUT_FOLDERS_FLOWER,
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,
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
125 PAN_BORDER_1 = 1 << 0,
126 PAN_BORDER_2 = 1 << 1,
127 PAN_BORDER_3 = 1 << 2,
128 PAN_BORDER_4 = 1 << 3
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
137 typedef struct _PanItem PanItem;
152 PanTextAttrType text_attr;
170 typedef struct _PanWindow PanWindow;
175 ImageWindow *imd_normal;
178 GtkWidget *path_entry;
180 GtkWidget *label_message;
181 GtkWidget *label_zoom;
183 GtkWidget *search_box;
184 GtkWidget *search_entry;
185 GtkWidget *search_label;
186 GtkWidget *search_button;
187 GtkWidget *search_button_arrow;
189 GtkWidget *date_button;
191 GtkWidget *scrollbar_h;
192 GtkWidget *scrollbar_v;
197 PanLayoutType layout;
202 gint exif_date_enable;
204 gint info_image_size;
205 gint info_includes_exif;
207 gint ignore_symlinks;
218 CacheLoader *cache_cl;
231 typedef struct _PanGrid PanGrid;
240 typedef struct _PanCacheData PanCacheData;
241 struct _PanCacheData {
249 GList *pan_layout_intersect(PanWindow *pw, gint x, gint y, gint width, gint height);
250 void pan_layout_resize(PanWindow *pw);
252 void pan_cache_sync_date(PanWindow *pw, GList *list);
257 void pan_item_free(PanItem *pi);
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);
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);
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);
274 PanItem *pan_item_box_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height,
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);
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);
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);
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);
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);
305 typedef struct _PanTextAlignment PanTextAlignment;
306 struct _PanTextAlignment {
317 PanTextAlignment *pan_text_alignment_new(PanWindow *pw, gint x, gint y, const gchar *key);
318 void pan_text_alignment_free(PanTextAlignment *ta);
320 PanItem *pan_text_alignment_add(PanTextAlignment *ta, const gchar *label, const gchar *text);
321 void pan_text_alignment_calc(PanTextAlignment *ta, PanItem *box);
324 /* utils in pan-util.c */
327 PAN_DATE_LENGTH_EXACT,
328 PAN_DATE_LENGTH_HOUR,
330 PAN_DATE_LENGTH_WEEK,
331 PAN_DATE_LENGTH_MONTH,
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);
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);
346 /* the different view types */
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);