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