4 * Copyright (C) 2008 - 2009 The Geeqie Team
8 * This software is released under the GNU General Public License (GNU GPL).
9 * Please read the included file COPYING for more information.
10 * This software comes with no warranty of any kind, use at your own risk!
18 #include "cache-loader.h"
21 #include "image-load.h"
22 #include "pixbuf_util.h"
23 #include "pixbuf-renderer.h"
27 /* thumbnail sizes and spacing */
29 #define PAN_THUMB_SIZE_DOTS 4
30 #define PAN_THUMB_SIZE_NONE 24
31 #define PAN_THUMB_SIZE_SMALL 64
32 #define PAN_THUMB_SIZE_NORMAL 128
33 #define PAN_THUMB_SIZE_LARGE 256
34 #define PAN_THUMB_SIZE pw->thumb_size
36 #define PAN_THUMB_GAP_DOTS 2
37 #define PAN_THUMB_GAP_SMALL 14
38 #define PAN_THUMB_GAP_NORMAL 30
39 #define PAN_THUMB_GAP_LARGE 40
40 #define PAN_THUMB_GAP_HUGE 50
41 #define PAN_THUMB_GAP pw->thumb_gap
43 /* basic sizes, colors, spacings */
45 #define PAN_SHADOW_OFFSET 6
46 #define PAN_SHADOW_FADE 5
47 #define PAN_SHADOW_COLOR 0, 0, 0
48 #define PAN_SHADOW_ALPHA 64
50 #define PAN_OUTLINE_THICKNESS 1
51 #define PAN_OUTLINE_COLOR_1 255, 255, 255
52 #define PAN_OUTLINE_COLOR_2 64, 64, 64
53 #define PAN_OUTLINE_ALPHA 180
55 #define PAN_BACKGROUND_COLOR 150, 150, 150
57 #define PAN_GRID_SIZE 60
58 #define PAN_GRID_COLOR 0, 0, 0
59 #define PAN_GRID_ALPHA 20
61 #define PAN_BOX_COLOR 255, 255, 255
62 #define PAN_BOX_ALPHA 100
63 #define PAN_BOX_BORDER 20
65 #define PAN_BOX_OUTLINE_THICKNESS 4
66 #define PAN_BOX_OUTLINE_COLOR 0, 0, 0
67 #define PAN_BOX_OUTLINE_ALPHA 128
69 #define PAN_TEXT_BORDER_SIZE 4
70 #define PAN_TEXT_COLOR 0, 0, 0
74 #define PAN_POPUP_COLOR 255, 255, 225
75 #define PAN_POPUP_ALPHA 255
76 #define PAN_POPUP_BORDER 1
77 #define PAN_POPUP_BORDER_COLOR 0, 0, 0
78 #define PAN_POPUP_TEXT_COLOR 0, 0, 0
81 #define PAN_GROUP_MAX 16
86 PAN_LAYOUT_TIMELINE = 0,
88 PAN_LAYOUT_FOLDERS_LINEAR,
89 PAN_LAYOUT_FOLDERS_FLOWER,
95 PAN_IMAGE_SIZE_THUMB_DOTS = 0,
96 PAN_IMAGE_SIZE_THUMB_NONE,
97 PAN_IMAGE_SIZE_THUMB_SMALL,
98 PAN_IMAGE_SIZE_THUMB_NORMAL,
99 PAN_IMAGE_SIZE_THUMB_LARGE,
118 PAN_TEXT_ATTR_NONE = 0,
119 PAN_TEXT_ATTR_BOLD = 1 << 0,
120 PAN_TEXT_ATTR_HEADING = 1 << 1,
121 PAN_TEXT_ATTR_MARKUP = 1 << 2
126 PAN_BORDER_1 = 1 << 0,
127 PAN_BORDER_2 = 1 << 1,
128 PAN_BORDER_3 = 1 << 2,
129 PAN_BORDER_4 = 1 << 3
132 #define PAN_BORDER_TOP PAN_BORDER_1
133 #define PAN_BORDER_RIGHT PAN_BORDER_2
134 #define PAN_BORDER_BOTTOM PAN_BORDER_3
135 #define PAN_BORDER_LEFT PAN_BORDER_4
138 typedef struct _PanItem PanItem;
153 PanTextAttrType text_attr;
171 typedef struct _PanWindow PanWindow;
176 ImageWindow *imd_normal;
179 GtkWidget *path_entry;
181 GtkWidget *label_message;
182 GtkWidget *label_zoom;
184 GtkWidget *search_box;
185 GtkWidget *search_entry;
186 GtkWidget *search_label;
187 GtkWidget *search_button;
188 GtkWidget *search_button_arrow;
190 GtkWidget *date_button;
192 GtkWidget *scrollbar_h;
193 GtkWidget *scrollbar_v;
198 PanLayoutType layout;
203 gboolean exif_date_enable;
205 gint info_image_size;
206 gboolean info_includes_exif;
208 gboolean ignore_symlinks;
219 CacheLoader *cache_cl;
231 /* file list for edit menu */
232 GList *editmenu_fd_list;
235 typedef struct _PanGrid PanGrid;
244 typedef struct _PanCacheData PanCacheData;
245 struct _PanCacheData {
253 GList *pan_layout_intersect(PanWindow *pw, gint x, gint y, gint width, gint height);
254 void pan_layout_resize(PanWindow *pw);
256 void pan_cache_sync_date(PanWindow *pw, GList *list);
258 GList *pan_cache_sort(GList *list, SortType method, gboolean ascend);
261 void pan_item_free(PanItem *pi);
263 void pan_item_set_key(PanItem *pi, const gchar *key);
264 void pan_item_added(PanWindow *pw, PanItem *pi);
265 void pan_item_remove(PanWindow *pw, PanItem *pi);
267 void pan_item_size_by_item(PanItem *pi, PanItem *child, gint border);
268 void pan_item_size_coordinates(PanItem *pi, gint border, gint *w, gint *h);
271 PanItem *pan_item_find_by_key(PanWindow *pw, PanItemType type, const gchar *key);
272 GList *pan_item_find_by_path(PanWindow *pw, PanItemType type, const gchar *path,
273 gboolean ignore_case, gboolean partial);
274 GList *pan_item_find_by_fd(PanWindow *pw, PanItemType type, FileData *fd,
275 gboolean ignore_case, gboolean partial);
276 PanItem *pan_item_find_by_coord(PanWindow *pw, PanItemType type,
277 gint x, gint y, const gchar *key);
280 PanItem *pan_item_box_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height,
282 guint8 base_r, guint8 base_g, guint8 base_b, guint8 base_a,
283 guint8 bord_r, guint8 bord_g, guint8 bord_b, guint8 bord_a);
284 void pan_item_box_shadow(PanItem *pi, gint offset, gint fade);
285 gint pan_item_box_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
286 gint x, gint y, gint width, gint height);
288 PanItem *pan_item_tri_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height,
289 gint x1, gint y1, gint x2, gint y2, gint x3, gint y3,
290 guint8 r, guint8 g, guint8 b, guint8 a);
291 void pan_item_tri_border(PanItem *pi, gint borders,
292 guint8 r, guint8 g, guint8 b, guint8 a);
293 gint pan_item_tri_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
294 gint x, gint y, gint width, gint height);
296 PanItem *pan_item_text_new(PanWindow *pw, gint x, gint y, const gchar *text,
297 PanTextAttrType attr, PanBorderType border,
298 guint8 r, guint8 g, guint8 b, guint8 a);
299 gint pan_item_text_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
300 gint x, gint y, gint width, gint height);
302 PanItem *pan_item_thumb_new(PanWindow *pw, FileData *fd, gint x, gint y);
303 gint pan_item_thumb_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
304 gint x, gint y, gint width, gint height);
306 PanItem *pan_item_image_new(PanWindow *pw, FileData *fd, gint x, gint y, gint w, gint h);
307 gint pan_item_image_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
308 gint x, gint y, gint width, gint height);
311 typedef struct _PanTextAlignment PanTextAlignment;
312 struct _PanTextAlignment {
323 PanTextAlignment *pan_text_alignment_new(PanWindow *pw, gint x, gint y, const gchar *key);
324 void pan_text_alignment_free(PanTextAlignment *ta);
326 PanItem *pan_text_alignment_add(PanTextAlignment *ta, const gchar *label, const gchar *text);
327 void pan_text_alignment_calc(PanTextAlignment *ta, PanItem *box);
330 /* utils in pan-util.c */
333 PAN_DATE_LENGTH_EXACT,
334 PAN_DATE_LENGTH_HOUR,
336 PAN_DATE_LENGTH_WEEK,
337 PAN_DATE_LENGTH_MONTH,
341 gboolean pan_date_compare(time_t a, time_t b, PanDateLengthType length);
342 gint pan_date_value(time_t d, PanDateLengthType length);
343 gchar *pan_date_value_string(time_t d, PanDateLengthType length);
344 time_t pan_date_to_time(gint year, gint month, gint day);
346 gboolean pan_is_link_loop(const gchar *s);
347 gboolean pan_is_ignored(const gchar *s, gboolean ignore_symlinks);
348 GList *pan_list_tree(FileData *dir_fd, SortType sort, gboolean ascend,
349 gboolean ignore_symlinks);
352 /* the different view types */
354 void pan_calendar_update(PanWindow *pw, PanItem *pi_day);
355 void pan_calendar_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height);
356 void pan_flower_compute(PanWindow *pw, FileData *dir_fd,
357 gint *width, gint *height,
358 gint *scroll_x, gint *scroll_y);
359 void pan_folder_tree_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height);
360 void pan_grid_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height);
361 void pan_timeline_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height);
365 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */