Mercurial > geeqie
annotate src/layout_image.c @ 178:9dc8bc9b2bb9
first exiv2 support that does not crash immediately
author | nadvornik |
---|---|
date | Wed, 13 Feb 2008 16:52:41 +0000 |
parents | 682705e0c0e0 |
children | f6e307c7bad6 |
rev | line source |
---|---|
9 | 1 /* |
2 * GQview | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
3 * (C) 2006 John Ellis |
9 | 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 #include "gqview.h" | |
13 #include "layout_image.h" | |
14 | |
15 #include "collect.h" | |
16 #include "dnd.h" | |
17 #include "editors.h" | |
18 #include "filelist.h" | |
19 #include "fullscreen.h" | |
20 #include "image.h" | |
21 #include "image-overlay.h" | |
22 #include "img-view.h" | |
23 #include "info.h" | |
24 #include "layout.h" | |
25 #include "layout_util.h" | |
26 #include "menu.h" | |
27 #include "pixbuf_util.h" | |
28 #include "utilops.h" | |
29 #include "slideshow.h" | |
30 #include "ui_bookmark.h" | |
31 #include "ui_fileops.h" | |
32 #include "ui_menu.h" | |
33 | |
34 #include <gdk/gdkkeysyms.h> /* for keyboard values */ | |
35 | |
36 | |
37 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw); | |
38 static void layout_image_set_buttons(LayoutWindow *lw); | |
39 | |
40 /* | |
41 *---------------------------------------------------------------------------- | |
42 * full screen overlay | |
43 *---------------------------------------------------------------------------- | |
44 */ | |
45 | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
46 void layout_image_overlay_toggle(LayoutWindow *lw) |
9 | 47 { |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
48 if (image_osd_get(lw->image, NULL, NULL)) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
49 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
50 image_osd_set(lw->image, FALSE, FALSE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
51 } |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
52 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
53 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
54 image_osd_set(lw->image, (lw->full_screen != NULL), TRUE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
55 image_osd_icon(lw->image, IMAGE_OSD_ICON, -1); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
56 } |
9 | 57 } |
58 | |
59 void layout_image_overlay_update(LayoutWindow *lw) | |
60 { | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
61 if (!lw) return; |
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
62 |
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
63 image_osd_update(lw->image); |
9 | 64 } |
65 | |
66 /* | |
67 *---------------------------------------------------------------------------- | |
68 * full screen | |
69 *---------------------------------------------------------------------------- | |
70 */ | |
71 | |
72 static void layout_image_fullscreen_menu_pos_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) | |
73 { | |
74 LayoutWindow *lw = data; | |
75 | |
76 if (!lw->full_screen) return; | |
77 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
78 gdk_window_get_origin(lw->full_screen->imd->pr->window, x, y); |
9 | 79 popup_menu_position_clamp(menu, x, y, 0); |
80 } | |
81 | |
82 static void layout_image_full_screen_menu_popup(LayoutWindow *lw) | |
83 { | |
84 GtkWidget *menu; | |
85 | |
86 menu = layout_image_pop_menu(lw); | |
87 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, layout_image_fullscreen_menu_pos_cb, lw, 0, GDK_CURRENT_TIME); | |
88 } | |
89 | |
160 | 90 #if 0 |
91 /* this is handled by layout_key_press_cb */ | |
92 | |
93 | |
9 | 94 static gint layout_image_full_screen_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
95 { | |
96 LayoutWindow *lw = data; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
97 gint stop_signal; |
9 | 98 gint x = 0; |
99 gint y = 0; | |
100 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
101 stop_signal = TRUE; |
9 | 102 switch (event->keyval) |
103 { | |
104 case GDK_Left: case GDK_KP_Left: | |
105 x -= 1; | |
106 break; | |
107 case GDK_Right: case GDK_KP_Right: | |
108 x += 1; | |
109 break; | |
110 case GDK_Up: case GDK_KP_Up: | |
111 y -= 1; | |
112 break; | |
113 case GDK_Down: case GDK_KP_Down: | |
114 y += 1; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
115 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
116 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
117 stop_signal = FALSE; |
9 | 118 break; |
119 } | |
120 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
121 if (x != 0 || y!= 0) |
9 | 122 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
123 if (event->state & GDK_SHIFT_MASK) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
124 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
125 x *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
126 y *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
127 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
128 |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
129 keyboard_scroll_calc(&x, &y, event); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
130 layout_image_scroll(lw, x, y); |
9 | 131 } |
132 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
133 if (stop_signal) return stop_signal; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
134 |
9 | 135 if (event->state & GDK_CONTROL_MASK) |
136 { | |
137 gint n = -1; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
138 |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
139 stop_signal = TRUE; |
9 | 140 switch (event->keyval) |
141 { | |
142 case '1': | |
143 n = 0; | |
144 break; | |
145 case '2': | |
146 n = 1; | |
147 break; | |
148 case '3': | |
149 n = 2; | |
150 break; | |
151 case '4': | |
152 n = 3; | |
153 break; | |
154 case '5': | |
155 n = 4; | |
156 break; | |
157 case '6': | |
158 n = 5; | |
159 break; | |
160 case '7': | |
161 n = 6; | |
162 break; | |
163 case '8': | |
164 n = 7; | |
165 break; | |
166 case '9': | |
167 n = 8; | |
168 break; | |
169 case '0': | |
170 n = 9; | |
171 break; | |
172 case 'C': case 'c': | |
138 | 173 file_util_copy(layout_image_get_fd(lw), NULL, NULL, widget); |
9 | 174 break; |
175 case 'M': case 'm': | |
138 | 176 file_util_move(layout_image_get_fd(lw), NULL, NULL, widget); |
9 | 177 break; |
178 case 'R': case 'r': | |
138 | 179 file_util_rename(layout_image_get_fd(lw), NULL, widget); |
9 | 180 break; |
181 case 'D': case 'd': | |
138 | 182 file_util_delete(layout_image_get_fd(lw), NULL, widget); |
9 | 183 break; |
184 case 'P': case 'p': | |
138 | 185 info_window_new(layout_image_get_fd(lw), NULL); |
9 | 186 break; |
187 case 'Q': case 'q': | |
188 exit_gqview(); | |
189 return FALSE; | |
190 break; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
191 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
192 stop_signal = FALSE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
193 break; |
9 | 194 } |
195 if (n != -1) | |
196 { | |
60
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
197 if (!editor_window_flag_set(n)) |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
198 { |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
199 layout_image_full_screen_stop(lw); |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
200 } |
138 | 201 start_editor_from_file(n, layout_image_get_fd(lw)); |
9 | 202 } |
203 } | |
204 else if (event->state & GDK_SHIFT_MASK) | |
205 { | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
206 stop_signal = TRUE; |
9 | 207 switch (event->keyval) |
208 { | |
209 case 'R': case 'r': | |
210 layout_image_alter(lw, ALTER_ROTATE_180); | |
211 break; | |
212 case 'M': case 'm': | |
213 layout_image_alter(lw, ALTER_MIRROR); | |
214 break; | |
215 case 'F': case 'f': | |
216 layout_image_alter(lw, ALTER_FLIP); | |
217 break; | |
82
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
218 case 'G': case 'g': |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
219 layout_image_alter(lw, ALTER_DESATURATE); |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
220 break; |
9 | 221 default: |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
222 stop_signal = FALSE; |
9 | 223 break; |
224 } | |
225 } | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
226 else |
9 | 227 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
228 stop_signal = TRUE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
229 switch (event->keyval) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
230 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
231 case '+': case '=': case GDK_KP_Add: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
232 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
|
233 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
234 case '-': case GDK_KP_Subtract: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
235 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
|
236 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
237 case 'X': case 'x': case GDK_KP_Multiply: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
238 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
|
239 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
240 case 'Z': case 'z': case GDK_KP_Divide: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
241 case '1': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
242 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
|
243 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
244 case '2': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
245 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
|
246 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
247 case '3': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
248 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
|
249 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
250 case '4': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
251 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
|
252 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
253 case '7': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
254 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
|
255 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
256 case '8': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
257 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
|
258 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
259 case '9': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
260 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
|
261 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
262 case 'W': case 'w': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
263 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
|
264 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
265 case 'H': case 'h': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
266 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
|
267 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
268 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
|
269 case GDK_BackSpace: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
270 case 'B': case 'b': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
271 layout_image_prev(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
272 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
273 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
|
274 case GDK_space: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
275 case 'N': case 'n': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
276 layout_image_next(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
277 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
278 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
|
279 layout_image_first(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
280 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
281 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
|
282 layout_image_last(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
283 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
284 case ']': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
285 layout_image_alter(lw, ALTER_ROTATE_90); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
286 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
287 case '[': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
288 layout_image_alter(lw, ALTER_ROTATE_90_CC); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
289 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
290 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
|
291 if (enable_delete_key) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
292 { |
138 | 293 file_util_delete(layout_image_get_fd(lw), NULL, widget); |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
294 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
295 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
296 case GDK_Escape: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
297 layout_image_full_screen_stop(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
298 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
299 case 'R': case 'r': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
300 layout_refresh(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
301 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
302 case 'S': case 's': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
303 layout_image_slideshow_toggle(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
304 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
305 case 'P': case 'p': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
306 layout_image_slideshow_pause_toggle(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
307 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
308 case 'F': case 'f': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
309 case 'V': case 'v': |
86
cade6a52a165
Mon Oct 23 05:34:29 2006 John Ellis <johne@verizon.net>
gqview
parents:
84
diff
changeset
|
310 case GDK_F11: |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
311 layout_image_full_screen_stop(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
312 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
313 case GDK_Menu: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
314 case GDK_F10: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
315 layout_image_full_screen_menu_popup(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
316 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
317 case 'I': case 'i': |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
318 layout_image_overlay_toggle(lw); |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
319 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
320 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
321 stop_signal = FALSE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
322 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
323 } |
9 | 324 } |
325 | |
326 return stop_signal; | |
327 } | |
328 | |
160 | 329 #endif |
330 | |
9 | 331 static void layout_image_full_screen_stop_func(FullScreenData *fs, gpointer data) |
332 { | |
333 LayoutWindow *lw = data; | |
334 | |
335 /* restore image window */ | |
336 lw->image = fs->normal_imd; | |
337 | |
338 if (lw->slideshow) | |
339 { | |
340 lw->slideshow->imd = lw->image; | |
341 } | |
342 | |
343 lw->full_screen = NULL; | |
344 } | |
345 | |
346 void layout_image_full_screen_start(LayoutWindow *lw) | |
347 { | |
348 if (!layout_valid(&lw)) return; | |
349 | |
350 if (lw->full_screen) return; | |
351 | |
352 lw->full_screen = fullscreen_start(lw->window, lw->image, | |
353 layout_image_full_screen_stop_func, lw); | |
354 | |
355 /* set to new image window */ | |
356 lw->image = lw->full_screen->imd; | |
357 | |
358 if (lw->slideshow) | |
359 { | |
360 lw->slideshow->imd = lw->image; | |
361 } | |
362 | |
363 layout_image_set_buttons(lw); | |
364 | |
365 g_signal_connect(G_OBJECT(lw->full_screen->window), "key_press_event", | |
160 | 366 G_CALLBACK(layout_key_press_cb), lw); |
9 | 367 |
160 | 368 layout_actions_add_window(lw, lw->full_screen->window); |
9 | 369 #if 0 |
370 gtk_widget_set_sensitive(lw->window, FALSE); | |
371 if (lw->tools) gtk_widget_set_sensitive(lw->tools, FALSE); | |
372 #endif | |
373 | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
374 if (image_osd_get(lw->full_screen->normal_imd, NULL, NULL)) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
375 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
376 image_osd_set(lw->image, TRUE, TRUE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
377 image_osd_set(lw->full_screen->normal_imd, FALSE, FALSE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
378 } |
9 | 379 } |
380 | |
381 void layout_image_full_screen_stop(LayoutWindow *lw) | |
382 { | |
383 if (!layout_valid(&lw)) return; | |
384 if (!lw->full_screen) return; | |
385 | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
386 if (image_osd_get(lw->image, NULL, NULL)) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
387 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
388 image_osd_set(lw->full_screen->normal_imd, FALSE, TRUE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
389 } |
9 | 390 fullscreen_stop(lw->full_screen); |
391 | |
392 #if 0 | |
393 gtk_widget_set_sensitive(lw->window, TRUE); | |
394 if (lw->tools) gtk_widget_set_sensitive(lw->tools, TRUE); | |
395 #endif | |
396 } | |
397 | |
398 void layout_image_full_screen_toggle(LayoutWindow *lw) | |
399 { | |
400 if (!layout_valid(&lw)) return; | |
401 if (lw->full_screen) | |
402 { | |
403 layout_image_full_screen_stop(lw); | |
404 } | |
405 else | |
406 { | |
407 layout_image_full_screen_start(lw); | |
408 } | |
409 } | |
410 | |
411 gint layout_image_full_screen_active(LayoutWindow *lw) | |
412 { | |
413 if (!layout_valid(&lw)) return FALSE; | |
414 | |
415 return (lw->full_screen != NULL); | |
416 } | |
417 | |
418 /* | |
419 *---------------------------------------------------------------------------- | |
420 * slideshow | |
421 *---------------------------------------------------------------------------- | |
422 */ | |
423 | |
424 static void layout_image_slideshow_next(LayoutWindow *lw) | |
425 { | |
426 if (lw->slideshow) slideshow_next(lw->slideshow); | |
427 } | |
428 | |
429 static void layout_image_slideshow_prev(LayoutWindow *lw) | |
430 { | |
431 if (lw->slideshow) slideshow_prev(lw->slideshow); | |
432 } | |
433 | |
434 static void layout_image_slideshow_stop_func(SlideShowData *ss, gpointer data) | |
435 { | |
436 LayoutWindow *lw = data; | |
437 | |
438 lw->slideshow = NULL; | |
439 layout_status_update_info(lw, NULL); | |
440 } | |
441 | |
442 void layout_image_slideshow_start(LayoutWindow *lw) | |
443 { | |
444 CollectionData *cd; | |
445 CollectInfo *info; | |
446 | |
447 if (!layout_valid(&lw)) return; | |
448 if (lw->slideshow) return; | |
449 | |
450 cd = image_get_collection(lw->image, &info); | |
451 | |
452 if (cd && info) | |
453 { | |
454 lw->slideshow = slideshow_start_from_collection(lw->image, cd, | |
455 layout_image_slideshow_stop_func, lw, info); | |
456 } | |
457 else | |
458 { | |
459 lw->slideshow = slideshow_start(lw->image, lw, | |
460 layout_list_get_index(lw, layout_image_get_path(lw)), | |
461 layout_image_slideshow_stop_func, lw); | |
462 } | |
463 | |
464 layout_status_update_info(lw, NULL); | |
465 } | |
466 | |
467 /* note that slideshow will take ownership of the list, do not free it */ | |
468 void layout_image_slideshow_start_from_list(LayoutWindow *lw, GList *list) | |
469 { | |
470 if (!layout_valid(&lw)) return; | |
471 | |
472 if (lw->slideshow || !list) | |
473 { | |
138 | 474 filelist_free(list); |
9 | 475 return; |
476 } | |
477 | |
138 | 478 lw->slideshow = slideshow_start_from_filelist(lw->image, list, |
9 | 479 layout_image_slideshow_stop_func, lw); |
480 | |
481 layout_status_update_info(lw, NULL); | |
482 } | |
483 | |
484 void layout_image_slideshow_stop(LayoutWindow *lw) | |
485 { | |
486 if (!layout_valid(&lw)) return; | |
487 | |
488 if (!lw->slideshow) return; | |
489 | |
490 slideshow_free(lw->slideshow); | |
491 /* the stop_func sets lw->slideshow to NULL for us */ | |
492 } | |
493 | |
494 void layout_image_slideshow_toggle(LayoutWindow *lw) | |
495 { | |
496 if (!layout_valid(&lw)) return; | |
497 | |
498 if (lw->slideshow) | |
499 { | |
500 layout_image_slideshow_stop(lw); | |
501 } | |
502 else | |
503 { | |
504 layout_image_slideshow_start(lw); | |
505 } | |
506 } | |
507 | |
508 gint layout_image_slideshow_active(LayoutWindow *lw) | |
509 { | |
510 if (!layout_valid(&lw)) return FALSE; | |
511 | |
512 return (lw->slideshow != NULL); | |
513 } | |
514 | |
515 gint layout_image_slideshow_pause_toggle(LayoutWindow *lw) | |
516 { | |
517 gint ret; | |
518 | |
519 if (!layout_valid(&lw)) return FALSE; | |
520 | |
521 ret = slideshow_pause_toggle(lw->slideshow); | |
522 | |
523 layout_status_update_info(lw, NULL); | |
524 | |
525 return ret; | |
526 } | |
527 | |
528 gint layout_image_slideshow_paused(LayoutWindow *lw) | |
529 { | |
530 if (!layout_valid(&lw)) return FALSE; | |
531 | |
532 return (slideshow_paused(lw->slideshow)); | |
533 } | |
534 | |
535 static gint layout_image_slideshow_continue_check(LayoutWindow *lw) | |
536 { | |
537 if (!lw->slideshow) return FALSE; | |
538 | |
539 if (!slideshow_should_continue(lw->slideshow)) | |
540 { | |
541 layout_image_slideshow_stop(lw); | |
542 return FALSE; | |
543 } | |
544 | |
545 return TRUE; | |
546 } | |
547 | |
548 /* | |
549 *---------------------------------------------------------------------------- | |
550 * pop-up menus | |
551 *---------------------------------------------------------------------------- | |
552 */ | |
553 | |
554 static void li_pop_menu_zoom_in_cb(GtkWidget *widget, gpointer data) | |
555 { | |
556 LayoutWindow *lw = data; | |
557 | |
130 | 558 layout_image_zoom_adjust(lw, get_zoom_increment()); |
9 | 559 } |
560 | |
561 static void li_pop_menu_zoom_out_cb(GtkWidget *widget, gpointer data) | |
562 { | |
563 LayoutWindow *lw = data; | |
130 | 564 layout_image_zoom_adjust(lw, -get_zoom_increment()); |
9 | 565 } |
566 | |
567 static void li_pop_menu_zoom_1_1_cb(GtkWidget *widget, gpointer data) | |
568 { | |
569 LayoutWindow *lw = data; | |
570 | |
130 | 571 layout_image_zoom_set(lw, 1.0); |
9 | 572 } |
573 | |
574 static void li_pop_menu_zoom_fit_cb(GtkWidget *widget, gpointer data) | |
575 { | |
576 LayoutWindow *lw = data; | |
577 | |
130 | 578 layout_image_zoom_set(lw, 0.0); |
9 | 579 } |
580 | |
581 static void li_pop_menu_edit_cb(GtkWidget *widget, gpointer data) | |
582 { | |
583 LayoutWindow *lw; | |
584 gint n; | |
585 | |
586 lw = submenu_item_get_data(widget); | |
587 n = GPOINTER_TO_INT(data); | |
588 | |
60
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
589 if (!editor_window_flag_set(n)) |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
590 { |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
591 layout_image_full_screen_stop(lw); |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
592 } |
138 | 593 start_editor_from_file(n, layout_image_get_fd(lw)); |
9 | 594 } |
595 | |
596 static void li_pop_menu_wallpaper_cb(GtkWidget *widget, gpointer data) | |
597 { | |
598 LayoutWindow *lw = data; | |
599 | |
600 layout_image_to_root(lw); | |
601 } | |
602 | |
603 static void li_pop_menu_alter_cb(GtkWidget *widget, gpointer data) | |
604 { | |
605 LayoutWindow *lw = data; | |
606 AlterType type; | |
607 | |
608 lw = submenu_item_get_data(widget); | |
609 type = (AlterType)GPOINTER_TO_INT(data); | |
610 | |
611 image_alter(lw->image, type); | |
612 } | |
613 | |
614 static void li_pop_menu_info_cb(GtkWidget *widget, gpointer data) | |
615 { | |
616 LayoutWindow *lw = data; | |
617 | |
138 | 618 info_window_new(layout_image_get_fd(lw), NULL); |
9 | 619 } |
620 | |
621 static void li_pop_menu_new_cb(GtkWidget *widget, gpointer data) | |
622 { | |
623 LayoutWindow *lw = data; | |
624 | |
138 | 625 view_window_new(layout_image_get_fd(lw)); |
9 | 626 } |
627 | |
628 static GtkWidget *li_pop_menu_click_parent(GtkWidget *widget, LayoutWindow *lw) | |
629 { | |
630 GtkWidget *menu; | |
631 GtkWidget *parent; | |
632 | |
633 menu = gtk_widget_get_toplevel(widget); | |
634 if (!menu) return NULL; | |
635 | |
636 parent = g_object_get_data(G_OBJECT(menu), "click_parent"); | |
637 | |
638 if (!parent && lw->full_screen) | |
639 { | |
640 parent = lw->full_screen->imd->widget; | |
641 } | |
642 | |
643 return parent; | |
644 } | |
645 | |
646 static void li_pop_menu_copy_cb(GtkWidget *widget, gpointer data) | |
647 { | |
648 LayoutWindow *lw = data; | |
649 | |
138 | 650 file_util_copy(layout_image_get_fd(lw), NULL, NULL, |
9 | 651 li_pop_menu_click_parent(widget, lw)); |
652 } | |
653 | |
654 static void li_pop_menu_move_cb(GtkWidget *widget, gpointer data) | |
655 { | |
656 LayoutWindow *lw = data; | |
657 | |
138 | 658 file_util_move(layout_image_get_fd(lw), NULL, NULL, |
9 | 659 li_pop_menu_click_parent(widget, lw)); |
660 } | |
661 | |
662 static void li_pop_menu_rename_cb(GtkWidget *widget, gpointer data) | |
663 { | |
664 LayoutWindow *lw = data; | |
665 | |
138 | 666 file_util_rename(layout_image_get_fd(lw), NULL, |
9 | 667 li_pop_menu_click_parent(widget, lw)); |
668 } | |
669 | |
670 static void li_pop_menu_delete_cb(GtkWidget *widget, gpointer data) | |
671 { | |
672 LayoutWindow *lw = data; | |
673 | |
138 | 674 file_util_delete(layout_image_get_fd(lw), NULL, |
9 | 675 li_pop_menu_click_parent(widget, lw)); |
676 } | |
677 | |
678 static void li_pop_menu_slide_start_cb(GtkWidget *widget, gpointer data) | |
679 { | |
680 LayoutWindow *lw = data; | |
681 | |
682 layout_image_slideshow_start(lw); | |
683 } | |
684 | |
685 static void li_pop_menu_slide_stop_cb(GtkWidget *widget, gpointer data) | |
686 { | |
687 LayoutWindow *lw = data; | |
688 | |
689 layout_image_slideshow_stop(lw); | |
690 } | |
691 | |
692 static void li_pop_menu_slide_pause_cb(GtkWidget *widget, gpointer data) | |
693 { | |
694 LayoutWindow *lw = data; | |
695 | |
696 layout_image_slideshow_pause_toggle(lw); | |
697 } | |
698 | |
699 static void li_pop_menu_full_screen_cb(GtkWidget *widget, gpointer data) | |
700 { | |
701 LayoutWindow *lw = data; | |
702 | |
703 layout_image_full_screen_toggle(lw); | |
704 } | |
705 | |
706 static void li_pop_menu_hide_cb(GtkWidget *widget, gpointer data) | |
707 { | |
708 LayoutWindow *lw = data; | |
709 | |
710 layout_tools_hide_toggle(lw); | |
711 } | |
712 | |
713 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw) | |
714 { | |
715 GtkWidget *menu; | |
716 GtkWidget *item; | |
717 GtkWidget *submenu; | |
718 const gchar *path; | |
719 gint fullscreen; | |
720 | |
721 path = layout_image_get_path(lw); | |
722 fullscreen = layout_image_full_screen_active(lw); | |
723 | |
724 menu = popup_menu_short_lived(); | |
725 | |
726 menu_item_add_stock(menu, _("Zoom _in"), GTK_STOCK_ZOOM_IN, G_CALLBACK(li_pop_menu_zoom_in_cb), lw); | |
727 menu_item_add_stock(menu, _("Zoom _out"), GTK_STOCK_ZOOM_OUT, G_CALLBACK(li_pop_menu_zoom_out_cb), lw); | |
728 menu_item_add_stock(menu, _("Zoom _1:1"), GTK_STOCK_ZOOM_100, G_CALLBACK(li_pop_menu_zoom_1_1_cb), lw); | |
729 menu_item_add_stock(menu, _("Fit image to _window"), GTK_STOCK_ZOOM_FIT, G_CALLBACK(li_pop_menu_zoom_fit_cb), lw); | |
730 menu_item_add_divider(menu); | |
731 | |
732 submenu = submenu_add_edit(menu, &item, G_CALLBACK(li_pop_menu_edit_cb), lw); | |
733 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
734 menu_item_add_divider(submenu); | |
735 menu_item_add(submenu, _("Set as _wallpaper"), G_CALLBACK(li_pop_menu_wallpaper_cb), lw); | |
736 | |
737 item = submenu_add_alter(menu, G_CALLBACK(li_pop_menu_alter_cb), lw); | |
738 | |
739 item = menu_item_add_stock(menu, _("_Properties"), GTK_STOCK_PROPERTIES, G_CALLBACK(li_pop_menu_info_cb), lw); | |
740 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
741 | |
742 item = menu_item_add_stock(menu, _("View in _new window"), GTK_STOCK_NEW, G_CALLBACK(li_pop_menu_new_cb), lw); | |
743 if (!path || fullscreen) gtk_widget_set_sensitive(item, FALSE); | |
744 | |
745 menu_item_add_divider(menu); | |
746 | |
747 item = menu_item_add_stock(menu, _("_Copy..."), GTK_STOCK_COPY, G_CALLBACK(li_pop_menu_copy_cb), lw); | |
748 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
749 item = menu_item_add(menu, _("_Move..."), G_CALLBACK(li_pop_menu_move_cb), lw); | |
750 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
751 item = menu_item_add(menu, _("_Rename..."), G_CALLBACK(li_pop_menu_rename_cb), lw); | |
752 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
753 item = menu_item_add_stock(menu, _("_Delete..."), GTK_STOCK_DELETE, G_CALLBACK(li_pop_menu_delete_cb), lw); | |
754 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
755 | |
756 menu_item_add_divider(menu); | |
757 | |
758 if (layout_image_slideshow_active(lw)) | |
759 { | |
760 menu_item_add(menu, _("_Stop slideshow"), G_CALLBACK(li_pop_menu_slide_stop_cb), lw); | |
761 if (layout_image_slideshow_paused(lw)) | |
762 { | |
763 item = menu_item_add(menu, _("Continue slides_how"), | |
764 G_CALLBACK(li_pop_menu_slide_pause_cb), lw); | |
765 } | |
766 else | |
767 { | |
768 item = menu_item_add(menu, _("Pause slides_how"), | |
769 G_CALLBACK(li_pop_menu_slide_pause_cb), lw); | |
770 } | |
771 } | |
772 else | |
773 { | |
774 menu_item_add(menu, _("_Start slideshow"), G_CALLBACK(li_pop_menu_slide_start_cb), lw); | |
775 item = menu_item_add(menu, _("Pause slides_how"), G_CALLBACK(li_pop_menu_slide_pause_cb), lw); | |
776 gtk_widget_set_sensitive(item, FALSE); | |
777 } | |
778 | |
779 if (!fullscreen) | |
780 { | |
781 menu_item_add(menu, _("_Full screen"), G_CALLBACK(li_pop_menu_full_screen_cb), lw); | |
782 } | |
783 else | |
784 { | |
785 menu_item_add(menu, _("Exit _full screen"), G_CALLBACK(li_pop_menu_full_screen_cb), lw); | |
786 } | |
787 | |
788 menu_item_add_divider(menu); | |
789 | |
790 item = menu_item_add_check(menu, _("Hide file _list"), lw->tools_hidden, | |
791 G_CALLBACK(li_pop_menu_hide_cb), lw); | |
792 if (fullscreen) gtk_widget_set_sensitive(item, FALSE); | |
793 | |
794 return menu; | |
795 } | |
796 | |
797 static void layout_image_menu_pos_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) | |
798 { | |
799 LayoutWindow *lw = data; | |
800 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
801 gdk_window_get_origin(lw->image->pr->window, x, y); |
9 | 802 popup_menu_position_clamp(menu, x, y, 0); |
803 } | |
804 | |
805 void layout_image_menu_popup(LayoutWindow *lw) | |
806 { | |
807 GtkWidget *menu; | |
808 | |
809 menu = layout_image_pop_menu(lw); | |
810 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, layout_image_menu_pos_cb, lw, 0, GDK_CURRENT_TIME); | |
811 } | |
812 | |
813 /* | |
814 *---------------------------------------------------------------------------- | |
815 * dnd | |
816 *---------------------------------------------------------------------------- | |
817 */ | |
818 | |
819 static void layout_image_dnd_receive(GtkWidget *widget, GdkDragContext *context, | |
820 gint x, gint y, | |
821 GtkSelectionData *selection_data, guint info, | |
822 guint time, gpointer data) | |
823 { | |
824 LayoutWindow *lw = data; | |
127 | 825 gint i; |
826 | |
827 | |
828 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
829 { | |
830 if (lw->split_images[i] && lw->split_images[i]->pr == widget) | |
831 break; | |
832 } | |
833 if (i < MAX_SPLIT_IMAGES) | |
834 { | |
835 printf("dnd image activate %d\n", i); | |
836 layout_image_activate(lw, i); | |
837 } | |
838 | |
9 | 839 |
840 if (info == TARGET_URI_LIST || info == TARGET_APP_COLLECTION_MEMBER) | |
841 { | |
842 CollectionData *source; | |
843 GList *list; | |
844 GList *info_list; | |
845 | |
846 if (info == TARGET_URI_LIST) | |
847 { | |
138 | 848 list = uri_filelist_from_text((gchar *)selection_data->data, TRUE); |
9 | 849 source = NULL; |
850 info_list = NULL; | |
851 } | |
852 else | |
853 { | |
854 source = collection_from_dnd_data((gchar *)selection_data->data, &list, &info_list); | |
855 } | |
856 | |
857 if (list) | |
858 { | |
138 | 859 FileData *fd = list->data; |
9 | 860 |
138 | 861 if (isfile(fd->path)) |
9 | 862 { |
863 gchar *base; | |
864 gint row; | |
865 | |
138 | 866 base = remove_level_from_path(fd->path); |
9 | 867 if (strcmp(base, layout_get_path(lw)) != 0) |
868 { | |
869 layout_set_path(lw, base); | |
870 } | |
871 g_free(base); | |
872 | |
138 | 873 row = layout_list_get_index(lw, fd->path); |
9 | 874 if (source && info_list) |
875 { | |
876 layout_image_set_collection(lw, source, info_list->data); | |
877 } | |
878 else if (row == -1) | |
879 { | |
138 | 880 layout_image_set_fd(lw, fd); |
9 | 881 } |
882 else | |
883 { | |
884 layout_image_set_index(lw, row); | |
885 } | |
886 } | |
138 | 887 else if (isdir(fd->path)) |
9 | 888 { |
138 | 889 layout_set_path(lw, fd->path); |
890 layout_image_set_fd(lw, NULL); | |
9 | 891 } |
892 } | |
893 | |
138 | 894 filelist_free(list); |
9 | 895 g_list_free(info_list); |
896 } | |
897 } | |
898 | |
899 static void layout_image_dnd_get(GtkWidget *widget, GdkDragContext *context, | |
900 GtkSelectionData *selection_data, guint info, | |
901 guint time, gpointer data) | |
902 { | |
903 LayoutWindow *lw = data; | |
138 | 904 FileData *fd; |
127 | 905 gint i; |
906 | |
907 | |
908 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
909 { | |
910 if (lw->split_images[i] && lw->split_images[i]->pr == widget) | |
911 break; | |
912 } | |
913 if (i < MAX_SPLIT_IMAGES) | |
914 { | |
915 printf("dnd get from %d\n", i); | |
138 | 916 fd = image_get_fd(lw->split_images[i]); |
127 | 917 } |
918 else | |
138 | 919 fd = layout_image_get_fd(lw); |
9 | 920 |
138 | 921 if (fd) |
9 | 922 { |
923 gchar *text = NULL; | |
924 gint len; | |
925 gint plain_text; | |
926 GList *list; | |
927 | |
928 switch (info) | |
929 { | |
930 case TARGET_URI_LIST: | |
931 plain_text = FALSE; | |
932 break; | |
933 case TARGET_TEXT_PLAIN: | |
934 default: | |
935 plain_text = TRUE; | |
936 break; | |
937 } | |
138 | 938 list = g_list_append(NULL, fd); |
939 text = uri_text_from_filelist(list, &len, plain_text); | |
9 | 940 g_list_free(list); |
941 if (text) | |
942 { | |
943 gtk_selection_data_set (selection_data, selection_data->target, | |
64
04ff0df3ad2f
Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
60
diff
changeset
|
944 8, (guchar *)text, len); |
9 | 945 g_free(text); |
946 } | |
947 } | |
948 else | |
949 { | |
950 gtk_selection_data_set (selection_data, selection_data->target, | |
951 8, NULL, 0); | |
952 } | |
953 } | |
954 | |
955 static void layout_image_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data) | |
956 { | |
957 LayoutWindow *lw = data; | |
958 if (context->action == GDK_ACTION_MOVE) | |
959 { | |
960 const gchar *path; | |
961 gint row; | |
962 | |
963 path = layout_image_get_path(lw); | |
964 row = layout_list_get_index(lw, path); | |
965 if (row < 0) return; | |
966 | |
967 if (!isfile(path)) | |
968 { | |
969 if (row < layout_list_count(lw, NULL) - 1) | |
970 { | |
971 layout_image_next(lw); | |
972 } | |
973 else | |
974 { | |
975 layout_image_prev(lw); | |
976 } | |
977 } | |
978 layout_refresh(lw); | |
979 } | |
980 } | |
981 | |
127 | 982 static void layout_image_dnd_init(LayoutWindow *lw, gint i) |
9 | 983 { |
127 | 984 ImageWindow *imd = lw->split_images[i]; |
985 | |
986 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK, | |
9 | 987 dnd_file_drag_types, dnd_file_drag_types_count, |
988 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); | |
127 | 989 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get", |
9 | 990 G_CALLBACK(layout_image_dnd_get), lw); |
127 | 991 g_signal_connect(G_OBJECT(imd->pr), "drag_end", |
9 | 992 G_CALLBACK(layout_image_dnd_end), lw); |
993 | |
127 | 994 gtk_drag_dest_set(imd->pr, |
9 | 995 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, |
996 dnd_file_drop_types, dnd_file_drop_types_count, | |
997 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); | |
127 | 998 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received", |
9 | 999 G_CALLBACK(layout_image_dnd_receive), lw); |
1000 } | |
1001 | |
1002 | |
1003 /* | |
1004 *---------------------------------------------------------------------------- | |
1005 * misc | |
1006 *---------------------------------------------------------------------------- | |
1007 */ | |
1008 | |
1009 void layout_image_to_root(LayoutWindow *lw) | |
1010 { | |
1011 image_to_root_window(lw->image, (image_zoom_get(lw->image) == 0)); | |
1012 } | |
1013 | |
1014 /* | |
1015 *---------------------------------------------------------------------------- | |
1016 * manipulation + accessors | |
1017 *---------------------------------------------------------------------------- | |
1018 */ | |
1019 | |
1020 void layout_image_scroll(LayoutWindow *lw, gint x, gint y) | |
1021 { | |
1022 if (!layout_valid(&lw)) return; | |
1023 | |
1024 image_scroll(lw->image, x, y); | |
1025 } | |
1026 | |
1027 void layout_image_zoom_adjust(LayoutWindow *lw, gdouble increment) | |
1028 { | |
130 | 1029 gint i; |
9 | 1030 if (!layout_valid(&lw)) return; |
1031 | |
1032 image_zoom_adjust(lw->image, increment); | |
130 | 1033 |
1034 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1035 { | |
1036 if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_zoom) | |
1037 image_zoom_adjust(lw->split_images[i], increment); ; | |
1038 } | |
9 | 1039 } |
1040 | |
1041 void layout_image_zoom_set(LayoutWindow *lw, gdouble zoom) | |
1042 { | |
130 | 1043 gint i; |
9 | 1044 if (!layout_valid(&lw)) return; |
1045 | |
1046 image_zoom_set(lw->image, zoom); | |
130 | 1047 |
1048 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1049 { | |
1050 if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_zoom) | |
1051 image_zoom_set(lw->split_images[i], zoom); | |
1052 } | |
9 | 1053 } |
1054 | |
1055 void layout_image_zoom_set_fill_geometry(LayoutWindow *lw, gint vertical) | |
1056 { | |
1057 if (!layout_valid(&lw)) return; | |
1058 | |
1059 image_zoom_set_fill_geometry(lw->image, vertical); | |
1060 } | |
1061 | |
1062 void layout_image_alter(LayoutWindow *lw, AlterType type) | |
1063 { | |
1064 if (!layout_valid(&lw)) return; | |
1065 | |
1066 image_alter(lw->image, type); | |
1067 } | |
1068 | |
1069 const gchar *layout_image_get_path(LayoutWindow *lw) | |
1070 { | |
1071 if (!layout_valid(&lw)) return NULL; | |
1072 | |
1073 return image_get_path(lw->image); | |
1074 } | |
1075 | |
1076 const gchar *layout_image_get_name(LayoutWindow *lw) | |
1077 { | |
1078 if (!layout_valid(&lw)) return NULL; | |
1079 | |
1080 return image_get_name(lw->image); | |
1081 } | |
1082 | |
138 | 1083 FileData *layout_image_get_fd(LayoutWindow *lw) |
1084 { | |
1085 if (!layout_valid(&lw)) return NULL; | |
1086 | |
1087 return image_get_fd(lw->image); | |
1088 } | |
1089 | |
9 | 1090 CollectionData *layout_image_get_collection(LayoutWindow *lw, CollectInfo **info) |
1091 { | |
1092 if (!layout_valid(&lw)) return NULL; | |
1093 | |
1094 return image_get_collection(lw->image, info); | |
1095 } | |
1096 | |
1097 gint layout_image_get_index(LayoutWindow *lw) | |
1098 { | |
1099 return layout_list_get_index(lw, image_get_path(lw->image)); | |
1100 } | |
1101 | |
1102 /* | |
1103 *---------------------------------------------------------------------------- | |
1104 * image changers | |
1105 *---------------------------------------------------------------------------- | |
1106 */ | |
1107 | |
138 | 1108 void layout_image_set_fd(LayoutWindow *lw, FileData *fd) |
9 | 1109 { |
131 | 1110 gdouble sx, sy; |
9 | 1111 if (!layout_valid(&lw)) return; |
1112 | |
129 | 1113 image_get_scroll_center(lw->image, &sx, &sy); |
1114 | |
138 | 1115 image_change_fd(lw->image, fd, image_zoom_get_default(lw->image, zoom_mode)); |
9 | 1116 |
129 | 1117 image_set_scroll_center(lw->image, sx, sy); |
1118 | |
138 | 1119 layout_list_sync_fd(lw, fd); |
9 | 1120 layout_image_slideshow_continue_check(lw); |
1121 layout_bars_new_image(lw); | |
1122 } | |
1123 | |
138 | 1124 void layout_image_set_with_ahead(LayoutWindow *lw, FileData *fd, FileData *read_ahead_fd) |
9 | 1125 { |
1126 if (!layout_valid(&lw)) return; | |
1127 | |
144 | 1128 /* |
1129 This should be handled at the caller: in vflist_select_image | |
1130 if (path) | |
9 | 1131 { |
1132 const gchar *old_path; | |
1133 | |
1134 old_path = layout_image_get_path(lw); | |
1135 if (old_path && strcmp(path, old_path) == 0) return; | |
1136 } | |
127 | 1137 */ |
138 | 1138 layout_image_set_fd(lw, fd); |
1139 if (enable_read_ahead) image_prebuffer_set(lw->image, read_ahead_fd); | |
9 | 1140 } |
1141 | |
1142 void layout_image_set_index(LayoutWindow *lw, gint index) | |
1143 { | |
138 | 1144 FileData *fd; |
1145 FileData *read_ahead_fd; | |
9 | 1146 gint old; |
1147 | |
1148 if (!layout_valid(&lw)) return; | |
1149 | |
1150 old = layout_list_get_index(lw, layout_image_get_path(lw)); | |
138 | 1151 fd = layout_list_get_fd(lw, index); |
9 | 1152 |
1153 if (old > index) | |
1154 { | |
138 | 1155 read_ahead_fd = layout_list_get_fd(lw, index - 1); |
9 | 1156 } |
1157 else | |
1158 { | |
138 | 1159 read_ahead_fd = layout_list_get_fd(lw, index + 1); |
9 | 1160 } |
1161 | |
138 | 1162 layout_image_set_with_ahead(lw, fd, read_ahead_fd); |
9 | 1163 } |
1164 | |
1165 static void layout_image_set_collection_real(LayoutWindow *lw, CollectionData *cd, CollectInfo *info, gint forward) | |
1166 { | |
1167 if (!layout_valid(&lw)) return; | |
1168 | |
1169 image_change_from_collection(lw->image, cd, info, image_zoom_get_default(lw->image, zoom_mode)); | |
1170 if (enable_read_ahead) | |
1171 { | |
1172 CollectInfo *r_info; | |
1173 if (forward) | |
1174 { | |
1175 r_info = collection_next_by_info(cd, info); | |
1176 if (!r_info) r_info = collection_prev_by_info(cd, info); | |
1177 } | |
1178 else | |
1179 { | |
1180 r_info = collection_prev_by_info(cd, info); | |
1181 if (!r_info) r_info = collection_next_by_info(cd, info); | |
1182 } | |
138 | 1183 if (r_info) image_prebuffer_set(lw->image, r_info->fd); |
9 | 1184 } |
1185 | |
1186 layout_image_slideshow_continue_check(lw); | |
1187 layout_bars_new_image(lw); | |
1188 } | |
1189 | |
1190 void layout_image_set_collection(LayoutWindow *lw, CollectionData *cd, CollectInfo *info) | |
1191 { | |
1192 layout_image_set_collection_real(lw, cd, info, TRUE); | |
138 | 1193 layout_list_sync_fd(lw, layout_image_get_fd(lw)); |
9 | 1194 } |
1195 | |
1196 void layout_image_refresh(LayoutWindow *lw) | |
1197 { | |
1198 if (!layout_valid(&lw)) return; | |
1199 | |
1200 image_reload(lw->image); | |
1201 } | |
1202 | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1203 void layout_image_color_profile_set(LayoutWindow *lw, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1204 gint input_type, gint screen_type, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1205 gint use_image) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1206 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1207 if (!layout_valid(&lw)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1208 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1209 image_color_profile_set(lw->image, input_type, screen_type, use_image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1210 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1211 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1212 gint layout_image_color_profile_get(LayoutWindow *lw, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1213 gint *input_type, gint *screen_type, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1214 gint *use_image) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1215 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1216 if (!layout_valid(&lw)) return FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1217 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1218 return image_color_profile_get(lw->image, input_type, screen_type, use_image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1219 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1220 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1221 void layout_image_color_profile_set_use(LayoutWindow *lw, gint enable) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1222 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1223 if (!layout_valid(&lw)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1224 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1225 image_color_profile_set_use(lw->image, enable); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1226 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1227 if (lw->info_color) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1228 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1229 #ifndef HAVE_LCMS |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1230 enable = FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1231 #endif |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1232 gtk_widget_set_sensitive(GTK_BIN(lw->info_color)->child, enable); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1233 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1234 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1235 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1236 gint layout_image_color_profile_get_use(LayoutWindow *lw) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1237 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1238 if (!layout_valid(&lw)) return FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1239 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1240 return image_color_profile_get_use(lw->image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1241 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1242 |
9 | 1243 /* |
1244 *---------------------------------------------------------------------------- | |
1245 * list walkers | |
1246 *---------------------------------------------------------------------------- | |
1247 */ | |
1248 | |
1249 void layout_image_next(LayoutWindow *lw) | |
1250 { | |
1251 gint current; | |
1252 CollectionData *cd; | |
1253 CollectInfo *info; | |
1254 | |
1255 if (!layout_valid(&lw)) return; | |
1256 | |
1257 if (layout_image_slideshow_active(lw)) | |
1258 { | |
1259 layout_image_slideshow_next(lw); | |
1260 return; | |
1261 } | |
1262 | |
1263 cd = image_get_collection(lw->image, &info); | |
1264 | |
1265 if (cd && info) | |
1266 { | |
1267 info = collection_next_by_info(cd, info); | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1268 if (info) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1269 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1270 layout_image_set_collection_real(lw, cd, info, TRUE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1271 } |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1272 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1273 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1274 image_osd_icon(lw->image, IMAGE_OSD_LAST, -1); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1275 } |
9 | 1276 return; |
1277 } | |
1278 | |
1279 current = layout_image_get_index(lw); | |
1280 | |
1281 if (current >= 0) | |
1282 { | |
1283 if (current < layout_list_count(lw, NULL) - 1) | |
1284 { | |
1285 layout_image_set_index(lw, current + 1); | |
1286 } | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1287 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1288 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1289 image_osd_icon(lw->image, IMAGE_OSD_LAST, -1); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1290 } |
9 | 1291 } |
1292 else | |
1293 { | |
1294 layout_image_set_index(lw, 0); | |
1295 } | |
1296 } | |
1297 | |
1298 void layout_image_prev(LayoutWindow *lw) | |
1299 { | |
1300 gint current; | |
1301 CollectionData *cd; | |
1302 CollectInfo *info; | |
1303 | |
1304 if (!layout_valid(&lw)) return; | |
1305 | |
1306 if (layout_image_slideshow_active(lw)) | |
1307 { | |
1308 layout_image_slideshow_prev(lw); | |
1309 return; | |
1310 } | |
1311 | |
1312 cd = image_get_collection(lw->image, &info); | |
1313 | |
1314 if (cd && info) | |
1315 { | |
1316 info = collection_prev_by_info(cd, info); | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1317 if (info) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1318 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1319 layout_image_set_collection_real(lw, cd, info, FALSE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1320 } |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1321 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1322 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1323 image_osd_icon(lw->image, IMAGE_OSD_FIRST, -1); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1324 } |
9 | 1325 return; |
1326 } | |
1327 | |
1328 current = layout_image_get_index(lw); | |
1329 | |
1330 if (current >= 0) | |
1331 { | |
1332 if (current > 0) | |
1333 { | |
1334 layout_image_set_index(lw, current - 1); | |
1335 } | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1336 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1337 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1338 image_osd_icon(lw->image, IMAGE_OSD_FIRST, -1); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1339 } |
9 | 1340 } |
1341 else | |
1342 { | |
1343 layout_image_set_index(lw, layout_list_count(lw, NULL) - 1); | |
1344 } | |
1345 } | |
1346 | |
1347 void layout_image_first(LayoutWindow *lw) | |
1348 { | |
1349 gint current; | |
1350 CollectionData *cd; | |
1351 CollectInfo *info; | |
1352 | |
1353 if (!layout_valid(&lw)) return; | |
1354 | |
1355 cd = image_get_collection(lw->image, &info); | |
1356 | |
1357 if (cd && info) | |
1358 { | |
1359 CollectInfo *new; | |
1360 new = collection_get_first(cd); | |
1361 if (new != info) layout_image_set_collection_real(lw, cd, new, TRUE); | |
1362 return; | |
1363 } | |
1364 | |
1365 current = layout_image_get_index(lw); | |
1366 if (current != 0 && layout_list_count(lw, NULL) > 0) | |
1367 { | |
1368 layout_image_set_index(lw, 0); | |
1369 } | |
1370 } | |
1371 | |
1372 void layout_image_last(LayoutWindow *lw) | |
1373 { | |
1374 gint current; | |
1375 gint count; | |
1376 CollectionData *cd; | |
1377 CollectInfo *info; | |
1378 | |
1379 if (!layout_valid(&lw)) return; | |
1380 | |
1381 cd = image_get_collection(lw->image, &info); | |
1382 | |
1383 if (cd && info) | |
1384 { | |
1385 CollectInfo *new; | |
1386 new = collection_get_last(cd); | |
1387 if (new != info) layout_image_set_collection_real(lw, cd, new, FALSE); | |
1388 return; | |
1389 } | |
1390 | |
1391 current = layout_image_get_index(lw); | |
1392 count = layout_list_count(lw, NULL); | |
1393 if (current != count - 1 && count > 0) | |
1394 { | |
1395 layout_image_set_index(lw, count - 1); | |
1396 } | |
1397 } | |
1398 | |
1399 /* | |
1400 *---------------------------------------------------------------------------- | |
1401 * mouse callbacks | |
1402 *---------------------------------------------------------------------------- | |
1403 */ | |
1404 | |
127 | 1405 static gint image_idx(LayoutWindow *lw, ImageWindow *imd) |
1406 { | |
1407 gint i; | |
1408 | |
1409 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1410 { | |
1411 if (lw->split_images[i] == imd) | |
1412 break; | |
1413 } | |
1414 if (i < MAX_SPLIT_IMAGES) | |
1415 { | |
1416 return i; | |
1417 } | |
1418 return -1; | |
1419 } | |
1420 | |
1421 | |
9 | 1422 static void layout_image_button_cb(ImageWindow *imd, gint button, guint32 time, |
1423 gdouble x, gdouble y, guint state, gpointer data) | |
1424 { | |
1425 LayoutWindow *lw = data; | |
1426 GtkWidget *menu; | |
1427 | |
1428 switch (button) | |
1429 { | |
1430 case 1: | |
1431 layout_image_next(lw); | |
1432 break; | |
1433 case 2: | |
1434 layout_image_prev(lw); | |
1435 break; | |
1436 case 3: | |
1437 menu = layout_image_pop_menu(lw); | |
1438 if (imd == lw->image) | |
1439 { | |
1440 g_object_set_data(G_OBJECT(menu), "click_parent", imd->widget); | |
1441 } | |
1442 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, time); | |
1443 break; | |
1444 default: | |
1445 break; | |
1446 } | |
1447 } | |
1448 | |
1449 static void layout_image_scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time, | |
1450 gdouble x, gdouble y, guint state, gpointer data) | |
1451 { | |
1452 LayoutWindow *lw = data; | |
1453 | |
127 | 1454 gint i = image_idx(lw, imd); |
1455 | |
1456 if (i != -1) | |
1457 { | |
1458 printf("image activate scroll %d\n", i); | |
1459 layout_image_activate(lw, i); | |
1460 } | |
1461 | |
1462 | |
9 | 1463 if (state & GDK_CONTROL_MASK) |
1464 { | |
1465 switch (direction) | |
1466 { | |
1467 case GDK_SCROLL_UP: | |
1468 image_zoom_adjust_at_point(imd, get_zoom_increment(), x, y); | |
1469 break; | |
1470 case GDK_SCROLL_DOWN: | |
1471 image_zoom_adjust_at_point(imd, -get_zoom_increment(), x, y); | |
1472 break; | |
1473 default: | |
1474 break; | |
1475 } | |
1476 } | |
1477 else if ( (state & GDK_SHIFT_MASK) != (mousewheel_scrolls)) | |
1478 { | |
1479 switch (direction) | |
1480 { | |
1481 case GDK_SCROLL_UP: | |
1482 image_scroll(imd, 0, -MOUSEWHEEL_SCROLL_SIZE); | |
1483 break; | |
1484 case GDK_SCROLL_DOWN: | |
1485 image_scroll(imd, 0, MOUSEWHEEL_SCROLL_SIZE); | |
1486 break; | |
1487 case GDK_SCROLL_LEFT: | |
1488 image_scroll(imd, -MOUSEWHEEL_SCROLL_SIZE, 0); | |
1489 break; | |
1490 case GDK_SCROLL_RIGHT: | |
1491 image_scroll(imd, MOUSEWHEEL_SCROLL_SIZE, 0); | |
1492 break; | |
1493 default: | |
1494 break; | |
1495 } | |
1496 } | |
1497 else | |
1498 { | |
1499 switch (direction) | |
1500 { | |
1501 case GDK_SCROLL_UP: | |
1502 layout_image_prev(lw); | |
1503 break; | |
1504 case GDK_SCROLL_DOWN: | |
1505 layout_image_next(lw); | |
1506 break; | |
1507 default: | |
1508 break; | |
1509 } | |
1510 } | |
1511 } | |
1512 | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1513 static void layout_image_drag_cb(ImageWindow *imd, gint button, guint32 time, |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1514 gdouble x, gdouble y, guint state, gdouble dx, gdouble dy, gpointer data) |
127 | 1515 { |
1516 gint i; | |
1517 LayoutWindow *lw = data; | |
1518 | |
1519 | |
1520 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1521 { | |
1522 if (lw->split_images[i] && lw->split_images[i] != imd) | |
129 | 1523 if (lw->connect_scroll) |
1524 { | |
131 | 1525 gdouble sx, sy; |
1526 if (state & GDK_CONTROL_MASK) | |
129 | 1527 { |
1528 image_get_scroll_center(imd, &sx, &sy); | |
1529 } | |
1530 else | |
1531 { | |
1532 image_get_scroll_center(lw->split_images[i], &sx, &sy); | |
1533 sx += dx; | |
1534 sy += dy; | |
1535 } | |
1536 image_set_scroll_center(lw->split_images[i], sx, sy); | |
1537 } | |
127 | 1538 } |
1539 } | |
1540 | |
1541 static void layout_image_button_inactive_cb(ImageWindow *imd, gint button, guint32 time, | |
1542 gdouble x, gdouble y, guint state, gpointer data) | |
1543 { | |
1544 LayoutWindow *lw = data; | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1545 GtkWidget *menu; |
127 | 1546 gint i = image_idx(lw, imd); |
1547 | |
1548 if (i != -1) | |
1549 { | |
1550 layout_image_activate(lw, i); | |
1551 } | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1552 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1553 switch (button) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1554 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1555 case 3: |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1556 menu = layout_image_pop_menu(lw); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1557 if (imd == lw->image) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1558 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1559 g_object_set_data(G_OBJECT(menu), "click_parent", imd->widget); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1560 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1561 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, time); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1562 break; |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1563 default: |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1564 break; |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1565 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1566 |
127 | 1567 } |
1568 | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1569 static void layout_image_drag_inactive_cb(ImageWindow *imd, gint button, guint32 time, |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1570 gdouble x, gdouble y, guint state, gdouble dx, gdouble dy, gpointer data) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1571 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1572 LayoutWindow *lw = data; |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1573 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1574 gint i = image_idx(lw, imd); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1575 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1576 if (i != -1) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1577 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1578 layout_image_activate(lw, i); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1579 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1580 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1581 |
129 | 1582 /* continue as with active image */ |
1583 layout_image_drag_cb(imd, button, time, x, y, state, dx, dy, data); | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1584 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1585 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1586 |
9 | 1587 static void layout_image_set_buttons(LayoutWindow *lw) |
1588 { | |
1589 image_set_button_func(lw->image, layout_image_button_cb, lw); | |
1590 image_set_scroll_func(lw->image, layout_image_scroll_cb, lw); | |
1591 } | |
1592 | |
127 | 1593 static void layout_image_set_buttons_inactive(LayoutWindow *lw, gint i) |
1594 { | |
1595 image_set_button_func(lw->split_images[i], layout_image_button_inactive_cb, lw); | |
1596 image_set_scroll_func(lw->split_images[i], layout_image_scroll_cb, lw); | |
1597 } | |
1598 | |
9 | 1599 /* |
1600 *---------------------------------------------------------------------------- | |
1601 * setup | |
1602 *---------------------------------------------------------------------------- | |
1603 */ | |
1604 | |
1605 static void layout_image_update_cb(ImageWindow *imd, gpointer data) | |
1606 { | |
1607 LayoutWindow *lw = data; | |
1608 layout_status_update_image(lw); | |
1609 } | |
1610 | |
127 | 1611 GtkWidget *layout_image_new(LayoutWindow *lw, gint i) |
9 | 1612 { |
127 | 1613 if (!lw->split_images[i]) |
9 | 1614 { |
127 | 1615 lw->split_images[i] = image_new(TRUE); |
1616 | |
1617 gtk_widget_ref(lw->split_images[i]->widget); | |
9 | 1618 |
127 | 1619 if (black_window_background) image_background_set_black(lw->split_images[i], TRUE); |
9 | 1620 |
1621 image_auto_refresh(lw->image, 0); | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1622 |
127 | 1623 layout_image_dnd_init(lw, i); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1624 image_color_profile_set(lw->image, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1625 color_profile_input_type, color_profile_screen_type, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1626 color_profile_use_image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1627 image_color_profile_set_use(lw->image, color_profile_enabled); |
9 | 1628 } |
1629 | |
127 | 1630 return lw->split_images[i]->widget; |
1631 } | |
1632 | |
1633 void layout_image_deactivate(LayoutWindow *lw, gint i) | |
1634 { | |
1635 | |
1636 if (!lw->split_images[i]) return; | |
1637 image_set_update_func(lw->split_images[i], NULL, NULL); | |
1638 layout_image_set_buttons_inactive(lw, i); | |
129 | 1639 image_set_drag_func(lw->split_images[i], layout_image_drag_inactive_cb, lw); |
127 | 1640 |
1641 image_attach_window(lw->split_images[i], NULL, NULL, NULL, FALSE); | |
1642 image_select(lw->split_images[i], FALSE); | |
1643 } | |
1644 | |
1645 | |
1646 void layout_image_activate(LayoutWindow *lw, gint i) | |
1647 { | |
138 | 1648 FileData *fd; |
127 | 1649 |
1650 gchar *base; | |
1651 gint row; | |
1652 gint j; | |
1653 | |
1654 if (!lw->split_images[i]) return; | |
1655 | |
1656 /* deactivate currently active */ | |
1657 if (lw->active_split_image != i) | |
1658 layout_image_deactivate(lw, lw->active_split_image); | |
1659 | |
1660 lw->image = lw->split_images[i]; | |
1661 lw->active_split_image = i; | |
1662 | |
1663 image_set_update_func(lw->image, layout_image_update_cb, lw); | |
1664 layout_image_set_buttons(lw); | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1665 image_set_drag_func(lw->image, layout_image_drag_cb, lw); |
127 | 1666 |
1667 image_attach_window(lw->image, lw->window, NULL, "GQview", FALSE); | |
1668 | |
152 | 1669 /* do not hilight selected image in SPLIT_NONE */ |
1670 /* maybe the image should be selected always and hilight should be controled by | |
1671 another image option */ | |
1672 if (lw->split_mode != SPLIT_NONE) | |
1673 image_select(lw->split_images[i], TRUE); | |
1674 else | |
1675 image_select(lw->split_images[i], FALSE); | |
127 | 1676 |
138 | 1677 fd = image_get_fd(lw->image); |
127 | 1678 |
138 | 1679 if (fd) |
127 | 1680 { |
1681 // layout_list_sync_path(lw, path); | |
138 | 1682 layout_set_path(lw, fd->path); |
127 | 1683 } |
1684 } | |
1685 | |
1686 | |
1687 GtkWidget *layout_image_setup_split_none(LayoutWindow *lw) | |
1688 { | |
1689 gint i; | |
1690 | |
152 | 1691 lw->split_mode = SPLIT_NONE; |
1692 | |
127 | 1693 if (!lw->split_images[0]) |
1694 { | |
1695 layout_image_new(lw, 0); | |
175 | 1696 image_set_frame(lw->split_images[0], (!lw->tools_float && !lw->tools_hidden)); |
1697 image_set_selectable(lw->split_images[0], 0); | |
127 | 1698 layout_image_activate(lw, 0); |
1699 } | |
175 | 1700 else |
1701 { | |
1702 image_set_frame(lw->split_images[0], (!lw->tools_float && !lw->tools_hidden)); | |
1703 image_set_selectable(lw->split_images[0], 0); | |
1704 } | |
127 | 1705 |
1706 for (i=1; i < MAX_SPLIT_IMAGES; i++) | |
1707 { | |
1708 if (lw->split_images[i]) | |
1709 { | |
1710 gtk_widget_unref(lw->split_images[i]->widget); | |
1711 lw->split_images[i] = NULL; | |
1712 } | |
1713 } | |
152 | 1714 |
175 | 1715 |
152 | 1716 layout_image_activate(lw, 0); |
127 | 1717 |
1718 lw->split_image_widget = lw->split_images[0]->widget; | |
1719 | |
1720 return lw->split_image_widget; | |
9 | 1721 } |
1722 | |
127 | 1723 GtkWidget *layout_image_setup_split_hv(LayoutWindow *lw, gboolean horizontal) |
1724 { | |
1725 GtkWidget *paned; | |
1726 gint i; | |
152 | 1727 |
1728 lw->split_mode = horizontal ? SPLIT_HOR : SPLIT_VERT; | |
127 | 1729 |
1730 if (!lw->split_images[0]) | |
1731 { | |
1732 layout_image_new(lw, 0); | |
1733 } | |
175 | 1734 image_set_frame(lw->split_images[0], 1); |
1735 image_set_selectable(lw->split_images[0], 1); | |
127 | 1736 |
1737 if (!lw->split_images[1]) | |
1738 { | |
1739 layout_image_new(lw, 1); | |
175 | 1740 image_set_frame(lw->split_images[1], 1); |
1741 image_set_selectable(lw->split_images[1], 1); | |
127 | 1742 if (lw->image) |
153
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1743 { |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1744 gdouble sx, sy; |
138 | 1745 image_change_fd(lw->split_images[1], |
153
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1746 image_get_fd(lw->image), image_zoom_get(lw->image)); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1747 image_get_scroll_center(lw->image, &sx, &sy); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1748 image_set_scroll_center(lw->split_images[1], sx, sy); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1749 } |
127 | 1750 layout_image_deactivate(lw, 1); |
152 | 1751 layout_image_activate(lw, 0); |
127 | 1752 } |
175 | 1753 else |
1754 { | |
1755 image_set_frame(lw->split_images[1], 1); | |
1756 image_set_selectable(lw->split_images[1], 1); | |
1757 } | |
127 | 1758 |
1759 | |
1760 for (i=2; i < MAX_SPLIT_IMAGES; i++) | |
1761 { | |
1762 if (lw->split_images[i]) | |
1763 { | |
1764 gtk_widget_unref(lw->split_images[i]->widget); | |
1765 lw->split_images[i] = NULL; | |
1766 } | |
1767 } | |
1768 | |
1769 if (!lw->image || lw->active_split_image < 0 || lw->active_split_image > 1) | |
1770 { | |
1771 layout_image_activate(lw, 0); | |
1772 } | |
1773 | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
153
diff
changeset
|
1774 /* horizontal split means vpaned and vice versa */ |
127 | 1775 if (horizontal) |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
153
diff
changeset
|
1776 paned = gtk_vpaned_new (); |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
153
diff
changeset
|
1777 else |
127 | 1778 paned = gtk_hpaned_new (); |
1779 | |
1780 gtk_paned_pack1 (GTK_PANED (paned), lw->split_images[0]->widget, TRUE, TRUE); | |
1781 gtk_paned_pack2 (GTK_PANED (paned), lw->split_images[1]->widget, TRUE, TRUE); | |
1782 | |
1783 gtk_widget_show (lw->split_images[0]->widget); | |
1784 gtk_widget_show (lw->split_images[1]->widget); | |
1785 | |
1786 | |
1787 lw->split_image_widget = paned; | |
1788 | |
1789 return lw->split_image_widget; | |
1790 | |
1791 } | |
1792 | |
1793 GtkWidget *layout_image_setup_split_quad(LayoutWindow *lw) | |
1794 { | |
1795 GtkWidget *hpaned; | |
1796 GtkWidget *vpaned1; | |
1797 GtkWidget *vpaned2; | |
1798 gint i; | |
1799 | |
152 | 1800 lw->split_mode = SPLIT_QUAD; |
1801 | |
127 | 1802 if (!lw->split_images[0]) |
1803 { | |
1804 layout_image_new(lw, 0); | |
152 | 1805 } |
1806 | |
175 | 1807 image_set_frame(lw->split_images[0], 1); |
1808 image_set_selectable(lw->split_images[0], 1); | |
1809 | |
152 | 1810 if (!lw->split_images[1]) |
1811 { | |
127 | 1812 layout_image_activate(lw, 0); |
1813 } | |
1814 | |
1815 for (i=1; i < 4; i++) | |
1816 if (!lw->split_images[i]) | |
1817 { | |
1818 layout_image_new(lw, i); | |
175 | 1819 image_set_frame(lw->split_images[i], 1); |
1820 image_set_selectable(lw->split_images[i], 1); | |
127 | 1821 if (lw->image) |
153
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1822 { |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1823 gdouble sx, sy; |
138 | 1824 image_change_fd(lw->split_images[i], |
153
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1825 image_get_fd(lw->image), image_zoom_get(lw->image)); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1826 image_get_scroll_center(lw->image, &sx, &sy); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1827 image_set_scroll_center(lw->split_images[i], sx, sy); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1828 } |
127 | 1829 layout_image_deactivate(lw, i); |
1830 } | |
175 | 1831 else |
1832 { | |
1833 image_set_frame(lw->split_images[i], 1); | |
1834 image_set_selectable(lw->split_images[i], 1); | |
1835 } | |
127 | 1836 |
1837 for (i=4; i < MAX_SPLIT_IMAGES; i++) | |
1838 { | |
1839 if (lw->split_images[i]) | |
1840 { | |
1841 gtk_widget_unref(lw->split_images[i]->widget); | |
1842 lw->split_images[i] = NULL; | |
1843 } | |
1844 } | |
1845 | |
174 | 1846 |
127 | 1847 if (!lw->image || lw->active_split_image < 0 || lw->active_split_image > 3) |
1848 { | |
1849 layout_image_activate(lw, 0); | |
1850 } | |
1851 | |
1852 hpaned = gtk_hpaned_new (); | |
1853 vpaned1 = gtk_vpaned_new (); | |
1854 vpaned2 = gtk_vpaned_new (); | |
1855 | |
1856 gtk_paned_pack1 (GTK_PANED (vpaned1), lw->split_images[0]->widget, TRUE, TRUE); | |
1857 gtk_paned_pack2 (GTK_PANED (vpaned1), lw->split_images[2]->widget, TRUE, TRUE); | |
1858 | |
1859 gtk_paned_pack1 (GTK_PANED (vpaned2), lw->split_images[1]->widget, TRUE, TRUE); | |
1860 gtk_paned_pack2 (GTK_PANED (vpaned2), lw->split_images[3]->widget, TRUE, TRUE); | |
1861 | |
1862 gtk_paned_pack1 (GTK_PANED (hpaned), vpaned1, TRUE, TRUE); | |
1863 gtk_paned_pack2 (GTK_PANED (hpaned), vpaned2, TRUE, TRUE); | |
1864 | |
1865 | |
1866 for (i=0; i < 4; i++) | |
1867 gtk_widget_show (lw->split_images[i]->widget); | |
1868 gtk_widget_show (vpaned1); | |
1869 gtk_widget_show (vpaned2); | |
1870 | |
1871 | |
1872 lw->split_image_widget = hpaned; | |
1873 | |
1874 return lw->split_image_widget; | |
1875 | |
1876 } | |
1877 | |
1878 GtkWidget *layout_image_setup_split(LayoutWindow *lw, ImageSplitMode mode) | |
1879 { | |
1880 switch (mode) | |
1881 { | |
1882 case SPLIT_HOR: | |
1883 return layout_image_setup_split_hv(lw, TRUE); | |
1884 case SPLIT_VERT: | |
1885 return layout_image_setup_split_hv(lw, FALSE); | |
1886 case SPLIT_QUAD: | |
1887 return layout_image_setup_split_quad(lw); | |
1888 case SPLIT_NONE: | |
1889 default: | |
1890 return layout_image_setup_split_none(lw); | |
1891 } | |
1892 } | |
1893 | |
1894 | |
9 | 1895 /* |
1896 *----------------------------------------------------------------------------- | |
1897 * maintenance (for rename, move, remove) | |
1898 *----------------------------------------------------------------------------- | |
1899 */ | |
1900 | |
138 | 1901 void layout_image_maint_renamed(LayoutWindow *lw, FileData *fd) |
9 | 1902 { |
138 | 1903 FileData *img_fd; |
9 | 1904 |
138 | 1905 img_fd = layout_image_get_fd(lw); |
1906 if (img_fd == fd) | |
9 | 1907 { |
138 | 1908 image_set_fd(lw->image, fd); |
9 | 1909 layout_bars_maint_renamed(lw); |
1910 } | |
1911 } | |
1912 | |
138 | 1913 void layout_image_maint_removed(LayoutWindow *lw, FileData *fd) |
9 | 1914 { |
138 | 1915 FileData *img_fd; |
9 | 1916 |
138 | 1917 img_fd = layout_image_get_fd(lw); |
1918 if (img_fd == fd) | |
9 | 1919 { |
1920 CollectionData *cd; | |
1921 CollectInfo *info; | |
1922 | |
1923 cd = image_get_collection(lw->image, &info); | |
1924 if (cd && info) | |
1925 { | |
1926 CollectInfo *new; | |
1927 | |
1928 new = collection_next_by_info(cd, info); | |
1929 if (!new) new = collection_prev_by_info(cd, info); | |
1930 | |
1931 if (new) | |
1932 { | |
1933 layout_image_set_collection(lw, cd, new); | |
1934 return; | |
1935 } | |
1936 } | |
1937 | |
138 | 1938 layout_image_set_fd(lw, NULL); |
9 | 1939 } |
1940 } | |
1941 | |
138 | 1942 void layout_image_maint_moved(LayoutWindow *lw, FileData *fd) |
9 | 1943 { |
138 | 1944 layout_image_maint_renamed(lw, fd); |
9 | 1945 } |
1946 |