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