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