Mercurial > geeqie
annotate src/layout_util.c @ 258:395d7115df14
Change default exif order a bit to move up common and useful
info.
author | zas_ |
---|---|
date | Fri, 04 Apr 2008 22:34:55 +0000 |
parents | c1d7b6d5f228 |
children | e0e2c2b72c5a |
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 | |
596 layout_image_overlay_toggle(lw); | |
597 } | |
598 | |
9 | 599 static void layout_menu_refresh_cb(GtkAction *action, gpointer data) |
600 { | |
601 LayoutWindow *lw = data; | |
602 | |
603 layout_refresh(lw); | |
604 } | |
605 | |
606 static void layout_menu_float_cb(GtkToggleAction *action, gpointer data) | |
607 { | |
608 LayoutWindow *lw = data; | |
160 | 609 if (lw->full_screen) |
610 layout_image_full_screen_stop(lw); | |
9 | 611 |
612 if (lw->tools_float != gtk_toggle_action_get_active(action)) | |
613 { | |
614 layout_tools_float_toggle(lw); | |
615 } | |
616 } | |
617 | |
618 static void layout_menu_hide_cb(GtkAction *action, gpointer data) | |
619 { | |
620 LayoutWindow *lw = data; | |
160 | 621 if (lw->full_screen) |
622 layout_image_full_screen_stop(lw); | |
9 | 623 |
624 layout_tools_hide_toggle(lw); | |
625 } | |
626 | |
627 static void layout_menu_toolbar_cb(GtkToggleAction *action, gpointer data) | |
628 { | |
629 LayoutWindow *lw = data; | |
160 | 630 if (lw->full_screen) |
631 layout_image_full_screen_stop(lw); | |
9 | 632 |
633 if (lw->toolbar_hidden != gtk_toggle_action_get_active(action)) | |
634 { | |
635 layout_toolbar_toggle(lw); | |
636 } | |
637 } | |
638 | |
639 static void layout_menu_bar_info_cb(GtkToggleAction *action, gpointer data) | |
640 { | |
641 LayoutWindow *lw = data; | |
160 | 642 if (lw->full_screen) |
643 layout_image_full_screen_stop(lw); | |
9 | 644 |
645 if (lw->bar_info_enabled != gtk_toggle_action_get_active(action)) | |
646 { | |
647 layout_bar_info_toggle(lw); | |
648 } | |
649 } | |
650 | |
651 static void layout_menu_bar_exif_cb(GtkToggleAction *action, gpointer data) | |
652 { | |
653 LayoutWindow *lw = data; | |
160 | 654 if (lw->full_screen) |
655 layout_image_full_screen_stop(lw); | |
9 | 656 |
657 if (lw->bar_exif_enabled != gtk_toggle_action_get_active(action)) | |
658 { | |
659 layout_bar_exif_toggle(lw); | |
660 } | |
661 } | |
662 | |
663 static void layout_menu_bar_sort_cb(GtkToggleAction *action, gpointer data) | |
664 { | |
665 LayoutWindow *lw = data; | |
160 | 666 if (lw->full_screen) |
667 layout_image_full_screen_stop(lw); | |
9 | 668 |
669 if (lw->bar_sort_enabled != gtk_toggle_action_get_active(action)) | |
670 { | |
671 layout_bar_sort_toggle(lw); | |
672 } | |
673 } | |
674 | |
675 static void layout_menu_slideshow_cb(GtkAction *action, gpointer data) | |
676 { | |
677 LayoutWindow *lw = data; | |
678 | |
679 layout_image_slideshow_toggle(lw); | |
680 } | |
681 | |
682 static void layout_menu_help_cb(GtkAction *action, gpointer data) | |
683 { | |
160 | 684 LayoutWindow *lw = data; |
685 if (lw->full_screen) | |
686 layout_image_full_screen_stop(lw); | |
9 | 687 help_window_show("html_contents"); |
688 } | |
689 | |
690 static void layout_menu_help_keys_cb(GtkAction *action, gpointer data) | |
691 { | |
160 | 692 LayoutWindow *lw = data; |
693 if (lw->full_screen) | |
694 layout_image_full_screen_stop(lw); | |
9 | 695 help_window_show("documentation"); |
696 } | |
697 | |
698 static void layout_menu_notes_cb(GtkAction *action, gpointer data) | |
699 { | |
160 | 700 LayoutWindow *lw = data; |
701 if (lw->full_screen) | |
702 layout_image_full_screen_stop(lw); | |
9 | 703 help_window_show("release_notes"); |
704 } | |
705 | |
706 static void layout_menu_about_cb(GtkAction *action, gpointer data) | |
707 { | |
160 | 708 LayoutWindow *lw = data; |
709 if (lw->full_screen) | |
710 layout_image_full_screen_stop(lw); | |
9 | 711 show_about_window(); |
712 } | |
713 | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
714 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
715 /* |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
716 *----------------------------------------------------------------------------- |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
717 * select menu |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
718 *----------------------------------------------------------------------------- |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
719 */ |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
720 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
721 static void layout_menu_select_all_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
722 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
723 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
724 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
725 layout_select_all(lw); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
726 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
727 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
728 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
|
729 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
730 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
731 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
732 layout_select_none(lw); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
733 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
734 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
735 static void layout_menu_marks_cb(GtkToggleAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
736 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
737 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
738 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
739 layout_marks_set(lw, gtk_toggle_action_get_active(action)); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
740 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
741 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
742 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
743 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
|
744 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
745 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
746 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
|
747 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
748 mark--; |
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 layout_selection_to_mark(lw, mark, STM_MODE_SET); |
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 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
753 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
|
754 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
755 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
756 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
|
757 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
758 mark--; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
759 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
760 layout_selection_to_mark(lw, mark, STM_MODE_RESET); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
761 } |
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 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
|
764 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
765 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
766 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
|
767 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
768 mark--; |
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_selection_to_mark(lw, mark, STM_MODE_TOGGLE); |
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 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
|
774 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
775 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
776 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
|
777 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
778 mark--; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
779 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
780 layout_mark_to_selection(lw, mark, MTS_MODE_SET); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
781 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
782 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
783 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
|
784 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
785 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
786 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
|
787 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
788 mark--; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
789 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
790 layout_mark_to_selection(lw, mark, MTS_MODE_OR); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
791 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
792 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
793 static void layout_menu_sel_mark_and_cb(GtkAction *action, gpointer data) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
794 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
795 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
796 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
|
797 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
798 mark--; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
799 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
800 layout_mark_to_selection(lw, mark, MTS_MODE_AND); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
801 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
802 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
803 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
|
804 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
805 LayoutWindow *lw = data; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
806 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
|
807 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
808 mark--; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
809 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
810 layout_mark_to_selection(lw, mark, MTS_MODE_MINUS); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
811 } |
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 |
9 | 814 /* |
815 *----------------------------------------------------------------------------- | |
159 | 816 * go menu |
817 *----------------------------------------------------------------------------- | |
818 */ | |
819 | |
820 static void layout_menu_image_first_cb(GtkAction *action, gpointer data) | |
821 { | |
822 LayoutWindow *lw = data; | |
823 layout_image_first(lw); | |
824 } | |
825 | |
826 static void layout_menu_image_prev_cb(GtkAction *action, gpointer data) | |
827 { | |
828 LayoutWindow *lw = data; | |
829 layout_image_prev(lw); | |
830 } | |
831 | |
832 static void layout_menu_image_next_cb(GtkAction *action, gpointer data) | |
833 { | |
834 LayoutWindow *lw = data; | |
835 layout_image_next(lw); | |
836 } | |
837 | |
838 static void layout_menu_image_last_cb(GtkAction *action, gpointer data) | |
839 { | |
840 LayoutWindow *lw = data; | |
841 layout_image_last(lw); | |
842 } | |
843 | |
844 | |
845 /* | |
846 *----------------------------------------------------------------------------- | |
9 | 847 * edit menu |
848 *----------------------------------------------------------------------------- | |
849 */ | |
850 | |
851 static void layout_menu_edit_cb(GtkAction *action, gpointer data) | |
852 { | |
853 LayoutWindow *lw = data; | |
854 GList *list; | |
855 gint n; | |
856 | |
857 n = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "edit_index")); | |
858 | |
160 | 859 |
860 if (lw->full_screen && !editor_window_flag_set(n)) | |
861 { | |
862 layout_image_full_screen_stop(lw); | |
863 } | |
9 | 864 list = layout_selection_list(lw); |
138 | 865 start_editor_from_filelist(n, list); |
866 filelist_free(list); | |
9 | 867 } |
868 | |
869 static void layout_menu_edit_update(LayoutWindow *lw) | |
870 { | |
871 gint i; | |
872 | |
873 /* main edit menu */ | |
874 | |
875 if (!lw->action_group) return; | |
876 | |
877 for (i = 0; i < 10; i++) | |
878 { | |
879 gchar *key; | |
880 GtkAction *action; | |
881 | |
882 key = g_strdup_printf("Editor%d", i); | |
883 | |
884 action = gtk_action_group_get_action(lw->action_group, key); | |
885 g_object_set_data(G_OBJECT(action), "edit_index", GINT_TO_POINTER(i)); | |
886 | |
887 if (editor_command[i] && strlen(editor_command[i]) > 0) | |
888 { | |
889 gchar *text; | |
890 | |
891 if (editor_name[i] && strlen(editor_name[i]) > 0) | |
892 { | |
893 text = g_strdup_printf(_("in %s..."), editor_name[i]); | |
894 } | |
895 else | |
896 { | |
897 text = g_strdup(_("in (unknown)...")); | |
898 } | |
899 g_object_set(action, "label", text, | |
900 "sensitive", TRUE, NULL); | |
901 g_free(text); | |
902 } | |
903 else | |
904 { | |
905 g_object_set(action, "label", _("empty"), | |
906 "sensitive", FALSE, NULL); | |
907 } | |
908 | |
909 g_free(key); | |
910 } | |
911 } | |
912 | |
913 void layout_edit_update_all(void) | |
914 { | |
915 GList *work; | |
916 | |
917 work = layout_window_list; | |
918 while (work) | |
919 { | |
920 LayoutWindow *lw = work->data; | |
921 work = work->next; | |
922 | |
923 layout_menu_edit_update(lw); | |
924 } | |
925 } | |
926 | |
927 /* | |
928 *----------------------------------------------------------------------------- | |
929 * recent menu | |
930 *----------------------------------------------------------------------------- | |
931 */ | |
932 | |
933 static void layout_menu_recent_cb(GtkWidget *widget, gpointer data) | |
934 { | |
935 gint n; | |
936 gchar *path; | |
937 | |
938 n = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "recent_index")); | |
939 | |
940 path = g_list_nth_data(history_list_get_by_key("recent"), n); | |
941 | |
942 if (!path) return; | |
943 | |
944 /* make a copy of it */ | |
945 path = g_strdup(path); | |
946 collection_window_new(path); | |
947 g_free(path); | |
948 } | |
949 | |
950 static void layout_menu_recent_update(LayoutWindow *lw) | |
951 { | |
952 GtkWidget *menu; | |
953 GtkWidget *recent; | |
954 GtkWidget *item; | |
955 GList *list; | |
956 gint n; | |
957 | |
958 if (!lw->ui_manager) return; | |
959 | |
960 list = history_list_get_by_key("recent"); | |
961 n = 0; | |
962 | |
963 menu = gtk_menu_new(); | |
964 | |
965 while (list) | |
966 { | |
967 item = menu_item_add_simple(menu, filename_from_path((gchar *)list->data), | |
968 G_CALLBACK(layout_menu_recent_cb), lw); | |
969 g_object_set_data(G_OBJECT(item), "recent_index", GINT_TO_POINTER(n)); | |
970 list = list->next; | |
971 n++; | |
972 } | |
973 | |
974 if (n == 0) | |
975 { | |
976 menu_item_add(menu, _("Empty"), NULL, NULL); | |
977 } | |
978 | |
979 recent = gtk_ui_manager_get_widget(lw->ui_manager, "/MainMenu/FileMenu/OpenRecent"); | |
980 gtk_menu_item_set_submenu(GTK_MENU_ITEM(recent), menu); | |
981 gtk_widget_set_sensitive(recent, (n != 0)); | |
982 } | |
983 | |
984 void layout_recent_update_all(void) | |
985 { | |
986 GList *work; | |
987 | |
988 work = layout_window_list; | |
989 while (work) | |
990 { | |
991 LayoutWindow *lw = work->data; | |
992 work = work->next; | |
993 | |
994 layout_menu_recent_update(lw); | |
995 } | |
996 } | |
997 | |
998 void layout_recent_add_path(const gchar *path) | |
999 { | |
1000 if (!path) return; | |
1001 | |
1002 history_list_add_to_key("recent", path, recent_list_max); | |
1003 | |
1004 layout_recent_update_all(); | |
1005 } | |
1006 | |
1007 /* | |
1008 *----------------------------------------------------------------------------- | |
1009 * menu | |
1010 *----------------------------------------------------------------------------- | |
1011 */ | |
1012 | |
1013 #define CB G_CALLBACK | |
1014 | |
1015 static GtkActionEntry menu_entries[] = { | |
1016 { "FileMenu", NULL, N_("_File") }, | |
159 | 1017 { "GoMenu", NULL, N_("_Go") }, |
9 | 1018 { "EditMenu", NULL, N_("_Edit") }, |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1019 { "SelectMenu", NULL, N_("_Select") }, |
9 | 1020 { "AdjustMenu", NULL, N_("_Adjust") }, |
1021 { "ViewMenu", NULL, N_("_View") }, | |
159 | 1022 { "ZoomMenu", NULL, N_("_Zoom") }, |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1023 { "SplitMenu", NULL, N_("_Split") }, |
9 | 1024 { "HelpMenu", NULL, N_("_Help") }, |
1025 | |
159 | 1026 { "FirstImage", GTK_STOCK_GOTO_TOP, N_("_First Image"), "Home", NULL, CB(layout_menu_image_first_cb) }, |
1027 { "PrevImage", GTK_STOCK_GO_UP, N_("_Previous Image"), "BackSpace", NULL, CB(layout_menu_image_prev_cb) }, | |
1028 { "NextImage", GTK_STOCK_GO_DOWN, N_("_Next Image"), "space", NULL, CB(layout_menu_image_next_cb) }, | |
1029 { "LastImage", GTK_STOCK_GOTO_BOTTOM, N_("_Last Image"), "End", NULL, CB(layout_menu_image_last_cb) }, | |
1030 | |
1031 | |
9 | 1032 { "NewWindow", GTK_STOCK_NEW, N_("New _window"), NULL, NULL, CB(layout_menu_new_window_cb) }, |
1033 { "NewCollection", GTK_STOCK_INDEX,N_("_New collection"), "C", NULL, CB(layout_menu_new_cb) }, | |
1034 { "OpenCollection", GTK_STOCK_OPEN, N_("_Open collection..."),"O", NULL, CB(layout_menu_open_cb) }, | |
1035 { "OpenRecent", NULL, N_("Open _recent") }, | |
1036 { "Search", GTK_STOCK_FIND, N_("_Search..."), "F3", NULL, CB(layout_menu_search_cb) }, | |
1037 { "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
|
1038 { "PanView", NULL, N_("Pan _view"), "<control>J", NULL, CB(layout_menu_pan_cb) }, |
9 | 1039 { "Print", GTK_STOCK_PRINT,N_("_Print..."), "<shift>P", NULL, CB(layout_menu_print_cb) }, |
1040 { "NewFolder", NULL, N_("N_ew folder..."), "<control>F", NULL, CB(layout_menu_dir_cb) }, | |
1041 { "Copy", NULL, N_("_Copy..."), "<control>C", NULL, CB(layout_menu_copy_cb) }, | |
1042 { "Move", NULL, N_("_Move..."), "<control>M", NULL, CB(layout_menu_move_cb) }, | |
1043 { "Rename", NULL, N_("_Rename..."), "<control>R", NULL, CB(layout_menu_rename_cb) }, | |
1044 { "Delete", GTK_STOCK_DELETE, N_("_Delete..."), "<control>D", NULL, CB(layout_menu_delete_cb) }, | |
1045 { "CloseWindow", GTK_STOCK_CLOSE,N_("C_lose window"), "<control>W", NULL, CB(layout_menu_close_cb) }, | |
1046 { "Quit", GTK_STOCK_QUIT, N_("_Quit"), "<control>Q", NULL, CB(layout_menu_exit_cb) }, | |
1047 | |
163 | 1048 { "Editor0", NULL, "editor0", NULL, NULL, CB(layout_menu_edit_cb) }, |
1049 { "Editor1", NULL, "editor1", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1050 { "Editor2", NULL, "editor2", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1051 { "Editor3", NULL, "editor3", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1052 { "Editor4", NULL, "editor4", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1053 { "Editor5", NULL, "editor5", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1054 { "Editor6", NULL, "editor6", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1055 { "Editor7", NULL, "editor7", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1056 { "Editor8", NULL, "editor8", NULL, NULL, CB(layout_menu_edit_cb) }, | |
1057 { "Editor9", NULL, "editor9", NULL, NULL, CB(layout_menu_edit_cb) }, | |
9 | 1058 { "RotateCW", NULL, N_("_Rotate clockwise"), "bracketright", NULL, CB(layout_menu_alter_90_cb) }, |
1059 { "RotateCCW", NULL, N_("Rotate _counterclockwise"), "bracketleft", NULL, CB(layout_menu_alter_90cc_cb) }, | |
1060 { "Rotate180", NULL, N_("Rotate 1_80"), "<shift>R", NULL, CB(layout_menu_alter_180_cb) }, | |
1061 { "Mirror", NULL, N_("_Mirror"), "<shift>M", NULL, CB(layout_menu_alter_mirror_cb) }, | |
1062 { "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
|
1063 { "Grayscale", NULL, N_("_Grayscale"), "<shift>G", NULL, CB(layout_menu_alter_desaturate_cb) }, |
9 | 1064 { "Properties",GTK_STOCK_PROPERTIES, N_("_Properties"), "<control>P", NULL, CB(layout_menu_info_cb) }, |
1065 { "SelectAll", NULL, N_("Select _all"), "<control>A", NULL, CB(layout_menu_select_all_cb) }, | |
1066 { "SelectNone", NULL, N_("Select _none"), "<control><shift>A",NULL, CB(layout_menu_unselect_all_cb) }, | |
1067 { "Preferences",GTK_STOCK_PREFERENCES,N_("P_references..."), "<control>O", NULL, CB(layout_menu_config_cb) }, | |
1068 { "Maintenance", NULL, N_("_Thumbnail maintenance..."),NULL, NULL, CB(layout_menu_remove_thumb_cb) }, | |
1069 { "Wallpaper", NULL, N_("Set as _wallpaper"),NULL, NULL, CB(layout_menu_wallpaper_cb) }, | |
1070 | |
1071 { "ZoomIn", GTK_STOCK_ZOOM_IN, N_("Zoom _in"), "equal", NULL, CB(layout_menu_zoom_in_cb) }, | |
1072 { "ZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _out"), "minus", NULL, CB(layout_menu_zoom_out_cb) }, | |
1073 { "Zoom100", GTK_STOCK_ZOOM_100, N_("Zoom _1:1"), "Z", NULL, CB(layout_menu_zoom_1_1_cb) }, | |
1074 { "ZoomFit", GTK_STOCK_ZOOM_FIT, N_("_Zoom to fit"), "X", NULL, CB(layout_menu_zoom_fit_cb) }, | |
159 | 1075 { "ZoomFillHor", NULL, N_("Fit _Horizontally"),"H", NULL, CB(layout_menu_zoom_fit_hor_cb) }, |
1076 { "ZoomFillVert", NULL, N_("Fit _Vorizontally"),"W", NULL, CB(layout_menu_zoom_fit_vert_cb) }, | |
1077 { "Zoom200", NULL, N_("Zoom _2:1"), NULL, NULL, CB(layout_menu_zoom_2_1_cb) }, | |
1078 { "Zoom300", NULL, N_("Zoom _3:1"), NULL, NULL, CB(layout_menu_zoom_3_1_cb) }, | |
1079 { "Zoom400", NULL, N_("Zoom _4:1"), NULL, NULL, CB(layout_menu_zoom_4_1_cb) }, | |
1080 { "Zoom50", NULL, N_("Zoom 1:2"), NULL, NULL, CB(layout_menu_zoom_1_2_cb) }, | |
1081 { "Zoom33", NULL, N_("Zoom 1:3"), NULL, NULL, CB(layout_menu_zoom_1_3_cb) }, | |
1082 { "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
|
1083 |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1084 |
159 | 1085 { "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
|
1086 |
9 | 1087 { "FullScreen", NULL, N_("F_ull screen"), "F", NULL, CB(layout_menu_fullscreen_cb) }, |
159 | 1088 { "ImageOverlay", NULL, N_("_Image Overlay"), "I", NULL, CB(layout_menu_overlay_cb) }, |
9 | 1089 { "HideTools", NULL, N_("_Hide file list"), "<control>H", NULL, CB(layout_menu_hide_cb) }, |
1090 { "SlideShow", NULL, N_("Toggle _slideshow"),"S", NULL, CB(layout_menu_slideshow_cb) }, | |
1091 { "Refresh", GTK_STOCK_REFRESH, N_("_Refresh"), "R", NULL, CB(layout_menu_refresh_cb) }, | |
1092 | |
1093 { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", NULL, CB(layout_menu_help_cb) }, | |
1094 { "HelpShortcuts", NULL, N_("_Keyboard shortcuts"),NULL, NULL, CB(layout_menu_help_keys_cb) }, | |
1095 { "HelpNotes", NULL, N_("_Release notes"), NULL, NULL, CB(layout_menu_notes_cb) }, | |
1096 { "About", NULL, N_("_About"), NULL, NULL, CB(layout_menu_about_cb) } | |
1097 }; | |
1098 | |
1099 static GtkToggleActionEntry menu_toggle_entries[] = { | |
1100 { "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
|
1101 { "ShowMarks", NULL, N_("Show _Marks"), "M", NULL, CB(layout_menu_marks_cb) }, |
9 | 1102 { "FolderTree", NULL, N_("Tr_ee"), "<control>T", NULL, CB(layout_menu_tree_cb) }, |
1103 { "FloatTools", NULL, N_("_Float file list"), "L", NULL, CB(layout_menu_float_cb) }, | |
1104 { "HideToolbar", NULL, N_("Hide tool_bar"), NULL, NULL, CB(layout_menu_toolbar_cb) }, | |
1105 { "SBarKeywords", NULL, N_("_Keywords"), "<control>K", NULL, CB(layout_menu_bar_info_cb) }, | |
1106 { "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
|
1107 { "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
|
1108 { "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
|
1109 { "ConnectZoom", NULL, N_("Connected zoom"), "<control>Y", NULL, CB(layout_menu_connect_zoom_cb) } |
9 | 1110 }; |
1111 | |
1112 static GtkRadioActionEntry menu_radio_entries[] = { | |
1113 { "ViewList", NULL, N_("_List"), "<control>L", NULL, 0 }, | |
1114 { "ViewIcons", NULL, N_("I_cons"), "<control>I", NULL, 1 } | |
1115 }; | |
1116 | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1117 static GtkRadioActionEntry menu_split_radio_entries[] = { |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1118 { "SplitHorizontal", NULL, N_("Horizontal"), "E", NULL, SPLIT_HOR }, |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1119 { "SplitVertical", NULL, N_("Vertical"), "U", NULL, SPLIT_VERT }, |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1120 { "SplitQuad", NULL, N_("Quad"), "Q", NULL, SPLIT_QUAD }, |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1121 { "SplitSingle", NULL, N_("Single"), "Y", NULL, SPLIT_NONE } |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1122 }; |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1123 |
9 | 1124 #undef CB |
1125 | |
1126 static const char *menu_ui_description = | |
1127 "<ui>" | |
1128 " <menubar name='MainMenu'>" | |
1129 " <menu action='FileMenu'>" | |
1130 " <menuitem action='NewWindow'/>" | |
1131 " <menuitem action='NewCollection'/>" | |
1132 " <menuitem action='OpenCollection'/>" | |
1133 " <menuitem action='OpenRecent'/>" | |
1134 " <separator/>" | |
1135 " <menuitem action='Search'/>" | |
1136 " <menuitem action='FindDupes'/>" | |
12
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1137 " <menuitem action='PanView'/>" |
9 | 1138 " <separator/>" |
1139 " <menuitem action='Print'/>" | |
1140 " <menuitem action='NewFolder'/>" | |
1141 " <separator/>" | |
1142 " <menuitem action='Copy'/>" | |
1143 " <menuitem action='Move'/>" | |
1144 " <menuitem action='Rename'/>" | |
1145 " <menuitem action='Delete'/>" | |
1146 " <separator/>" | |
1147 " <menuitem action='CloseWindow'/>" | |
1148 " <menuitem action='Quit'/>" | |
1149 " </menu>" | |
159 | 1150 " <menu action='GoMenu'>" |
1151 " <menuitem action='FirstImage'/>" | |
1152 " <menuitem action='PrevImage'/>" | |
1153 " <menuitem action='NextImage'/>" | |
1154 " <menuitem action='LastImage'/>" | |
1155 " </menu>" | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1156 " <menu action='SelectMenu'>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1157 " <menuitem action='SelectAll'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1158 " <menuitem action='SelectNone'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1159 " <separator/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1160 " <menuitem action='ShowMarks'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1161 " <separator/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1162 " </menu>" |
9 | 1163 " <menu action='EditMenu'>" |
1164 " <menuitem action='Editor0'/>" | |
1165 " <menuitem action='Editor1'/>" | |
1166 " <menuitem action='Editor2'/>" | |
1167 " <menuitem action='Editor3'/>" | |
1168 " <menuitem action='Editor4'/>" | |
1169 " <menuitem action='Editor5'/>" | |
1170 " <menuitem action='Editor6'/>" | |
1171 " <menuitem action='Editor7'/>" | |
1172 " <menuitem action='Editor8'/>" | |
1173 " <menuitem action='Editor9'/>" | |
1174 " <separator/>" | |
1175 " <menu action='AdjustMenu'>" | |
1176 " <menuitem action='RotateCW'/>" | |
1177 " <menuitem action='RotateCCW'/>" | |
1178 " <menuitem action='Rotate180'/>" | |
1179 " <menuitem action='Mirror'/>" | |
1180 " <menuitem action='Flip'/>" | |
82
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
1181 " <menuitem action='Grayscale'/>" |
9 | 1182 " </menu>" |
1183 " <menuitem action='Properties'/>" | |
1184 " <separator/>" | |
1185 " <menuitem action='Preferences'/>" | |
1186 " <menuitem action='Maintenance'/>" | |
1187 " <separator/>" | |
1188 " <menuitem action='Wallpaper'/>" | |
1189 " </menu>" | |
1190 " <menu action='ViewMenu'>" | |
159 | 1191 " <menuitem action='ViewInNewWindow'/>" |
9 | 1192 " <separator/>" |
159 | 1193 " <menu action='ZoomMenu'>" |
1194 " <menuitem action='ZoomIn'/>" | |
1195 " <menuitem action='ZoomOut'/>" | |
1196 " <menuitem action='ZoomFit'/>" | |
1197 " <menuitem action='ZoomFillHor'/>" | |
1198 " <menuitem action='ZoomFillVert'/>" | |
1199 " <menuitem action='Zoom100'/>" | |
1200 " <menuitem action='Zoom200'/>" | |
1201 " <menuitem action='Zoom300'/>" | |
1202 " <menuitem action='Zoom400'/>" | |
1203 " <menuitem action='Zoom50'/>" | |
1204 " <menuitem action='Zoom33'/>" | |
1205 " <menuitem action='Zoom25'/>" | |
1206 " </menu>" | |
9 | 1207 " <separator/>" |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1208 " <menu action='SplitMenu'>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1209 " <menuitem action='SplitHorizontal'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1210 " <menuitem action='SplitVertical'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1211 " <menuitem action='SplitQuad'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1212 " <menuitem action='SplitSingle'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1213 " </menu>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1214 " <menuitem action='ConnectScroll'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1215 " <menuitem action='ConnectZoom'/>" |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1216 " <separator/>" |
9 | 1217 " <menuitem action='Thumbnails'/>" |
1218 " <menuitem action='ViewList'/>" | |
1219 " <menuitem action='ViewIcons'/>" | |
1220 " <separator/>" | |
1221 " <menuitem action='FolderTree'/>" | |
159 | 1222 " <menuitem action='ImageOverlay'/>" |
9 | 1223 " <menuitem action='FullScreen'/>" |
1224 " <separator/>" | |
1225 " <menuitem action='FloatTools'/>" | |
1226 " <menuitem action='HideTools'/>" | |
1227 " <menuitem action='HideToolbar'/>" | |
1228 " <separator/>" | |
1229 " <menuitem action='SBarKeywords'/>" | |
1230 " <menuitem action='SBarExif'/>" | |
1231 " <menuitem action='SBarSort'/>" | |
1232 " <separator/>" | |
1233 " <menuitem action='SlideShow'/>" | |
1234 " <menuitem action='Refresh'/>" | |
1235 " </menu>" | |
1236 " <menu action='HelpMenu'>" | |
1237 " <separator/>" | |
1238 " <menuitem action='HelpContents'/>" | |
1239 " <menuitem action='HelpShortcuts'/>" | |
1240 " <menuitem action='HelpNotes'/>" | |
1241 " <separator/>" | |
1242 " <menuitem action='About'/>" | |
1243 " </menu>" | |
1244 " </menubar>" | |
1245 "</ui>"; | |
1246 | |
1247 | |
1248 static gchar *menu_translate(const gchar *path, gpointer data) | |
1249 { | |
1250 return _(path); | |
1251 } | |
1252 | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1253 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
|
1254 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1255 char name[50]; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1256 char label[100]; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1257 char accel[50]; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1258 GtkActionEntry entry = { name, NULL, label, accel, NULL, cb }; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1259 GtkAction *action; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1260 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1261 g_snprintf(name, sizeof(name), name_tmpl, mark); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1262 g_snprintf(label, sizeof(label), label_tmpl, mark); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1263 if (accel_tmpl) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1264 g_snprintf(accel, sizeof(accel), accel_tmpl, mark % 10); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1265 else |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1266 accel[0] = 0; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1267 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
|
1268 action = gtk_action_group_get_action(lw->action_group, name); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1269 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
|
1270 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1271 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1272 static void layout_actions_setup_marks(LayoutWindow *lw) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1273 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1274 int mark; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1275 GError *error; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1276 GString *desc = g_string_new( |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1277 "<ui>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1278 " <menubar name='MainMenu'>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1279 " <menu action='SelectMenu'>"); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1280 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1281 for (mark = 1; mark <= FILEDATA_MARKS_SIZE; mark++) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1282 { |
163 | 1283 layout_actions_setup_mark(lw, mark, "Mark%d", _("Mark _%d"), NULL, NULL); |
1284 layout_actions_setup_mark(lw, mark, "SetMark%d", _("_Set mark %d"), NULL, G_CALLBACK(layout_menu_set_mark_sel_cb)); | |
1285 layout_actions_setup_mark(lw, mark, "ResetMark%d", _("_Reset mark %d"), NULL, G_CALLBACK(layout_menu_res_mark_sel_cb)); | |
1286 layout_actions_setup_mark(lw, mark, "ToggleMark%d", _("_Toggle mark %d"), "%d", G_CALLBACK(layout_menu_toggle_mark_sel_cb)); | |
1287 layout_actions_setup_mark(lw, mark, "SelectMark%d", _("_Select mark %d"), "<control>%d", G_CALLBACK(layout_menu_sel_mark_cb)); | |
1288 layout_actions_setup_mark(lw, mark, "AddMark%d", _("_Add mark %d"), NULL, G_CALLBACK(layout_menu_sel_mark_or_cb)); | |
1289 layout_actions_setup_mark(lw, mark, "IntMark%d", _("_Intersection with mark %d"), NULL, G_CALLBACK(layout_menu_sel_mark_and_cb)); | |
1290 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
|
1291 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1292 g_string_append_printf(desc, |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1293 " <menu action='Mark%d'>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1294 " <menuitem action='ToggleMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1295 " <menuitem action='SetMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1296 " <menuitem action='ResetMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1297 " <separator/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1298 " <menuitem action='SelectMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1299 " <menuitem action='AddMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1300 " <menuitem action='IntMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1301 " <menuitem action='UnselMark%d'/>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1302 " </menu>", |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1303 mark, mark, mark, mark, mark, mark, mark, mark); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1304 } |
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 g_string_append(desc, |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1307 " </menu>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1308 " </menubar>" |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1309 "</ui>" ); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1310 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1311 error = NULL; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1312 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
|
1313 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1314 g_message ("building menus failed: %s", error->message); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1315 g_error_free (error); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1316 exit (EXIT_FAILURE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1317 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1318 g_string_free(desc, TRUE); |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1319 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
160
diff
changeset
|
1320 |
9 | 1321 void layout_actions_setup(LayoutWindow *lw) |
1322 { | |
1323 GError *error; | |
1324 | |
1325 if (lw->ui_manager) return; | |
1326 | |
1327 lw->action_group = gtk_action_group_new ("MenuActions"); | |
1328 gtk_action_group_set_translate_func(lw->action_group, menu_translate, NULL, NULL); | |
1329 | |
1330 gtk_action_group_add_actions(lw->action_group, | |
1331 menu_entries, G_N_ELEMENTS(menu_entries), lw); | |
1332 gtk_action_group_add_toggle_actions(lw->action_group, | |
1333 menu_toggle_entries, G_N_ELEMENTS(menu_toggle_entries), lw); | |
1334 gtk_action_group_add_radio_actions(lw->action_group, | |
1335 menu_radio_entries, G_N_ELEMENTS(menu_radio_entries), | |
1336 0, G_CALLBACK(layout_menu_list_cb), lw); | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1337 gtk_action_group_add_radio_actions(lw->action_group, |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
138
diff
changeset
|
1338 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
|
1339 0, G_CALLBACK(layout_menu_split_cb), lw); |
9 | 1340 |
1341 lw->ui_manager = gtk_ui_manager_new(); | |
1342 gtk_ui_manager_set_add_tearoffs(lw->ui_manager, TRUE); | |
1343 gtk_ui_manager_insert_action_group(lw->ui_manager, lw->action_group, 0); | |
1344 | |
1345 error = NULL; | |
1346 if (!gtk_ui_manager_add_ui_from_string(lw->ui_manager, menu_ui_description, -1, &error)) | |
1347 { | |
1348 g_message ("building menus failed: %s", error->message); | |
1349 g_error_free (error); | |
1350 exit (EXIT_FAILURE); | |
1351 } | |
162
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 layout_actions_setup_marks(lw); |
9 | 1354 } |
1355 | |
1356 void layout_actions_add_window(LayoutWindow *lw, GtkWidget *window) | |
1357 { | |
1358 GtkAccelGroup *group; | |
1359 | |
1360 if (!lw->ui_manager) return; | |
1361 | |
1362 group = gtk_ui_manager_get_accel_group(lw->ui_manager); | |
1363 gtk_window_add_accel_group(GTK_WINDOW(window), group); | |
1364 } | |
1365 | |
1366 GtkWidget *layout_actions_menu_bar(LayoutWindow *lw) | |
1367 { | |
1368 return gtk_ui_manager_get_widget(lw->ui_manager, "/MainMenu"); | |
1369 } | |
1370 | |
1371 | |
1372 /* | |
1373 *----------------------------------------------------------------------------- | |
1374 * toolbar | |
1375 *----------------------------------------------------------------------------- | |
1376 */ | |
1377 | |
1378 static void layout_button_thumb_cb(GtkWidget *widget, gpointer data) | |
1379 { | |
1380 LayoutWindow *lw = data; | |
1381 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1382 layout_thumb_set(lw, gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget))); |
9 | 1383 } |
1384 | |
1385 static void layout_button_home_cb(GtkWidget *widget, gpointer data) | |
1386 { | |
1387 LayoutWindow *lw = data; | |
1388 const gchar *path = homedir(); | |
1389 | |
1390 if (path) layout_set_path(lw, path); | |
1391 } | |
1392 | |
1393 static void layout_button_refresh_cb(GtkWidget *widget, gpointer data) | |
1394 { | |
1395 LayoutWindow *lw = data; | |
1396 | |
1397 layout_refresh(lw); | |
1398 } | |
1399 | |
1400 static void layout_button_zoom_in_cb(GtkWidget *widget, gpointer data) | |
1401 { | |
1402 LayoutWindow *lw = data; | |
1403 | |
1404 layout_image_zoom_adjust(lw, get_zoom_increment()); | |
1405 } | |
1406 | |
1407 static void layout_button_zoom_out_cb(GtkWidget *widget, gpointer data) | |
1408 { | |
1409 LayoutWindow *lw = data; | |
1410 | |
1411 layout_image_zoom_adjust(lw, -get_zoom_increment()); | |
1412 } | |
1413 | |
1414 static void layout_button_zoom_fit_cb(GtkWidget *widget, gpointer data) | |
1415 { | |
1416 LayoutWindow *lw = data; | |
1417 | |
1418 layout_image_zoom_set(lw, 0.0); | |
1419 } | |
1420 | |
1421 static void layout_button_zoom_1_1_cb(GtkWidget *widget, gpointer data) | |
1422 { | |
1423 LayoutWindow *lw = data; | |
1424 | |
1425 layout_image_zoom_set(lw, 1.0); | |
1426 } | |
1427 | |
1428 static void layout_button_config_cb(GtkWidget *widget, gpointer data) | |
1429 { | |
1430 show_config_window(); | |
1431 } | |
1432 | |
1433 static void layout_button_float_cb(GtkWidget *widget, gpointer data) | |
1434 { | |
1435 LayoutWindow *lw = data; | |
1436 | |
1437 layout_tools_float_toggle(lw); | |
1438 } | |
1439 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1440 static void layout_button_custom_icon(GtkWidget *button, const gchar *key) |
9 | 1441 { |
1442 GtkWidget *icon; | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1443 GdkPixbuf *pixbuf; |
9 | 1444 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1445 pixbuf = pixbuf_inline(key); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1446 if (!pixbuf) return; |
9 | 1447 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1448 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
|
1449 g_object_unref(pixbuf); |
9 | 1450 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1451 pref_toolbar_button_set_icon(button, icon, NULL); |
9 | 1452 gtk_widget_show(icon); |
1453 } | |
1454 | |
1455 GtkWidget *layout_button_bar(LayoutWindow *lw) | |
1456 { | |
1457 GtkWidget *box; | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1458 GtkWidget *button; |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1459 |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1460 box = pref_toolbar_new(NULL, GTK_TOOLBAR_ICONS); |
9 | 1461 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1462 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
|
1463 _("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
|
1464 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
|
1465 lw->thumb_button = button; |
9 | 1466 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1467 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
|
1468 _("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
|
1469 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
|
1470 _("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
|
1471 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
|
1472 _("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
|
1473 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
|
1474 _("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
|
1475 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
|
1476 _("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
|
1477 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
|
1478 _("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
|
1479 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
|
1480 _("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
|
1481 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
|
1482 _("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
|
1483 layout_button_custom_icon(button, PIXBUF_INLINE_ICON_FLOAT); |
9 | 1484 |
1485 return box; | |
1486 } | |
1487 | |
1488 /* | |
1489 *----------------------------------------------------------------------------- | |
1490 * misc | |
1491 *----------------------------------------------------------------------------- | |
1492 */ | |
1493 | |
1494 static void layout_util_sync_views(LayoutWindow *lw) | |
1495 { | |
1496 GtkAction *action; | |
1497 | |
1498 if (!lw->action_group) return; | |
1499 | |
1500 action = gtk_action_group_get_action(lw->action_group, "FolderTree"); | |
1501 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->tree_view); | |
1502 | |
1503 action = gtk_action_group_get_action(lw->action_group, "ViewIcons"); | |
1504 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->icon_view); | |
1505 | |
1506 action = gtk_action_group_get_action(lw->action_group, "FloatTools"); | |
1507 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->tools_float); | |
1508 | |
1509 action = gtk_action_group_get_action(lw->action_group, "SBarKeywords"); | |
1510 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->bar_info_enabled); | |
1511 | |
1512 action = gtk_action_group_get_action(lw->action_group, "SBarExif"); | |
1513 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->bar_exif_enabled); | |
1514 | |
1515 action = gtk_action_group_get_action(lw->action_group, "SBarSort"); | |
1516 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->bar_sort_enabled); | |
1517 | |
1518 action = gtk_action_group_get_action(lw->action_group, "HideToolbar"); | |
1519 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->toolbar_hidden); | |
1520 } | |
1521 | |
1522 void layout_util_sync_thumb(LayoutWindow *lw) | |
1523 { | |
1524 GtkAction *action; | |
1525 | |
1526 if (!lw->action_group) return; | |
1527 | |
1528 action = gtk_action_group_get_action(lw->action_group, "Thumbnails"); | |
1529 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->thumbs_enabled); | |
1530 g_object_set(action, "sensitive", !lw->icon_view, NULL); | |
1531 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1532 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(lw->thumb_button), lw->thumbs_enabled); |
9 | 1533 gtk_widget_set_sensitive(lw->thumb_button, !lw->icon_view); |
1534 } | |
1535 | |
1536 void layout_util_sync(LayoutWindow *lw) | |
1537 { | |
1538 layout_util_sync_views(lw); | |
1539 layout_util_sync_thumb(lw); | |
1540 layout_menu_recent_update(lw); | |
1541 layout_menu_edit_update(lw); | |
1542 } | |
1543 | |
1544 /* | |
1545 *----------------------------------------------------------------------------- | |
1546 * icons (since all the toolbar icons are included here, best place as any) | |
1547 *----------------------------------------------------------------------------- | |
1548 */ | |
1549 | |
1550 PixmapFolders *folder_icons_new(void) | |
1551 { | |
1552 PixmapFolders *pf; | |
1553 | |
1554 pf = g_new0(PixmapFolders, 1); | |
1555 | |
1556 pf->close = pixbuf_inline(PIXBUF_INLINE_FOLDER_CLOSED); | |
1557 pf->open = pixbuf_inline(PIXBUF_INLINE_FOLDER_OPEN); | |
1558 pf->deny = pixbuf_inline(PIXBUF_INLINE_FOLDER_LOCKED); | |
1559 pf->parent = pixbuf_inline(PIXBUF_INLINE_FOLDER_UP); | |
1560 | |
1561 return pf; | |
1562 } | |
1563 | |
1564 void folder_icons_free(PixmapFolders *pf) | |
1565 { | |
1566 if (!pf) return; | |
1567 | |
1568 g_object_unref(pf->close); | |
1569 g_object_unref(pf->open); | |
1570 g_object_unref(pf->deny); | |
1571 g_object_unref(pf->parent); | |
1572 | |
1573 g_free(pf); | |
1574 } | |
1575 | |
1576 /* | |
1577 *----------------------------------------------------------------------------- | |
1578 * sidebars | |
1579 *----------------------------------------------------------------------------- | |
1580 */ | |
1581 | |
1582 #define SIDEBAR_WIDTH 288 | |
1583 | |
1584 static void layout_bar_info_destroyed(GtkWidget *widget, gpointer data) | |
1585 { | |
1586 LayoutWindow *lw = data; | |
1587 | |
1588 lw->bar_info = NULL; | |
1589 | |
1590 if (lw->utility_box) | |
1591 { | |
1592 /* destroyed from within itself */ | |
1593 lw->bar_info_enabled = FALSE; | |
1594 layout_util_sync_views(lw); | |
1595 } | |
1596 } | |
1597 | |
1598 static GList *layout_bar_info_list_cb(gpointer data) | |
1599 { | |
1600 LayoutWindow *lw = data; | |
1601 | |
1602 return layout_selection_list(lw); | |
1603 } | |
1604 | |
1605 static void layout_bar_info_new(LayoutWindow *lw) | |
1606 { | |
1607 if (!lw->utility_box) return; | |
1608 | |
138 | 1609 lw->bar_info = bar_info_new(layout_image_get_fd(lw), FALSE, lw->utility_box); |
9 | 1610 bar_info_set_selection_func(lw->bar_info, layout_bar_info_list_cb, lw); |
1611 bar_info_selection(lw->bar_info, layout_selection_count(lw, NULL) - 1); | |
1612 bar_info_size_request(lw->bar_info, SIDEBAR_WIDTH * 3 / 4); | |
1613 g_signal_connect(G_OBJECT(lw->bar_info), "destroy", | |
1614 G_CALLBACK(layout_bar_info_destroyed), lw); | |
1615 lw->bar_info_enabled = TRUE; | |
1616 | |
1617 gtk_box_pack_start(GTK_BOX(lw->utility_box), lw->bar_info, FALSE, FALSE, 0); | |
1618 gtk_widget_show(lw->bar_info); | |
1619 } | |
1620 | |
1621 static void layout_bar_info_close(LayoutWindow *lw) | |
1622 { | |
1623 if (lw->bar_info) | |
1624 { | |
1625 bar_info_close(lw->bar_info); | |
1626 lw->bar_info = NULL; | |
1627 } | |
1628 lw->bar_info_enabled = FALSE; | |
1629 } | |
1630 | |
1631 void layout_bar_info_toggle(LayoutWindow *lw) | |
1632 { | |
1633 if (lw->bar_info_enabled) | |
1634 { | |
1635 layout_bar_info_close(lw); | |
1636 } | |
1637 else | |
1638 { | |
1639 layout_bar_info_new(lw); | |
1640 } | |
1641 } | |
1642 | |
1643 static void layout_bar_info_new_image(LayoutWindow *lw) | |
1644 { | |
1645 if (!lw->bar_info || !lw->bar_info_enabled) return; | |
1646 | |
138 | 1647 bar_info_set(lw->bar_info, layout_image_get_fd(lw)); |
9 | 1648 } |
1649 | |
1650 static void layout_bar_info_new_selection(LayoutWindow *lw, gint count) | |
1651 { | |
1652 if (!lw->bar_info || !lw->bar_info_enabled) return; | |
1653 | |
1654 bar_info_selection(lw->bar_info, count - 1); | |
1655 } | |
1656 | |
1657 static void layout_bar_info_maint_renamed(LayoutWindow *lw) | |
1658 { | |
1659 if (!lw->bar_info || !lw->bar_info_enabled) return; | |
1660 | |
138 | 1661 bar_info_maint_renamed(lw->bar_info, layout_image_get_fd(lw)); |
9 | 1662 } |
1663 | |
1664 static void layout_bar_exif_destroyed(GtkWidget *widget, gpointer data) | |
1665 { | |
1666 LayoutWindow *lw = data; | |
1667 | |
1668 if (lw->bar_exif) | |
1669 { | |
1670 lw->bar_exif_advanced = bar_exif_is_advanced(lw->bar_exif); | |
1671 } | |
1672 | |
1673 lw->bar_exif = NULL; | |
1674 if (lw->utility_box) | |
1675 { | |
1676 /* destroyed from within itself */ | |
1677 lw->bar_exif_enabled = FALSE; | |
1678 layout_util_sync_views(lw); | |
1679 } | |
1680 } | |
1681 | |
1682 static void layout_bar_exif_sized(GtkWidget *widget, GtkAllocation *allocation, gpointer data) | |
1683 { | |
1684 LayoutWindow *lw = data; | |
1685 | |
1686 if (lw->bar_exif) | |
1687 { | |
1688 lw->bar_exif_size = allocation->width; | |
1689 } | |
1690 } | |
1691 | |
1692 static void layout_bar_exif_new(LayoutWindow *lw) | |
1693 { | |
1694 if (!lw->utility_box) return; | |
1695 | |
138 | 1696 lw->bar_exif = bar_exif_new(TRUE, layout_image_get_fd(lw), |
9 | 1697 lw->bar_exif_advanced, lw->utility_box); |
1698 g_signal_connect(G_OBJECT(lw->bar_exif), "destroy", | |
1699 G_CALLBACK(layout_bar_exif_destroyed), lw); | |
1700 g_signal_connect(G_OBJECT(lw->bar_exif), "size_allocate", | |
1701 G_CALLBACK(layout_bar_exif_sized), lw); | |
1702 lw->bar_exif_enabled = TRUE; | |
1703 | |
1704 if (lw->bar_exif_size < 1) lw->bar_exif_size = SIDEBAR_WIDTH; | |
1705 gtk_widget_set_size_request(lw->bar_exif, lw->bar_exif_size, -1); | |
1706 gtk_box_pack_start(GTK_BOX(lw->utility_box), lw->bar_exif, FALSE, FALSE, 0); | |
1707 if (lw->bar_info) gtk_box_reorder_child(GTK_BOX(lw->utility_box), lw->bar_exif, 1); | |
1708 gtk_widget_show(lw->bar_exif); | |
1709 } | |
1710 | |
1711 static void layout_bar_exif_close(LayoutWindow *lw) | |
1712 { | |
1713 if (lw->bar_exif) | |
1714 { | |
1715 bar_exif_close(lw->bar_exif); | |
1716 lw->bar_exif = NULL; | |
1717 } | |
1718 lw->bar_exif_enabled = FALSE; | |
1719 } | |
1720 | |
1721 void layout_bar_exif_toggle(LayoutWindow *lw) | |
1722 { | |
1723 if (lw->bar_exif_enabled) | |
1724 { | |
1725 layout_bar_exif_close(lw); | |
1726 } | |
1727 else | |
1728 { | |
1729 layout_bar_exif_new(lw); | |
1730 } | |
1731 } | |
1732 | |
1733 static void layout_bar_exif_new_image(LayoutWindow *lw) | |
1734 { | |
1735 if (!lw->bar_exif || !lw->bar_exif_enabled) return; | |
1736 | |
138 | 1737 bar_exif_set(lw->bar_exif, layout_image_get_fd(lw)); |
9 | 1738 } |
1739 | |
1740 static void layout_bar_sort_destroyed(GtkWidget *widget, gpointer data) | |
1741 { | |
1742 LayoutWindow *lw = data; | |
1743 | |
1744 lw->bar_sort = NULL; | |
1745 | |
1746 if (lw->utility_box) | |
1747 { | |
1748 /* destroyed from within itself */ | |
1749 lw->bar_sort_enabled = FALSE; | |
1750 | |
1751 layout_util_sync_views(lw); | |
1752 } | |
1753 } | |
1754 | |
1755 static void layout_bar_sort_new(LayoutWindow *lw) | |
1756 { | |
1757 if (!lw->utility_box) return; | |
1758 | |
1759 lw->bar_sort = bar_sort_new(lw); | |
1760 g_signal_connect(G_OBJECT(lw->bar_sort), "destroy", | |
1761 G_CALLBACK(layout_bar_sort_destroyed), lw); | |
1762 lw->bar_sort_enabled = TRUE; | |
1763 | |
1764 gtk_box_pack_end(GTK_BOX(lw->utility_box), lw->bar_sort, FALSE, FALSE, 0); | |
1765 gtk_widget_show(lw->bar_sort); | |
1766 } | |
1767 | |
1768 static void layout_bar_sort_close(LayoutWindow *lw) | |
1769 { | |
1770 if (lw->bar_sort) | |
1771 { | |
1772 bar_sort_close(lw->bar_sort); | |
1773 lw->bar_sort = NULL; | |
1774 } | |
1775 lw->bar_sort_enabled = FALSE; | |
1776 } | |
1777 | |
1778 void layout_bar_sort_toggle(LayoutWindow *lw) | |
1779 { | |
1780 if (lw->bar_sort_enabled) | |
1781 { | |
1782 layout_bar_sort_close(lw); | |
1783 } | |
1784 else | |
1785 { | |
1786 layout_bar_sort_new(lw); | |
1787 } | |
1788 } | |
1789 | |
1790 void layout_bars_new_image(LayoutWindow *lw) | |
1791 { | |
1792 layout_bar_info_new_image(lw); | |
1793 layout_bar_exif_new_image(lw); | |
1794 } | |
1795 | |
1796 void layout_bars_new_selection(LayoutWindow *lw, gint count) | |
1797 { | |
1798 layout_bar_info_new_selection(lw, count); | |
1799 } | |
1800 | |
1801 GtkWidget *layout_bars_prepare(LayoutWindow *lw, GtkWidget *image) | |
1802 { | |
1803 lw->utility_box = gtk_hbox_new(FALSE, PREF_PAD_GAP); | |
1804 gtk_box_pack_start(GTK_BOX(lw->utility_box), image, TRUE, TRUE, 0); | |
1805 gtk_widget_show(image); | |
1806 | |
1807 if (lw->bar_sort_enabled) | |
1808 { | |
1809 layout_bar_sort_new(lw); | |
1810 } | |
1811 | |
1812 if (lw->bar_info_enabled) | |
1813 { | |
1814 layout_bar_info_new(lw); | |
1815 } | |
1816 | |
1817 if (lw->bar_exif_enabled) | |
1818 { | |
1819 layout_bar_exif_new(lw); | |
1820 } | |
1821 | |
1822 return lw->utility_box; | |
1823 } | |
1824 | |
1825 void layout_bars_close(LayoutWindow *lw) | |
1826 { | |
1827 layout_bar_sort_close(lw); | |
1828 layout_bar_exif_close(lw); | |
1829 layout_bar_info_close(lw); | |
1830 } | |
1831 | |
1832 void layout_bars_maint_renamed(LayoutWindow *lw) | |
1833 { | |
1834 layout_bar_info_maint_renamed(lw); | |
1835 } | |
1836 |