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