Mercurial > geeqie
annotate src/layout_util.c @ 495:c7a2471e5c4e
Introduce macros to display debug messages.
if (debug) printf(...) is now replaced by variadic macros:
DEBUG_1()
And for higher debugging levels:
DEBUG_2()
DEBUG_3()
DEBUG_4()
author | zas_ |
---|---|
date | Wed, 23 Apr 2008 20:47:19 +0000 |
parents | 3809ffa3567b |
children | a33badd85f16 |
rev | line source |
---|---|
9 | 1 /* |
196 | 2 * Geeqie |
9 | 3 * (C) 2004 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 | |
13 | |
281 | 14 #include "main.h" |
9 | 15 #include "layout_util.h" |
16 | |
17 #include "bar_info.h" | |
18 #include "bar_exif.h" | |
19 #include "bar_sort.h" | |
20 #include "cache_maint.h" | |
21 #include "collect.h" | |
22 #include "collect-dlg.h" | |
457
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
454
diff
changeset
|
23 #include "compat.h" |
9 | 24 #include "dupe.h" |
25 #include "editors.h" | |
249 | 26 #include "filelist.h" |
284 | 27 #include "image-overlay.h" |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
28 #include "img-view.h" |
9 | 29 #include "info.h" |
30 #include "layout_image.h" | |
12
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
31 #include "pan-view.h" |
9 | 32 #include "pixbuf_util.h" |
33 #include "preferences.h" | |
34 #include "print.h" | |
35 #include "search.h" | |
36 #include "utilops.h" | |
37 #include "ui_bookmark.h" | |
38 #include "ui_fileops.h" | |
39 #include "ui_menu.h" | |
40 #include "ui_misc.h" | |
41 #include "ui_tabcomp.h" | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
42 #include "view_dir.h" |
9 | 43 |
44 #include <gdk/gdkkeysyms.h> /* for keyboard values */ | |
45 | |
46 | |
47 #define MENU_EDIT_ACTION_OFFSET 16 | |
48 | |
49 | |
50 /* | |
51 *----------------------------------------------------------------------------- | |
52 * keyboard handler | |
53 *----------------------------------------------------------------------------- | |
54 */ | |
55 | |
56 static guint tree_key_overrides[] = { | |
57 GDK_Page_Up, GDK_KP_Page_Up, | |
58 GDK_Page_Down, GDK_KP_Page_Down, | |
59 GDK_Home, GDK_KP_Home, | |
60 GDK_End, GDK_KP_End | |
61 }; | |
62 | |
63 static gint layout_key_match(guint keyval) | |
64 { | |
65 gint i; | |
66 | |
67 for (i = 0; i < sizeof(tree_key_overrides) / sizeof(guint); i++) | |
68 { | |
69 if (keyval == tree_key_overrides[i]) return TRUE; | |
70 } | |
71 | |
72 return FALSE; | |
73 } | |
74 | |
160 | 75 gint layout_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
9 | 76 { |
77 LayoutWindow *lw = data; | |
78 gint stop_signal = FALSE; | |
79 gint x = 0; | |
80 gint y = 0; | |
81 | |
82 if (lw->path_entry && GTK_WIDGET_HAS_FOCUS(lw->path_entry)) | |
83 { | |
84 if (event->keyval == GDK_Escape && lw->path) | |
85 { | |
86 gtk_entry_set_text(GTK_ENTRY(lw->path_entry), lw->path); | |
87 } | |
88 | |
89 /* the gtkaccelgroup of the window is stealing presses before they get to the entry (and more), | |
90 * so when the some widgets have focus, give them priority (HACK) | |
91 */ | |
92 if (gtk_widget_event(lw->path_entry, (GdkEvent *)event)) | |
93 { | |
94 return TRUE; | |
95 } | |
96 } | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
97 if (lw->vd && lw->dir_view_type == DIRVIEW_TREE && GTK_WIDGET_HAS_FOCUS(lw->vd->view) && |
9 | 98 !layout_key_match(event->keyval) && |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
99 gtk_widget_event(lw->vd->view, (GdkEvent *)event)) |
9 | 100 { |
101 return TRUE; | |
102 } | |
103 if (lw->bar_info && | |
104 bar_info_event(lw->bar_info, (GdkEvent *)event)) | |
105 { | |
106 return TRUE; | |
107 } | |
108 | |
160 | 109 /* |
110 if (event->type == GDK_KEY_PRESS && lw->full_screen && | |
111 gtk_accel_groups_activate(G_OBJECT(lw->window), event->keyval, event->state)) | |
112 return TRUE; | |
113 */ | |
114 | |
9 | 115 if (lw->image && |
160 | 116 (GTK_WIDGET_HAS_FOCUS(lw->image->widget) || (lw->tools && widget == lw->window) || lw->full_screen) ) |
9 | 117 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
118 stop_signal = TRUE; |
9 | 119 switch (event->keyval) |
120 { | |
121 case GDK_Left: case GDK_KP_Left: | |
122 x -= 1; | |
123 break; | |
124 case GDK_Right: case GDK_KP_Right: | |
125 x += 1; | |
126 break; | |
127 case GDK_Up: case GDK_KP_Up: | |
128 y -= 1; | |
129 break; | |
130 case GDK_Down: case GDK_KP_Down: | |
131 y += 1; | |
132 break; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
133 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
134 stop_signal = FALSE; |
9 | 135 break; |
136 } | |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
137 |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
138 if (!stop_signal && |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
139 !(event->state & GDK_CONTROL_MASK)) |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
140 { |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
141 stop_signal = TRUE; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
142 switch (event->keyval) |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
143 { |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
144 case GDK_Menu: |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
145 layout_image_menu_popup(lw); |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
146 break; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
147 default: |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
148 stop_signal = FALSE; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
149 break; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
150 } |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
151 } |
9 | 152 } |
153 | |
154 if (x != 0 || y!= 0) | |
155 { | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
156 if (event->state & GDK_SHIFT_MASK) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
157 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
158 x *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
159 y *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
160 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
161 |
9 | 162 keyboard_scroll_calc(&x, &y, event); |
163 layout_image_scroll(lw, x, y); | |
164 } | |
165 | |
166 return stop_signal; | |
167 } | |
168 | |
169 void layout_keyboard_init(LayoutWindow *lw, GtkWidget *window) | |
170 { | |
171 g_signal_connect(G_OBJECT(window), "key_press_event", | |
172 G_CALLBACK(layout_key_press_cb), lw); | |
173 } | |
174 | |
175 /* | |
176 *----------------------------------------------------------------------------- | |
177 * menu callbacks | |
178 *----------------------------------------------------------------------------- | |
179 */ | |
442 | 180 |
181 | |
160 | 182 static GtkWidget *layout_window(LayoutWindow *lw) |
183 { | |
184 return lw->full_screen ? lw->full_screen->window : lw->window; | |
185 } | |
9 | 186 |
187 static void layout_menu_new_window_cb(GtkAction *action, gpointer data) | |
188 { | |
189 LayoutWindow *lw = data; | |
190 LayoutWindow *nw; | |
191 | |
160 | 192 if (lw->full_screen) |
193 layout_image_full_screen_stop(lw); | |
194 | |
9 | 195 nw = layout_new(NULL, FALSE, FALSE); |
329 | 196 layout_sort_set(nw, options->file_sort.method, options->file_sort.ascending); |
9 | 197 layout_set_path(nw, layout_get_path(lw)); |
198 } | |
199 | |
200 static void layout_menu_new_cb(GtkAction *action, gpointer data) | |
201 { | |
160 | 202 LayoutWindow *lw = data; |
203 if (lw->full_screen) | |
204 layout_image_full_screen_stop(lw); | |
9 | 205 collection_window_new(NULL); |
206 } | |
207 | |
208 static void layout_menu_open_cb(GtkAction *action, gpointer data) | |
209 { | |
160 | 210 LayoutWindow *lw = data; |
211 if (lw->full_screen) | |
212 layout_image_full_screen_stop(lw); | |
9 | 213 collection_dialog_load(NULL); |
214 } | |
215 | |
216 static void layout_menu_search_cb(GtkAction *action, gpointer data) | |
217 { | |
218 LayoutWindow *lw = data; | |
160 | 219 if (lw->full_screen) |
220 layout_image_full_screen_stop(lw); | |
9 | 221 |
222 search_new(lw->path, layout_image_get_path(lw)); | |
223 } | |
224 | |
225 static void layout_menu_dupes_cb(GtkAction *action, gpointer data) | |
226 { | |
160 | 227 LayoutWindow *lw = data; |
228 if (lw->full_screen) | |
229 layout_image_full_screen_stop(lw); | |
230 | |
9 | 231 dupe_window_new(DUPE_MATCH_NAME); |
232 } | |
233 | |
12
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
234 static void layout_menu_pan_cb(GtkAction *action, gpointer data) |
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
235 { |
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
236 LayoutWindow *lw = data; |
160 | 237 if (lw->full_screen) |
238 layout_image_full_screen_stop(lw); | |
12
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
239 |
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
240 pan_window_new(layout_get_path(lw)); |
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
241 } |
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
242 |
9 | 243 static void layout_menu_print_cb(GtkAction *action, gpointer data) |
244 { | |
245 LayoutWindow *lw = data; | |
246 | |
160 | 247 print_window_new(layout_image_get_fd(lw), layout_selection_list(lw), layout_list(lw), layout_window(lw)); |
9 | 248 } |
249 | |
250 static void layout_menu_dir_cb(GtkAction *action, gpointer data) | |
251 { | |
252 LayoutWindow *lw = data; | |
253 | |
160 | 254 file_util_create_dir(lw->path, layout_window(lw)); |
9 | 255 } |
256 | |
257 static void layout_menu_copy_cb(GtkAction *action, gpointer data) | |
258 { | |
259 LayoutWindow *lw = data; | |
260 | |
160 | 261 file_util_copy(NULL, layout_selection_list(lw), NULL, layout_window(lw)); |
9 | 262 } |
263 | |
264 static void layout_menu_move_cb(GtkAction *action, gpointer data) | |
265 { | |
266 LayoutWindow *lw = data; | |
267 | |
160 | 268 file_util_move(NULL, layout_selection_list(lw), NULL, layout_window(lw)); |
9 | 269 } |
270 | |
271 static void layout_menu_rename_cb(GtkAction *action, gpointer data) | |
272 { | |
273 LayoutWindow *lw = data; | |
274 | |
160 | 275 file_util_rename(NULL, layout_selection_list(lw), layout_window(lw)); |
9 | 276 } |
277 | |
278 static void layout_menu_delete_cb(GtkAction *action, gpointer data) | |
279 { | |
280 LayoutWindow *lw = data; | |
281 | |
160 | 282 file_util_delete(NULL, layout_selection_list(lw), layout_window(lw)); |
9 | 283 } |
284 | |
285 static void layout_menu_close_cb(GtkAction *action, gpointer data) | |
286 { | |
287 LayoutWindow *lw = data; | |
160 | 288 if (lw->full_screen) |
289 layout_image_full_screen_stop(lw); | |
9 | 290 |
291 layout_close(lw); | |
292 } | |
293 | |
294 static void layout_menu_exit_cb(GtkAction *action, gpointer data) | |
295 { | |
278 | 296 exit_program(); |
9 | 297 } |
298 | |
299 static void layout_menu_alter_90_cb(GtkAction *action, gpointer data) | |
300 { | |
301 LayoutWindow *lw = data; | |
302 | |
303 layout_image_alter(lw, ALTER_ROTATE_90); | |
304 } | |
305 | |
306 static void layout_menu_alter_90cc_cb(GtkAction *action, gpointer data) | |
307 { | |
308 LayoutWindow *lw = data; | |
309 | |
310 layout_image_alter(lw, ALTER_ROTATE_90_CC); | |
311 } | |
312 | |
313 static void layout_menu_alter_180_cb(GtkAction *action, gpointer data) | |
314 { | |
315 LayoutWindow *lw = data; | |
316 | |
317 layout_image_alter(lw, ALTER_ROTATE_180); | |
318 } | |
319 | |
320 static void layout_menu_alter_mirror_cb(GtkAction *action, gpointer data) | |
321 { | |
322 LayoutWindow *lw = data; | |
323 | |
324 layout_image_alter(lw, ALTER_MIRROR); | |
325 } | |
326 | |
327 static void layout_menu_alter_flip_cb(GtkAction *action, gpointer data) | |
328 { | |
329 LayoutWindow *lw = data; | |
330 | |
331 layout_image_alter(lw, ALTER_FLIP); | |
332 } | |
333 | |
82
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
334 static void layout_menu_alter_desaturate_cb(GtkAction *action, gpointer data) |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
335 { |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
336 LayoutWindow *lw = data; |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
337 |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
338 layout_image_alter(lw, ALTER_DESATURATE); |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
339 } |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
340 |
439 | 341 static void layout_menu_alter_none_cb(GtkAction *action, gpointer data) |
342 { | |
343 LayoutWindow *lw = data; | |
344 | |
345 layout_image_alter(lw, ALTER_NONE); | |
346 } | |
347 | |
9 | 348 static void layout_menu_info_cb(GtkAction *action, gpointer data) |
349 { | |
350 LayoutWindow *lw = data; | |
351 GList *list; | |
138 | 352 FileData *fd = NULL; |
9 | 353 |
354 list = layout_selection_list(lw); | |
138 | 355 if (!list) fd = layout_image_get_fd(lw); |
9 | 356 |
479
5212d4fed37f
Ensure Properties dialog is displayed above fullscreen window.
zas_
parents:
475
diff
changeset
|
357 info_window_new(fd, list, NULL); |
9 | 358 } |
359 | |
360 | |
361 static void layout_menu_config_cb(GtkAction *action, gpointer data) | |
362 { | |
160 | 363 LayoutWindow *lw = data; |
364 if (lw->full_screen) | |
365 layout_image_full_screen_stop(lw); | |
366 | |
9 | 367 show_config_window(); |
368 } | |
369 | |
370 static void layout_menu_remove_thumb_cb(GtkAction *action, gpointer data) | |
371 { | |
160 | 372 LayoutWindow *lw = data; |
373 if (lw->full_screen) | |
374 layout_image_full_screen_stop(lw); | |
375 | |
9 | 376 cache_manager_show(); |
377 } | |
378 | |
379 static void layout_menu_wallpaper_cb(GtkAction *action, gpointer data) | |
380 { | |
381 LayoutWindow *lw = data; | |
382 | |
383 layout_image_to_root(lw); | |
384 } | |
385 | |
386 static void layout_menu_zoom_in_cb(GtkAction *action, gpointer data) | |
387 { | |
388 LayoutWindow *lw = data; | |
389 | |
390 layout_image_zoom_adjust(lw, get_zoom_increment()); | |
391 } | |
392 | |
393 static void layout_menu_zoom_out_cb(GtkAction *action, gpointer data) | |
394 { | |
395 LayoutWindow *lw = data; | |
396 | |
397 layout_image_zoom_adjust(lw, -get_zoom_increment()); | |
398 } | |
399 | |
400 static void layout_menu_zoom_1_1_cb(GtkAction *action, gpointer data) | |
401 { | |
402 LayoutWindow *lw = data; | |
403 | |
404 layout_image_zoom_set(lw, 1.0); | |
405 } | |
406 | |
407 static void layout_menu_zoom_fit_cb(GtkAction *action, gpointer data) | |
408 { | |
409 LayoutWindow *lw = data; | |
410 | |
411 layout_image_zoom_set(lw, 0.0); | |
412 } | |
413 | |
159 | 414 static void layout_menu_zoom_fit_hor_cb(GtkAction *action, gpointer data) |
415 { | |
416 LayoutWindow *lw = data; | |
417 | |
418 layout_image_zoom_set_fill_geometry(lw, TRUE); | |
419 } | |
420 | |
421 static void layout_menu_zoom_fit_vert_cb(GtkAction *action, gpointer data) | |
422 { | |
423 LayoutWindow *lw = data; | |
424 | |
425 layout_image_zoom_set_fill_geometry(lw, FALSE); | |
426 } | |
427 | |
428 static void layout_menu_zoom_2_1_cb(GtkAction *action, gpointer data) | |
429 { | |
430 LayoutWindow *lw = data; | |
431 | |
432 layout_image_zoom_set(lw, 2.0); | |
433 } | |
434 | |
435 static void layout_menu_zoom_3_1_cb(GtkAction *action, gpointer data) | |
436 { | |
437 LayoutWindow *lw = data; | |
438 | |
439 layout_image_zoom_set(lw, 3.0); | |
440 } | |
441 static void layout_menu_zoom_4_1_cb(GtkAction *action, gpointer data) | |
442 { | |
443 LayoutWindow *lw = data; | |
444 | |
445 layout_image_zoom_set(lw, 4.0); | |
446 } | |
447 | |
448 static void layout_menu_zoom_1_2_cb(GtkAction *action, gpointer data) | |
449 { | |
450 LayoutWindow *lw = data; | |
451 | |
452 layout_image_zoom_set(lw, -2.0); | |
453 } | |
454 | |
455 static void layout_menu_zoom_1_3_cb(GtkAction *action, gpointer data) | |
456 { | |
457 LayoutWindow *lw = data; | |
458 | |
459 layout_image_zoom_set(lw, -3.0); | |
460 } | |
461 | |
462 static void layout_menu_zoom_1_4_cb(GtkAction *action, gpointer data) | |
463 { | |
464 LayoutWindow *lw = data; | |
465 | |
466 layout_image_zoom_set(lw, -4.0); | |
467 } | |
468 | |
469 | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
470 static void layout_menu_split_cb(GtkRadioAction *action, GtkRadioAction *current, gpointer data) |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
471 { |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
472 LayoutWindow *lw = data; |
160 | 473 if (lw->full_screen) |
474 layout_image_full_screen_stop(lw); | |
475 | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
476 ImageSplitMode mode = gtk_radio_action_get_current_value(action); |
442 | 477 |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
478 if (mode == lw->split_mode) mode = 0; /* toggle back */ |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
479 |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
480 layout_split_change(lw, mode); |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
481 } |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
482 |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
483 static void layout_menu_connect_scroll_cb(GtkToggleAction *action, gpointer data) |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
484 { |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
485 LayoutWindow *lw = data; |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
486 lw->connect_scroll = gtk_toggle_action_get_active(action); |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
487 } |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
488 |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
489 static void layout_menu_connect_zoom_cb(GtkToggleAction *action, gpointer data) |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
490 { |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
491 LayoutWindow *lw = data; |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
492 lw->connect_zoom = gtk_toggle_action_get_active(action); |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
493 } |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
494 |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
495 |
9 | 496 static void layout_menu_thumb_cb(GtkToggleAction *action, gpointer data) |
497 { | |
498 LayoutWindow *lw = data; | |
499 | |
500 layout_thumb_set(lw, gtk_toggle_action_get_active(action)); | |
501 } | |
502 | |
132 | 503 |
9 | 504 static void layout_menu_list_cb(GtkRadioAction *action, GtkRadioAction *current, gpointer data) |
505 { | |
506 LayoutWindow *lw = data; | |
160 | 507 if (lw->full_screen) |
508 layout_image_full_screen_stop(lw); | |
9 | 509 |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
510 layout_views_set(lw, lw->dir_view_type, (gtk_radio_action_get_current_value(action) == 1)); |
9 | 511 } |
512 | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
513 static void layout_menu_view_dir_as_cb(GtkRadioAction *action, GtkRadioAction *current, gpointer data) |
9 | 514 { |
515 LayoutWindow *lw = data; | |
160 | 516 if (lw->full_screen) |
517 layout_image_full_screen_stop(lw); | |
9 | 518 |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
519 layout_views_set(lw, (DirViewType) gtk_radio_action_get_current_value(action), lw->icon_view); |
9 | 520 } |
521 | |
159 | 522 static void layout_menu_view_in_new_window_cb(GtkAction *action, gpointer data) |
523 { | |
524 LayoutWindow *lw = data; | |
525 | |
160 | 526 if (lw->full_screen) |
527 layout_image_full_screen_stop(lw); | |
159 | 528 view_window_new(layout_image_get_fd(lw)); |
529 } | |
530 | |
9 | 531 static void layout_menu_fullscreen_cb(GtkAction *action, gpointer data) |
532 { | |
533 LayoutWindow *lw = data; | |
534 | |
535 layout_image_full_screen_toggle(lw); | |
536 } | |
537 | |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
538 static void layout_menu_escape_cb(GtkAction *action, gpointer data) |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
539 { |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
540 LayoutWindow *lw = data; |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
541 |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
542 layout_image_full_screen_stop(lw); |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
543 /* FIXME:interrupting thumbs no longer allowed */ |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
544 #if 0 |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
545 interrupt_thumbs(); |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
546 #endif |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
547 } |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
548 |
159 | 549 static void layout_menu_overlay_cb(GtkAction *action, gpointer data) |
550 { | |
551 LayoutWindow *lw = data; | |
552 | |
482 | 553 image_osd_toggle(lw->image); |
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
554 } |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
555 |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
556 static void layout_menu_histogram_chan_cb(GtkAction *action, gpointer data) |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
557 { |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
558 LayoutWindow *lw = data; |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
559 |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
560 image_osd_histogram_chan_toggle(lw->image); |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
561 } |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
562 |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
563 static void layout_menu_histogram_log_cb(GtkAction *action, gpointer data) |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
564 { |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
565 LayoutWindow *lw = data; |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
566 |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
567 image_osd_histogram_log_toggle(lw->image); |
159 | 568 } |
569 | |
9 | 570 static void layout_menu_refresh_cb(GtkAction *action, gpointer data) |
571 { | |
572 LayoutWindow *lw = data; | |
573 | |
574 layout_refresh(lw); | |
575 } | |
576 | |
577 static void layout_menu_float_cb(GtkToggleAction *action, gpointer data) | |
578 { | |
579 LayoutWindow *lw = data; | |
160 | 580 if (lw->full_screen) |
581 layout_image_full_screen_stop(lw); | |
9 | 582 |
583 if (lw->tools_float != gtk_toggle_action_get_active(action)) | |
584 { | |
585 layout_tools_float_toggle(lw); | |
586 } | |
587 } | |
588 | |
589 static void layout_menu_hide_cb(GtkAction *action, gpointer data) | |
590 { | |
591 LayoutWindow *lw = data; | |
160 | 592 if (lw->full_screen) |
593 layout_image_full_screen_stop(lw); | |
9 | 594 |
595 layout_tools_hide_toggle(lw); | |
596 } | |
597 | |
598 static void layout_menu_toolbar_cb(GtkToggleAction *action, gpointer data) | |
599 { | |
600 LayoutWindow *lw = data; | |
160 | 601 if (lw->full_screen) |
602 layout_image_full_screen_stop(lw); | |
9 | 603 |
604 if (lw->toolbar_hidden != gtk_toggle_action_get_active(action)) | |
605 { | |
606 layout_toolbar_toggle(lw); | |
607 } | |
608 } | |
609 | |
610 static void layout_menu_bar_info_cb(GtkToggleAction *action, gpointer data) | |
611 { | |
612 LayoutWindow *lw = data; | |
160 | 613 if (lw->full_screen) |
614 layout_image_full_screen_stop(lw); | |
9 | 615 |
616 if (lw->bar_info_enabled != gtk_toggle_action_get_active(action)) | |
617 { | |
618 layout_bar_info_toggle(lw); | |
619 } | |
620 } | |
621 | |
622 static void layout_menu_bar_exif_cb(GtkToggleAction *action, gpointer data) | |
623 { | |
624 LayoutWindow *lw = data; | |
160 | 625 if (lw->full_screen) |
626 layout_image_full_screen_stop(lw); | |
9 | 627 |
628 if (lw->bar_exif_enabled != gtk_toggle_action_get_active(action)) | |
629 { | |
630 layout_bar_exif_toggle(lw); | |
631 } | |
632 } | |
633 | |
634 static void layout_menu_bar_sort_cb(GtkToggleAction *action, gpointer data) | |
635 { | |
636 LayoutWindow *lw = data; | |
160 | 637 if (lw->full_screen) |
638 layout_image_full_screen_stop(lw); | |
9 | 639 |
640 if (lw->bar_sort_enabled != gtk_toggle_action_get_active(action)) | |
641 { | |
642 layout_bar_sort_toggle(lw); | |
643 } | |
644 } | |
645 | |
646 static void layout_menu_slideshow_cb(GtkAction *action, gpointer data) | |
647 { | |
648 LayoutWindow *lw = data; | |
649 | |
650 layout_image_slideshow_toggle(lw); | |
651 } | |
652 | |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
653 static void layout_menu_slideshow_pause_cb(GtkAction *action, gpointer data) |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
654 { |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
655 LayoutWindow *lw = data; |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
656 |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
657 layout_image_slideshow_pause_toggle(lw); |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
658 } |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
659 |
9 | 660 static void layout_menu_help_cb(GtkAction *action, gpointer data) |
661 { | |
160 | 662 LayoutWindow *lw = data; |
663 if (lw->full_screen) | |
664 layout_image_full_screen_stop(lw); | |
9 | 665 help_window_show("html_contents"); |
666 } | |
667 | |
668 static void layout_menu_help_keys_cb(GtkAction *action, gpointer data) | |
669 { | |
160 | 670 LayoutWindow *lw = data; |
671 if (lw->full_screen) | |
672 layout_image_full_screen_stop(lw); | |
9 | 673 help_window_show("documentation"); |
674 } | |
675 | |
676 static void layout_menu_notes_cb(GtkAction *action, gpointer data) | |
677 { | |
160 | 678 LayoutWindow *lw = data; |
679 if (lw->full_screen) | |
680 layout_image_full_screen_stop(lw); | |
9 | 681 help_window_show("release_notes"); |
682 } | |
683 | |
684 static void layout_menu_about_cb(GtkAction *action, gpointer data) | |
685 { | |
160 | 686 LayoutWindow *lw = data; |
687 if (lw->full_screen) | |
688 layout_image_full_screen_stop(lw); | |
9 | 689 show_about_window(); |
690 } | |
691 | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
692 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
693 /* |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
694 *----------------------------------------------------------------------------- |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
695 * select menu |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
696 *----------------------------------------------------------------------------- |
442 | 697 */ |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
698 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
699 static void layout_menu_select_all_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
700 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
701 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
702 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
703 layout_select_all(lw); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
704 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
705 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
706 static void layout_menu_unselect_all_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
707 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
708 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
709 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
710 layout_select_none(lw); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
711 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
712 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
713 static void layout_menu_marks_cb(GtkToggleAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
714 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
715 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
716 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
717 layout_marks_set(lw, gtk_toggle_action_get_active(action)); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
718 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
719 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
720 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
721 static void layout_menu_set_mark_sel_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
722 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
723 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
724 gint mark = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "mark_num")); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
725 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
726 mark--; |
442 | 727 |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
728 layout_selection_to_mark(lw, mark, STM_MODE_SET); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
729 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
730 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
731 static void layout_menu_res_mark_sel_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
732 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
733 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
734 gint mark = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "mark_num")); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
735 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
736 mark--; |
442 | 737 |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
738 layout_selection_to_mark(lw, mark, STM_MODE_RESET); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
739 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
740 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
741 static void layout_menu_toggle_mark_sel_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
742 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
743 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
744 gint mark = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "mark_num")); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
745 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
746 mark--; |
442 | 747 |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
748 layout_selection_to_mark(lw, mark, STM_MODE_TOGGLE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
749 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
750 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
751 static void layout_menu_sel_mark_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
752 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
753 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
754 gint mark = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "mark_num")); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
755 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
756 mark--; |
442 | 757 |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
758 layout_mark_to_selection(lw, mark, MTS_MODE_SET); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
759 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
760 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
761 static void layout_menu_sel_mark_or_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
762 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
763 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
764 gint mark = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "mark_num")); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
765 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
766 mark--; |
442 | 767 |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
768 layout_mark_to_selection(lw, mark, MTS_MODE_OR); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
769 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
770 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
771 static void layout_menu_sel_mark_and_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
772 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
773 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
774 gint mark = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "mark_num")); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
775 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
776 mark--; |
442 | 777 |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
778 layout_mark_to_selection(lw, mark, MTS_MODE_AND); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
779 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
780 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
781 static void layout_menu_sel_mark_minus_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
782 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
783 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
784 gint mark = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "mark_num")); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
785 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
786 mark--; |
442 | 787 |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
788 layout_mark_to_selection(lw, mark, MTS_MODE_MINUS); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
789 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
790 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
791 |
9 | 792 /* |
793 *----------------------------------------------------------------------------- | |
159 | 794 * go menu |
795 *----------------------------------------------------------------------------- | |
442 | 796 */ |
159 | 797 |
798 static void layout_menu_image_first_cb(GtkAction *action, gpointer data) | |
799 { | |
800 LayoutWindow *lw = data; | |
801 layout_image_first(lw); | |
802 } | |
803 | |
804 static void layout_menu_image_prev_cb(GtkAction *action, gpointer data) | |
805 { | |
806 LayoutWindow *lw = data; | |
807 layout_image_prev(lw); | |
808 } | |
809 | |
810 static void layout_menu_image_next_cb(GtkAction *action, gpointer data) | |
811 { | |
812 LayoutWindow *lw = data; | |
813 layout_image_next(lw); | |
814 } | |
815 | |
816 static void layout_menu_image_last_cb(GtkAction *action, gpointer data) | |
817 { | |
818 LayoutWindow *lw = data; | |
819 layout_image_last(lw); | |
820 } | |
821 | |
822 | |
823 /* | |
824 *----------------------------------------------------------------------------- | |
9 | 825 * edit menu |
826 *----------------------------------------------------------------------------- | |
442 | 827 */ |
9 | 828 |
829 static void layout_menu_edit_cb(GtkAction *action, gpointer data) | |
830 { | |
831 LayoutWindow *lw = data; | |
832 GList *list; | |
833 gint n; | |
834 | |
835 n = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "edit_index")); | |
836 | |
160 | 837 |
838 if (lw->full_screen && !editor_window_flag_set(n)) | |
839 { | |
840 layout_image_full_screen_stop(lw); | |
841 } | |
9 | 842 list = layout_selection_list(lw); |
138 | 843 start_editor_from_filelist(n, list); |
844 filelist_free(list); | |
9 | 845 } |
846 | |
847 static void layout_menu_edit_update(LayoutWindow *lw) | |
848 { | |
849 gint i; | |
850 | |
851 /* main edit menu */ | |
852 | |
853 if (!lw->action_group) return; | |
854 | |
855 for (i = 0; i < 10; i++) | |
856 { | |
857 gchar *key; | |
858 GtkAction *action; | |
859 | |
860 key = g_strdup_printf("Editor%d", i); | |
861 | |
862 action = gtk_action_group_get_action(lw->action_group, key); | |
863 g_object_set_data(G_OBJECT(action), "edit_index", GINT_TO_POINTER(i)); | |
864 | |
318 | 865 if (options->editor_command[i] && strlen(options->editor_command[i]) > 0) |
9 | 866 { |
867 gchar *text; | |
868 | |
318 | 869 if (options->editor_name[i] && strlen(options->editor_name[i]) > 0) |
9 | 870 { |
454 | 871 text = g_strdup_printf(_("_%d in %s..."), i, options->editor_name[i]); |
9 | 872 } |
873 else | |
874 { | |
454 | 875 text = g_strdup_printf(_("_%d in (unknown)..."), i); |
9 | 876 } |
877 g_object_set(action, "label", text, | |
878 "sensitive", TRUE, NULL); | |
879 g_free(text); | |
880 } | |
881 else | |
882 { | |
454 | 883 gchar *text; |
884 | |
885 text = g_strdup_printf(_("_%d empty"), i); | |
886 g_object_set(action, "label", text, "sensitive", FALSE, NULL); | |
887 g_free(text); | |
9 | 888 } |
889 | |
890 g_free(key); | |
891 } | |
892 } | |
893 | |
894 void layout_edit_update_all(void) | |
895 { | |
896 GList *work; | |
897 | |
898 work = layout_window_list; | |
899 while (work) | |
900 { | |
901 LayoutWindow *lw = work->data; | |
902 work = work->next; | |
903 | |
904 layout_menu_edit_update(lw); | |
905 } | |
906 } | |
907 | |
908 /* | |
909 *----------------------------------------------------------------------------- | |
910 * recent menu | |
911 *----------------------------------------------------------------------------- | |
912 */ | |
913 | |
914 static void layout_menu_recent_cb(GtkWidget *widget, gpointer data) | |
915 { | |
916 gint n; | |
917 gchar *path; | |
918 | |
919 n = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "recent_index")); | |
920 | |
921 path = g_list_nth_data(history_list_get_by_key("recent"), n); | |
922 | |
923 if (!path) return; | |
924 | |
925 /* make a copy of it */ | |
926 path = g_strdup(path); | |
927 collection_window_new(path); | |
928 g_free(path); | |
929 } | |
930 | |
931 static void layout_menu_recent_update(LayoutWindow *lw) | |
932 { | |
933 GtkWidget *menu; | |
934 GtkWidget *recent; | |
935 GtkWidget *item; | |
936 GList *list; | |
937 gint n; | |
938 | |
939 if (!lw->ui_manager) return; | |
940 | |
941 list = history_list_get_by_key("recent"); | |
942 n = 0; | |
943 | |
944 menu = gtk_menu_new(); | |
945 | |
946 while (list) | |
947 { | |
948 item = menu_item_add_simple(menu, filename_from_path((gchar *)list->data), | |
949 G_CALLBACK(layout_menu_recent_cb), lw); | |
950 g_object_set_data(G_OBJECT(item), "recent_index", GINT_TO_POINTER(n)); | |
951 list = list->next; | |
952 n++; | |
953 } | |
954 | |
955 if (n == 0) | |
956 { | |
957 menu_item_add(menu, _("Empty"), NULL, NULL); | |
958 } | |
959 | |
960 recent = gtk_ui_manager_get_widget(lw->ui_manager, "/MainMenu/FileMenu/OpenRecent"); | |
961 gtk_menu_item_set_submenu(GTK_MENU_ITEM(recent), menu); | |
962 gtk_widget_set_sensitive(recent, (n != 0)); | |
963 } | |
964 | |
965 void layout_recent_update_all(void) | |
966 { | |
967 GList *work; | |
968 | |
969 work = layout_window_list; | |
970 while (work) | |
971 { | |
972 LayoutWindow *lw = work->data; | |
973 work = work->next; | |
974 | |
975 layout_menu_recent_update(lw); | |
976 } | |
977 } | |
978 | |
979 void layout_recent_add_path(const gchar *path) | |
980 { | |
981 if (!path) return; | |
982 | |
343
63380ea3e65d
Rename recent_list_max/open_recent_max to open_recent_list_maxsize.
zas_
parents:
341
diff
changeset
|
983 history_list_add_to_key("recent", path, options->open_recent_list_maxsize); |
9 | 984 |
985 layout_recent_update_all(); | |
986 } | |
987 | |
988 /* | |
989 *----------------------------------------------------------------------------- | |
990 * menu | |
991 *----------------------------------------------------------------------------- | |
442 | 992 */ |
9 | 993 |
994 #define CB G_CALLBACK | |
995 | |
996 static GtkActionEntry menu_entries[] = { | |
997 { "FileMenu", NULL, N_("_File") }, | |
159 | 998 { "GoMenu", NULL, N_("_Go") }, |
9 | 999 { "EditMenu", NULL, N_("_Edit") }, |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1000 { "SelectMenu", NULL, N_("_Select") }, |
9 | 1001 { "AdjustMenu", NULL, N_("_Adjust") }, |
1002 { "ViewMenu", NULL, N_("_View") }, | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
1003 { "DirMenu", NULL, N_("_View Directory as") }, |
159 | 1004 { "ZoomMenu", NULL, N_("_Zoom") }, |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1005 { "SplitMenu", NULL, N_("_Split") }, |
9 | 1006 { "HelpMenu", NULL, N_("_Help") }, |
1007 | |
159 | 1008 { "FirstImage", GTK_STOCK_GOTO_TOP, N_("_First Image"), "Home", NULL, CB(layout_menu_image_first_cb) }, |
1009 { "PrevImage", GTK_STOCK_GO_UP, N_("_Previous Image"), "BackSpace", NULL, CB(layout_menu_image_prev_cb) }, | |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1010 { "PrevImageAlt1", GTK_STOCK_GO_UP, N_("_Previous Image"), "Page_Up", NULL, CB(layout_menu_image_prev_cb) }, |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1011 { "PrevImageAlt2", GTK_STOCK_GO_UP, N_("_Previous Image"), "KP_Page_Up", NULL, CB(layout_menu_image_prev_cb) }, |
159 | 1012 { "NextImage", GTK_STOCK_GO_DOWN, N_("_Next Image"), "space", NULL, CB(layout_menu_image_next_cb) }, |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1013 { "NextImageAlt1", GTK_STOCK_GO_DOWN, N_("_Next Image"), "Page_Down", NULL, CB(layout_menu_image_next_cb) }, |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1014 { "NextImageAlt2", GTK_STOCK_GO_DOWN, N_("_Next Image"), "KP_Page_Down", NULL, CB(layout_menu_image_next_cb) }, |
159 | 1015 { "LastImage", GTK_STOCK_GOTO_BOTTOM, N_("_Last Image"), "End", NULL, CB(layout_menu_image_last_cb) }, |
1016 | |
1017 | |
9 | 1018 { "NewWindow", GTK_STOCK_NEW, N_("New _window"), NULL, NULL, CB(layout_menu_new_window_cb) }, |
1019 { "NewCollection", GTK_STOCK_INDEX,N_("_New collection"), "C", NULL, CB(layout_menu_new_cb) }, | |
1020 { "OpenCollection", GTK_STOCK_OPEN, N_("_Open collection..."),"O", NULL, CB(layout_menu_open_cb) }, | |
1021 { "OpenRecent", NULL, N_("Open _recent") }, | |
1022 { "Search", GTK_STOCK_FIND, N_("_Search..."), "F3", NULL, CB(layout_menu_search_cb) }, | |
1023 { "FindDupes", GTK_STOCK_FIND, N_("_Find duplicates..."),"D", NULL, CB(layout_menu_dupes_cb) }, | |
12
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1024 { "PanView", NULL, N_("Pan _view"), "<control>J", NULL, CB(layout_menu_pan_cb) }, |
9 | 1025 { "Print", GTK_STOCK_PRINT,N_("_Print..."), "<shift>P", NULL, CB(layout_menu_print_cb) }, |
1026 { "NewFolder", NULL, N_("N_ew folder..."), "<control>F", NULL, CB(layout_menu_dir_cb) }, | |
1027 { "Copy", NULL, N_("_Copy..."), "<control>C", NULL, CB(layout_menu_copy_cb) }, | |
1028 { "Move", NULL, N_("_Move..."), "<control>M", NULL, CB(layout_menu_move_cb) }, | |
1029 { "Rename", NULL, N_("_Rename..."), "<control>R", NULL, CB(layout_menu_rename_cb) }, | |
1030 { "Delete", GTK_STOCK_DELETE, N_("_Delete..."), "<control>D", NULL, CB(layout_menu_delete_cb) }, | |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1031 { "DeleteAlt1",GTK_STOCK_DELETE, N_("_Delete..."), "Delete", NULL, CB(layout_menu_delete_cb) }, |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1032 { "DeleteAlt2",GTK_STOCK_DELETE, N_("_Delete..."), "KP_Delete", NULL, CB(layout_menu_delete_cb) }, |
9 | 1033 { "CloseWindow", GTK_STOCK_CLOSE,N_("C_lose window"), "<control>W", NULL, CB(layout_menu_close_cb) }, |
1034 { "Quit", GTK_STOCK_QUIT, N_("_Quit"), "<control>Q", NULL, CB(layout_menu_exit_cb) }, | |
1035 | |
163 | 1036 { "Editor0", NULL, "editor0", NULL, NULL, CB(layout_menu_edit_cb) }, |
1037 { "Editor1", NULL, "editor1", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1038 { "Editor2", NULL, "editor2", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1039 { "Editor3", NULL, "editor3", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1040 { "Editor4", NULL, "editor4", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1041 { "Editor5", NULL, "editor5", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1042 { "Editor6", NULL, "editor6", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1043 { "Editor7", NULL, "editor7", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1044 { "Editor8", NULL, "editor8", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1045 { "Editor9", NULL, "editor9", NULL, NULL, CB(layout_menu_edit_cb) }, | |
442 | 1046 |
9 | 1047 { "RotateCW", NULL, N_("_Rotate clockwise"), "bracketright", NULL, CB(layout_menu_alter_90_cb) }, |
1048 { "RotateCCW", NULL, N_("Rotate _counterclockwise"), "bracketleft", NULL, CB(layout_menu_alter_90cc_cb) }, | |
1049 { "Rotate180", NULL, N_("Rotate 1_80"), "<shift>R", NULL, CB(layout_menu_alter_180_cb) }, | |
1050 { "Mirror", NULL, N_("_Mirror"), "<shift>M", NULL, CB(layout_menu_alter_mirror_cb) }, | |
1051 { "Flip", NULL, N_("_Flip"), "<shift>F", NULL, CB(layout_menu_alter_flip_cb) }, | |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
380
diff
changeset
|
1052 { "Grayscale", NULL, N_("Toggle _grayscale"),"<shift>G", NULL, CB(layout_menu_alter_desaturate_cb) }, |
439 | 1053 { "AlterNone", NULL, N_("_Original state"), "<shift>O", NULL, CB(layout_menu_alter_none_cb) }, |
1054 | |
9 | 1055 { "Properties",GTK_STOCK_PROPERTIES, N_("_Properties"), "<control>P", NULL, CB(layout_menu_info_cb) }, |
1056 { "SelectAll", NULL, N_("Select _all"), "<control>A", NULL, CB(layout_menu_select_all_cb) }, | |
1057 { "SelectNone", NULL, N_("Select _none"), "<control><shift>A",NULL, CB(layout_menu_unselect_all_cb) }, | |
1058 { "Preferences",GTK_STOCK_PREFERENCES,N_("P_references..."), "<control>O", NULL, CB(layout_menu_config_cb) }, | |
1059 { "Maintenance", NULL, N_("_Thumbnail maintenance..."),NULL, NULL, CB(layout_menu_remove_thumb_cb) }, | |
1060 { "Wallpaper", NULL, N_("Set as _wallpaper"),NULL, NULL, CB(layout_menu_wallpaper_cb) }, | |
1061 | |
1062 { "ZoomIn", GTK_STOCK_ZOOM_IN, N_("Zoom _in"), "equal", NULL, CB(layout_menu_zoom_in_cb) }, | |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1063 { "ZoomInAlt1",GTK_STOCK_ZOOM_IN, N_("Zoom _in"), "plus", NULL, CB(layout_menu_zoom_in_cb) }, |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1064 { "ZoomInAlt2",GTK_STOCK_ZOOM_IN, N_("Zoom _in"), "KP_Add", NULL, CB(layout_menu_zoom_in_cb) }, |
9 | 1065 { "ZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _out"), "minus", NULL, CB(layout_menu_zoom_out_cb) }, |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1066 { "ZoomOutAlt1",GTK_STOCK_ZOOM_OUT, N_("Zoom _out"), "KP_Subtract", NULL, CB(layout_menu_zoom_out_cb) }, |
9 | 1067 { "Zoom100", GTK_STOCK_ZOOM_100, N_("Zoom _1:1"), "Z", NULL, CB(layout_menu_zoom_1_1_cb) }, |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1068 { "Zoom100Alt1",GTK_STOCK_ZOOM_100, N_("Zoom _1:1"), "KP_Divide", NULL, CB(layout_menu_zoom_1_1_cb) }, |
9 | 1069 { "ZoomFit", GTK_STOCK_ZOOM_FIT, N_("_Zoom to fit"), "X", NULL, CB(layout_menu_zoom_fit_cb) }, |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1070 { "ZoomFitAlt1",GTK_STOCK_ZOOM_FIT, N_("_Zoom to fit"), "KP_Multiply", NULL, CB(layout_menu_zoom_fit_cb) }, |
159 | 1071 { "ZoomFillHor", NULL, N_("Fit _Horizontally"),"H", NULL, CB(layout_menu_zoom_fit_hor_cb) }, |
1072 { "ZoomFillVert", NULL, N_("Fit _Vorizontally"),"W", NULL, CB(layout_menu_zoom_fit_vert_cb) }, | |
1073 { "Zoom200", NULL, N_("Zoom _2:1"), NULL, NULL, CB(layout_menu_zoom_2_1_cb) }, | |
1074 { "Zoom300", NULL, N_("Zoom _3:1"), NULL, NULL, CB(layout_menu_zoom_3_1_cb) }, | |
1075 { "Zoom400", NULL, N_("Zoom _4:1"), NULL, NULL, CB(layout_menu_zoom_4_1_cb) }, | |
1076 { "Zoom50", NULL, N_("Zoom 1:2"), NULL, NULL, CB(layout_menu_zoom_1_2_cb) }, | |
1077 { "Zoom33", NULL, N_("Zoom 1:3"), NULL, NULL, CB(layout_menu_zoom_1_3_cb) }, | |
1078 { "Zoom25", NULL, N_("Zoom 1:4"), NULL, NULL, CB(layout_menu_zoom_1_4_cb) }, | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1079 |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1080 |
159 | 1081 { "ViewInNewWindow", NULL, N_("_View in new window"), "<control>V", NULL, CB(layout_menu_view_in_new_window_cb) }, |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1082 |
9 | 1083 { "FullScreen", NULL, N_("F_ull screen"), "F", NULL, CB(layout_menu_fullscreen_cb) }, |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1084 { "FullScreenAlt1", NULL, N_("F_ull screen"), "V", NULL, CB(layout_menu_fullscreen_cb) }, |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1085 { "FullScreenAlt2", NULL, N_("F_ull screen"), "F11", NULL, CB(layout_menu_fullscreen_cb) }, |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1086 { "Escape", NULL, N_("Escape"), "Escape", NULL, CB(layout_menu_escape_cb) }, |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1087 { "EscapeAlt1", NULL, N_("Escape"), "Q", NULL, CB(layout_menu_escape_cb) }, |
159 | 1088 { "ImageOverlay", NULL, N_("_Image Overlay"), "I", NULL, CB(layout_menu_overlay_cb) }, |
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
1089 { "HistogramChan", NULL, N_("Histogram _channels"), "K", NULL, CB(layout_menu_histogram_chan_cb) }, |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
1090 { "HistogramLog", NULL, N_("Histogram _log mode"), "J", NULL, CB(layout_menu_histogram_log_cb) }, |
9 | 1091 { "HideTools", NULL, N_("_Hide file list"), "<control>H", NULL, CB(layout_menu_hide_cb) }, |
450 | 1092 { "SlideShowPause", NULL, N_("_Pause slideshow"), "P", NULL, CB(layout_menu_slideshow_pause_cb) }, |
9 | 1093 { "Refresh", GTK_STOCK_REFRESH, N_("_Refresh"), "R", NULL, CB(layout_menu_refresh_cb) }, |
1094 | |
1095 { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", NULL, CB(layout_menu_help_cb) }, | |
1096 { "HelpShortcuts", NULL, N_("_Keyboard shortcuts"),NULL, NULL, CB(layout_menu_help_keys_cb) }, | |
1097 { "HelpNotes", NULL, N_("_Release notes"), NULL, NULL, CB(layout_menu_notes_cb) }, | |
1098 { "About", NULL, N_("_About"), NULL, NULL, CB(layout_menu_about_cb) } | |
1099 }; | |
1100 | |
1101 static GtkToggleActionEntry menu_toggle_entries[] = { | |
1102 { "Thumbnails", NULL, N_("_Thumbnails"), "T", NULL, CB(layout_menu_thumb_cb) }, | |
442 | 1103 { "ShowMarks", NULL, N_("Show _Marks"), "M", NULL, CB(layout_menu_marks_cb) }, |
9 | 1104 { "FloatTools", NULL, N_("_Float file list"), "L", NULL, CB(layout_menu_float_cb) }, |
1105 { "HideToolbar", NULL, N_("Hide tool_bar"), NULL, NULL, CB(layout_menu_toolbar_cb) }, | |
1106 { "SBarKeywords", NULL, N_("_Keywords"), "<control>K", NULL, CB(layout_menu_bar_info_cb) }, | |
1107 { "SBarExif", NULL, N_("E_xif data"), "<control>E", NULL, CB(layout_menu_bar_exif_cb) }, | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1108 { "SBarSort", NULL, N_("Sort _manager"), "<control>S", NULL, CB(layout_menu_bar_sort_cb) }, |
453 | 1109 { "ConnectScroll", NULL, N_("Co_nnected scroll"), "<control>U", NULL, CB(layout_menu_connect_scroll_cb) }, |
1110 { "ConnectZoom", NULL, N_("C_onnected zoom"), "<control>Y", NULL, CB(layout_menu_connect_zoom_cb) }, | |
451 | 1111 { "SlideShow", NULL, N_("Toggle _slideshow"),"S", NULL, CB(layout_menu_slideshow_cb) }, |
9 | 1112 }; |
1113 | |
1114 static GtkRadioActionEntry menu_radio_entries[] = { | |
1115 { "ViewList", NULL, N_("_List"), "<control>L", NULL, 0 }, | |
1116 { "ViewIcons", NULL, N_("I_cons"), "<control>I", NULL, 1 } | |
1117 }; | |
1118 | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1119 static GtkRadioActionEntry menu_split_radio_entries[] = { |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1120 { "SplitHorizontal", NULL, N_("Horizontal"), "E", NULL, SPLIT_HOR }, |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1121 { "SplitVertical", NULL, N_("Vertical"), "U", NULL, SPLIT_VERT }, |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1122 { "SplitQuad", NULL, N_("Quad"), NULL, NULL, SPLIT_QUAD }, |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1123 { "SplitSingle", NULL, N_("Single"), "Y", NULL, SPLIT_NONE } |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1124 }; |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1125 |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
1126 |
9 | 1127 #undef CB |
1128 | |
1129 static const char *menu_ui_description = | |
1130 "<ui>" | |
1131 " <menubar name='MainMenu'>" | |
1132 " <menu action='FileMenu'>" | |
1133 " <menuitem action='NewWindow'/>" | |
1134 " <menuitem action='NewCollection'/>" | |
1135 " <menuitem action='OpenCollection'/>" | |
1136 " <menuitem action='OpenRecent'/>" | |
1137 " <separator/>" | |
1138 " <menuitem action='Search'/>" | |
1139 " <menuitem action='FindDupes'/>" | |
12
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1140 " <menuitem action='PanView'/>" |
9 | 1141 " <separator/>" |
1142 " <menuitem action='Print'/>" | |
1143 " <menuitem action='NewFolder'/>" | |
1144 " <separator/>" | |
1145 " <menuitem action='Copy'/>" | |
1146 " <menuitem action='Move'/>" | |
1147 " <menuitem action='Rename'/>" | |
1148 " <menuitem action='Delete'/>" | |
1149 " <separator/>" | |
1150 " <menuitem action='CloseWindow'/>" | |
1151 " <menuitem action='Quit'/>" | |
1152 " </menu>" | |
159 | 1153 " <menu action='GoMenu'>" |
1154 " <menuitem action='FirstImage'/>" | |
1155 " <menuitem action='PrevImage'/>" | |
1156 " <menuitem action='NextImage'/>" | |
1157 " <menuitem action='LastImage'/>" | |
1158 " </menu>" | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1159 " <menu action='SelectMenu'>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1160 " <menuitem action='SelectAll'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1161 " <menuitem action='SelectNone'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1162 " <separator/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1163 " <menuitem action='ShowMarks'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1164 " <separator/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1165 " </menu>" |
9 | 1166 " <menu action='EditMenu'>" |
1167 " <menuitem action='Editor0'/>" | |
1168 " <menuitem action='Editor1'/>" | |
1169 " <menuitem action='Editor2'/>" | |
1170 " <menuitem action='Editor3'/>" | |
1171 " <menuitem action='Editor4'/>" | |
1172 " <menuitem action='Editor5'/>" | |
1173 " <menuitem action='Editor6'/>" | |
1174 " <menuitem action='Editor7'/>" | |
1175 " <menuitem action='Editor8'/>" | |
1176 " <menuitem action='Editor9'/>" | |
1177 " <separator/>" | |
1178 " <menu action='AdjustMenu'>" | |
1179 " <menuitem action='RotateCW'/>" | |
1180 " <menuitem action='RotateCCW'/>" | |
1181 " <menuitem action='Rotate180'/>" | |
1182 " <menuitem action='Mirror'/>" | |
1183 " <menuitem action='Flip'/>" | |
82
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1184 " <menuitem action='Grayscale'/>" |
439 | 1185 " <menuitem action='AlterNone'/>" |
9 | 1186 " </menu>" |
1187 " <menuitem action='Properties'/>" | |
1188 " <separator/>" | |
1189 " <menuitem action='Preferences'/>" | |
1190 " <menuitem action='Maintenance'/>" | |
1191 " <separator/>" | |
1192 " <menuitem action='Wallpaper'/>" | |
1193 " </menu>" | |
1194 " <menu action='ViewMenu'>" | |
159 | 1195 " <menuitem action='ViewInNewWindow'/>" |
9 | 1196 " <separator/>" |
159 | 1197 " <menu action='ZoomMenu'>" |
1198 " <menuitem action='ZoomIn'/>" | |
1199 " <menuitem action='ZoomOut'/>" | |
1200 " <menuitem action='ZoomFit'/>" | |
1201 " <menuitem action='ZoomFillHor'/>" | |
1202 " <menuitem action='ZoomFillVert'/>" | |
1203 " <menuitem action='Zoom100'/>" | |
1204 " <menuitem action='Zoom200'/>" | |
1205 " <menuitem action='Zoom300'/>" | |
1206 " <menuitem action='Zoom400'/>" | |
1207 " <menuitem action='Zoom50'/>" | |
1208 " <menuitem action='Zoom33'/>" | |
1209 " <menuitem action='Zoom25'/>" | |
1210 " </menu>" | |
9 | 1211 " <separator/>" |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1212 " <menu action='SplitMenu'>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1213 " <menuitem action='SplitHorizontal'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1214 " <menuitem action='SplitVertical'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1215 " <menuitem action='SplitQuad'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1216 " <menuitem action='SplitSingle'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1217 " </menu>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1218 " <menuitem action='ConnectScroll'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1219 " <menuitem action='ConnectZoom'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1220 " <separator/>" |
9 | 1221 " <menuitem action='Thumbnails'/>" |
1222 " <menuitem action='ViewList'/>" | |
1223 " <menuitem action='ViewIcons'/>" | |
1224 " <separator/>" | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
1225 " <menu action='DirMenu'>" |
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
1226 " <menuitem action='FolderList'/>" |
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
1227 " <menuitem action='FolderTree'/>" |
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
1228 " </menu>" |
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
1229 " <separator/>" |
159 | 1230 " <menuitem action='ImageOverlay'/>" |
273
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
1231 " <menuitem action='HistogramChan'/>" |
e0e2c2b72c5a
reworked the histogram patch by Uwe Ohse, most of the code is in
nadvornik
parents:
249
diff
changeset
|
1232 " <menuitem action='HistogramLog'/>" |
9 | 1233 " <menuitem action='FullScreen'/>" |
1234 " <separator/>" | |
1235 " <menuitem action='FloatTools'/>" | |
1236 " <menuitem action='HideTools'/>" | |
1237 " <menuitem action='HideToolbar'/>" | |
1238 " <separator/>" | |
1239 " <menuitem action='SBarKeywords'/>" | |
1240 " <menuitem action='SBarExif'/>" | |
1241 " <menuitem action='SBarSort'/>" | |
1242 " <separator/>" | |
1243 " <menuitem action='SlideShow'/>" | |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1244 " <menuitem action='SlideShowPause'/>" |
9 | 1245 " <menuitem action='Refresh'/>" |
1246 " </menu>" | |
1247 " <menu action='HelpMenu'>" | |
1248 " <separator/>" | |
1249 " <menuitem action='HelpContents'/>" | |
1250 " <menuitem action='HelpShortcuts'/>" | |
1251 " <menuitem action='HelpNotes'/>" | |
1252 " <separator/>" | |
1253 " <menuitem action='About'/>" | |
1254 " </menu>" | |
1255 " </menubar>" | |
428
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1256 "<accelerator action='PrevImageAlt1'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1257 "<accelerator action='PrevImageAlt2'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1258 "<accelerator action='NextImageAlt1'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1259 "<accelerator action='NextImageAlt2'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1260 "<accelerator action='DeleteAlt1'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1261 "<accelerator action='DeleteAlt2'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1262 "<accelerator action='ZoomInAlt1'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1263 "<accelerator action='ZoomInAlt2'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1264 "<accelerator action='ZoomOutAlt1'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1265 "<accelerator action='Zoom100Alt1'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1266 "<accelerator action='ZoomFitAlt1'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1267 "<accelerator action='FullScreenAlt1'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1268 "<accelerator action='FullScreenAlt2'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1269 "<accelerator action='Escape'/>" |
af843364b3ea
I have finally found how to add alternative hotkeys
nadvornik
parents:
398
diff
changeset
|
1270 "<accelerator action='EscapeAlt1'/>" |
9 | 1271 "</ui>"; |
1272 | |
1273 | |
1274 static gchar *menu_translate(const gchar *path, gpointer data) | |
1275 { | |
1276 return _(path); | |
1277 } | |
1278 | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1279 static void layout_actions_setup_mark(LayoutWindow *lw, gint mark, char *name_tmpl, char *label_tmpl, char *accel_tmpl, GCallback cb) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1280 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1281 char name[50]; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1282 char label[100]; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1283 char accel[50]; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1284 GtkActionEntry entry = { name, NULL, label, accel, NULL, cb }; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1285 GtkAction *action; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1286 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1287 g_snprintf(name, sizeof(name), name_tmpl, mark); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1288 g_snprintf(label, sizeof(label), label_tmpl, mark); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1289 if (accel_tmpl) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1290 g_snprintf(accel, sizeof(accel), accel_tmpl, mark % 10); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1291 else |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1292 accel[0] = 0; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1293 gtk_action_group_add_actions(lw->action_group, &entry, 1, lw); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1294 action = gtk_action_group_get_action(lw->action_group, name); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1295 g_object_set_data(G_OBJECT(action), "mark_num", GINT_TO_POINTER(mark)); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1296 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1297 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1298 static void layout_actions_setup_marks(LayoutWindow *lw) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1299 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1300 int mark; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1301 GError *error; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1302 GString *desc = g_string_new( |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1303 "<ui>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1304 " <menubar name='MainMenu'>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1305 " <menu action='SelectMenu'>"); |
442 | 1306 |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1307 for (mark = 1; mark <= FILEDATA_MARKS_SIZE; mark++) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1308 { |
163 | 1309 layout_actions_setup_mark(lw, mark, "Mark%d", _("Mark _%d"), NULL, NULL); |
1310 layout_actions_setup_mark(lw, mark, "SetMark%d", _("_Set mark %d"), NULL, G_CALLBACK(layout_menu_set_mark_sel_cb)); | |
1311 layout_actions_setup_mark(lw, mark, "ResetMark%d", _("_Reset mark %d"), NULL, G_CALLBACK(layout_menu_res_mark_sel_cb)); | |
1312 layout_actions_setup_mark(lw, mark, "ToggleMark%d", _("_Toggle mark %d"), "%d", G_CALLBACK(layout_menu_toggle_mark_sel_cb)); | |
429 | 1313 layout_actions_setup_mark(lw, mark, "ToggleMark%dAlt1", _("_Toggle mark %d"), "KP_%d", G_CALLBACK(layout_menu_toggle_mark_sel_cb)); |
163 | 1314 layout_actions_setup_mark(lw, mark, "SelectMark%d", _("_Select mark %d"), "<control>%d", G_CALLBACK(layout_menu_sel_mark_cb)); |
429 | 1315 layout_actions_setup_mark(lw, mark, "SelectMark%dAlt1", _("_Select mark %d"), "<control>KP_%d", G_CALLBACK(layout_menu_sel_mark_cb)); |
163 | 1316 layout_actions_setup_mark(lw, mark, "AddMark%d", _("_Add mark %d"), NULL, G_CALLBACK(layout_menu_sel_mark_or_cb)); |
1317 layout_actions_setup_mark(lw, mark, "IntMark%d", _("_Intersection with mark %d"), NULL, G_CALLBACK(layout_menu_sel_mark_and_cb)); | |
1318 layout_actions_setup_mark(lw, mark, "UnselMark%d", _("_Unselect mark %d"), NULL, G_CALLBACK(layout_menu_sel_mark_minus_cb)); | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1319 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1320 g_string_append_printf(desc, |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1321 " <menu action='Mark%d'>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1322 " <menuitem action='ToggleMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1323 " <menuitem action='SetMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1324 " <menuitem action='ResetMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1325 " <separator/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1326 " <menuitem action='SelectMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1327 " <menuitem action='AddMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1328 " <menuitem action='IntMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1329 " <menuitem action='UnselMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1330 " </menu>", |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1331 mark, mark, mark, mark, mark, mark, mark, mark); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1332 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1333 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1334 g_string_append(desc, |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1335 " </menu>" |
429 | 1336 " </menubar>"); |
1337 for (mark = 1; mark <= FILEDATA_MARKS_SIZE; mark++) | |
1338 { | |
1339 g_string_append_printf(desc, | |
1340 "<accelerator action='ToggleMark%dAlt1'/>" | |
1341 "<accelerator action='SelectMark%dAlt1'/>", | |
1342 mark, mark); | |
1343 } | |
1344 g_string_append(desc, "</ui>" ); | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1345 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1346 error = NULL; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1347 if (!gtk_ui_manager_add_ui_from_string(lw->ui_manager, desc->str, -1, &error)) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1348 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1349 g_message ("building menus failed: %s", error->message); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1350 g_error_free (error); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1351 exit (EXIT_FAILURE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1352 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1353 g_string_free(desc, TRUE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1354 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1355 |
9 | 1356 void layout_actions_setup(LayoutWindow *lw) |
1357 { | |
1358 GError *error; | |
1359 | |
1360 if (lw->ui_manager) return; | |
1361 | |
1362 lw->action_group = gtk_action_group_new ("MenuActions"); | |
1363 gtk_action_group_set_translate_func(lw->action_group, menu_translate, NULL, NULL); | |
1364 | |
1365 gtk_action_group_add_actions(lw->action_group, | |
1366 menu_entries, G_N_ELEMENTS(menu_entries), lw); | |
1367 gtk_action_group_add_toggle_actions(lw->action_group, | |
1368 menu_toggle_entries, G_N_ELEMENTS(menu_toggle_entries), lw); | |
1369 gtk_action_group_add_radio_actions(lw->action_group, | |
1370 menu_radio_entries, G_N_ELEMENTS(menu_radio_entries), | |
1371 0, G_CALLBACK(layout_menu_list_cb), lw); | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1372 gtk_action_group_add_radio_actions(lw->action_group, |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1373 menu_split_radio_entries, G_N_ELEMENTS(menu_split_radio_entries), |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1374 0, G_CALLBACK(layout_menu_split_cb), lw); |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
1375 gtk_action_group_add_radio_actions(lw->action_group, |
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
1376 menu_view_dir_radio_entries, G_N_ELEMENTS(menu_view_dir_radio_entries), |
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
343
diff
changeset
|
1377 0, G_CALLBACK(layout_menu_view_dir_as_cb), lw); |
9 | 1378 |
1379 lw->ui_manager = gtk_ui_manager_new(); | |
1380 gtk_ui_manager_set_add_tearoffs(lw->ui_manager, TRUE); | |
1381 gtk_ui_manager_insert_action_group(lw->ui_manager, lw->action_group, 0); | |
1382 | |
1383 error = NULL; | |
1384 if (!gtk_ui_manager_add_ui_from_string(lw->ui_manager, menu_ui_description, -1, &error)) | |
1385 { | |
1386 g_message ("building menus failed: %s", error->message); | |
1387 g_error_free (error); | |
1388 exit (EXIT_FAILURE); | |
1389 } | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1390 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1391 layout_actions_setup_marks(lw); |
9 | 1392 } |
1393 | |
1394 void layout_actions_add_window(LayoutWindow *lw, GtkWidget *window) | |
1395 { | |
1396 GtkAccelGroup *group; | |
1397 | |
1398 if (!lw->ui_manager) return; | |
1399 | |
1400 group = gtk_ui_manager_get_accel_group(lw->ui_manager); | |
1401 gtk_window_add_accel_group(GTK_WINDOW(window), group); | |
1402 } | |
1403 | |
1404 GtkWidget *layout_actions_menu_bar(LayoutWindow *lw) | |
1405 { | |
1406 return gtk_ui_manager_get_widget(lw->ui_manager, "/MainMenu"); | |
1407 } | |
1408 | |
1409 | |
1410 /* | |
1411 *----------------------------------------------------------------------------- | |
1412 * toolbar | |
1413 *----------------------------------------------------------------------------- | |
442 | 1414 */ |
9 | 1415 |
1416 static void layout_button_thumb_cb(GtkWidget *widget, gpointer data) | |
1417 { | |
1418 LayoutWindow *lw = data; | |
1419 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1420 layout_thumb_set(lw, gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget))); |
9 | 1421 } |
1422 | |
1423 static void layout_button_home_cb(GtkWidget *widget, gpointer data) | |
1424 { | |
1425 LayoutWindow *lw = data; | |
1426 const gchar *path = homedir(); | |
1427 | |
1428 if (path) layout_set_path(lw, path); | |
1429 } | |
1430 | |
1431 static void layout_button_refresh_cb(GtkWidget *widget, gpointer data) | |
1432 { | |
1433 LayoutWindow *lw = data; | |
1434 | |
1435 layout_refresh(lw); | |
1436 } | |
1437 | |
1438 static void layout_button_zoom_in_cb(GtkWidget *widget, gpointer data) | |
1439 { | |
1440 LayoutWindow *lw = data; | |
1441 | |
1442 layout_image_zoom_adjust(lw, get_zoom_increment()); | |
1443 } | |
1444 | |
1445 static void layout_button_zoom_out_cb(GtkWidget *widget, gpointer data) | |
1446 { | |
1447 LayoutWindow *lw = data; | |
1448 | |
1449 layout_image_zoom_adjust(lw, -get_zoom_increment()); | |
1450 } | |
1451 | |
1452 static void layout_button_zoom_fit_cb(GtkWidget *widget, gpointer data) | |
1453 { | |
1454 LayoutWindow *lw = data; | |
1455 | |
1456 layout_image_zoom_set(lw, 0.0); | |
1457 } | |
1458 | |
1459 static void layout_button_zoom_1_1_cb(GtkWidget *widget, gpointer data) | |
1460 { | |
1461 LayoutWindow *lw = data; | |
1462 | |
1463 layout_image_zoom_set(lw, 1.0); | |
1464 } | |
1465 | |
1466 static void layout_button_config_cb(GtkWidget *widget, gpointer data) | |
1467 { | |
1468 show_config_window(); | |
1469 } | |
1470 | |
1471 static void layout_button_float_cb(GtkWidget *widget, gpointer data) | |
1472 { | |
1473 LayoutWindow *lw = data; | |
1474 | |
1475 layout_tools_float_toggle(lw); | |
1476 } | |
1477 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1478 static void layout_button_custom_icon(GtkWidget *button, const gchar *key) |
9 | 1479 { |
1480 GtkWidget *icon; | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1481 GdkPixbuf *pixbuf; |
9 | 1482 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1483 pixbuf = pixbuf_inline(key); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1484 if (!pixbuf) return; |
9 | 1485 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1486 icon = gtk_image_new_from_pixbuf(pixbuf); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1487 g_object_unref(pixbuf); |
9 | 1488 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1489 pref_toolbar_button_set_icon(button, icon, NULL); |
9 | 1490 gtk_widget_show(icon); |
1491 } | |
1492 | |
1493 GtkWidget *layout_button_bar(LayoutWindow *lw) | |
1494 { | |
1495 GtkWidget *box; | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1496 GtkWidget *button; |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1497 |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1498 box = pref_toolbar_new(NULL, GTK_TOOLBAR_ICONS); |
9 | 1499 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1500 button = pref_toolbar_button(box, NULL, _("_Thumbnails"), TRUE, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1501 _("Show thumbnails"), G_CALLBACK(layout_button_thumb_cb), lw); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1502 layout_button_custom_icon(button, PIXBUF_INLINE_ICON_THUMB); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1503 lw->thumb_button = button; |
9 | 1504 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1505 pref_toolbar_button(box, GTK_STOCK_HOME, NULL, FALSE, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1506 _("Change to home folder"), G_CALLBACK(layout_button_home_cb), lw); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1507 pref_toolbar_button(box, GTK_STOCK_REFRESH, NULL, FALSE, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1508 _("Refresh file list"), G_CALLBACK(layout_button_refresh_cb), lw); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1509 pref_toolbar_button(box, GTK_STOCK_ZOOM_IN, NULL, FALSE, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1510 _("Zoom in"), G_CALLBACK(layout_button_zoom_in_cb), lw); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1511 pref_toolbar_button(box, GTK_STOCK_ZOOM_OUT, NULL, FALSE, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1512 _("Zoom out"), G_CALLBACK(layout_button_zoom_out_cb), lw); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1513 pref_toolbar_button(box, GTK_STOCK_ZOOM_FIT, NULL, FALSE, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1514 _("Fit image to window"), G_CALLBACK(layout_button_zoom_fit_cb), lw); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1515 pref_toolbar_button(box, GTK_STOCK_ZOOM_100, NULL, FALSE, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1516 _("Set zoom 1:1"), G_CALLBACK(layout_button_zoom_1_1_cb), lw); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1517 pref_toolbar_button(box, GTK_STOCK_PREFERENCES, NULL, FALSE, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1518 _("Configure options"), G_CALLBACK(layout_button_config_cb), lw); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1519 button = pref_toolbar_button(box, NULL, _("_Float"), FALSE, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1520 _("Float Controls"), G_CALLBACK(layout_button_float_cb), lw); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1521 layout_button_custom_icon(button, PIXBUF_INLINE_ICON_FLOAT); |
9 | 1522 |
1523 return box; | |
1524 } | |
1525 | |
1526 /* | |
1527 *----------------------------------------------------------------------------- | |
1528 * misc | |
1529 *----------------------------------------------------------------------------- | |
1530 */ | |
1531 | |
1532 static void layout_util_sync_views(LayoutWindow *lw) | |
1533 { | |
1534 GtkAction *action; | |
1535 | |
1536 if (!lw->action_group) return; | |
1537 | |
1538 action = gtk_action_group_get_action(lw->action_group, "FolderTree"); | |
457
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
454
diff
changeset
|
1539 radio_action_set_current_value(GTK_RADIO_ACTION(action), lw->dir_view_type); |
9 | 1540 |
1541 action = gtk_action_group_get_action(lw->action_group, "ViewIcons"); | |
1542 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->icon_view); | |
1543 | |
1544 action = gtk_action_group_get_action(lw->action_group, "FloatTools"); | |
1545 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->tools_float); | |
1546 | |
1547 action = gtk_action_group_get_action(lw->action_group, "SBarKeywords"); | |
1548 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->bar_info_enabled); | |
1549 | |
1550 action = gtk_action_group_get_action(lw->action_group, "SBarExif"); | |
1551 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->bar_exif_enabled); | |
1552 | |
1553 action = gtk_action_group_get_action(lw->action_group, "SBarSort"); | |
1554 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->bar_sort_enabled); | |
1555 | |
1556 action = gtk_action_group_get_action(lw->action_group, "HideToolbar"); | |
1557 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->toolbar_hidden); | |
433
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
429
diff
changeset
|
1558 |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
429
diff
changeset
|
1559 action = gtk_action_group_get_action(lw->action_group, "ShowMarks"); |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
429
diff
changeset
|
1560 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->marks_enabled); |
451 | 1561 |
1562 action = gtk_action_group_get_action(lw->action_group, "SlideShow"); | |
1563 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), layout_image_slideshow_active(lw)); | |
9 | 1564 } |
1565 | |
1566 void layout_util_sync_thumb(LayoutWindow *lw) | |
1567 { | |
1568 GtkAction *action; | |
1569 | |
1570 if (!lw->action_group) return; | |
1571 | |
1572 action = gtk_action_group_get_action(lw->action_group, "Thumbnails"); | |
1573 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->thumbs_enabled); | |
1574 g_object_set(action, "sensitive", !lw->icon_view, NULL); | |
1575 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1576 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(lw->thumb_button), lw->thumbs_enabled); |
9 | 1577 gtk_widget_set_sensitive(lw->thumb_button, !lw->icon_view); |
1578 } | |
1579 | |
1580 void layout_util_sync(LayoutWindow *lw) | |
1581 { | |
1582 layout_util_sync_views(lw); | |
1583 layout_util_sync_thumb(lw); | |
1584 layout_menu_recent_update(lw); | |
1585 layout_menu_edit_update(lw); | |
1586 } | |
1587 | |
1588 /* | |
1589 *----------------------------------------------------------------------------- | |
1590 * icons (since all the toolbar icons are included here, best place as any) | |
1591 *----------------------------------------------------------------------------- | |
1592 */ | |
1593 | |
1594 PixmapFolders *folder_icons_new(void) | |
1595 { | |
1596 PixmapFolders *pf; | |
1597 | |
1598 pf = g_new0(PixmapFolders, 1); | |
1599 | |
1600 pf->close = pixbuf_inline(PIXBUF_INLINE_FOLDER_CLOSED); | |
1601 pf->open = pixbuf_inline(PIXBUF_INLINE_FOLDER_OPEN); | |
1602 pf->deny = pixbuf_inline(PIXBUF_INLINE_FOLDER_LOCKED); | |
1603 pf->parent = pixbuf_inline(PIXBUF_INLINE_FOLDER_UP); | |
1604 | |
1605 return pf; | |
1606 } | |
1607 | |
1608 void folder_icons_free(PixmapFolders *pf) | |
1609 { | |
1610 if (!pf) return; | |
1611 | |
1612 g_object_unref(pf->close); | |
1613 g_object_unref(pf->open); | |
1614 g_object_unref(pf->deny); | |
1615 g_object_unref(pf->parent); | |
1616 | |
1617 g_free(pf); | |
1618 } | |
1619 | |
1620 /* | |
1621 *----------------------------------------------------------------------------- | |
1622 * sidebars | |
1623 *----------------------------------------------------------------------------- | |
1624 */ | |
1625 | |
1626 static void layout_bar_info_destroyed(GtkWidget *widget, gpointer data) | |
1627 { | |
1628 LayoutWindow *lw = data; | |
1629 | |
1630 lw->bar_info = NULL; | |
1631 | |
1632 if (lw->utility_box) | |
1633 { | |
1634 /* destroyed from within itself */ | |
1635 lw->bar_info_enabled = FALSE; | |
1636 layout_util_sync_views(lw); | |
1637 } | |
1638 } | |
1639 | |
1640 static GList *layout_bar_info_list_cb(gpointer data) | |
1641 { | |
1642 LayoutWindow *lw = data; | |
1643 | |
1644 return layout_selection_list(lw); | |
1645 } | |
1646 | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1647 static void layout_bar_info_sized(GtkWidget *widget, GtkAllocation *allocation, gpointer data) |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1648 { |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1649 LayoutWindow *lw = data; |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1650 |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1651 if (!lw->bar_info) return; |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1652 |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1653 options->panels.info.width = lw->bar_info_width = allocation->width; |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1654 } |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1655 |
9 | 1656 static void layout_bar_info_new(LayoutWindow *lw) |
1657 { | |
1658 if (!lw->utility_box) return; | |
442 | 1659 |
138 | 1660 lw->bar_info = bar_info_new(layout_image_get_fd(lw), FALSE, lw->utility_box); |
9 | 1661 bar_info_set_selection_func(lw->bar_info, layout_bar_info_list_cb, lw); |
1662 bar_info_selection(lw->bar_info, layout_selection_count(lw, NULL) - 1); | |
1663 g_signal_connect(G_OBJECT(lw->bar_info), "destroy", | |
1664 G_CALLBACK(layout_bar_info_destroyed), lw); | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1665 g_signal_connect(G_OBJECT(lw->bar_info), "size_allocate", |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1666 G_CALLBACK(layout_bar_info_sized), lw); |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1667 |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1668 options->panels.info.enabled = lw->bar_info_enabled = TRUE; |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1669 gtk_widget_set_size_request(lw->bar_info, lw->bar_info_width, -1); |
9 | 1670 |
1671 gtk_box_pack_start(GTK_BOX(lw->utility_box), lw->bar_info, FALSE, FALSE, 0); | |
1672 gtk_widget_show(lw->bar_info); | |
1673 } | |
442 | 1674 |
9 | 1675 static void layout_bar_info_close(LayoutWindow *lw) |
1676 { | |
1677 if (lw->bar_info) | |
1678 { | |
1679 bar_info_close(lw->bar_info); | |
1680 lw->bar_info = NULL; | |
1681 } | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1682 options->panels.info.enabled = lw->bar_info_enabled = FALSE; |
9 | 1683 } |
1684 | |
1685 void layout_bar_info_toggle(LayoutWindow *lw) | |
1686 { | |
1687 if (lw->bar_info_enabled) | |
1688 { | |
1689 layout_bar_info_close(lw); | |
1690 } | |
1691 else | |
1692 { | |
1693 layout_bar_info_new(lw); | |
1694 } | |
1695 } | |
1696 | |
1697 static void layout_bar_info_new_image(LayoutWindow *lw) | |
1698 { | |
1699 if (!lw->bar_info || !lw->bar_info_enabled) return; | |
1700 | |
138 | 1701 bar_info_set(lw->bar_info, layout_image_get_fd(lw)); |
9 | 1702 } |
1703 | |
1704 static void layout_bar_info_new_selection(LayoutWindow *lw, gint count) | |
1705 { | |
1706 if (!lw->bar_info || !lw->bar_info_enabled) return; | |
1707 | |
1708 bar_info_selection(lw->bar_info, count - 1); | |
1709 } | |
1710 | |
1711 static void layout_bar_info_maint_renamed(LayoutWindow *lw) | |
1712 { | |
1713 if (!lw->bar_info || !lw->bar_info_enabled) return; | |
1714 | |
138 | 1715 bar_info_maint_renamed(lw->bar_info, layout_image_get_fd(lw)); |
9 | 1716 } |
1717 | |
1718 static void layout_bar_exif_destroyed(GtkWidget *widget, gpointer data) | |
1719 { | |
1720 LayoutWindow *lw = data; | |
1721 | |
1722 if (lw->bar_exif) | |
1723 { | |
1724 lw->bar_exif_advanced = bar_exif_is_advanced(lw->bar_exif); | |
1725 } | |
1726 | |
1727 lw->bar_exif = NULL; | |
1728 if (lw->utility_box) | |
1729 { | |
1730 /* destroyed from within itself */ | |
1731 lw->bar_exif_enabled = FALSE; | |
1732 layout_util_sync_views(lw); | |
1733 } | |
1734 } | |
1735 | |
1736 static void layout_bar_exif_sized(GtkWidget *widget, GtkAllocation *allocation, gpointer data) | |
1737 { | |
1738 LayoutWindow *lw = data; | |
1739 | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1740 if (!lw->bar_exif) return; |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1741 |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1742 options->panels.exif.width = lw->bar_exif_width = allocation->width; |
9 | 1743 } |
1744 | |
1745 static void layout_bar_exif_new(LayoutWindow *lw) | |
1746 { | |
1747 if (!lw->utility_box) return; | |
1748 | |
138 | 1749 lw->bar_exif = bar_exif_new(TRUE, layout_image_get_fd(lw), |
9 | 1750 lw->bar_exif_advanced, lw->utility_box); |
1751 g_signal_connect(G_OBJECT(lw->bar_exif), "destroy", | |
1752 G_CALLBACK(layout_bar_exif_destroyed), lw); | |
1753 g_signal_connect(G_OBJECT(lw->bar_exif), "size_allocate", | |
1754 G_CALLBACK(layout_bar_exif_sized), lw); | |
1755 | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1756 options->panels.exif.enabled = lw->bar_exif_enabled = TRUE; |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1757 gtk_widget_set_size_request(lw->bar_exif, lw->bar_exif_width, -1); |
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1758 |
9 | 1759 gtk_box_pack_start(GTK_BOX(lw->utility_box), lw->bar_exif, FALSE, FALSE, 0); |
1760 if (lw->bar_info) gtk_box_reorder_child(GTK_BOX(lw->utility_box), lw->bar_exif, 1); | |
1761 gtk_widget_show(lw->bar_exif); | |
1762 } | |
1763 | |
1764 static void layout_bar_exif_close(LayoutWindow *lw) | |
1765 { | |
1766 if (lw->bar_exif) | |
1767 { | |
1768 bar_exif_close(lw->bar_exif); | |
1769 lw->bar_exif = NULL; | |
1770 } | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1771 options->panels.exif.enabled = lw->bar_exif_enabled = FALSE; |
9 | 1772 } |
1773 | |
1774 void layout_bar_exif_toggle(LayoutWindow *lw) | |
1775 { | |
1776 if (lw->bar_exif_enabled) | |
1777 { | |
1778 layout_bar_exif_close(lw); | |
1779 } | |
1780 else | |
1781 { | |
1782 layout_bar_exif_new(lw); | |
1783 } | |
1784 } | |
1785 | |
1786 static void layout_bar_exif_new_image(LayoutWindow *lw) | |
1787 { | |
1788 if (!lw->bar_exif || !lw->bar_exif_enabled) return; | |
1789 | |
138 | 1790 bar_exif_set(lw->bar_exif, layout_image_get_fd(lw)); |
9 | 1791 } |
1792 | |
1793 static void layout_bar_sort_destroyed(GtkWidget *widget, gpointer data) | |
1794 { | |
1795 LayoutWindow *lw = data; | |
1796 | |
1797 lw->bar_sort = NULL; | |
1798 | |
1799 if (lw->utility_box) | |
1800 { | |
1801 /* destroyed from within itself */ | |
1802 lw->bar_sort_enabled = FALSE; | |
1803 | |
1804 layout_util_sync_views(lw); | |
1805 } | |
1806 } | |
1807 | |
1808 static void layout_bar_sort_new(LayoutWindow *lw) | |
1809 { | |
1810 if (!lw->utility_box) return; | |
1811 | |
1812 lw->bar_sort = bar_sort_new(lw); | |
1813 g_signal_connect(G_OBJECT(lw->bar_sort), "destroy", | |
1814 G_CALLBACK(layout_bar_sort_destroyed), lw); | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1815 options->panels.sort.enabled = lw->bar_sort_enabled = TRUE; |
9 | 1816 |
1817 gtk_box_pack_end(GTK_BOX(lw->utility_box), lw->bar_sort, FALSE, FALSE, 0); | |
1818 gtk_widget_show(lw->bar_sort); | |
1819 } | |
1820 | |
1821 static void layout_bar_sort_close(LayoutWindow *lw) | |
1822 { | |
1823 if (lw->bar_sort) | |
1824 { | |
1825 bar_sort_close(lw->bar_sort); | |
1826 lw->bar_sort = NULL; | |
1827 } | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
482
diff
changeset
|
1828 options->panels.sort.enabled = lw->bar_sort_enabled = FALSE; |
9 | 1829 } |
1830 | |
1831 void layout_bar_sort_toggle(LayoutWindow *lw) | |
1832 { | |
1833 if (lw->bar_sort_enabled) | |
1834 { | |
1835 layout_bar_sort_close(lw); | |
1836 } | |
1837 else | |
1838 { | |
1839 layout_bar_sort_new(lw); | |
1840 } | |
1841 } | |
1842 | |
1843 void layout_bars_new_image(LayoutWindow *lw) | |
1844 { | |
1845 layout_bar_info_new_image(lw); | |
1846 layout_bar_exif_new_image(lw); | |
1847 } | |
1848 | |
1849 void layout_bars_new_selection(LayoutWindow *lw, gint count) | |
1850 { | |
1851 layout_bar_info_new_selection(lw, count); | |
1852 } | |
1853 | |
1854 GtkWidget *layout_bars_prepare(LayoutWindow *lw, GtkWidget *image) | |
1855 { | |
1856 lw->utility_box = gtk_hbox_new(FALSE, PREF_PAD_GAP); | |
1857 gtk_box_pack_start(GTK_BOX(lw->utility_box), image, TRUE, TRUE, 0); | |
1858 gtk_widget_show(image); | |
1859 | |
1860 if (lw->bar_sort_enabled) | |
1861 { | |
1862 layout_bar_sort_new(lw); | |
1863 } | |
1864 | |
1865 if (lw->bar_info_enabled) | |
1866 { | |
1867 layout_bar_info_new(lw); | |
1868 } | |
1869 | |
1870 if (lw->bar_exif_enabled) | |
1871 { | |
1872 layout_bar_exif_new(lw); | |
1873 } | |
1874 | |
1875 return lw->utility_box; | |
1876 } | |
1877 | |
1878 void layout_bars_close(LayoutWindow *lw) | |
1879 { | |
1880 layout_bar_sort_close(lw); | |
1881 layout_bar_exif_close(lw); | |
1882 layout_bar_info_close(lw); | |
1883 } | |
1884 | |
1885 void layout_bars_maint_renamed(LayoutWindow *lw) | |
1886 { | |
1887 layout_bar_info_maint_renamed(lw); | |
1888 } |