Mercurial > geeqie.yaz
annotate src/layout_util.c @ 98:e639afdc1c60
Sat Nov 4 10:31:51 2006 John Ellis <johne@verizon.net>
* README: Updates.
* icons/Makefile.am: Remove icon files that no longer exist.
* configure.in: Release 2.1.3
author | gqview |
---|---|
date | Sat, 04 Nov 2006 15:41:42 +0000 |
parents | 50dc5a14d37b |
children | e2a8b7f2165b |
rev | line source |
---|---|
9 | 1 /* |
2 * GQview | |
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" | |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
24 #include "img-view.h" |
9 | 25 #include "info.h" |
26 #include "layout_image.h" | |
12
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
27 #include "pan-view.h" |
9 | 28 #include "pixbuf_util.h" |
29 #include "preferences.h" | |
30 #include "print.h" | |
31 #include "search.h" | |
32 #include "utilops.h" | |
33 #include "ui_bookmark.h" | |
34 #include "ui_fileops.h" | |
35 #include "ui_menu.h" | |
36 #include "ui_misc.h" | |
37 #include "ui_tabcomp.h" | |
38 | |
39 #include <gdk/gdkkeysyms.h> /* for keyboard values */ | |
40 | |
41 | |
42 #define MENU_EDIT_ACTION_OFFSET 16 | |
43 | |
44 | |
45 /* | |
46 *----------------------------------------------------------------------------- | |
47 * keyboard handler | |
48 *----------------------------------------------------------------------------- | |
49 */ | |
50 | |
51 static guint tree_key_overrides[] = { | |
52 GDK_Page_Up, GDK_KP_Page_Up, | |
53 GDK_Page_Down, GDK_KP_Page_Down, | |
54 GDK_Home, GDK_KP_Home, | |
55 GDK_End, GDK_KP_End | |
56 }; | |
57 | |
58 static gint layout_key_match(guint keyval) | |
59 { | |
60 gint i; | |
61 | |
62 for (i = 0; i < sizeof(tree_key_overrides) / sizeof(guint); i++) | |
63 { | |
64 if (keyval == tree_key_overrides[i]) return TRUE; | |
65 } | |
66 | |
67 return FALSE; | |
68 } | |
69 | |
70 static gint layout_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) | |
71 { | |
72 LayoutWindow *lw = data; | |
73 gint stop_signal = FALSE; | |
74 gint x = 0; | |
75 gint y = 0; | |
76 | |
77 if (lw->path_entry && GTK_WIDGET_HAS_FOCUS(lw->path_entry)) | |
78 { | |
79 if (event->keyval == GDK_Escape && lw->path) | |
80 { | |
81 gtk_entry_set_text(GTK_ENTRY(lw->path_entry), lw->path); | |
82 } | |
83 | |
84 /* the gtkaccelgroup of the window is stealing presses before they get to the entry (and more), | |
85 * so when the some widgets have focus, give them priority (HACK) | |
86 */ | |
87 if (gtk_widget_event(lw->path_entry, (GdkEvent *)event)) | |
88 { | |
89 return TRUE; | |
90 } | |
91 } | |
92 if (lw->vdt && GTK_WIDGET_HAS_FOCUS(lw->vdt->treeview) && | |
93 !layout_key_match(event->keyval) && | |
94 gtk_widget_event(lw->vdt->treeview, (GdkEvent *)event)) | |
95 { | |
96 return TRUE; | |
97 } | |
98 if (lw->bar_info && | |
99 bar_info_event(lw->bar_info, (GdkEvent *)event)) | |
100 { | |
101 return TRUE; | |
102 } | |
103 | |
104 if (lw->image && | |
105 (GTK_WIDGET_HAS_FOCUS(lw->image->widget) || (lw->tools && widget == lw->window)) ) | |
106 { | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
107 stop_signal = TRUE; |
9 | 108 switch (event->keyval) |
109 { | |
110 case GDK_Left: case GDK_KP_Left: | |
111 x -= 1; | |
112 break; | |
113 case GDK_Right: case GDK_KP_Right: | |
114 x += 1; | |
115 break; | |
116 case GDK_Up: case GDK_KP_Up: | |
117 y -= 1; | |
118 break; | |
119 case GDK_Down: case GDK_KP_Down: | |
120 y += 1; | |
121 break; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
122 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
123 stop_signal = FALSE; |
9 | 124 break; |
125 } | |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
126 |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
127 if (!stop_signal && |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
128 !(event->state & GDK_CONTROL_MASK)) |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
129 { |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
130 stop_signal = TRUE; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
131 switch (event->keyval) |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
132 { |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
133 case GDK_BackSpace: |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
134 case 'B': case 'b': |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
135 layout_image_prev(lw); |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
136 break; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
137 case GDK_space: |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
138 case 'N': case 'n': |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
139 layout_image_next(lw); |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
140 break; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
141 case GDK_Menu: |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
142 layout_image_menu_popup(lw); |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
143 break; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
144 default: |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
145 stop_signal = FALSE; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
146 break; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
147 } |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
148 } |
9 | 149 } |
150 | |
151 if (x != 0 || y!= 0) | |
152 { | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
153 if (event->state & GDK_SHIFT_MASK) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
154 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
155 x *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
156 y *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
157 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
158 |
9 | 159 keyboard_scroll_calc(&x, &y, event); |
160 layout_image_scroll(lw, x, y); | |
161 } | |
162 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
163 if (stop_signal) return stop_signal; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
164 |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
165 if (event->state & GDK_CONTROL_MASK) |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
166 { |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
167 stop_signal = TRUE; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
168 switch (event->keyval) |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
169 { |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
170 case 'v' : case 'V': |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
171 view_window_new(layout_image_get_path(lw)); |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
172 break; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
173 default: |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
174 stop_signal = FALSE; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
175 break; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
176 } |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
177 } |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
178 else |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
179 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
180 stop_signal = TRUE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
181 switch (event->keyval) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
182 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
183 case '+': case GDK_KP_Add: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
184 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
|
185 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
186 case GDK_KP_Subtract: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
187 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
|
188 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
189 case GDK_KP_Multiply: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
190 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
|
191 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
192 case GDK_KP_Divide: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
193 case '1': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
194 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
|
195 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
196 case '2': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
197 layout_image_zoom_set(lw, 2.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
198 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
199 case '3': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
200 layout_image_zoom_set(lw, 3.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
201 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
202 case '4': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
203 layout_image_zoom_set(lw, 4.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
204 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
205 case '7': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
206 layout_image_zoom_set(lw, -4.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
207 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
208 case '8': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
209 layout_image_zoom_set(lw, -3.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
210 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
211 case '9': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
212 layout_image_zoom_set(lw, -2.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
213 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
214 case 'W': case 'w': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
215 layout_image_zoom_set_fill_geometry(lw, FALSE); |
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 case 'H': case 'h': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
218 layout_image_zoom_set_fill_geometry(lw, TRUE); |
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 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
|
221 layout_image_prev(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
222 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
223 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
|
224 layout_image_next(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
225 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
226 case GDK_Home: case GDK_KP_Home: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
227 layout_image_first(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
228 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
229 case GDK_End: case GDK_KP_End: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
230 layout_image_last(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
231 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
232 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
|
233 if (enable_delete_key) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
234 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
235 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
|
236 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
237 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
238 case GDK_Escape: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
239 /* FIXME:interrupting thumbs no longer allowed */ |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
240 #if 0 |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
241 interrupt_thumbs(); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
242 #endif |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
243 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
244 case 'P': case 'p': |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
245 if (!event->state & GDK_SHIFT_MASK) |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
246 { |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
247 layout_image_slideshow_pause_toggle(lw); |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
248 } |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
249 else |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
250 { |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
251 stop_signal = FALSE; |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
252 } |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
253 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
254 case 'V': case 'v': |
86
cade6a52a165
Mon Oct 23 05:34:29 2006 John Ellis <johne@verizon.net>
gqview
parents:
84
diff
changeset
|
255 case GDK_F11: |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
256 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
|
257 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
258 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
259 stop_signal = FALSE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
260 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
261 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
262 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
263 |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
264 #if 0 |
9 | 265 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
|
266 #endif |
9 | 267 |
268 return stop_signal; | |
269 } | |
270 | |
271 void layout_keyboard_init(LayoutWindow *lw, GtkWidget *window) | |
272 { | |
273 g_signal_connect(G_OBJECT(window), "key_press_event", | |
274 G_CALLBACK(layout_key_press_cb), lw); | |
275 } | |
276 | |
277 /* | |
278 *----------------------------------------------------------------------------- | |
279 * menu callbacks | |
280 *----------------------------------------------------------------------------- | |
281 */ | |
282 | |
283 static void layout_menu_new_window_cb(GtkAction *action, gpointer data) | |
284 { | |
285 LayoutWindow *lw = data; | |
286 LayoutWindow *nw; | |
287 | |
288 nw = layout_new(NULL, FALSE, FALSE); | |
289 layout_sort_set(nw, file_sort_method, file_sort_ascending); | |
290 layout_set_path(nw, layout_get_path(lw)); | |
291 } | |
292 | |
293 static void layout_menu_new_cb(GtkAction *action, gpointer data) | |
294 { | |
295 collection_window_new(NULL); | |
296 } | |
297 | |
298 static void layout_menu_open_cb(GtkAction *action, gpointer data) | |
299 { | |
300 collection_dialog_load(NULL); | |
301 } | |
302 | |
303 static void layout_menu_search_cb(GtkAction *action, gpointer data) | |
304 { | |
305 LayoutWindow *lw = data; | |
306 | |
307 search_new(lw->path, layout_image_get_path(lw)); | |
308 } | |
309 | |
310 static void layout_menu_dupes_cb(GtkAction *action, gpointer data) | |
311 { | |
312 dupe_window_new(DUPE_MATCH_NAME); | |
313 } | |
314 | |
12
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
315 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
|
316 { |
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
317 LayoutWindow *lw = data; |
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
318 |
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
319 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
|
320 } |
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
321 |
9 | 322 static void layout_menu_print_cb(GtkAction *action, gpointer data) |
323 { | |
324 LayoutWindow *lw = data; | |
325 | |
326 print_window_new(layout_image_get_path(lw), layout_selection_list(lw), layout_list(lw), lw->window); | |
327 } | |
328 | |
329 static void layout_menu_dir_cb(GtkAction *action, gpointer data) | |
330 { | |
331 LayoutWindow *lw = data; | |
332 | |
333 file_util_create_dir(lw->path, lw->window); | |
334 } | |
335 | |
336 static void layout_menu_copy_cb(GtkAction *action, gpointer data) | |
337 { | |
338 LayoutWindow *lw = data; | |
339 | |
340 file_util_copy(NULL, layout_selection_list(lw), NULL, lw->window); | |
341 } | |
342 | |
343 static void layout_menu_move_cb(GtkAction *action, gpointer data) | |
344 { | |
345 LayoutWindow *lw = data; | |
346 | |
347 file_util_move(NULL, layout_selection_list(lw), NULL, lw->window); | |
348 } | |
349 | |
350 static void layout_menu_rename_cb(GtkAction *action, gpointer data) | |
351 { | |
352 LayoutWindow *lw = data; | |
353 | |
354 file_util_rename(NULL, layout_selection_list(lw), lw->window); | |
355 } | |
356 | |
357 static void layout_menu_delete_cb(GtkAction *action, gpointer data) | |
358 { | |
359 LayoutWindow *lw = data; | |
360 | |
361 file_util_delete(NULL, layout_selection_list(lw), lw->window); | |
362 } | |
363 | |
364 static void layout_menu_close_cb(GtkAction *action, gpointer data) | |
365 { | |
366 LayoutWindow *lw = data; | |
367 | |
368 layout_close(lw); | |
369 } | |
370 | |
371 static void layout_menu_exit_cb(GtkAction *action, gpointer data) | |
372 { | |
373 exit_gqview(); | |
374 } | |
375 | |
376 static void layout_menu_alter_90_cb(GtkAction *action, gpointer data) | |
377 { | |
378 LayoutWindow *lw = data; | |
379 | |
380 layout_image_alter(lw, ALTER_ROTATE_90); | |
381 } | |
382 | |
383 static void layout_menu_alter_90cc_cb(GtkAction *action, gpointer data) | |
384 { | |
385 LayoutWindow *lw = data; | |
386 | |
387 layout_image_alter(lw, ALTER_ROTATE_90_CC); | |
388 } | |
389 | |
390 static void layout_menu_alter_180_cb(GtkAction *action, gpointer data) | |
391 { | |
392 LayoutWindow *lw = data; | |
393 | |
394 layout_image_alter(lw, ALTER_ROTATE_180); | |
395 } | |
396 | |
397 static void layout_menu_alter_mirror_cb(GtkAction *action, gpointer data) | |
398 { | |
399 LayoutWindow *lw = data; | |
400 | |
401 layout_image_alter(lw, ALTER_MIRROR); | |
402 } | |
403 | |
404 static void layout_menu_alter_flip_cb(GtkAction *action, gpointer data) | |
405 { | |
406 LayoutWindow *lw = data; | |
407 | |
408 layout_image_alter(lw, ALTER_FLIP); | |
409 } | |
410 | |
82
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
411 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
|
412 { |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
413 LayoutWindow *lw = data; |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
414 |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
415 layout_image_alter(lw, ALTER_DESATURATE); |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
416 } |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
417 |
9 | 418 static void layout_menu_info_cb(GtkAction *action, gpointer data) |
419 { | |
420 LayoutWindow *lw = data; | |
421 GList *list; | |
422 const gchar *path = NULL; | |
423 | |
424 list = layout_selection_list(lw); | |
425 if (!list) path = layout_image_get_path(lw); | |
426 | |
427 info_window_new(path, list); | |
428 } | |
429 | |
430 static void layout_menu_select_all_cb(GtkAction *action, gpointer data) | |
431 { | |
432 LayoutWindow *lw = data; | |
433 | |
434 layout_select_all(lw); | |
435 } | |
436 | |
437 static void layout_menu_unselect_all_cb(GtkAction *action, gpointer data) | |
438 { | |
439 LayoutWindow *lw = data; | |
440 | |
441 layout_select_none(lw); | |
442 } | |
443 | |
444 static void layout_menu_config_cb(GtkAction *action, gpointer data) | |
445 { | |
446 show_config_window(); | |
447 } | |
448 | |
449 static void layout_menu_remove_thumb_cb(GtkAction *action, gpointer data) | |
450 { | |
451 cache_manager_show(); | |
452 } | |
453 | |
454 static void layout_menu_wallpaper_cb(GtkAction *action, gpointer data) | |
455 { | |
456 LayoutWindow *lw = data; | |
457 | |
458 layout_image_to_root(lw); | |
459 } | |
460 | |
461 static void layout_menu_zoom_in_cb(GtkAction *action, gpointer data) | |
462 { | |
463 LayoutWindow *lw = data; | |
464 | |
465 layout_image_zoom_adjust(lw, get_zoom_increment()); | |
466 } | |
467 | |
468 static void layout_menu_zoom_out_cb(GtkAction *action, gpointer data) | |
469 { | |
470 LayoutWindow *lw = data; | |
471 | |
472 layout_image_zoom_adjust(lw, -get_zoom_increment()); | |
473 } | |
474 | |
475 static void layout_menu_zoom_1_1_cb(GtkAction *action, gpointer data) | |
476 { | |
477 LayoutWindow *lw = data; | |
478 | |
479 layout_image_zoom_set(lw, 1.0); | |
480 } | |
481 | |
482 static void layout_menu_zoom_fit_cb(GtkAction *action, gpointer data) | |
483 { | |
484 LayoutWindow *lw = data; | |
485 | |
486 layout_image_zoom_set(lw, 0.0); | |
487 } | |
488 | |
489 static void layout_menu_thumb_cb(GtkToggleAction *action, gpointer data) | |
490 { | |
491 LayoutWindow *lw = data; | |
492 | |
493 layout_thumb_set(lw, gtk_toggle_action_get_active(action)); | |
494 } | |
495 | |
496 static void layout_menu_list_cb(GtkRadioAction *action, GtkRadioAction *current, gpointer data) | |
497 { | |
498 LayoutWindow *lw = data; | |
499 | |
500 layout_views_set(lw, lw->tree_view, (gtk_radio_action_get_current_value(action) == 1)); | |
501 } | |
502 | |
503 static void layout_menu_tree_cb(GtkToggleAction *action, gpointer data) | |
504 { | |
505 LayoutWindow *lw = data; | |
506 | |
507 layout_views_set(lw, gtk_toggle_action_get_active(action), lw->icon_view); | |
508 } | |
509 | |
510 static void layout_menu_fullscreen_cb(GtkAction *action, gpointer data) | |
511 { | |
512 LayoutWindow *lw = data; | |
513 | |
514 layout_image_full_screen_toggle(lw); | |
515 } | |
516 | |
517 static void layout_menu_refresh_cb(GtkAction *action, gpointer data) | |
518 { | |
519 LayoutWindow *lw = data; | |
520 | |
521 layout_refresh(lw); | |
522 } | |
523 | |
524 static void layout_menu_float_cb(GtkToggleAction *action, gpointer data) | |
525 { | |
526 LayoutWindow *lw = data; | |
527 | |
528 if (lw->tools_float != gtk_toggle_action_get_active(action)) | |
529 { | |
530 layout_tools_float_toggle(lw); | |
531 } | |
532 } | |
533 | |
534 static void layout_menu_hide_cb(GtkAction *action, gpointer data) | |
535 { | |
536 LayoutWindow *lw = data; | |
537 | |
538 layout_tools_hide_toggle(lw); | |
539 } | |
540 | |
541 static void layout_menu_toolbar_cb(GtkToggleAction *action, gpointer data) | |
542 { | |
543 LayoutWindow *lw = data; | |
544 | |
545 if (lw->toolbar_hidden != gtk_toggle_action_get_active(action)) | |
546 { | |
547 layout_toolbar_toggle(lw); | |
548 } | |
549 } | |
550 | |
551 static void layout_menu_bar_info_cb(GtkToggleAction *action, gpointer data) | |
552 { | |
553 LayoutWindow *lw = data; | |
554 | |
555 if (lw->bar_info_enabled != gtk_toggle_action_get_active(action)) | |
556 { | |
557 layout_bar_info_toggle(lw); | |
558 } | |
559 } | |
560 | |
561 static void layout_menu_bar_exif_cb(GtkToggleAction *action, gpointer data) | |
562 { | |
563 LayoutWindow *lw = data; | |
564 | |
565 if (lw->bar_exif_enabled != gtk_toggle_action_get_active(action)) | |
566 { | |
567 layout_bar_exif_toggle(lw); | |
568 } | |
569 } | |
570 | |
571 static void layout_menu_bar_sort_cb(GtkToggleAction *action, gpointer data) | |
572 { | |
573 LayoutWindow *lw = data; | |
574 | |
575 if (lw->bar_sort_enabled != gtk_toggle_action_get_active(action)) | |
576 { | |
577 layout_bar_sort_toggle(lw); | |
578 } | |
579 } | |
580 | |
581 static void layout_menu_slideshow_cb(GtkAction *action, gpointer data) | |
582 { | |
583 LayoutWindow *lw = data; | |
584 | |
585 layout_image_slideshow_toggle(lw); | |
586 } | |
587 | |
588 static void layout_menu_help_cb(GtkAction *action, gpointer data) | |
589 { | |
590 help_window_show("html_contents"); | |
591 } | |
592 | |
593 static void layout_menu_help_keys_cb(GtkAction *action, gpointer data) | |
594 { | |
595 help_window_show("documentation"); | |
596 } | |
597 | |
598 static void layout_menu_notes_cb(GtkAction *action, gpointer data) | |
599 { | |
600 help_window_show("release_notes"); | |
601 } | |
602 | |
603 static void layout_menu_about_cb(GtkAction *action, gpointer data) | |
604 { | |
605 show_about_window(); | |
606 } | |
607 | |
608 /* | |
609 *----------------------------------------------------------------------------- | |
610 * edit menu | |
611 *----------------------------------------------------------------------------- | |
612 */ | |
613 | |
614 static void layout_menu_edit_cb(GtkAction *action, gpointer data) | |
615 { | |
616 LayoutWindow *lw = data; | |
617 GList *list; | |
618 gint n; | |
619 | |
620 n = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "edit_index")); | |
621 | |
622 list = layout_selection_list(lw); | |
623 start_editor_from_path_list(n, list); | |
624 path_list_free(list); | |
625 } | |
626 | |
627 static void layout_menu_edit_update(LayoutWindow *lw) | |
628 { | |
629 gint i; | |
630 | |
631 /* main edit menu */ | |
632 | |
633 if (!lw->action_group) return; | |
634 | |
635 for (i = 0; i < 10; i++) | |
636 { | |
637 gchar *key; | |
638 GtkAction *action; | |
639 | |
640 key = g_strdup_printf("Editor%d", i); | |
641 | |
642 action = gtk_action_group_get_action(lw->action_group, key); | |
643 g_object_set_data(G_OBJECT(action), "edit_index", GINT_TO_POINTER(i)); | |
644 | |
645 if (editor_command[i] && strlen(editor_command[i]) > 0) | |
646 { | |
647 gchar *text; | |
648 | |
649 if (editor_name[i] && strlen(editor_name[i]) > 0) | |
650 { | |
651 text = g_strdup_printf(_("in %s..."), editor_name[i]); | |
652 } | |
653 else | |
654 { | |
655 text = g_strdup(_("in (unknown)...")); | |
656 } | |
657 g_object_set(action, "label", text, | |
658 "sensitive", TRUE, NULL); | |
659 g_free(text); | |
660 } | |
661 else | |
662 { | |
663 g_object_set(action, "label", _("empty"), | |
664 "sensitive", FALSE, NULL); | |
665 } | |
666 | |
667 g_free(key); | |
668 } | |
669 } | |
670 | |
671 void layout_edit_update_all(void) | |
672 { | |
673 GList *work; | |
674 | |
675 work = layout_window_list; | |
676 while (work) | |
677 { | |
678 LayoutWindow *lw = work->data; | |
679 work = work->next; | |
680 | |
681 layout_menu_edit_update(lw); | |
682 } | |
683 } | |
684 | |
685 /* | |
686 *----------------------------------------------------------------------------- | |
687 * recent menu | |
688 *----------------------------------------------------------------------------- | |
689 */ | |
690 | |
691 static void layout_menu_recent_cb(GtkWidget *widget, gpointer data) | |
692 { | |
693 gint n; | |
694 gchar *path; | |
695 | |
696 n = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "recent_index")); | |
697 | |
698 path = g_list_nth_data(history_list_get_by_key("recent"), n); | |
699 | |
700 if (!path) return; | |
701 | |
702 /* make a copy of it */ | |
703 path = g_strdup(path); | |
704 collection_window_new(path); | |
705 g_free(path); | |
706 } | |
707 | |
708 static void layout_menu_recent_update(LayoutWindow *lw) | |
709 { | |
710 GtkWidget *menu; | |
711 GtkWidget *recent; | |
712 GtkWidget *item; | |
713 GList *list; | |
714 gint n; | |
715 | |
716 if (!lw->ui_manager) return; | |
717 | |
718 list = history_list_get_by_key("recent"); | |
719 n = 0; | |
720 | |
721 menu = gtk_menu_new(); | |
722 | |
723 while (list) | |
724 { | |
725 item = menu_item_add_simple(menu, filename_from_path((gchar *)list->data), | |
726 G_CALLBACK(layout_menu_recent_cb), lw); | |
727 g_object_set_data(G_OBJECT(item), "recent_index", GINT_TO_POINTER(n)); | |
728 list = list->next; | |
729 n++; | |
730 } | |
731 | |
732 if (n == 0) | |
733 { | |
734 menu_item_add(menu, _("Empty"), NULL, NULL); | |
735 } | |
736 | |
737 recent = gtk_ui_manager_get_widget(lw->ui_manager, "/MainMenu/FileMenu/OpenRecent"); | |
738 gtk_menu_item_set_submenu(GTK_MENU_ITEM(recent), menu); | |
739 gtk_widget_set_sensitive(recent, (n != 0)); | |
740 } | |
741 | |
742 void layout_recent_update_all(void) | |
743 { | |
744 GList *work; | |
745 | |
746 work = layout_window_list; | |
747 while (work) | |
748 { | |
749 LayoutWindow *lw = work->data; | |
750 work = work->next; | |
751 | |
752 layout_menu_recent_update(lw); | |
753 } | |
754 } | |
755 | |
756 void layout_recent_add_path(const gchar *path) | |
757 { | |
758 if (!path) return; | |
759 | |
760 history_list_add_to_key("recent", path, recent_list_max); | |
761 | |
762 layout_recent_update_all(); | |
763 } | |
764 | |
765 /* | |
766 *----------------------------------------------------------------------------- | |
767 * menu | |
768 *----------------------------------------------------------------------------- | |
769 */ | |
770 | |
771 #define CB G_CALLBACK | |
772 | |
773 static GtkActionEntry menu_entries[] = { | |
774 { "FileMenu", NULL, N_("_File") }, | |
775 { "EditMenu", NULL, N_("_Edit") }, | |
776 { "AdjustMenu", NULL, N_("_Adjust") }, | |
777 { "ViewMenu", NULL, N_("_View") }, | |
778 { "HelpMenu", NULL, N_("_Help") }, | |
779 | |
780 { "NewWindow", GTK_STOCK_NEW, N_("New _window"), NULL, NULL, CB(layout_menu_new_window_cb) }, | |
781 { "NewCollection", GTK_STOCK_INDEX,N_("_New collection"), "C", NULL, CB(layout_menu_new_cb) }, | |
782 { "OpenCollection", GTK_STOCK_OPEN, N_("_Open collection..."),"O", NULL, CB(layout_menu_open_cb) }, | |
783 { "OpenRecent", NULL, N_("Open _recent") }, | |
784 { "Search", GTK_STOCK_FIND, N_("_Search..."), "F3", NULL, CB(layout_menu_search_cb) }, | |
785 { "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
|
786 { "PanView", NULL, N_("Pan _view"), "<control>J", NULL, CB(layout_menu_pan_cb) }, |
9 | 787 { "Print", GTK_STOCK_PRINT,N_("_Print..."), "<shift>P", NULL, CB(layout_menu_print_cb) }, |
788 { "NewFolder", NULL, N_("N_ew folder..."), "<control>F", NULL, CB(layout_menu_dir_cb) }, | |
789 { "Copy", NULL, N_("_Copy..."), "<control>C", NULL, CB(layout_menu_copy_cb) }, | |
790 { "Move", NULL, N_("_Move..."), "<control>M", NULL, CB(layout_menu_move_cb) }, | |
791 { "Rename", NULL, N_("_Rename..."), "<control>R", NULL, CB(layout_menu_rename_cb) }, | |
792 { "Delete", GTK_STOCK_DELETE, N_("_Delete..."), "<control>D", NULL, CB(layout_menu_delete_cb) }, | |
793 { "CloseWindow", GTK_STOCK_CLOSE,N_("C_lose window"), "<control>W", NULL, CB(layout_menu_close_cb) }, | |
794 { "Quit", GTK_STOCK_QUIT, N_("_Quit"), "<control>Q", NULL, CB(layout_menu_exit_cb) }, | |
795 | |
796 { "Editor0", NULL, "editor0", "<control>1", NULL, CB(layout_menu_edit_cb) }, | |
797 { "Editor1", NULL, "editor1", "<control>2", NULL, CB(layout_menu_edit_cb) }, | |
798 { "Editor2", NULL, "editor2", "<control>3", NULL, CB(layout_menu_edit_cb) }, | |
799 { "Editor3", NULL, "editor3", "<control>4", NULL, CB(layout_menu_edit_cb) }, | |
800 { "Editor4", NULL, "editor4", "<control>5", NULL, CB(layout_menu_edit_cb) }, | |
801 { "Editor5", NULL, "editor5", "<control>6", NULL, CB(layout_menu_edit_cb) }, | |
802 { "Editor6", NULL, "editor6", "<control>7", NULL, CB(layout_menu_edit_cb) }, | |
803 { "Editor7", NULL, "editor7", "<control>8", NULL, CB(layout_menu_edit_cb) }, | |
804 { "Editor8", NULL, "editor8", "<control>9", NULL, CB(layout_menu_edit_cb) }, | |
805 { "Editor9", NULL, "editor9", "<control>0", NULL, CB(layout_menu_edit_cb) }, | |
806 { "RotateCW", NULL, N_("_Rotate clockwise"), "bracketright", NULL, CB(layout_menu_alter_90_cb) }, | |
807 { "RotateCCW", NULL, N_("Rotate _counterclockwise"), "bracketleft", NULL, CB(layout_menu_alter_90cc_cb) }, | |
808 { "Rotate180", NULL, N_("Rotate 1_80"), "<shift>R", NULL, CB(layout_menu_alter_180_cb) }, | |
809 { "Mirror", NULL, N_("_Mirror"), "<shift>M", NULL, CB(layout_menu_alter_mirror_cb) }, | |
810 { "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
|
811 { "Grayscale", NULL, N_("_Grayscale"), "<shift>G", NULL, CB(layout_menu_alter_desaturate_cb) }, |
9 | 812 { "Properties",GTK_STOCK_PROPERTIES, N_("_Properties"), "<control>P", NULL, CB(layout_menu_info_cb) }, |
813 { "SelectAll", NULL, N_("Select _all"), "<control>A", NULL, CB(layout_menu_select_all_cb) }, | |
814 { "SelectNone", NULL, N_("Select _none"), "<control><shift>A",NULL, CB(layout_menu_unselect_all_cb) }, | |
815 { "Preferences",GTK_STOCK_PREFERENCES,N_("P_references..."), "<control>O", NULL, CB(layout_menu_config_cb) }, | |
816 { "Maintenance", NULL, N_("_Thumbnail maintenance..."),NULL, NULL, CB(layout_menu_remove_thumb_cb) }, | |
817 { "Wallpaper", NULL, N_("Set as _wallpaper"),NULL, NULL, CB(layout_menu_wallpaper_cb) }, | |
818 | |
819 { "ZoomIn", GTK_STOCK_ZOOM_IN, N_("Zoom _in"), "equal", NULL, CB(layout_menu_zoom_in_cb) }, | |
820 { "ZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _out"), "minus", NULL, CB(layout_menu_zoom_out_cb) }, | |
821 { "Zoom100", GTK_STOCK_ZOOM_100, N_("Zoom _1:1"), "Z", NULL, CB(layout_menu_zoom_1_1_cb) }, | |
822 { "ZoomFit", GTK_STOCK_ZOOM_FIT, N_("_Zoom to fit"), "X", NULL, CB(layout_menu_zoom_fit_cb) }, | |
823 { "FullScreen", NULL, N_("F_ull screen"), "F", NULL, CB(layout_menu_fullscreen_cb) }, | |
824 { "HideTools", NULL, N_("_Hide file list"), "<control>H", NULL, CB(layout_menu_hide_cb) }, | |
825 { "SlideShow", NULL, N_("Toggle _slideshow"),"S", NULL, CB(layout_menu_slideshow_cb) }, | |
826 { "Refresh", GTK_STOCK_REFRESH, N_("_Refresh"), "R", NULL, CB(layout_menu_refresh_cb) }, | |
827 | |
828 { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", NULL, CB(layout_menu_help_cb) }, | |
829 { "HelpShortcuts", NULL, N_("_Keyboard shortcuts"),NULL, NULL, CB(layout_menu_help_keys_cb) }, | |
830 { "HelpNotes", NULL, N_("_Release notes"), NULL, NULL, CB(layout_menu_notes_cb) }, | |
831 { "About", NULL, N_("_About"), NULL, NULL, CB(layout_menu_about_cb) } | |
832 }; | |
833 | |
834 static GtkToggleActionEntry menu_toggle_entries[] = { | |
835 { "Thumbnails", NULL, N_("_Thumbnails"), "T", NULL, CB(layout_menu_thumb_cb) }, | |
836 { "FolderTree", NULL, N_("Tr_ee"), "<control>T", NULL, CB(layout_menu_tree_cb) }, | |
837 { "FloatTools", NULL, N_("_Float file list"), "L", NULL, CB(layout_menu_float_cb) }, | |
838 { "HideToolbar", NULL, N_("Hide tool_bar"), NULL, NULL, CB(layout_menu_toolbar_cb) }, | |
839 { "SBarKeywords", NULL, N_("_Keywords"), "<control>K", NULL, CB(layout_menu_bar_info_cb) }, | |
840 { "SBarExif", NULL, N_("E_xif data"), "<control>E", NULL, CB(layout_menu_bar_exif_cb) }, | |
841 { "SBarSort", NULL, N_("Sort _manager"), "<control>S", NULL, CB(layout_menu_bar_sort_cb) } | |
842 }; | |
843 | |
844 static GtkRadioActionEntry menu_radio_entries[] = { | |
845 { "ViewList", NULL, N_("_List"), "<control>L", NULL, 0 }, | |
846 { "ViewIcons", NULL, N_("I_cons"), "<control>I", NULL, 1 } | |
847 }; | |
848 | |
849 #undef CB | |
850 | |
851 static const char *menu_ui_description = | |
852 "<ui>" | |
853 " <menubar name='MainMenu'>" | |
854 " <menu action='FileMenu'>" | |
855 " <menuitem action='NewWindow'/>" | |
856 " <menuitem action='NewCollection'/>" | |
857 " <menuitem action='OpenCollection'/>" | |
858 " <menuitem action='OpenRecent'/>" | |
859 " <separator/>" | |
860 " <menuitem action='Search'/>" | |
861 " <menuitem action='FindDupes'/>" | |
12
147f4c4b9025
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
862 " <menuitem action='PanView'/>" |
9 | 863 " <separator/>" |
864 " <menuitem action='Print'/>" | |
865 " <menuitem action='NewFolder'/>" | |
866 " <separator/>" | |
867 " <menuitem action='Copy'/>" | |
868 " <menuitem action='Move'/>" | |
869 " <menuitem action='Rename'/>" | |
870 " <menuitem action='Delete'/>" | |
871 " <separator/>" | |
872 " <menuitem action='CloseWindow'/>" | |
873 " <menuitem action='Quit'/>" | |
874 " </menu>" | |
875 " <menu action='EditMenu'>" | |
876 " <menuitem action='Editor0'/>" | |
877 " <menuitem action='Editor1'/>" | |
878 " <menuitem action='Editor2'/>" | |
879 " <menuitem action='Editor3'/>" | |
880 " <menuitem action='Editor4'/>" | |
881 " <menuitem action='Editor5'/>" | |
882 " <menuitem action='Editor6'/>" | |
883 " <menuitem action='Editor7'/>" | |
884 " <menuitem action='Editor8'/>" | |
885 " <menuitem action='Editor9'/>" | |
886 " <separator/>" | |
887 " <menu action='AdjustMenu'>" | |
888 " <menuitem action='RotateCW'/>" | |
889 " <menuitem action='RotateCCW'/>" | |
890 " <menuitem action='Rotate180'/>" | |
891 " <menuitem action='Mirror'/>" | |
892 " <menuitem action='Flip'/>" | |
82
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
893 " <menuitem action='Grayscale'/>" |
9 | 894 " </menu>" |
895 " <menuitem action='Properties'/>" | |
896 " <separator/>" | |
897 " <menuitem action='SelectAll'/>" | |
898 " <menuitem action='SelectNone'/>" | |
899 " <separator/>" | |
900 " <menuitem action='Preferences'/>" | |
901 " <menuitem action='Maintenance'/>" | |
902 " <separator/>" | |
903 " <menuitem action='Wallpaper'/>" | |
904 " </menu>" | |
905 " <menu action='ViewMenu'>" | |
906 " <separator/>" | |
907 " <menuitem action='ZoomIn'/>" | |
908 " <menuitem action='ZoomOut'/>" | |
909 " <menuitem action='Zoom100'/>" | |
910 " <menuitem action='ZoomFit'/>" | |
911 " <separator/>" | |
912 " <menuitem action='Thumbnails'/>" | |
913 " <menuitem action='ViewList'/>" | |
914 " <menuitem action='ViewIcons'/>" | |
915 " <separator/>" | |
916 " <menuitem action='FolderTree'/>" | |
917 " <menuitem action='FullScreen'/>" | |
918 " <separator/>" | |
919 " <menuitem action='FloatTools'/>" | |
920 " <menuitem action='HideTools'/>" | |
921 " <menuitem action='HideToolbar'/>" | |
922 " <separator/>" | |
923 " <menuitem action='SBarKeywords'/>" | |
924 " <menuitem action='SBarExif'/>" | |
925 " <menuitem action='SBarSort'/>" | |
926 " <separator/>" | |
927 " <menuitem action='SlideShow'/>" | |
928 " <menuitem action='Refresh'/>" | |
929 " </menu>" | |
930 " <menu action='HelpMenu'>" | |
931 " <separator/>" | |
932 " <menuitem action='HelpContents'/>" | |
933 " <menuitem action='HelpShortcuts'/>" | |
934 " <menuitem action='HelpNotes'/>" | |
935 " <separator/>" | |
936 " <menuitem action='About'/>" | |
937 " </menu>" | |
938 " </menubar>" | |
939 "</ui>"; | |
940 | |
941 | |
942 static gchar *menu_translate(const gchar *path, gpointer data) | |
943 { | |
944 return _(path); | |
945 } | |
946 | |
947 void layout_actions_setup(LayoutWindow *lw) | |
948 { | |
949 GError *error; | |
950 | |
951 if (lw->ui_manager) return; | |
952 | |
953 lw->action_group = gtk_action_group_new ("MenuActions"); | |
954 gtk_action_group_set_translate_func(lw->action_group, menu_translate, NULL, NULL); | |
955 | |
956 gtk_action_group_add_actions(lw->action_group, | |
957 menu_entries, G_N_ELEMENTS(menu_entries), lw); | |
958 gtk_action_group_add_toggle_actions(lw->action_group, | |
959 menu_toggle_entries, G_N_ELEMENTS(menu_toggle_entries), lw); | |
960 gtk_action_group_add_radio_actions(lw->action_group, | |
961 menu_radio_entries, G_N_ELEMENTS(menu_radio_entries), | |
962 0, G_CALLBACK(layout_menu_list_cb), lw); | |
963 | |
964 lw->ui_manager = gtk_ui_manager_new(); | |
965 gtk_ui_manager_set_add_tearoffs(lw->ui_manager, TRUE); | |
966 gtk_ui_manager_insert_action_group(lw->ui_manager, lw->action_group, 0); | |
967 | |
968 error = NULL; | |
969 if (!gtk_ui_manager_add_ui_from_string(lw->ui_manager, menu_ui_description, -1, &error)) | |
970 { | |
971 g_message ("building menus failed: %s", error->message); | |
972 g_error_free (error); | |
973 exit (EXIT_FAILURE); | |
974 } | |
975 } | |
976 | |
977 void layout_actions_add_window(LayoutWindow *lw, GtkWidget *window) | |
978 { | |
979 GtkAccelGroup *group; | |
980 | |
981 if (!lw->ui_manager) return; | |
982 | |
983 group = gtk_ui_manager_get_accel_group(lw->ui_manager); | |
984 gtk_window_add_accel_group(GTK_WINDOW(window), group); | |
985 } | |
986 | |
987 GtkWidget *layout_actions_menu_bar(LayoutWindow *lw) | |
988 { | |
989 return gtk_ui_manager_get_widget(lw->ui_manager, "/MainMenu"); | |
990 } | |
991 | |
992 | |
993 /* | |
994 *----------------------------------------------------------------------------- | |
995 * toolbar | |
996 *----------------------------------------------------------------------------- | |
997 */ | |
998 | |
999 static void layout_button_thumb_cb(GtkWidget *widget, gpointer data) | |
1000 { | |
1001 LayoutWindow *lw = data; | |
1002 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1003 layout_thumb_set(lw, gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget))); |
9 | 1004 } |
1005 | |
1006 static void layout_button_home_cb(GtkWidget *widget, gpointer data) | |
1007 { | |
1008 LayoutWindow *lw = data; | |
1009 const gchar *path = homedir(); | |
1010 | |
1011 if (path) layout_set_path(lw, path); | |
1012 } | |
1013 | |
1014 static void layout_button_refresh_cb(GtkWidget *widget, gpointer data) | |
1015 { | |
1016 LayoutWindow *lw = data; | |
1017 | |
1018 layout_refresh(lw); | |
1019 } | |
1020 | |
1021 static void layout_button_zoom_in_cb(GtkWidget *widget, gpointer data) | |
1022 { | |
1023 LayoutWindow *lw = data; | |
1024 | |
1025 layout_image_zoom_adjust(lw, get_zoom_increment()); | |
1026 } | |
1027 | |
1028 static void layout_button_zoom_out_cb(GtkWidget *widget, gpointer data) | |
1029 { | |
1030 LayoutWindow *lw = data; | |
1031 | |
1032 layout_image_zoom_adjust(lw, -get_zoom_increment()); | |
1033 } | |
1034 | |
1035 static void layout_button_zoom_fit_cb(GtkWidget *widget, gpointer data) | |
1036 { | |
1037 LayoutWindow *lw = data; | |
1038 | |
1039 layout_image_zoom_set(lw, 0.0); | |
1040 } | |
1041 | |
1042 static void layout_button_zoom_1_1_cb(GtkWidget *widget, gpointer data) | |
1043 { | |
1044 LayoutWindow *lw = data; | |
1045 | |
1046 layout_image_zoom_set(lw, 1.0); | |
1047 } | |
1048 | |
1049 static void layout_button_config_cb(GtkWidget *widget, gpointer data) | |
1050 { | |
1051 show_config_window(); | |
1052 } | |
1053 | |
1054 static void layout_button_float_cb(GtkWidget *widget, gpointer data) | |
1055 { | |
1056 LayoutWindow *lw = data; | |
1057 | |
1058 layout_tools_float_toggle(lw); | |
1059 } | |
1060 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1061 static void layout_button_custom_icon(GtkWidget *button, const gchar *key) |
9 | 1062 { |
1063 GtkWidget *icon; | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1064 GdkPixbuf *pixbuf; |
9 | 1065 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1066 pixbuf = pixbuf_inline(key); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1067 if (!pixbuf) return; |
9 | 1068 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1069 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
|
1070 g_object_unref(pixbuf); |
9 | 1071 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1072 pref_toolbar_button_set_icon(button, icon, NULL); |
9 | 1073 gtk_widget_show(icon); |
1074 } | |
1075 | |
1076 GtkWidget *layout_button_bar(LayoutWindow *lw) | |
1077 { | |
1078 GtkWidget *box; | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1079 GtkWidget *button; |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1080 |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1081 box = pref_toolbar_new(NULL, GTK_TOOLBAR_ICONS); |
9 | 1082 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1083 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
|
1084 _("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
|
1085 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
|
1086 lw->thumb_button = button; |
9 | 1087 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1088 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
|
1089 _("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
|
1090 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
|
1091 _("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
|
1092 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
|
1093 _("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
|
1094 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
|
1095 _("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
|
1096 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
|
1097 _("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
|
1098 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
|
1099 _("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
|
1100 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
|
1101 _("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
|
1102 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
|
1103 _("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
|
1104 layout_button_custom_icon(button, PIXBUF_INLINE_ICON_FLOAT); |
9 | 1105 |
1106 return box; | |
1107 } | |
1108 | |
1109 /* | |
1110 *----------------------------------------------------------------------------- | |
1111 * misc | |
1112 *----------------------------------------------------------------------------- | |
1113 */ | |
1114 | |
1115 static void layout_util_sync_views(LayoutWindow *lw) | |
1116 { | |
1117 GtkAction *action; | |
1118 | |
1119 if (!lw->action_group) return; | |
1120 | |
1121 action = gtk_action_group_get_action(lw->action_group, "FolderTree"); | |
1122 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->tree_view); | |
1123 | |
1124 action = gtk_action_group_get_action(lw->action_group, "ViewIcons"); | |
1125 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->icon_view); | |
1126 | |
1127 action = gtk_action_group_get_action(lw->action_group, "FloatTools"); | |
1128 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->tools_float); | |
1129 | |
1130 action = gtk_action_group_get_action(lw->action_group, "SBarKeywords"); | |
1131 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->bar_info_enabled); | |
1132 | |
1133 action = gtk_action_group_get_action(lw->action_group, "SBarExif"); | |
1134 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->bar_exif_enabled); | |
1135 | |
1136 action = gtk_action_group_get_action(lw->action_group, "SBarSort"); | |
1137 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->bar_sort_enabled); | |
1138 | |
1139 action = gtk_action_group_get_action(lw->action_group, "HideToolbar"); | |
1140 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->toolbar_hidden); | |
1141 } | |
1142 | |
1143 void layout_util_sync_thumb(LayoutWindow *lw) | |
1144 { | |
1145 GtkAction *action; | |
1146 | |
1147 if (!lw->action_group) return; | |
1148 | |
1149 action = gtk_action_group_get_action(lw->action_group, "Thumbnails"); | |
1150 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->thumbs_enabled); | |
1151 g_object_set(action, "sensitive", !lw->icon_view, NULL); | |
1152 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
12
diff
changeset
|
1153 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(lw->thumb_button), lw->thumbs_enabled); |
9 | 1154 gtk_widget_set_sensitive(lw->thumb_button, !lw->icon_view); |
1155 } | |
1156 | |
1157 void layout_util_sync(LayoutWindow *lw) | |
1158 { | |
1159 layout_util_sync_views(lw); | |
1160 layout_util_sync_thumb(lw); | |
1161 layout_menu_recent_update(lw); | |
1162 layout_menu_edit_update(lw); | |
1163 } | |
1164 | |
1165 /* | |
1166 *----------------------------------------------------------------------------- | |
1167 * icons (since all the toolbar icons are included here, best place as any) | |
1168 *----------------------------------------------------------------------------- | |
1169 */ | |
1170 | |
1171 PixmapFolders *folder_icons_new(void) | |
1172 { | |
1173 PixmapFolders *pf; | |
1174 | |
1175 pf = g_new0(PixmapFolders, 1); | |
1176 | |
1177 pf->close = pixbuf_inline(PIXBUF_INLINE_FOLDER_CLOSED); | |
1178 pf->open = pixbuf_inline(PIXBUF_INLINE_FOLDER_OPEN); | |
1179 pf->deny = pixbuf_inline(PIXBUF_INLINE_FOLDER_LOCKED); | |
1180 pf->parent = pixbuf_inline(PIXBUF_INLINE_FOLDER_UP); | |
1181 | |
1182 return pf; | |
1183 } | |
1184 | |
1185 void folder_icons_free(PixmapFolders *pf) | |
1186 { | |
1187 if (!pf) return; | |
1188 | |
1189 g_object_unref(pf->close); | |
1190 g_object_unref(pf->open); | |
1191 g_object_unref(pf->deny); | |
1192 g_object_unref(pf->parent); | |
1193 | |
1194 g_free(pf); | |
1195 } | |
1196 | |
1197 /* | |
1198 *----------------------------------------------------------------------------- | |
1199 * sidebars | |
1200 *----------------------------------------------------------------------------- | |
1201 */ | |
1202 | |
1203 #define SIDEBAR_WIDTH 288 | |
1204 | |
1205 static void layout_bar_info_destroyed(GtkWidget *widget, gpointer data) | |
1206 { | |
1207 LayoutWindow *lw = data; | |
1208 | |
1209 lw->bar_info = NULL; | |
1210 | |
1211 if (lw->utility_box) | |
1212 { | |
1213 /* destroyed from within itself */ | |
1214 lw->bar_info_enabled = FALSE; | |
1215 layout_util_sync_views(lw); | |
1216 } | |
1217 } | |
1218 | |
1219 static GList *layout_bar_info_list_cb(gpointer data) | |
1220 { | |
1221 LayoutWindow *lw = data; | |
1222 | |
1223 return layout_selection_list(lw); | |
1224 } | |
1225 | |
1226 static void layout_bar_info_new(LayoutWindow *lw) | |
1227 { | |
1228 if (!lw->utility_box) return; | |
1229 | |
1230 lw->bar_info = bar_info_new(layout_image_get_path(lw), FALSE, lw->utility_box); | |
1231 bar_info_set_selection_func(lw->bar_info, layout_bar_info_list_cb, lw); | |
1232 bar_info_selection(lw->bar_info, layout_selection_count(lw, NULL) - 1); | |
1233 bar_info_size_request(lw->bar_info, SIDEBAR_WIDTH * 3 / 4); | |
1234 g_signal_connect(G_OBJECT(lw->bar_info), "destroy", | |
1235 G_CALLBACK(layout_bar_info_destroyed), lw); | |
1236 lw->bar_info_enabled = TRUE; | |
1237 | |
1238 gtk_box_pack_start(GTK_BOX(lw->utility_box), lw->bar_info, FALSE, FALSE, 0); | |
1239 gtk_widget_show(lw->bar_info); | |
1240 } | |
1241 | |
1242 static void layout_bar_info_close(LayoutWindow *lw) | |
1243 { | |
1244 if (lw->bar_info) | |
1245 { | |
1246 bar_info_close(lw->bar_info); | |
1247 lw->bar_info = NULL; | |
1248 } | |
1249 lw->bar_info_enabled = FALSE; | |
1250 } | |
1251 | |
1252 void layout_bar_info_toggle(LayoutWindow *lw) | |
1253 { | |
1254 if (lw->bar_info_enabled) | |
1255 { | |
1256 layout_bar_info_close(lw); | |
1257 } | |
1258 else | |
1259 { | |
1260 layout_bar_info_new(lw); | |
1261 } | |
1262 } | |
1263 | |
1264 static void layout_bar_info_new_image(LayoutWindow *lw) | |
1265 { | |
1266 if (!lw->bar_info || !lw->bar_info_enabled) return; | |
1267 | |
1268 bar_info_set(lw->bar_info, layout_image_get_path(lw)); | |
1269 } | |
1270 | |
1271 static void layout_bar_info_new_selection(LayoutWindow *lw, gint count) | |
1272 { | |
1273 if (!lw->bar_info || !lw->bar_info_enabled) return; | |
1274 | |
1275 bar_info_selection(lw->bar_info, count - 1); | |
1276 } | |
1277 | |
1278 static void layout_bar_info_maint_renamed(LayoutWindow *lw) | |
1279 { | |
1280 if (!lw->bar_info || !lw->bar_info_enabled) return; | |
1281 | |
1282 bar_info_maint_renamed(lw->bar_info, layout_image_get_path(lw)); | |
1283 } | |
1284 | |
1285 static void layout_bar_exif_destroyed(GtkWidget *widget, gpointer data) | |
1286 { | |
1287 LayoutWindow *lw = data; | |
1288 | |
1289 if (lw->bar_exif) | |
1290 { | |
1291 lw->bar_exif_advanced = bar_exif_is_advanced(lw->bar_exif); | |
1292 } | |
1293 | |
1294 lw->bar_exif = NULL; | |
1295 if (lw->utility_box) | |
1296 { | |
1297 /* destroyed from within itself */ | |
1298 lw->bar_exif_enabled = FALSE; | |
1299 layout_util_sync_views(lw); | |
1300 } | |
1301 } | |
1302 | |
1303 static void layout_bar_exif_sized(GtkWidget *widget, GtkAllocation *allocation, gpointer data) | |
1304 { | |
1305 LayoutWindow *lw = data; | |
1306 | |
1307 if (lw->bar_exif) | |
1308 { | |
1309 lw->bar_exif_size = allocation->width; | |
1310 } | |
1311 } | |
1312 | |
1313 static void layout_bar_exif_new(LayoutWindow *lw) | |
1314 { | |
1315 if (!lw->utility_box) return; | |
1316 | |
1317 lw->bar_exif = bar_exif_new(TRUE, layout_image_get_path(lw), | |
1318 lw->bar_exif_advanced, lw->utility_box); | |
1319 g_signal_connect(G_OBJECT(lw->bar_exif), "destroy", | |
1320 G_CALLBACK(layout_bar_exif_destroyed), lw); | |
1321 g_signal_connect(G_OBJECT(lw->bar_exif), "size_allocate", | |
1322 G_CALLBACK(layout_bar_exif_sized), lw); | |
1323 lw->bar_exif_enabled = TRUE; | |
1324 | |
1325 if (lw->bar_exif_size < 1) lw->bar_exif_size = SIDEBAR_WIDTH; | |
1326 gtk_widget_set_size_request(lw->bar_exif, lw->bar_exif_size, -1); | |
1327 gtk_box_pack_start(GTK_BOX(lw->utility_box), lw->bar_exif, FALSE, FALSE, 0); | |
1328 if (lw->bar_info) gtk_box_reorder_child(GTK_BOX(lw->utility_box), lw->bar_exif, 1); | |
1329 gtk_widget_show(lw->bar_exif); | |
1330 } | |
1331 | |
1332 static void layout_bar_exif_close(LayoutWindow *lw) | |
1333 { | |
1334 if (lw->bar_exif) | |
1335 { | |
1336 bar_exif_close(lw->bar_exif); | |
1337 lw->bar_exif = NULL; | |
1338 } | |
1339 lw->bar_exif_enabled = FALSE; | |
1340 } | |
1341 | |
1342 void layout_bar_exif_toggle(LayoutWindow *lw) | |
1343 { | |
1344 if (lw->bar_exif_enabled) | |
1345 { | |
1346 layout_bar_exif_close(lw); | |
1347 } | |
1348 else | |
1349 { | |
1350 layout_bar_exif_new(lw); | |
1351 } | |
1352 } | |
1353 | |
1354 static void layout_bar_exif_new_image(LayoutWindow *lw) | |
1355 { | |
1356 if (!lw->bar_exif || !lw->bar_exif_enabled) return; | |
1357 | |
1358 bar_exif_set(lw->bar_exif, layout_image_get_path(lw)); | |
1359 } | |
1360 | |
1361 static void layout_bar_sort_destroyed(GtkWidget *widget, gpointer data) | |
1362 { | |
1363 LayoutWindow *lw = data; | |
1364 | |
1365 lw->bar_sort = NULL; | |
1366 | |
1367 if (lw->utility_box) | |
1368 { | |
1369 /* destroyed from within itself */ | |
1370 lw->bar_sort_enabled = FALSE; | |
1371 | |
1372 layout_util_sync_views(lw); | |
1373 } | |
1374 } | |
1375 | |
1376 static void layout_bar_sort_new(LayoutWindow *lw) | |
1377 { | |
1378 if (!lw->utility_box) return; | |
1379 | |
1380 lw->bar_sort = bar_sort_new(lw); | |
1381 g_signal_connect(G_OBJECT(lw->bar_sort), "destroy", | |
1382 G_CALLBACK(layout_bar_sort_destroyed), lw); | |
1383 lw->bar_sort_enabled = TRUE; | |
1384 | |
1385 gtk_box_pack_end(GTK_BOX(lw->utility_box), lw->bar_sort, FALSE, FALSE, 0); | |
1386 gtk_widget_show(lw->bar_sort); | |
1387 } | |
1388 | |
1389 static void layout_bar_sort_close(LayoutWindow *lw) | |
1390 { | |
1391 if (lw->bar_sort) | |
1392 { | |
1393 bar_sort_close(lw->bar_sort); | |
1394 lw->bar_sort = NULL; | |
1395 } | |
1396 lw->bar_sort_enabled = FALSE; | |
1397 } | |
1398 | |
1399 void layout_bar_sort_toggle(LayoutWindow *lw) | |
1400 { | |
1401 if (lw->bar_sort_enabled) | |
1402 { | |
1403 layout_bar_sort_close(lw); | |
1404 } | |
1405 else | |
1406 { | |
1407 layout_bar_sort_new(lw); | |
1408 } | |
1409 } | |
1410 | |
1411 void layout_bars_new_image(LayoutWindow *lw) | |
1412 { | |
1413 layout_bar_info_new_image(lw); | |
1414 layout_bar_exif_new_image(lw); | |
1415 } | |
1416 | |
1417 void layout_bars_new_selection(LayoutWindow *lw, gint count) | |
1418 { | |
1419 layout_bar_info_new_selection(lw, count); | |
1420 } | |
1421 | |
1422 GtkWidget *layout_bars_prepare(LayoutWindow *lw, GtkWidget *image) | |
1423 { | |
1424 lw->utility_box = gtk_hbox_new(FALSE, PREF_PAD_GAP); | |
1425 gtk_box_pack_start(GTK_BOX(lw->utility_box), image, TRUE, TRUE, 0); | |
1426 gtk_widget_show(image); | |
1427 | |
1428 if (lw->bar_sort_enabled) | |
1429 { | |
1430 layout_bar_sort_new(lw); | |
1431 } | |
1432 | |
1433 if (lw->bar_info_enabled) | |
1434 { | |
1435 layout_bar_info_new(lw); | |
1436 } | |
1437 | |
1438 if (lw->bar_exif_enabled) | |
1439 { | |
1440 layout_bar_exif_new(lw); | |
1441 } | |
1442 | |
1443 return lw->utility_box; | |
1444 } | |
1445 | |
1446 void layout_bars_close(LayoutWindow *lw) | |
1447 { | |
1448 layout_bar_sort_close(lw); | |
1449 layout_bar_exif_close(lw); | |
1450 layout_bar_info_close(lw); | |
1451 } | |
1452 | |
1453 void layout_bars_maint_renamed(LayoutWindow *lw) | |
1454 { | |
1455 layout_bar_info_maint_renamed(lw); | |
1456 } | |
1457 |