Mercurial > geeqie.yaz
annotate src/layout.c @ 468:2df505c60459
Replace fullscreen.info and fullscreen.show_info options by:
image_overlay.common.enabled => to save last state to rc file
image_overlay.common.show_at_startup => overrides .common.enabled at startup
image_overlay.common.template_string => replace fullscreen.info
common is used since for now there is only one image overlay setup,
later specific setups may be added.
author | zas_ |
---|---|
date | Mon, 21 Apr 2008 20:01:22 +0000 |
parents | 4b2d7f9af171 |
children | 48c8e49b571c |
rev | line source |
---|---|
9 | 1 /* |
196 | 2 * Geeqie |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
3 * (C) 2006 John Ellis |
9 | 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 | |
281 | 12 #include "main.h" |
9 | 13 #include "layout.h" |
14 | |
15 #include "image.h" | |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
16 #include "color-man.h" |
9 | 17 #include "layout_config.h" |
18 #include "layout_image.h" | |
19 #include "layout_util.h" | |
20 #include "menu.h" | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
21 #include "pixbuf-renderer.h" |
9 | 22 #include "pixbuf_util.h" |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
23 #include "utilops.h" |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
24 #include "view_dir.h" |
9 | 25 #include "view_file_list.h" |
26 #include "view_file_icon.h" | |
27 #include "ui_bookmark.h" | |
28 #include "ui_fileops.h" | |
29 #include "ui_menu.h" | |
30 #include "ui_misc.h" | |
31 #include "ui_tabcomp.h" | |
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
270
diff
changeset
|
32 #include "histogram.h" |
9 | 33 |
34 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
35 #define MAINWINDOW_DEF_WIDTH 700 |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
36 #define MAINWINDOW_DEF_HEIGHT 500 |
9 | 37 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
38 #define MAIN_WINDOW_DIV_HPOS 270 |
9 | 39 #define MAIN_WINDOW_DIV_VPOS 200 |
40 | |
41 #define TOOLWINDOW_DEF_WIDTH 260 | |
42 #define TOOLWINDOW_DEF_HEIGHT 450 | |
43 #define PROGRESS_WIDTH 150 | |
44 #define ZOOM_LABEL_WIDTH 64 | |
45 | |
46 #define PANE_DIVIDER_SIZE 10 | |
47 | |
48 | |
49 GList *layout_window_list = NULL; | |
50 | |
51 | |
52 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle); | |
53 | |
54 | |
55 /* | |
56 *----------------------------------------------------------------------------- | |
57 * misc | |
58 *----------------------------------------------------------------------------- | |
59 */ | |
60 | |
61 gint layout_valid(LayoutWindow **lw) | |
62 { | |
63 if (*lw == NULL) | |
64 { | |
65 if (layout_window_list) *lw = layout_window_list->data; | |
66 return (*lw != NULL); | |
67 } | |
68 | |
69 return (g_list_find(layout_window_list, *lw) != NULL); | |
70 } | |
71 | |
72 LayoutWindow *layout_find_by_image(ImageWindow *imd) | |
73 { | |
74 GList *work; | |
75 | |
76 work = layout_window_list; | |
77 while (work) | |
78 { | |
79 LayoutWindow *lw = work->data; | |
80 work = work->next; | |
81 | |
82 if (lw->image == imd) return lw; | |
83 } | |
84 | |
85 return NULL; | |
86 } | |
87 | |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
88 LayoutWindow *layout_find_by_image_fd(ImageWindow *imd) |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
89 { |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
90 GList *work; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
91 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
92 work = layout_window_list; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
93 while (work) |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
94 { |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
95 LayoutWindow *lw = work->data; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
96 work = work->next; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
97 if (lw->image->image_fd == imd->image_fd) |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
98 return lw; |
442 | 99 |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
100 } |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
101 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
102 return NULL; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
103 } |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
104 |
9 | 105 /* |
106 *----------------------------------------------------------------------------- | |
107 * menu, toolbar, and dir view | |
108 *----------------------------------------------------------------------------- | |
109 */ | |
110 | |
111 static void layout_path_entry_changed_cb(GtkWidget *widget, gpointer data) | |
112 { | |
113 LayoutWindow *lw = data; | |
114 gchar *buf; | |
115 | |
116 if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) < 0) return; | |
117 | |
118 buf = g_strdup(gtk_entry_get_text(GTK_ENTRY(lw->path_entry))); | |
119 if (!buf || (lw->path && strcmp(buf, lw->path) == 0)) | |
120 { | |
121 g_free(buf); | |
122 return; | |
123 } | |
124 | |
125 layout_set_path(lw, buf); | |
126 | |
442 | 127 g_free(buf); |
9 | 128 } |
129 | |
130 static void layout_path_entry_tab_cb(const gchar *path, gpointer data) | |
131 { | |
132 LayoutWindow *lw = data; | |
133 gchar *buf; | |
134 gchar *base; | |
135 | |
136 buf = g_strdup(path); | |
137 parse_out_relatives(buf); | |
138 base = remove_level_from_path(buf); | |
139 | |
140 if (isdir(buf)) | |
141 { | |
142 if ((!lw->path || strcmp(lw->path, buf) != 0) && layout_set_path(lw, buf)) | |
143 { | |
144 gint pos = -1; | |
145 /* put the '/' back, if we are in tab completion for a dir and result was path change */ | |
146 gtk_editable_insert_text(GTK_EDITABLE(lw->path_entry), "/", -1, &pos); | |
147 gtk_editable_set_position(GTK_EDITABLE(lw->path_entry), | |
148 strlen(gtk_entry_get_text(GTK_ENTRY(lw->path_entry)))); | |
149 } | |
150 } | |
151 else if (lw->path && strcmp(lw->path, base) == 0) | |
152 { | |
153 layout_list_scroll_to_subpart(lw, filename_from_path(buf)); | |
154 } | |
155 | |
156 g_free(base); | |
157 g_free(buf); | |
158 } | |
159 | |
160 static void layout_path_entry_cb(const gchar *path, gpointer data) | |
161 { | |
162 LayoutWindow *lw = data; | |
163 gchar *buf; | |
164 | |
165 buf = g_strdup(path); | |
166 parse_out_relatives(buf); | |
167 | |
168 layout_set_path(lw, buf); | |
169 | |
170 g_free(buf); | |
171 } | |
172 | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
173 static void layout_vd_select_cb(ViewDir *vd, const gchar *path, gpointer data) |
9 | 174 { |
175 LayoutWindow *lw = data; | |
176 | |
177 layout_set_path(lw, path); | |
178 } | |
179 | |
180 static GtkWidget *layout_tool_setup(LayoutWindow *lw) | |
181 { | |
182 GtkWidget *box; | |
183 GtkWidget *menu_bar; | |
184 GtkWidget *tabcomp; | |
185 | |
186 box = gtk_vbox_new(FALSE, 0); | |
187 | |
188 menu_bar = layout_actions_menu_bar(lw); | |
189 gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, FALSE, 0); | |
190 gtk_widget_show(menu_bar); | |
191 | |
192 lw->toolbar = layout_button_bar(lw); | |
193 gtk_box_pack_start(GTK_BOX(box), lw->toolbar, FALSE, FALSE, 0); | |
194 if (!lw->toolbar_hidden) gtk_widget_show(lw->toolbar); | |
195 | |
196 tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1, | |
197 layout_path_entry_cb, lw); | |
198 tab_completion_add_tab_func(lw->path_entry, layout_path_entry_tab_cb, lw); | |
199 gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0); | |
200 gtk_widget_show(tabcomp); | |
201 | |
202 g_signal_connect(G_OBJECT(lw->path_entry->parent), "changed", | |
203 G_CALLBACK(layout_path_entry_changed_cb), lw); | |
204 | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
205 lw->vd = vd_new(lw->dir_view_type, lw->path); |
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
206 vd_set_layout(lw->vd, lw); |
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
207 vd_set_select_func(lw->vd, layout_vd_select_cb, lw); |
9 | 208 |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
209 lw->dir_view = lw->vd->widget; |
9 | 210 |
211 gtk_box_pack_start(GTK_BOX(box), lw->dir_view, TRUE, TRUE, 0); | |
212 gtk_widget_show(lw->dir_view); | |
213 | |
214 gtk_widget_show(box); | |
215 | |
216 return box; | |
217 } | |
218 | |
219 /* | |
220 *----------------------------------------------------------------------------- | |
221 * sort button (and menu) | |
222 *----------------------------------------------------------------------------- | |
223 */ | |
224 | |
225 static void layout_sort_menu_cb(GtkWidget *widget, gpointer data) | |
226 { | |
227 LayoutWindow *lw; | |
228 SortType type; | |
229 | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
230 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
231 |
9 | 232 lw = submenu_item_get_data(widget); |
233 if (!lw) return; | |
234 | |
235 type = (SortType)GPOINTER_TO_INT(data); | |
236 | |
237 layout_sort_set(lw, type, lw->sort_ascend); | |
238 } | |
239 | |
240 static void layout_sort_menu_ascend_cb(GtkWidget *widget, gpointer data) | |
241 { | |
242 LayoutWindow *lw = data; | |
243 | |
244 layout_sort_set(lw, lw->sort_method, !lw->sort_ascend); | |
245 } | |
246 | |
247 static void layout_sort_menu_hide_cb(GtkWidget *widget, gpointer data) | |
248 { | |
249 /* destroy the menu */ | |
250 gtk_widget_unref(GTK_WIDGET(widget)); | |
251 } | |
252 | |
253 static void layout_sort_button_press_cb(GtkWidget *widget, gpointer data) | |
254 { | |
255 LayoutWindow *lw = data; | |
256 GtkWidget *menu; | |
257 GdkEvent *event; | |
258 guint32 etime; | |
259 | |
260 menu = submenu_add_sort(NULL, G_CALLBACK(layout_sort_menu_cb), lw, FALSE, FALSE, TRUE, lw->sort_method); | |
261 | |
88
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
262 /* take ownership of menu */ |
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
263 #ifdef GTK_OBJECT_FLOATING |
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
264 /* GTK+ < 2.10 */ |
9 | 265 g_object_ref(G_OBJECT(menu)); |
266 gtk_object_sink(GTK_OBJECT(menu)); | |
88
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
267 #else |
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
268 /* GTK+ >= 2.10 */ |
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
269 g_object_ref_sink(G_OBJECT(menu)); |
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
270 #endif |
9 | 271 |
442 | 272 /* ascending option */ |
9 | 273 menu_item_add_divider(menu); |
274 menu_item_add_check(menu, _("Ascending"), lw->sort_ascend, G_CALLBACK(layout_sort_menu_ascend_cb), lw); | |
275 | |
276 g_signal_connect(G_OBJECT(menu), "selection_done", | |
277 G_CALLBACK(layout_sort_menu_hide_cb), NULL); | |
278 | |
279 event = gtk_get_current_event(); | |
280 if (event) | |
281 { | |
282 etime = gdk_event_get_time(event); | |
283 gdk_event_free(event); | |
284 } | |
285 else | |
286 { | |
287 etime = 0; | |
288 } | |
289 | |
290 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, etime); | |
291 } | |
292 | |
293 static GtkWidget *layout_sort_button(LayoutWindow *lw) | |
294 { | |
295 GtkWidget *button; | |
296 | |
297 button = gtk_button_new_with_label(sort_type_get_text(lw->sort_method)); | |
442 | 298 g_signal_connect(G_OBJECT(button), "clicked", |
9 | 299 G_CALLBACK(layout_sort_button_press_cb), lw); |
442 | 300 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
9 | 301 |
442 | 302 return button; |
9 | 303 } |
304 | |
305 /* | |
306 *----------------------------------------------------------------------------- | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
307 * color profile button (and menu) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
308 *----------------------------------------------------------------------------- |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
309 */ |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
310 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
311 static void layout_color_menu_enable_cb(GtkWidget *widget, gpointer data) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
312 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
313 LayoutWindow *lw = data; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
314 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
315 layout_image_color_profile_set_use(lw, (!layout_image_color_profile_get_use(lw))); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
316 layout_image_refresh(lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
317 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
318 |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
319 static void layout_color_menu_use_image_cb(GtkWidget *widget, gpointer data) |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
320 { |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
321 LayoutWindow *lw = data; |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
322 gint input, screen, use_image; |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
323 |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
324 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
325 layout_image_color_profile_set(lw, input, screen, !use_image); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
326 layout_image_refresh(lw); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
327 } |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
328 |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
329 #define COLOR_MENU_KEY "color_menu_key" |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
330 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
331 static void layout_color_menu_input_cb(GtkWidget *widget, gpointer data) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
332 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
333 LayoutWindow *lw = data; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
334 gint type; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
335 gint input, screen, use_image; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
336 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
337 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
338 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
339 type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), COLOR_MENU_KEY)); |
432 | 340 if (type < 0 || type >= COLOR_PROFILE_FILE + COLOR_PROFILE_INPUTS) return; |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
341 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
342 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
343 if (type == input) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
344 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
345 layout_image_color_profile_set(lw, type, screen, use_image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
346 layout_image_refresh(lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
347 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
348 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
349 static void layout_color_menu_screen_cb(GtkWidget *widget, gpointer data) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
350 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
351 LayoutWindow *lw = data; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
352 gint type; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
353 gint input, screen, use_image; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
354 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
355 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
356 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
357 type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), COLOR_MENU_KEY)); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
358 if (type < 0 || type > 1) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
359 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
360 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
361 if (type == screen) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
362 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
363 layout_image_color_profile_set(lw, input, type, use_image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
364 layout_image_refresh(lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
365 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
366 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
367 static gchar *layout_color_name_parse(const gchar *name) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
368 { |
269
dca6c0b9f862
Simplify layout_color_name_parse() using g_strdelimit().
zas_
parents:
268
diff
changeset
|
369 if (!name) return g_strdup(_("Empty")); |
dca6c0b9f862
Simplify layout_color_name_parse() using g_strdelimit().
zas_
parents:
268
diff
changeset
|
370 return g_strdelimit(g_strdup(name), "_", '-'); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
371 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
372 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
373 static void layout_color_button_press_cb(GtkWidget *widget, gpointer data) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
374 { |
288
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
375 #ifndef HAVE_LCMS |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
376 gchar *msg = g_strdup_printf(_("This installation of %s was not built with support for color profiles."), GQ_APPNAME); |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
377 file_util_warning_dialog(_("Color profiles not supported"), |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
378 msg, |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
379 GTK_STOCK_DIALOG_INFO, widget); |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
380 g_free(msg); |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
381 return; |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
382 #else |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
383 LayoutWindow *lw = data; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
384 GtkWidget *menu; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
385 GtkWidget *item; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
386 gchar *buf; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
387 gchar *front; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
388 gchar *end; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
389 gint active; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
390 gint input = 0; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
391 gint screen = 0; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
392 gint use_image = 0; |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
393 gint from_image = 0; |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
394 gint i; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
395 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
396 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
397 |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
398 from_image = use_image && (layout_image_color_profile_get_from_image(lw) != COLOR_PROFILE_NONE); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
399 menu = popup_menu_short_lived(); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
400 |
270 | 401 active = layout_image_color_profile_get_use(lw); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
402 menu_item_add_check(menu, _("Use _color profiles"), active, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
403 G_CALLBACK(layout_color_menu_enable_cb), lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
404 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
405 menu_item_add_divider(menu); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
406 |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
407 item = menu_item_add_check(menu, _("Use profile from _image"), use_image, |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
408 G_CALLBACK(layout_color_menu_use_image_cb), lw); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
409 gtk_widget_set_sensitive(item, active); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
410 |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
411 for (i = COLOR_PROFILE_SRGB; i < COLOR_PROFILE_FILE; i++) |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
412 { |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
413 front = g_strdup_printf(_("Input _%d:"), i); |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
414 buf = g_strdup_printf("%s %s", front, i == COLOR_PROFILE_SRGB ? _("sRGB") : _("AdobeRGB compatible")); |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
415 g_free(front); |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
416 item = menu_item_add_radio(menu, (i == 0) ? NULL : item, |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
417 buf, (input == i), |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
418 G_CALLBACK(layout_color_menu_input_cb), lw); |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
419 g_free(buf); |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
420 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i)); |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
421 gtk_widget_set_sensitive(item, active && !from_image); |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
422 } |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
423 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
424 for (i = 0; i < COLOR_PROFILE_INPUTS; i++) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
425 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
426 const gchar *name; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
427 |
327 | 428 name = options->color_profile.input_name[i]; |
429 if (!name) name = filename_from_path(options->color_profile.input_file[i]); | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
430 |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
431 front = g_strdup_printf(_("Input _%d:"), i + COLOR_PROFILE_FILE); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
432 end = layout_color_name_parse(name); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
433 buf = g_strdup_printf("%s %s", front, end); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
434 g_free(front); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
435 g_free(end); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
436 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
437 item = menu_item_add_radio(menu, item, |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
438 buf, (i + COLOR_PROFILE_FILE == input), |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
439 G_CALLBACK(layout_color_menu_input_cb), lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
440 g_free(buf); |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
441 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + COLOR_PROFILE_FILE)); |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
442 gtk_widget_set_sensitive(item, active && options->color_profile.input_file[i] && !from_image); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
443 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
444 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
445 menu_item_add_divider(menu); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
446 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
447 buf = g_strdup_printf("%s sRGB", _("Screen")); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
448 item = menu_item_add_radio(menu, NULL, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
449 buf, (screen == 0), |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
450 G_CALLBACK(layout_color_menu_screen_cb), lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
451 g_free(buf); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
452 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(0)); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
453 gtk_widget_set_sensitive(item, active); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
454 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
455 item = menu_item_add_radio(menu, item, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
456 _("_Screen profile"), (screen == 1), |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
457 G_CALLBACK(layout_color_menu_screen_cb), lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
458 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(1)); |
327 | 459 gtk_widget_set_sensitive(item, active && options->color_profile.screen_file); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
460 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
461 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME); |
288
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
462 #endif /* HAVE_LCMS */ |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
463 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
464 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
465 static GtkWidget *layout_color_button(LayoutWindow *lw) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
466 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
467 GtkWidget *button; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
468 GtkWidget *image; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
469 gint enable; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
470 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
471 button = gtk_button_new(); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
472 image = gtk_image_new_from_stock(GTK_STOCK_SELECT_COLOR, GTK_ICON_SIZE_MENU); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
473 gtk_container_add(GTK_CONTAINER(button), image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
474 gtk_widget_show(image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
475 g_signal_connect(G_OBJECT(button), "clicked", |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
476 G_CALLBACK(layout_color_button_press_cb), lw); |
268 | 477 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
478 |
268 | 479 #ifdef HAVE_LCMS |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
480 enable = (lw->image) ? lw->image->color_profile_enable : FALSE; |
268 | 481 #else |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
482 enable = FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
483 #endif |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
484 gtk_widget_set_sensitive(image, enable); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
485 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
486 return button; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
487 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
488 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
489 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
490 /* |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
491 *----------------------------------------------------------------------------- |
9 | 492 * status bar |
493 *----------------------------------------------------------------------------- | |
494 */ | |
495 | |
496 void layout_status_update_progress(LayoutWindow *lw, gdouble val, const gchar *text) | |
497 { | |
498 if (!layout_valid(&lw)) return; | |
499 if (!lw->info_progress_bar) return; | |
500 | |
501 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(lw->info_progress_bar), val); | |
502 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(lw->info_progress_bar), (text) ? text : " "); | |
503 } | |
504 | |
505 void layout_status_update_info(LayoutWindow *lw, const gchar *text) | |
506 { | |
507 gchar *buf = NULL; | |
508 | |
509 if (!layout_valid(&lw)) return; | |
510 | |
511 if (!text) | |
512 { | |
513 gint n; | |
514 gint64 n_bytes = 0; | |
515 gint s; | |
516 gint64 s_bytes = 0; | |
517 const gchar *ss; | |
518 | |
519 if (layout_image_slideshow_active(lw)) | |
520 { | |
521 if (!layout_image_slideshow_paused(lw)) | |
522 { | |
523 ss = _(" Slideshow"); | |
524 } | |
525 else | |
526 { | |
527 ss = _(" Paused"); | |
528 } | |
529 } | |
530 else | |
531 { | |
532 ss = ""; | |
533 } | |
534 | |
535 n = layout_list_count(lw, &n_bytes); | |
536 s = layout_selection_count(lw, &s_bytes); | |
537 | |
538 layout_bars_new_selection(lw, s); | |
539 | |
540 if (s > 0) | |
541 { | |
268 | 542 gchar *b = text_from_size_abrev(n_bytes); |
543 gchar *sb = text_from_size_abrev(s_bytes); | |
9 | 544 buf = g_strdup_printf(_("%s, %d files (%s, %d)%s"), b, n, sb, s, ss); |
545 g_free(b); | |
546 g_free(sb); | |
547 } | |
548 else if (n > 0) | |
549 { | |
268 | 550 gchar *b = text_from_size_abrev(n_bytes); |
9 | 551 buf = g_strdup_printf(_("%s, %d files%s"), b, n, ss); |
552 g_free(b); | |
553 } | |
554 else | |
555 { | |
556 buf = g_strdup_printf(_("%d files%s"), n, ss); | |
557 } | |
558 | |
559 text = buf; | |
560 | |
561 layout_image_overlay_update(lw); | |
562 } | |
563 | |
564 gtk_label_set_text(GTK_LABEL(lw->info_status), text); | |
565 g_free(buf); | |
566 } | |
567 | |
568 void layout_status_update_image(LayoutWindow *lw) | |
569 { | |
570 gchar *text; | |
571 gchar *b; | |
572 | |
573 if (!layout_valid(&lw) || !lw->image) return; | |
574 | |
575 text = image_zoom_get_as_text(lw->image); | |
576 gtk_label_set_text(GTK_LABEL(lw->info_zoom), text); | |
577 g_free(text); | |
578 | |
579 b = text_from_size(lw->image->size); | |
580 | |
581 if (lw->image->unknown) | |
582 { | |
583 if (image_get_path(lw->image) && !access_file(image_get_path(lw->image), R_OK)) | |
584 { | |
585 text = g_strdup_printf(_("(no read permission) %s bytes"), b); | |
586 } | |
587 else | |
588 { | |
589 text = g_strdup_printf(_("( ? x ? ) %s bytes"), b); | |
590 } | |
591 } | |
592 else | |
593 { | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
594 gint width, height; |
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
595 |
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
596 pixbuf_renderer_get_image_size(PIXBUF_RENDERER(lw->image->pr), &width, &height); |
9 | 597 text = g_strdup_printf(_("( %d x %d ) %s bytes"), |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
598 width, height, b); |
9 | 599 } |
600 | |
601 gtk_label_set_text(GTK_LABEL(lw->info_details), text); | |
602 | |
603 g_free(b); | |
604 g_free(text); | |
605 } | |
606 | |
607 void layout_status_update_all(LayoutWindow *lw) | |
608 { | |
609 layout_status_update_progress(lw, 0.0, NULL); | |
610 layout_status_update_info(lw, NULL); | |
611 layout_status_update_image(lw); | |
612 } | |
613 | |
614 static GtkWidget *layout_status_label(gchar *text, GtkWidget *box, gint start, gint size, gint expand) | |
615 { | |
616 GtkWidget *label; | |
617 GtkWidget *frame; | |
618 | |
619 frame = gtk_frame_new(NULL); | |
620 if (size) gtk_widget_set_size_request(frame, size, -1); | |
621 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
622 if (start) | |
623 { | |
624 gtk_box_pack_start(GTK_BOX(box), frame, expand, expand, 0); | |
625 } | |
626 else | |
627 { | |
628 gtk_box_pack_end(GTK_BOX(box), frame, expand, expand, 0); | |
629 } | |
630 gtk_widget_show(frame); | |
631 | |
632 label = gtk_label_new(text ? text : ""); | |
633 gtk_container_add(GTK_CONTAINER(frame), label); | |
634 gtk_widget_show(label); | |
635 | |
636 return label; | |
637 } | |
638 | |
639 static void layout_status_setup(LayoutWindow *lw, GtkWidget *box, gint small_format) | |
640 { | |
641 GtkWidget *hbox; | |
642 | |
643 if (lw->info_box) return; | |
644 | |
645 if (small_format) | |
646 { | |
647 lw->info_box = gtk_vbox_new(FALSE, 0); | |
648 } | |
649 else | |
650 { | |
651 lw->info_box = gtk_hbox_new(FALSE, 0); | |
652 } | |
653 gtk_box_pack_end(GTK_BOX(box), lw->info_box, FALSE, FALSE, 0); | |
654 gtk_widget_show(lw->info_box); | |
655 | |
656 if (small_format) | |
657 { | |
658 hbox = gtk_hbox_new(FALSE, 0); | |
659 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0); | |
660 gtk_widget_show(hbox); | |
661 } | |
662 else | |
663 { | |
664 hbox = lw->info_box; | |
665 } | |
666 lw->info_progress_bar = gtk_progress_bar_new(); | |
667 gtk_widget_set_size_request(lw->info_progress_bar, PROGRESS_WIDTH, -1); | |
668 gtk_box_pack_start(GTK_BOX(hbox), lw->info_progress_bar, FALSE, FALSE, 0); | |
669 gtk_widget_show(lw->info_progress_bar); | |
670 | |
671 lw->info_sort = layout_sort_button(lw); | |
672 gtk_box_pack_start(GTK_BOX(hbox), lw->info_sort, FALSE, FALSE, 0); | |
673 gtk_widget_show(lw->info_sort); | |
674 | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
675 lw->info_color = layout_color_button(lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
676 gtk_widget_show(lw->info_color); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
677 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
678 if (small_format) gtk_box_pack_end(GTK_BOX(hbox), lw->info_color, FALSE, FALSE, 0); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
679 |
9 | 680 lw->info_status = layout_status_label(NULL, lw->info_box, TRUE, 0, (!small_format)); |
681 | |
682 if (small_format) | |
683 { | |
684 hbox = gtk_hbox_new(FALSE, 0); | |
685 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0); | |
686 gtk_widget_show(hbox); | |
687 } | |
688 else | |
689 { | |
690 hbox = lw->info_box; | |
691 } | |
692 lw->info_details = layout_status_label(NULL, hbox, TRUE, 0, TRUE); | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
693 if (!small_format) gtk_box_pack_start(GTK_BOX(hbox), lw->info_color, FALSE, FALSE, 0); |
9 | 694 lw->info_zoom = layout_status_label(NULL, hbox, FALSE, ZOOM_LABEL_WIDTH, FALSE); |
695 } | |
696 | |
697 /* | |
698 *----------------------------------------------------------------------------- | |
699 * views | |
700 *----------------------------------------------------------------------------- | |
701 */ | |
702 | |
703 static GtkWidget *layout_tools_new(LayoutWindow *lw) | |
704 { | |
705 lw->dir_view = layout_tool_setup(lw); | |
706 return lw->dir_view; | |
707 } | |
708 | |
709 static void layout_list_status_cb(ViewFileList *vfl, gpointer data) | |
710 { | |
711 LayoutWindow *lw = data; | |
712 | |
713 layout_status_update_info(lw, NULL); | |
714 } | |
715 | |
716 static void layout_list_thumb_cb(ViewFileList *vfl, gdouble val, const gchar *text, gpointer data) | |
717 { | |
718 LayoutWindow *lw = data; | |
719 | |
720 layout_status_update_progress(lw, val, text); | |
721 } | |
722 | |
723 static void layout_icon_status_cb(ViewFileIcon *vfi, gpointer data) | |
724 { | |
268 | 725 LayoutWindow *lw = data; |
9 | 726 |
268 | 727 layout_status_update_info(lw, NULL); |
9 | 728 } |
729 | |
730 static void layout_icon_thumb_cb(ViewFileIcon *vfi, gdouble val, const gchar *text, gpointer data) | |
731 { | |
268 | 732 LayoutWindow *lw = data; |
9 | 733 |
268 | 734 layout_status_update_progress(lw, val, text); |
9 | 735 } |
736 | |
737 static GtkWidget *layout_list_new(LayoutWindow *lw) | |
738 { | |
739 if (lw->icon_view) | |
740 { | |
741 lw->vfi = vficon_new(NULL); | |
742 vficon_set_layout(lw->vfi, lw); | |
743 | |
744 vficon_set_status_func(lw->vfi, layout_icon_status_cb, lw); | |
745 vficon_set_thumb_status_func(lw->vfi, layout_icon_thumb_cb, lw); | |
166 | 746 /* FIXME vficon_marks_set(lw->vfi, lw->marks_enabled); */ |
9 | 747 |
748 return lw->vfi->widget; | |
749 } | |
750 | |
751 lw->vfl = vflist_new(NULL, lw->thumbs_enabled); | |
752 vflist_set_layout(lw->vfl, lw); | |
753 | |
754 vflist_set_status_func(lw->vfl, layout_list_status_cb, lw); | |
755 vflist_set_thumb_status_func(lw->vfl, layout_list_thumb_cb, lw); | |
756 | |
166 | 757 vflist_marks_set(lw->vfl, lw->marks_enabled); |
442 | 758 |
9 | 759 return lw->vfl->widget; |
760 } | |
761 | |
762 static void layout_list_sync_thumb(LayoutWindow *lw) | |
763 { | |
764 if (lw->vfl) vflist_thumb_set(lw->vfl, lw->thumbs_enabled); | |
765 } | |
766 | |
132 | 767 static void layout_list_sync_marks(LayoutWindow *lw) |
768 { | |
769 if (lw->vfl) vflist_marks_set(lw->vfl, lw->marks_enabled); | |
770 } | |
771 | |
9 | 772 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle) |
773 { | |
774 if (!lw) return; | |
775 #if 0 | |
776 if (lw->vfl) vflist_scroll_to_subpart(lw->vfl, needle); | |
777 if (lw->vfi) vficon_scroll_to_subpart(lw->vfi, needle); | |
778 #endif | |
779 } | |
780 | |
781 GList *layout_list(LayoutWindow *lw) | |
782 { | |
783 if (!layout_valid(&lw)) return NULL; | |
784 | |
785 if (lw->vfl) return vflist_get_list(lw->vfl); | |
786 if (lw->vfi) return vficon_get_list(lw->vfi); | |
787 | |
788 return NULL; | |
789 } | |
790 | |
791 gint layout_list_count(LayoutWindow *lw, gint64 *bytes) | |
792 { | |
793 if (!layout_valid(&lw)) return 0; | |
794 | |
795 if (lw->vfl) return vflist_count(lw->vfl, bytes); | |
796 if (lw->vfi) return vficon_count(lw->vfi, bytes); | |
797 | |
798 return 0; | |
799 } | |
800 | |
801 const gchar *layout_list_get_path(LayoutWindow *lw, gint index) | |
802 { | |
803 if (!layout_valid(&lw)) return NULL; | |
804 | |
805 if (lw->vfl) return vflist_index_get_path(lw->vfl, index); | |
806 if (lw->vfi) return vficon_index_get_path(lw->vfi, index); | |
807 | |
808 return NULL; | |
809 } | |
810 | |
138 | 811 FileData *layout_list_get_fd(LayoutWindow *lw, gint index) |
812 { | |
813 if (!layout_valid(&lw)) return NULL; | |
814 | |
815 if (lw->vfl) return vflist_index_get_data(lw->vfl, index); | |
816 if (lw->vfi) return vficon_index_get_data(lw->vfi, index); | |
817 | |
818 return NULL; | |
819 } | |
820 | |
9 | 821 gint layout_list_get_index(LayoutWindow *lw, const gchar *path) |
822 { | |
823 if (!layout_valid(&lw)) return -1; | |
824 | |
825 if (lw->vfl) return vflist_index_by_path(lw->vfl, path); | |
826 if (lw->vfi) return vficon_index_by_path(lw->vfi, path); | |
827 | |
828 return -1; | |
829 } | |
830 | |
138 | 831 void layout_list_sync_fd(LayoutWindow *lw, FileData *fd) |
9 | 832 { |
833 if (!layout_valid(&lw)) return; | |
834 | |
138 | 835 if (lw->vfl) vflist_select_by_fd(lw->vfl, fd); |
836 if (lw->vfi) vficon_select_by_fd(lw->vfi, fd); | |
9 | 837 } |
838 | |
839 static void layout_list_sync_sort(LayoutWindow *lw) | |
840 { | |
841 if (!layout_valid(&lw)) return; | |
842 | |
843 if (lw->vfl) vflist_sort_set(lw->vfl, lw->sort_method, lw->sort_ascend); | |
844 if (lw->vfi) vficon_sort_set(lw->vfi, lw->sort_method, lw->sort_ascend); | |
845 } | |
846 | |
847 GList *layout_selection_list(LayoutWindow *lw) | |
848 { | |
849 if (!layout_valid(&lw)) return NULL; | |
850 | |
851 if (layout_image_get_collection(lw, NULL)) | |
852 { | |
138 | 853 FileData *fd; |
9 | 854 |
138 | 855 fd = layout_image_get_fd(lw); |
856 if (fd) return g_list_append(NULL, file_data_ref(fd)); | |
9 | 857 return NULL; |
858 } | |
859 | |
860 if (lw->vfl) return vflist_selection_get_list(lw->vfl); | |
861 if (lw->vfi) return vficon_selection_get_list(lw->vfi); | |
862 | |
863 return NULL; | |
864 } | |
865 | |
866 GList *layout_selection_list_by_index(LayoutWindow *lw) | |
867 { | |
868 if (!layout_valid(&lw)) return NULL; | |
869 | |
870 if (lw->vfl) return vflist_selection_get_list_by_index(lw->vfl); | |
871 if (lw->vfi) return vficon_selection_get_list_by_index(lw->vfi); | |
872 | |
873 return NULL; | |
874 } | |
875 | |
876 gint layout_selection_count(LayoutWindow *lw, gint64 *bytes) | |
877 { | |
878 if (!layout_valid(&lw)) return 0; | |
879 | |
880 if (lw->vfl) return vflist_selection_count(lw->vfl, bytes); | |
881 if (lw->vfi) return vficon_selection_count(lw->vfi, bytes); | |
882 | |
883 return 0; | |
884 } | |
885 | |
886 void layout_select_all(LayoutWindow *lw) | |
887 { | |
888 if (!layout_valid(&lw)) return; | |
889 | |
890 if (lw->vfl) vflist_select_all(lw->vfl); | |
891 if (lw->vfi) vficon_select_all(lw->vfi); | |
892 } | |
893 | |
894 void layout_select_none(LayoutWindow *lw) | |
895 { | |
896 if (!layout_valid(&lw)) return; | |
897 | |
898 if (lw->vfl) vflist_select_none(lw->vfl); | |
899 if (lw->vfi) vficon_select_none(lw->vfi); | |
900 } | |
901 | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
902 void layout_mark_to_selection(LayoutWindow *lw, gint mark, MarkToSelectionMode mode) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
903 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
904 if (!layout_valid(&lw)) return; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
905 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
906 if (lw->vfl) vflist_mark_to_selection(lw->vfl, mark, mode); |
165 | 907 if (lw->vfi) vficon_mark_to_selection(lw->vfi, mark, mode); |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
908 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
909 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
910 void layout_selection_to_mark(LayoutWindow *lw, gint mark, SelectionToMarkMode mode) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
911 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
912 if (!layout_valid(&lw)) return; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
913 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
914 if (lw->vfl) vflist_selection_to_mark(lw->vfl, mark, mode); |
165 | 915 if (lw->vfi) vficon_selection_to_mark(lw->vfi, mark, mode); |
442 | 916 |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
917 layout_status_update_info(lw, NULL); /* osd in fullscreen mode */ |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
918 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
919 |
9 | 920 /* |
921 *----------------------------------------------------------------------------- | |
922 * access | |
923 *----------------------------------------------------------------------------- | |
924 */ | |
925 | |
926 const gchar *layout_get_path(LayoutWindow *lw) | |
927 { | |
928 if (!layout_valid(&lw)) return NULL; | |
929 return lw->path; | |
930 } | |
931 | |
932 static void layout_sync_path(LayoutWindow *lw) | |
933 { | |
934 if (!lw->path) return; | |
935 | |
936 lw->last_time = filetime(lw->path); | |
937 | |
938 gtk_entry_set_text(GTK_ENTRY(lw->path_entry), lw->path); | |
390 | 939 if (lw->vd) vd_set_path(lw->vd, lw->path); |
9 | 940 |
941 if (lw->vfl) vflist_set_path(lw->vfl, lw->path); | |
942 if (lw->vfi) vficon_set_path(lw->vfi, lw->path); | |
943 } | |
944 | |
945 gint layout_set_path(LayoutWindow *lw, const gchar *path) | |
946 { | |
947 gint have_file = FALSE; | |
948 | |
949 if (!layout_valid(&lw)) return FALSE; | |
950 | |
951 if (!path || !isname(path)) return FALSE; | |
952 if (lw->path && path && strcmp(path, lw->path) == 0) | |
953 { | |
954 return TRUE; | |
955 } | |
956 | |
957 if (isdir(path)) | |
958 { | |
959 g_free(lw->path); | |
960 lw->path = g_strdup(path); | |
961 } | |
962 else | |
963 { | |
964 gchar *base; | |
965 | |
966 base = remove_level_from_path(path); | |
967 if (lw->path && strcmp(lw->path, base) == 0) | |
968 { | |
969 g_free(base); | |
970 } | |
971 else if (isdir(base)) | |
972 { | |
973 g_free(lw->path); | |
974 lw->path = base; | |
975 } | |
976 else | |
977 { | |
978 g_free(base); | |
979 return FALSE; | |
980 } | |
981 if (isfile(path)) have_file = TRUE; | |
982 } | |
983 | |
984 if (lw->path_entry) tab_completion_append_to_history(lw->path_entry, lw->path); | |
985 layout_sync_path(lw); | |
986 | |
987 if (have_file) | |
988 { | |
989 gint row; | |
990 | |
991 row = layout_list_get_index(lw, path); | |
992 if (row >= 0) | |
993 { | |
994 layout_image_set_index(lw, row); | |
995 } | |
996 else | |
997 { | |
138 | 998 layout_image_set_fd(lw, file_data_new_simple(path)); |
9 | 999 } |
1000 } | |
320 | 1001 else if (!options->lazy_image_sync) |
9 | 1002 { |
1003 layout_image_set_index(lw, 0); | |
1004 } | |
1005 | |
1006 return TRUE; | |
1007 } | |
1008 | |
1009 static void layout_refresh_lists(LayoutWindow *lw) | |
1010 { | |
1011 if (lw->path) lw->last_time = filetime(lw->path); | |
1012 | |
390 | 1013 if (lw->vd) vd_refresh(lw->vd); |
9 | 1014 |
1015 if (lw->vfl) vflist_refresh(lw->vfl); | |
1016 if (lw->vfi) vficon_refresh(lw->vfi); | |
1017 } | |
1018 | |
1019 static void layout_refresh_by_time(LayoutWindow *lw) | |
1020 { | |
1021 layout_refresh_lists(lw); | |
1022 | |
1023 if (lw->image && filetime(layout_image_get_path(lw)) >= lw->last_time) | |
1024 { | |
1025 layout_image_refresh(lw); | |
1026 } | |
1027 } | |
1028 | |
1029 void layout_refresh(LayoutWindow *lw) | |
1030 { | |
1031 if (!layout_valid(&lw)) return; | |
1032 | |
1033 if (debug) printf("layout refresh\n"); | |
1034 | |
1035 layout_refresh_lists(lw); | |
1036 | |
1037 if (lw->image) layout_image_refresh(lw); | |
1038 } | |
1039 | |
1040 static gint layout_check_for_update_cb(gpointer data) | |
1041 { | |
1042 LayoutWindow *lw = data; | |
1043 | |
320 | 1044 if (!options->update_on_time_change) return TRUE; |
9 | 1045 |
1046 if (lw->path) | |
1047 { | |
1048 time_t new_time; | |
1049 | |
1050 new_time = filetime(lw->path); | |
1051 | |
1052 if (new_time > 0 && new_time > lw->last_time) | |
1053 { | |
1054 if (debug) printf("layout path time changed, refreshing...\n"); | |
1055 layout_refresh_by_time(lw); | |
1056 } | |
1057 } | |
1058 | |
1059 return TRUE; | |
1060 } | |
1061 | |
1062 void layout_thumb_set(LayoutWindow *lw, gint enable) | |
1063 { | |
1064 if (!layout_valid(&lw)) return; | |
1065 | |
1066 if (lw->thumbs_enabled == enable) return; | |
1067 | |
1068 lw->thumbs_enabled = enable; | |
1069 | |
1070 layout_util_sync_thumb(lw); | |
1071 layout_list_sync_thumb(lw); | |
1072 } | |
1073 | |
132 | 1074 void layout_marks_set(LayoutWindow *lw, gint enable) |
1075 { | |
1076 if (!layout_valid(&lw)) return; | |
1077 | |
1078 if (lw->marks_enabled == enable) return; | |
1079 | |
1080 lw->marks_enabled = enable; | |
1081 | |
268 | 1082 // layout_util_sync_marks(lw); |
1083 layout_list_sync_marks(lw); | |
132 | 1084 } |
1085 | |
9 | 1086 gint layout_thumb_get(LayoutWindow *lw) |
1087 { | |
1088 if (!layout_valid(&lw)) return FALSE; | |
1089 | |
1090 return lw->thumbs_enabled; | |
1091 } | |
1092 | |
433
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1093 gint layout_marks_get(LayoutWindow *lw) |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1094 { |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1095 if (!layout_valid(&lw)) return FALSE; |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1096 |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1097 return lw->marks_enabled; |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1098 } |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1099 |
9 | 1100 void layout_sort_set(LayoutWindow *lw, SortType type, gint ascend) |
1101 { | |
1102 if (!layout_valid(&lw)) return; | |
1103 if (lw->sort_method == type && lw->sort_ascend == ascend) return; | |
1104 | |
1105 lw->sort_method = type; | |
1106 lw->sort_ascend = ascend; | |
1107 | |
1108 if (lw->info_sort) gtk_label_set_text(GTK_LABEL(GTK_BIN(lw->info_sort)->child), | |
1109 sort_type_get_text(type)); | |
1110 layout_list_sync_sort(lw); | |
1111 } | |
1112 | |
1113 gint layout_sort_get(LayoutWindow *lw, SortType *type, gint *ascend) | |
1114 { | |
1115 if (!layout_valid(&lw)) return FALSE; | |
1116 | |
1117 if (type) *type = lw->sort_method; | |
1118 if (ascend) *ascend = lw->sort_ascend; | |
1119 | |
1120 return TRUE; | |
1121 } | |
1122 | |
1123 gint layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h) | |
1124 { | |
1125 if (!layout_valid(&lw)) return FALSE; | |
1126 | |
1127 gdk_window_get_root_origin(lw->window->window, x, y); | |
1128 gdk_drawable_get_size(lw->window->window, w, h); | |
1129 | |
1130 return TRUE; | |
1131 } | |
1132 | |
1133 gint layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v) | |
1134 { | |
1135 if (!layout_valid(&lw)) return FALSE; | |
1136 | |
1137 if (lw->h_pane && GTK_PANED(lw->h_pane)->child1->allocation.x >= 0) | |
1138 { | |
1139 *h = GTK_PANED(lw->h_pane)->child1->allocation.width; | |
1140 } | |
1141 else if (h != &lw->div_h) | |
1142 { | |
1143 *h = lw->div_h; | |
1144 } | |
1145 | |
1146 if (lw->v_pane && GTK_PANED(lw->v_pane)->child1->allocation.x >= 0) | |
1147 { | |
1148 *v = GTK_PANED(lw->v_pane)->child1->allocation.height; | |
1149 } | |
1150 else if (v != &lw->div_v) | |
1151 { | |
1152 *v = lw->div_v; | |
1153 } | |
1154 | |
1155 return TRUE; | |
1156 } | |
1157 | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
1158 void layout_views_set(LayoutWindow *lw, DirViewType type, gint icons) |
9 | 1159 { |
1160 if (!layout_valid(&lw)) return; | |
1161 | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
1162 if (lw->dir_view_type == type && lw->icon_view == icons) return; |
9 | 1163 |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
1164 lw->dir_view_type = type; |
9 | 1165 lw->icon_view = icons; |
1166 | |
1167 layout_style_set(lw, -1, NULL); | |
1168 } | |
1169 | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
1170 gint layout_views_get(LayoutWindow *lw, DirViewType *type, gint *icons) |
9 | 1171 { |
1172 if (!layout_valid(&lw)) return FALSE; | |
1173 | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
1174 *type = lw->dir_view_type; |
9 | 1175 *icons = lw->icon_view; |
1176 | |
1177 return TRUE; | |
1178 } | |
1179 | |
1180 /* | |
1181 *----------------------------------------------------------------------------- | |
1182 * location utils | |
1183 *----------------------------------------------------------------------------- | |
1184 */ | |
1185 | |
1186 static gint layout_location_single(LayoutLocation l) | |
1187 { | |
1188 return (l == LAYOUT_LEFT || | |
1189 l == LAYOUT_RIGHT || | |
1190 l == LAYOUT_TOP || | |
1191 l == LAYOUT_BOTTOM); | |
1192 } | |
1193 | |
1194 static gint layout_location_vertical(LayoutLocation l) | |
1195 { | |
1196 return (l & LAYOUT_TOP || | |
1197 l & LAYOUT_BOTTOM); | |
1198 } | |
1199 | |
1200 static gint layout_location_first(LayoutLocation l) | |
1201 { | |
1202 return (l & LAYOUT_TOP || | |
1203 l & LAYOUT_LEFT); | |
1204 } | |
1205 | |
1206 static LayoutLocation layout_grid_compass(LayoutWindow *lw) | |
1207 { | |
1208 if (layout_location_single(lw->dir_location)) return lw->dir_location; | |
1209 if (layout_location_single(lw->file_location)) return lw->file_location; | |
1210 return lw->image_location; | |
1211 } | |
1212 | |
1213 static void layout_location_compute(LayoutLocation l1, LayoutLocation l2, | |
1214 GtkWidget *s1, GtkWidget *s2, | |
1215 GtkWidget **d1, GtkWidget **d2) | |
1216 { | |
1217 LayoutLocation l; | |
1218 | |
1219 l = l1 & l2; /* get common compass direction */ | |
1220 l = l1 - l; /* remove it */ | |
1221 | |
1222 if (layout_location_first(l)) | |
1223 { | |
1224 *d1 = s1; | |
1225 *d2 = s2; | |
1226 } | |
1227 else | |
1228 { | |
1229 *d1 = s2; | |
1230 *d2 = s1; | |
1231 } | |
1232 } | |
1233 | |
1234 /* | |
1235 *----------------------------------------------------------------------------- | |
1236 * tools window (for floating/hidden) | |
1237 *----------------------------------------------------------------------------- | |
1238 */ | |
1239 | |
1240 gint layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos) | |
1241 { | |
1242 if (!layout_valid(&lw)) return FALSE; | |
1243 | |
1244 if (!lw->tools || !GTK_WIDGET_VISIBLE(lw->tools)) | |
1245 { | |
1246 /* use the stored values (sort of breaks success return value) */ | |
1247 | |
1248 *divider_pos = lw->div_float; | |
1249 | |
1250 return FALSE; | |
1251 } | |
1252 | |
1253 gdk_window_get_root_origin(lw->tools->window, x, y); | |
1254 gdk_drawable_get_size(lw->tools->window, w, h); | |
1255 | |
1256 if (GTK_IS_VPANED(lw->tools_pane)) | |
1257 { | |
1258 *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.height; | |
1259 } | |
1260 else | |
1261 { | |
1262 *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.width; | |
1263 } | |
1264 | |
1265 return TRUE; | |
1266 } | |
1267 | |
1268 static void layout_tools_geometry_sync(LayoutWindow *lw) | |
1269 { | |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1270 layout_geometry_get_tools(lw, &options->layout.float_window.x, &options->layout.float_window.x, |
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1271 &options->layout.float_window.w, &options->layout.float_window.h, &lw->div_float); |
9 | 1272 } |
1273 | |
1274 static void layout_tools_hide(LayoutWindow *lw, gint hide) | |
1275 { | |
1276 if (!lw->tools) return; | |
1277 | |
1278 if (hide) | |
1279 { | |
1280 if (GTK_WIDGET_VISIBLE(lw->tools)) | |
1281 { | |
1282 layout_tools_geometry_sync(lw); | |
1283 gtk_widget_hide(lw->tools); | |
1284 } | |
1285 } | |
1286 else | |
1287 { | |
1288 if (!GTK_WIDGET_VISIBLE(lw->tools)) | |
1289 { | |
1290 gtk_widget_show(lw->tools); | |
1291 if (lw->vfi) vficon_refresh(lw->vfi); | |
1292 } | |
1293 } | |
1294 | |
1295 lw->tools_hidden = hide; | |
1296 } | |
1297 | |
1298 static gint layout_tools_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) | |
1299 { | |
1300 LayoutWindow *lw = data; | |
1301 | |
1302 layout_tools_float_toggle(lw); | |
1303 | |
1304 return TRUE; | |
1305 } | |
1306 | |
1307 static void layout_tools_setup(LayoutWindow *lw, GtkWidget *tools, GtkWidget *files) | |
1308 { | |
1309 GtkWidget *vbox; | |
1310 GtkWidget *w1, *w2; | |
1311 gint vertical; | |
1312 gint new_window = FALSE; | |
1313 | |
1314 vertical = (layout_location_single(lw->image_location) && !layout_location_vertical(lw->image_location)) || | |
1315 (!layout_location_single(lw->image_location) && layout_location_vertical(layout_grid_compass(lw))); | |
1316 #if 0 | |
1317 layout_location_compute(lw->dir_location, lw->file_location, | |
1318 tools, files, &w1, &w2); | |
1319 #endif | |
1320 /* for now, tools/dir are always first in order */ | |
1321 w1 = tools; | |
1322 w2 = files; | |
1323 | |
1324 if (!lw->tools) | |
1325 { | |
1326 GdkGeometry geometry; | |
1327 GdkWindowHints hints; | |
1328 | |
289
6a7298988a7a
Simplify and unify gtk_window creation with the help of
zas_
parents:
288
diff
changeset
|
1329 lw->tools = window_new(GTK_WINDOW_TOPLEVEL, "tools", PIXBUF_INLINE_ICON_TOOLS, NULL, _("Tools")); |
9 | 1330 g_signal_connect(G_OBJECT(lw->tools), "delete_event", |
1331 G_CALLBACK(layout_tools_delete_cb), lw); | |
1332 layout_keyboard_init(lw, lw->tools); | |
1333 | |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1334 if (options->layout.save_window_positions) |
9 | 1335 { |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1336 hints = GDK_HINT_USER_POS; |
9 | 1337 } |
1338 else | |
1339 { | |
1340 hints = 0; | |
1341 } | |
1342 | |
1343 geometry.min_width = 32; | |
1344 geometry.min_height = 32; | |
1345 geometry.base_width = TOOLWINDOW_DEF_WIDTH; | |
1346 geometry.base_height = TOOLWINDOW_DEF_HEIGHT; | |
1347 gtk_window_set_geometry_hints(GTK_WINDOW(lw->tools), NULL, &geometry, | |
1348 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hints); | |
1349 | |
1350 | |
268 | 1351 gtk_window_set_resizable(GTK_WINDOW(lw->tools), TRUE); |
1352 gtk_container_set_border_width(GTK_CONTAINER(lw->tools), 0); | |
442 | 1353 |
9 | 1354 new_window = TRUE; |
1355 } | |
1356 else | |
1357 { | |
1358 layout_tools_geometry_sync(lw); | |
1359 /* dump the contents */ | |
1360 gtk_widget_destroy(GTK_BIN(lw->tools)->child); | |
1361 } | |
1362 | |
1363 layout_actions_add_window(lw, lw->tools); | |
1364 | |
1365 vbox = gtk_vbox_new(FALSE, 0); | |
1366 gtk_container_add(GTK_CONTAINER(lw->tools), vbox); | |
1367 gtk_widget_show(vbox); | |
1368 | |
1369 layout_status_setup(lw, vbox, TRUE); | |
1370 | |
1371 if (vertical) | |
1372 { | |
1373 lw->tools_pane = gtk_vpaned_new(); | |
1374 } | |
1375 else | |
1376 { | |
1377 lw->tools_pane = gtk_hpaned_new(); | |
1378 } | |
1379 gtk_box_pack_start(GTK_BOX(vbox), lw->tools_pane, TRUE, TRUE, 0); | |
1380 gtk_widget_show(lw->tools_pane); | |
1381 | |
1382 gtk_paned_pack1(GTK_PANED(lw->tools_pane), w1, FALSE, TRUE); | |
1383 gtk_paned_pack2(GTK_PANED(lw->tools_pane), w2, TRUE, TRUE); | |
1384 | |
1385 gtk_widget_show(tools); | |
1386 gtk_widget_show(files); | |
1387 | |
1388 if (new_window) | |
1389 { | |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1390 if (options->layout.save_window_positions) |
9 | 1391 { |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1392 gtk_window_set_default_size(GTK_WINDOW(lw->tools), options->layout.float_window.w, options->layout.float_window.h); |
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1393 gtk_window_move(GTK_WINDOW(lw->tools), options->layout.float_window.x, options->layout.float_window.y); |
268 | 1394 } |
9 | 1395 else |
1396 { | |
1397 if (vertical) | |
1398 { | |
1399 gtk_window_set_default_size(GTK_WINDOW(lw->tools), | |
1400 TOOLWINDOW_DEF_WIDTH, TOOLWINDOW_DEF_HEIGHT); | |
1401 } | |
1402 else | |
1403 { | |
1404 gtk_window_set_default_size(GTK_WINDOW(lw->tools), | |
1405 TOOLWINDOW_DEF_HEIGHT, TOOLWINDOW_DEF_WIDTH); | |
1406 } | |
1407 } | |
1408 } | |
1409 | |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1410 if (!options->layout.save_window_positions) |
9 | 1411 { |
1412 if (vertical) | |
1413 { | |
1414 lw->div_float = MAIN_WINDOW_DIV_VPOS; | |
1415 } | |
1416 else | |
1417 { | |
1418 lw->div_float = MAIN_WINDOW_DIV_HPOS; | |
1419 } | |
1420 } | |
1421 | |
1422 gtk_paned_set_position(GTK_PANED(lw->tools_pane), lw->div_float); | |
1423 } | |
1424 | |
1425 /* | |
1426 *----------------------------------------------------------------------------- | |
1427 * glue (layout arrangement) | |
1428 *----------------------------------------------------------------------------- | |
1429 */ | |
1430 | |
1431 static void layout_grid_compute(LayoutWindow *lw, | |
1432 GtkWidget *image, GtkWidget *tools, GtkWidget *files, | |
1433 GtkWidget **w1, GtkWidget **w2, GtkWidget **w3) | |
1434 { | |
1435 /* heh, this was fun */ | |
1436 | |
1437 if (layout_location_single(lw->dir_location)) | |
1438 { | |
1439 if (layout_location_first(lw->dir_location)) | |
1440 { | |
1441 *w1 = tools; | |
1442 layout_location_compute(lw->file_location, lw->image_location, files, image, w2, w3); | |
1443 } | |
1444 else | |
1445 { | |
1446 *w3 = tools; | |
1447 layout_location_compute(lw->file_location, lw->image_location, files, image, w1, w2); | |
1448 } | |
1449 } | |
1450 else if (layout_location_single(lw->file_location)) | |
1451 { | |
1452 if (layout_location_first(lw->file_location)) | |
1453 { | |
1454 *w1 = files; | |
1455 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w2, w3); | |
1456 } | |
1457 else | |
1458 { | |
1459 *w3 = files; | |
1460 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w1, w2); | |
1461 } | |
1462 } | |
1463 else | |
1464 { | |
1465 /* image */ | |
1466 if (layout_location_first(lw->image_location)) | |
1467 { | |
1468 *w1 = image; | |
1469 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w2, w3); | |
1470 } | |
1471 else | |
1472 { | |
1473 *w3 = image; | |
1474 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w1, w2); | |
1475 } | |
1476 } | |
1477 } | |
1478 | |
127 | 1479 void layout_split_change(LayoutWindow *lw, ImageSplitMode mode) |
1480 { | |
1481 GtkWidget *image; | |
1482 gint i; | |
268 | 1483 |
1484 for (i = 0; i < MAX_SPLIT_IMAGES; i++) | |
127 | 1485 { |
1486 if (lw->split_images[i]) | |
1487 { | |
1488 gtk_widget_hide(lw->split_images[i]->widget); | |
442 | 1489 if (lw->split_images[i]->widget->parent != lw->utility_box) |
127 | 1490 gtk_container_remove(GTK_CONTAINER(lw->split_images[i]->widget->parent), lw->split_images[i]->widget); |
1491 } | |
1492 } | |
1493 gtk_container_remove(GTK_CONTAINER(lw->utility_box), lw->split_image_widget); | |
1494 | |
1495 image = layout_image_setup_split(lw, mode); | |
1496 | |
1497 gtk_box_pack_start(GTK_BOX(lw->utility_box), image, TRUE, TRUE, 0); | |
1498 gtk_box_reorder_child(GTK_BOX(lw->utility_box), image, 0); | |
1499 gtk_widget_show(image); | |
1500 } | |
1501 | |
9 | 1502 static void layout_grid_setup(LayoutWindow *lw) |
1503 { | |
1504 gint priority_location; | |
1505 GtkWidget *h; | |
1506 GtkWidget *v; | |
1507 GtkWidget *w1, *w2, *w3; | |
1508 | |
1509 GtkWidget *image; | |
1510 GtkWidget *tools; | |
1511 GtkWidget *files; | |
1512 | |
1513 layout_actions_setup(lw); | |
1514 layout_actions_add_window(lw, lw->window); | |
1515 | |
1516 lw->group_box = gtk_vbox_new(FALSE, 0); | |
1517 gtk_box_pack_start(GTK_BOX(lw->main_box), lw->group_box, TRUE, TRUE, 0); | |
1518 gtk_widget_show(lw->group_box); | |
1519 | |
1520 priority_location = layout_grid_compass(lw); | |
1521 | |
127 | 1522 image = layout_image_setup_split(lw, lw->split_mode); |
442 | 1523 |
9 | 1524 tools = layout_tools_new(lw); |
1525 files = layout_list_new(lw); | |
1526 | |
1527 image = layout_bars_prepare(lw, image); | |
1528 | |
1529 if (lw->tools_float || lw->tools_hidden) | |
1530 { | |
1531 gtk_box_pack_start(GTK_BOX(lw->group_box), image, TRUE, TRUE, 0); | |
1532 gtk_widget_show(image); | |
1533 | |
1534 layout_tools_setup(lw, tools, files); | |
1535 | |
1536 gtk_widget_grab_focus(lw->image->widget); | |
1537 | |
1538 return; | |
1539 } | |
1540 else if (lw->tools) | |
1541 { | |
1542 layout_tools_geometry_sync(lw); | |
1543 gtk_widget_destroy(lw->tools); | |
1544 lw->tools = NULL; | |
1545 lw->tools_pane = NULL; | |
1546 } | |
1547 | |
1548 layout_status_setup(lw, lw->group_box, FALSE); | |
1549 | |
1550 layout_grid_compute(lw, image, tools, files, &w1, &w2, &w3); | |
1551 | |
1552 v = lw->v_pane = gtk_vpaned_new(); | |
1553 | |
1554 h = lw->h_pane = gtk_hpaned_new(); | |
1555 | |
1556 if (!layout_location_vertical(priority_location)) | |
1557 { | |
1558 GtkWidget *tmp; | |
1559 | |
1560 tmp = v; | |
1561 v = h; | |
1562 h = tmp; | |
1563 } | |
1564 | |
1565 gtk_box_pack_start(GTK_BOX(lw->group_box), v, TRUE, TRUE, 0); | |
1566 | |
1567 if (!layout_location_first(priority_location)) | |
1568 { | |
1569 gtk_paned_pack1(GTK_PANED(v), h, FALSE, TRUE); | |
1570 gtk_paned_pack2(GTK_PANED(v), w3, TRUE, TRUE); | |
1571 | |
1572 gtk_paned_pack1(GTK_PANED(h), w1, FALSE, TRUE); | |
1573 gtk_paned_pack2(GTK_PANED(h), w2, TRUE, TRUE); | |
1574 } | |
1575 else | |
1576 { | |
1577 gtk_paned_pack1(GTK_PANED(v), w1, FALSE, TRUE); | |
1578 gtk_paned_pack2(GTK_PANED(v), h, TRUE, TRUE); | |
1579 | |
1580 gtk_paned_pack1(GTK_PANED(h), w2, FALSE, TRUE); | |
1581 gtk_paned_pack2(GTK_PANED(h), w3, TRUE, TRUE); | |
1582 } | |
1583 | |
1584 gtk_widget_show(image); | |
1585 gtk_widget_show(tools); | |
1586 gtk_widget_show(files); | |
1587 | |
1588 gtk_widget_show(v); | |
1589 gtk_widget_show(h); | |
1590 | |
1591 /* fix to have image pane visible when it is left and priority widget */ | |
1592 if (lw->div_h == -1 && | |
1593 w1 == image && | |
1594 !layout_location_vertical(priority_location) && | |
1595 layout_location_first(priority_location)) | |
1596 { | |
1597 gtk_widget_set_size_request(image, 200, -1); | |
1598 } | |
1599 | |
1600 gtk_paned_set_position(GTK_PANED(lw->h_pane), lw->div_h); | |
1601 gtk_paned_set_position(GTK_PANED(lw->v_pane), lw->div_v); | |
1602 | |
1603 gtk_widget_grab_focus(lw->image->widget); | |
1604 } | |
1605 | |
1606 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order) | |
1607 { | |
1608 gchar *path; | |
127 | 1609 gint i; |
9 | 1610 |
1611 if (!layout_valid(&lw)) return; | |
1612 | |
1613 if (style != -1) | |
1614 { | |
1615 LayoutLocation d, f, i; | |
1616 | |
1617 layout_config_parse(style, order, &d, &f, &i); | |
1618 | |
1619 if (lw->dir_location == d && | |
1620 lw->file_location == f && | |
1621 lw->image_location == i) return; | |
1622 | |
1623 lw->dir_location = d; | |
1624 lw->file_location = f; | |
1625 lw->image_location = i; | |
1626 } | |
1627 | |
1628 /* remember state */ | |
1629 | |
1630 layout_image_slideshow_stop(lw); | |
1631 layout_image_full_screen_stop(lw); | |
1632 | |
1633 path = lw->path; | |
1634 lw->path = NULL; | |
1635 lw->image = NULL; | |
1636 lw->utility_box = NULL; | |
1637 | |
1638 layout_geometry_get_dividers(lw, &lw->div_h, &lw->div_v); | |
1639 | |
1640 /* clear it all */ | |
1641 | |
268 | 1642 for (i = 0; i < MAX_SPLIT_IMAGES; i++) |
127 | 1643 { |
1644 if (lw->split_images[i]) | |
1645 { | |
1646 gtk_widget_hide(lw->split_images[i]->widget); | |
1647 gtk_container_remove(GTK_CONTAINER(lw->split_images[i]->widget->parent), lw->split_images[i]->widget); | |
1648 } | |
1649 } | |
9 | 1650 |
1651 lw->h_pane = NULL; | |
1652 lw->v_pane = NULL; | |
1653 | |
1654 lw->toolbar = NULL; | |
1655 lw->thumb_button = NULL; | |
1656 lw->path_entry = NULL; | |
1657 lw->dir_view = NULL; | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
1658 lw->vd = NULL; |
9 | 1659 |
1660 lw->file_view = NULL; | |
1661 lw->vfl = NULL; | |
1662 lw->vfi = NULL; | |
1663 | |
1664 lw->info_box = NULL; | |
1665 lw->info_progress_bar = NULL; | |
1666 lw->info_sort = NULL; | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
1667 lw->info_color = NULL; |
9 | 1668 lw->info_status = NULL; |
1669 lw->info_details = NULL; | |
1670 lw->info_zoom = NULL; | |
1671 | |
1672 if (lw->ui_manager) g_object_unref(lw->ui_manager); | |
1673 lw->ui_manager = NULL; | |
1674 lw->action_group = NULL; | |
1675 | |
1676 gtk_container_remove(GTK_CONTAINER(lw->main_box), lw->group_box); | |
1677 lw->group_box = NULL; | |
1678 | |
1679 /* re-fill */ | |
1680 | |
1681 layout_grid_setup(lw); | |
1682 layout_tools_hide(lw, lw->tools_hidden); | |
1683 | |
1684 layout_list_sync_sort(lw); | |
1685 layout_util_sync(lw); | |
1686 layout_status_update_all(lw); | |
1687 | |
1688 /* sync */ | |
1689 | |
127 | 1690 if (image_get_path(lw->image)) |
9 | 1691 { |
127 | 1692 layout_set_path(lw, image_get_path(lw->image)); |
9 | 1693 } |
1694 else | |
1695 { | |
1696 layout_set_path(lw, path); | |
1697 } | |
1698 image_top_window_set_sync(lw->image, (lw->tools_float || lw->tools_hidden)); | |
1699 | |
1700 /* clean up */ | |
1701 | |
1702 g_free(path); | |
1703 } | |
1704 | |
1705 void layout_styles_update(void) | |
1706 { | |
1707 GList *work; | |
1708 | |
1709 work = layout_window_list; | |
1710 while (work) | |
1711 { | |
1712 LayoutWindow *lw = work->data; | |
1713 work = work->next; | |
1714 | |
327 | 1715 layout_style_set(lw, options->layout.style, options->layout.order); |
9 | 1716 } |
1717 } | |
1718 | |
1719 void layout_colors_update(void) | |
1720 { | |
1721 GList *work; | |
1722 | |
1723 work = layout_window_list; | |
1724 while (work) | |
1725 { | |
1726 LayoutWindow *lw = work->data; | |
1727 work = work->next; | |
442 | 1728 |
208
fa0e05f985c3
set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents:
196
diff
changeset
|
1729 if (!lw->image) continue; |
339
de1c2cd06fce
Rename user_specified_window_background and window_background_color
zas_
parents:
338
diff
changeset
|
1730 image_background_set_color(lw->image, options->image.use_custom_border_color ? &options->image.border_color : NULL); |
9 | 1731 } |
1732 } | |
1733 | |
1734 void layout_tools_float_toggle(LayoutWindow *lw) | |
1735 { | |
1736 gint popped; | |
1737 | |
1738 if (!lw) return; | |
1739 | |
1740 if (!lw->tools_hidden) | |
1741 { | |
1742 popped = !lw->tools_float; | |
1743 } | |
1744 else | |
1745 { | |
1746 popped = TRUE; | |
1747 } | |
1748 | |
1749 if (lw->tools_float == popped) | |
1750 { | |
1751 if (popped && lw->tools_hidden) | |
1752 { | |
1753 layout_tools_float_set(lw, popped, FALSE); | |
1754 } | |
1755 } | |
1756 else | |
1757 { | |
1758 if (lw->tools_float) | |
1759 { | |
1760 layout_tools_float_set(lw, FALSE, FALSE); | |
1761 } | |
1762 else | |
1763 { | |
1764 layout_tools_float_set(lw, TRUE, FALSE); | |
1765 } | |
1766 } | |
1767 } | |
1768 | |
1769 void layout_tools_hide_toggle(LayoutWindow *lw) | |
1770 { | |
1771 if (!lw) return; | |
1772 | |
1773 layout_tools_float_set(lw, lw->tools_float, !lw->tools_hidden); | |
1774 } | |
1775 | |
1776 void layout_tools_float_set(LayoutWindow *lw, gint popped, gint hidden) | |
1777 { | |
1778 if (!layout_valid(&lw)) return; | |
1779 | |
1780 if (lw->tools_float == popped && lw->tools_hidden == hidden) return; | |
1781 | |
1782 if (lw->tools_float == popped && lw->tools_float && lw->tools) | |
1783 { | |
1784 layout_tools_hide(lw, hidden); | |
1785 return; | |
1786 } | |
1787 | |
1788 lw->tools_float = popped; | |
1789 lw->tools_hidden = hidden; | |
1790 | |
1791 layout_style_set(lw, -1, NULL); | |
1792 } | |
1793 | |
1794 gint layout_tools_float_get(LayoutWindow *lw, gint *popped, gint *hidden) | |
1795 { | |
1796 if (!layout_valid(&lw)) return FALSE; | |
1797 | |
1798 *popped = lw->tools_float; | |
1799 *hidden = lw->tools_hidden; | |
1800 | |
1801 return TRUE; | |
1802 } | |
1803 | |
1804 void layout_toolbar_toggle(LayoutWindow *lw) | |
1805 { | |
1806 if (!layout_valid(&lw)) return; | |
1807 if (!lw->toolbar) return; | |
1808 | |
1809 lw->toolbar_hidden = !lw->toolbar_hidden; | |
1810 | |
1811 if (lw->toolbar_hidden) | |
1812 { | |
1813 if (GTK_WIDGET_VISIBLE(lw->toolbar)) gtk_widget_hide(lw->toolbar); | |
1814 } | |
1815 else | |
1816 { | |
1817 if (!GTK_WIDGET_VISIBLE(lw->toolbar)) gtk_widget_show(lw->toolbar); | |
1818 } | |
1819 } | |
1820 | |
1821 gint layout_toolbar_hidden(LayoutWindow *lw) | |
1822 { | |
1823 if (!layout_valid(&lw)) return TRUE; | |
1824 | |
1825 return lw->toolbar_hidden; | |
1826 } | |
1827 | |
1828 /* | |
1829 *----------------------------------------------------------------------------- | |
1830 * base | |
1831 *----------------------------------------------------------------------------- | |
1832 */ | |
1833 | |
1834 void layout_close(LayoutWindow *lw) | |
1835 { | |
1836 if (layout_window_list && layout_window_list->next) | |
1837 { | |
1838 layout_free(lw); | |
1839 } | |
1840 else | |
1841 { | |
278 | 1842 exit_program(); |
9 | 1843 } |
1844 } | |
1845 | |
1846 void layout_free(LayoutWindow *lw) | |
1847 { | |
1848 if (!lw) return; | |
1849 | |
1850 layout_window_list = g_list_remove(layout_window_list, lw); | |
1851 | |
1852 if (lw->last_time_id != -1) | |
1853 { | |
1854 g_source_remove(lw->last_time_id); | |
1855 } | |
1856 | |
1857 layout_bars_close(lw); | |
1858 | |
1859 gtk_widget_destroy(lw->window); | |
442 | 1860 |
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
270
diff
changeset
|
1861 histogram_free(lw->histogram); |
9 | 1862 |
1863 g_free(lw->path); | |
1864 | |
1865 g_free(lw); | |
1866 } | |
1867 | |
1868 static gint layout_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) | |
1869 { | |
1870 LayoutWindow *lw = data; | |
1871 | |
1872 layout_close(lw); | |
1873 return TRUE; | |
1874 } | |
1875 | |
1876 LayoutWindow *layout_new(const gchar *path, gint popped, gint hidden) | |
1877 { | |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1878 return layout_new_with_geometry(path, popped, hidden, NULL); |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1879 } |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1880 |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1881 LayoutWindow *layout_new_with_geometry(const gchar *path, gint popped, gint hidden, |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1882 const gchar *geometry) |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1883 { |
9 | 1884 LayoutWindow *lw; |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1885 GdkGeometry hint; |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1886 GdkWindowHints hint_mask; |
9 | 1887 |
1888 lw = g_new0(LayoutWindow, 1); | |
1889 | |
340
77103f3f2cb1
Rename option thumbnails.enabled to layout.show_thumbnails as it makes
zas_
parents:
339
diff
changeset
|
1890 lw->thumbs_enabled = options->layout.show_thumbnails; |
433
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1891 lw->marks_enabled = options->layout.show_marks; |
9 | 1892 lw->sort_method = SORT_NAME; |
1893 lw->sort_ascend = TRUE; | |
1894 | |
1895 lw->tools_float = popped; | |
1896 lw->tools_hidden = hidden; | |
1897 | |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1898 lw->toolbar_hidden = options->layout.toolbar_hidden; |
9 | 1899 |
1900 lw->utility_box = NULL; | |
1901 lw->bar_sort = NULL; | |
1902 lw->bar_sort_enabled = FALSE; | |
1903 lw->bar_exif = NULL; | |
1904 lw->bar_exif_enabled = FALSE; | |
1905 lw->bar_exif_size = -1; | |
1906 lw->bar_exif_advanced = FALSE; | |
1907 | |
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
270
diff
changeset
|
1908 lw->histogram_enabled = FALSE; |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
270
diff
changeset
|
1909 |
9 | 1910 /* default layout */ |
1911 | |
327 | 1912 layout_config_parse(options->layout.style, options->layout.order, |
9 | 1913 &lw->dir_location, &lw->file_location, &lw->image_location); |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
1914 lw->dir_view_type = options->layout.dir_view_type; |
327 | 1915 lw->icon_view = options->layout.view_as_icons; |
9 | 1916 |
1917 /* divider positions */ | |
1918 | |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1919 if (options->layout.save_window_positions) |
9 | 1920 { |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1921 lw->div_h = options->layout.main_window.hdivider_pos; |
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1922 lw->div_v = options->layout.main_window.vdivider_pos; |
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1923 lw->div_float = options->layout.float_window.vdivider_pos; |
9 | 1924 } |
1925 else | |
1926 { | |
1927 lw->div_h = MAIN_WINDOW_DIV_HPOS; | |
1928 lw->div_v = MAIN_WINDOW_DIV_VPOS; | |
1929 lw->div_float = MAIN_WINDOW_DIV_VPOS; | |
1930 } | |
1931 | |
1932 /* window */ | |
1933 | |
289
6a7298988a7a
Simplify and unify gtk_window creation with the help of
zas_
parents:
288
diff
changeset
|
1934 lw->window = window_new(GTK_WINDOW_TOPLEVEL, GQ_WMCLASS, NULL, NULL, NULL); |
9 | 1935 gtk_window_set_resizable(GTK_WINDOW(lw->window), TRUE); |
1936 gtk_container_set_border_width(GTK_CONTAINER(lw->window), 0); | |
1937 | |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1938 if (options->layout.save_window_positions) |
9 | 1939 { |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1940 hint_mask = GDK_HINT_USER_POS; |
9 | 1941 } |
1942 else | |
1943 { | |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1944 hint_mask = 0; |
9 | 1945 } |
1946 | |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1947 hint.min_width = 32; |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1948 hint.min_height = 32; |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1949 hint.base_width = 0; |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1950 hint.base_height = 0; |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1951 gtk_window_set_geometry_hints(GTK_WINDOW(lw->window), NULL, &hint, |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1952 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hint_mask); |
9 | 1953 |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1954 if (options->layout.save_window_positions) |
9 | 1955 { |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1956 gtk_window_set_default_size(GTK_WINDOW(lw->window), options->layout.main_window.w, options->layout.main_window.h); |
9 | 1957 if (!layout_window_list) |
1958 { | |
338
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1959 gtk_window_move(GTK_WINDOW(lw->window), options->layout.main_window.x, options->layout.main_window.y); |
41c3cb73120f
Rename window options (moved to layout) and re-order rc file.
zas_
parents:
333
diff
changeset
|
1960 if (options->layout.main_window.maximized) gtk_window_maximize(GTK_WINDOW(lw->window)); |
9 | 1961 } |
1962 } | |
1963 else | |
1964 { | |
1965 gtk_window_set_default_size(GTK_WINDOW(lw->window), MAINWINDOW_DEF_WIDTH, MAINWINDOW_DEF_HEIGHT); | |
1966 } | |
1967 | |
1968 g_signal_connect(G_OBJECT(lw->window), "delete_event", | |
1969 G_CALLBACK(layout_delete_cb), lw); | |
1970 | |
1971 layout_keyboard_init(lw, lw->window); | |
1972 | |
1973 lw->main_box = gtk_vbox_new(FALSE, 0); | |
1974 gtk_container_add(GTK_CONTAINER(lw->window), lw->main_box); | |
1975 gtk_widget_show(lw->main_box); | |
1976 | |
1977 layout_grid_setup(lw); | |
1978 image_top_window_set_sync(lw->image, (lw->tools_float || lw->tools_hidden)); | |
1979 | |
1980 layout_util_sync(lw); | |
1981 layout_status_update_all(lw); | |
1982 | |
1983 if (path) | |
1984 { | |
1985 layout_set_path(lw, path); | |
1986 } | |
1987 else | |
1988 { | |
1989 GdkPixbuf *pixbuf; | |
1990 | |
1991 pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO); | |
1992 image_change_pixbuf(lw->image, pixbuf, 1.0); | |
1993 gdk_pixbuf_unref(pixbuf); | |
1994 } | |
1995 | |
1996 /* set up the time stat timeout */ | |
1997 lw->last_time = 0; | |
1998 lw->last_time_id = g_timeout_add(5000, layout_check_for_update_cb, lw); | |
1999 | |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2000 if (geometry) |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2001 { |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2002 if (!gtk_window_parse_geometry(GTK_WINDOW(lw->window), geometry)) |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2003 { |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2004 print_term(_("Invalid geometry\n")); |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2005 } |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2006 } |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2007 |
9 | 2008 gtk_widget_show(lw->window); |
2009 layout_tools_hide(lw, lw->tools_hidden); | |
2010 | |
2011 layout_window_list = g_list_append(layout_window_list, lw); | |
2012 | |
2013 return lw; | |
2014 } | |
2015 | |
2016 /* | |
2017 *----------------------------------------------------------------------------- | |
2018 * maintenance (for rename, move, remove) | |
2019 *----------------------------------------------------------------------------- | |
2020 */ | |
2021 | |
2022 static void layout_real_time_update(LayoutWindow *lw) | |
2023 { | |
2024 /* this resets the last time stamp of path so that a refresh does not occur | |
2025 * from an internal file operation. | |
2026 */ | |
2027 | |
2028 if (lw->path) lw->last_time = filetime(lw->path); | |
2029 } | |
2030 | |
138 | 2031 static void layout_real_renamed(LayoutWindow *lw, FileData *fd) |
9 | 2032 { |
2033 gint update = FALSE; | |
2034 | |
138 | 2035 if (lw->image) layout_image_maint_renamed(lw, fd); |
9 | 2036 |
138 | 2037 if (lw->vfl) update |= vflist_maint_renamed(lw->vfl, fd); |
2038 if (lw->vfi) update |= vficon_maint_renamed(lw->vfi, fd); | |
9 | 2039 |
2040 if (update) layout_real_time_update(lw); | |
2041 } | |
2042 | |
138 | 2043 static void layout_real_removed(LayoutWindow *lw, FileData *fd, GList *ignore_list) |
9 | 2044 { |
2045 gint update = FALSE; | |
2046 | |
138 | 2047 if (lw->image) layout_image_maint_removed(lw, fd); |
9 | 2048 |
138 | 2049 if (lw->vfl) update |= vflist_maint_removed(lw->vfl, fd, ignore_list); |
2050 if (lw->vfi) update |= vficon_maint_removed(lw->vfi, fd, ignore_list); | |
9 | 2051 |
2052 if (update) layout_real_time_update(lw); | |
2053 } | |
2054 | |
138 | 2055 static void layout_real_moved(LayoutWindow *lw, FileData *fd, GList *ignore_list) |
9 | 2056 { |
2057 gint update = FALSE; | |
2058 | |
138 | 2059 if (lw->image) layout_image_maint_moved(lw, fd); |
9 | 2060 |
138 | 2061 if (lw->vfl) update |= vflist_maint_moved(lw->vfl, fd, ignore_list); |
2062 if (lw->vfi) update |= vficon_maint_moved(lw->vfi, fd, ignore_list); | |
9 | 2063 |
2064 if (update) layout_real_time_update(lw); | |
2065 } | |
2066 | |
138 | 2067 void layout_maint_renamed(FileData *fd) |
9 | 2068 { |
2069 GList *work = layout_window_list; | |
2070 while (work) | |
2071 { | |
2072 LayoutWindow *lw = work->data; | |
2073 work = work->next; | |
2074 | |
138 | 2075 layout_real_renamed(lw, fd); |
9 | 2076 } |
2077 } | |
2078 | |
138 | 2079 void layout_maint_removed(FileData *fd, GList *ignore_list) |
9 | 2080 { |
2081 GList *work = layout_window_list; | |
2082 while (work) | |
2083 { | |
2084 LayoutWindow *lw = work->data; | |
2085 work = work->next; | |
2086 | |
138 | 2087 layout_real_removed(lw, fd, ignore_list); |
9 | 2088 } |
2089 } | |
2090 | |
138 | 2091 void layout_maint_moved(FileData *fd, GList *ignore_list) |
9 | 2092 { |
2093 GList *work = layout_window_list; | |
2094 while (work) | |
2095 { | |
2096 LayoutWindow *lw = work->data; | |
2097 work = work->next; | |
2098 | |
138 | 2099 layout_real_moved(lw, fd, ignore_list); |
9 | 2100 } |
2101 } |