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