Mercurial > geeqie
annotate src/pan-timeline.c @ 1771:ed19035b2350
changed https to http in wiki links
author | nadvornik |
---|---|
date | Wed, 18 Nov 2009 12:34:30 +0000 |
parents | 8b89e3ff286b |
children | 956aab097ea7 |
rev | line source |
---|---|
105 | 1 /* |
196 | 2 * Geeqie |
105 | 3 * (C) 2006 John Ellis |
1284 | 4 * Copyright (C) 2008 - 2009 The Geeqie Team |
105 | 5 * |
6 * Author: John Ellis | |
7 * | |
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! | |
11 */ | |
12 | |
13 | |
281 | 14 #include "main.h" |
105 | 15 #include "pan-types.h" |
16 | |
17 | |
783 | 18 void pan_timeline_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height) |
105 | 19 { |
20 GList *list; | |
21 GList *work; | |
22 gint x, y; | |
23 time_t tc; | |
24 gint total; | |
25 gint count; | |
26 PanItem *pi_month = NULL; | |
27 PanItem *pi_day = NULL; | |
28 gint month_start; | |
29 gint day_start; | |
30 gint x_width; | |
31 gint y_height; | |
32 | |
783 | 33 list = pan_list_tree(dir_fd, SORT_NONE, TRUE, pw->ignore_symlinks); |
105 | 34 |
35 if (pw->cache_list && pw->exif_date_enable) | |
36 { | |
138 | 37 pw->cache_list = pan_cache_sort(pw->cache_list, SORT_NAME, TRUE); |
105 | 38 list = filelist_sort(list, SORT_NAME, TRUE); |
39 pan_cache_sync_date(pw, list); | |
40 } | |
41 | |
138 | 42 pw->cache_list = pan_cache_sort(pw->cache_list, SORT_TIME, TRUE); |
105 | 43 list = filelist_sort(list, SORT_TIME, TRUE); |
44 | |
45 *width = PAN_BOX_BORDER * 2; | |
46 *height = PAN_BOX_BORDER * 2; | |
47 | |
48 x = 0; | |
49 y = 0; | |
50 month_start = y; | |
51 day_start = month_start; | |
52 x_width = 0; | |
53 y_height = 0; | |
54 tc = 0; | |
55 total = 0; | |
56 count = 0; | |
57 work = list; | |
58 while (work) | |
59 { | |
60 FileData *fd; | |
61 PanItem *pi; | |
62 | |
63 fd = work->data; | |
64 work = work->next; | |
65 | |
66 if (!pan_date_compare(fd->date, tc, PAN_DATE_LENGTH_DAY)) | |
67 { | |
68 GList *needle; | |
69 gchar *buf; | |
70 | |
71 if (!pan_date_compare(fd->date, tc, PAN_DATE_LENGTH_MONTH)) | |
72 { | |
73 pi_day = NULL; | |
74 | |
75 if (pi_month) | |
76 { | |
77 x = pi_month->x + pi_month->width + PAN_BOX_BORDER; | |
78 } | |
79 else | |
80 { | |
81 x = PAN_BOX_BORDER; | |
82 } | |
83 | |
84 y = PAN_BOX_BORDER; | |
85 | |
86 buf = pan_date_value_string(fd->date, PAN_DATE_LENGTH_MONTH); | |
87 pi = pan_item_text_new(pw, x, y, buf, | |
88 PAN_TEXT_ATTR_BOLD | PAN_TEXT_ATTR_HEADING, | |
89 PAN_TEXT_BORDER_SIZE, | |
90 PAN_TEXT_COLOR, 255); | |
91 g_free(buf); | |
92 y += pi->height; | |
93 | |
94 pi_month = pan_item_box_new(pw, file_data_new_simple(fd->path), | |
95 x, y, 0, 0, | |
96 PAN_BOX_OUTLINE_THICKNESS, | |
97 PAN_BOX_COLOR, PAN_BOX_ALPHA, | |
98 PAN_BOX_OUTLINE_COLOR, PAN_BOX_OUTLINE_ALPHA); | |
99 | |
100 x += PAN_BOX_BORDER; | |
101 y += PAN_BOX_BORDER; | |
102 month_start = y; | |
103 } | |
104 | |
105 if (pi_day) x = pi_day->x + pi_day->width + PAN_BOX_BORDER; | |
106 | |
107 tc = fd->date; | |
108 total = 1; | |
109 count = 0; | |
110 | |
111 needle = work; | |
112 while (needle) | |
113 { | |
114 FileData *nfd; | |
115 | |
116 nfd = needle->data; | |
117 if (pan_date_compare(nfd->date, tc, PAN_DATE_LENGTH_DAY)) | |
118 { | |
119 needle = needle->next; | |
120 total++; | |
121 } | |
122 else | |
123 { | |
124 needle = NULL; | |
125 } | |
126 } | |
127 | |
128 buf = pan_date_value_string(fd->date, PAN_DATE_LENGTH_WEEK); | |
129 pi = pan_item_text_new(pw, x, y, buf, PAN_TEXT_ATTR_NONE, | |
130 PAN_TEXT_BORDER_SIZE, | |
131 PAN_TEXT_COLOR, 255); | |
132 g_free(buf); | |
133 | |
134 y += pi->height; | |
135 | |
136 pi_day = pan_item_box_new(pw, file_data_new_simple(fd->path), x, y, 0, 0, | |
137 PAN_BOX_OUTLINE_THICKNESS, | |
138 PAN_BOX_COLOR, PAN_BOX_ALPHA, | |
139 PAN_BOX_OUTLINE_COLOR, PAN_BOX_OUTLINE_ALPHA); | |
140 | |
141 x += PAN_BOX_BORDER; | |
142 y += PAN_BOX_BORDER; | |
143 day_start = y; | |
144 } | |
145 | |
146 if (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE) | |
147 { | |
148 pi = pan_item_image_new(pw, fd, x, y, 10, 10); | |
149 if (pi->width > x_width) x_width = pi->width; | |
150 y_height = pi->height; | |
151 } | |
152 else | |
153 { | |
154 pi = pan_item_thumb_new(pw, fd, x, y); | |
155 x_width = PAN_THUMB_SIZE; | |
156 y_height = PAN_THUMB_SIZE; | |
157 } | |
158 | |
159 pan_item_size_by_item(pi_day, pi, PAN_BOX_BORDER); | |
160 pan_item_size_by_item(pi_month, pi_day, PAN_BOX_BORDER); | |
161 | |
162 total--; | |
163 count++; | |
164 | |
165 if (total > 0 && count < PAN_GROUP_MAX) | |
166 { | |
167 y += y_height + PAN_THUMB_GAP; | |
168 } | |
169 else | |
170 { | |
171 x += x_width + PAN_THUMB_GAP; | |
172 x_width = 0; | |
173 count = 0; | |
174 | |
175 if (total > 0) | |
176 y = day_start; | |
177 else | |
178 y = month_start; | |
179 } | |
180 | |
181 pan_item_size_coordinates(pi_month, PAN_BOX_BORDER, width, height); | |
182 } | |
183 | |
184 g_list_free(list); | |
185 } | |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
783
diff
changeset
|
186 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |