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