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