Mercurial > geeqie
annotate src/img-view.c @ 880:71fc4b084e7e
French translation was updated.
author | zas_ |
---|---|
date | Fri, 04 Jul 2008 22:49:04 +0000 |
parents | db6977f8b0f1 |
children | ad420f2eb789 |
rev | line source |
---|---|
1 | 1 /* |
196 | 2 * Geeqie |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
3 * (C) 2006 John Ellis |
475 | 4 * Copyright (C) 2008 The Geeqie Team |
1 | 5 * |
6 * Author: John Ellis | |
7 * | |
9 | 8 * This software is released under the GNU General Public License (GNU GPL). |
9 * Please read the included file COPYING for more information. | |
10 * This software comes with no warranty of any kind, use at your own risk! | |
1 | 11 */ |
12 | |
9 | 13 |
281 | 14 #include "main.h" |
9 | 15 #include "img-view.h" |
16 | |
17 #include "collect.h" | |
18 #include "collect-io.h" | |
19 #include "dnd.h" | |
20 #include "editors.h" | |
586 | 21 #include "filedata.h" |
9 | 22 #include "fullscreen.h" |
1 | 23 #include "image.h" |
9 | 24 #include "image-overlay.h" |
25 #include "info.h" | |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
26 #include "layout.h" |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
27 #include "layout_image.h" |
9 | 28 #include "menu.h" |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
29 #include "pixbuf-renderer.h" |
91
d063f97503b7
Wed Nov 1 11:39:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
89
diff
changeset
|
30 #include "pixbuf_util.h" |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
31 #include "print.h" |
9 | 32 #include "slideshow.h" |
33 #include "utilops.h" | |
34 #include "ui_bookmark.h" | |
35 #include "ui_fileops.h" | |
36 #include "ui_menu.h" | |
648
e34c1002e553
Move some functions from main.[ch] to new window.[ch].
zas_
parents:
621
diff
changeset
|
37 #include "window.h" |
9 | 38 |
1 | 39 #include <gdk/gdkkeysyms.h> /* for keyboard values */ |
40 | |
9 | 41 |
42 typedef struct _ViewWindow ViewWindow; | |
43 struct _ViewWindow | |
44 { | |
45 GtkWidget *window; | |
46 ImageWindow *imd; | |
47 FullScreenData *fs; | |
48 SlideShowData *ss; | |
49 | |
50 GList *list; | |
51 GList *list_pointer; | |
52 }; | |
53 | |
54 | |
55 static GList *view_window_list = NULL; | |
56 | |
57 | |
58 static GtkWidget *view_popup_menu(ViewWindow *vw); | |
59 static void view_fullscreen_toggle(ViewWindow *vw, gint force_off); | |
60 static void view_overlay_toggle(ViewWindow *vw); | |
61 | |
62 static void view_slideshow_next(ViewWindow *vw); | |
63 static void view_slideshow_prev(ViewWindow *vw); | |
64 static void view_slideshow_start(ViewWindow *vw); | |
65 static void view_slideshow_stop(ViewWindow *vw); | |
66 | |
67 static void view_window_close(ViewWindow *vw); | |
68 | |
69 static void view_window_dnd_init(ViewWindow *vw); | |
70 | |
797 | 71 static void view_window_notify_cb(FileData *fd, NotifyType type, gpointer data); |
9 | 72 |
73 /* | |
74 *----------------------------------------------------------------------------- | |
75 * misc | |
76 *----------------------------------------------------------------------------- | |
442 | 77 */ |
9 | 78 |
79 static ImageWindow *view_window_active_image(ViewWindow *vw) | |
80 { | |
81 if (vw->fs) return vw->fs->imd; | |
82 | |
83 return vw->imd; | |
84 } | |
85 | |
86 static void view_window_set_list(ViewWindow *vw, GList *list) | |
87 { | |
88 | |
138 | 89 filelist_free(vw->list); |
9 | 90 vw->list = NULL; |
91 vw->list_pointer = NULL; | |
92 | |
138 | 93 vw->list = filelist_copy(list); |
9 | 94 } |
95 | |
96 static gint view_window_contains_collection(ViewWindow *vw) | |
97 { | |
98 CollectionData *cd; | |
99 CollectInfo *info; | |
100 | |
101 cd = image_get_collection(view_window_active_image(vw), &info); | |
102 | |
103 return (cd && info); | |
104 } | |
105 | |
106 static void view_collection_step(ViewWindow *vw, gint next) | |
107 { | |
108 ImageWindow *imd = view_window_active_image(vw); | |
109 CollectionData *cd; | |
110 CollectInfo *info; | |
111 CollectInfo *read_ahead_info = NULL; | |
112 | |
113 cd = image_get_collection(imd, &info); | |
114 | |
115 if (!cd || !info) return; | |
116 | |
117 if (next) | |
118 { | |
119 info = collection_next_by_info(cd, info); | |
334 | 120 if (options->image.enable_read_ahead) |
9 | 121 { |
122 read_ahead_info = collection_next_by_info(cd, info); | |
123 if (!read_ahead_info) read_ahead_info = collection_prev_by_info(cd, info); | |
124 } | |
125 } | |
126 else | |
127 { | |
128 info = collection_prev_by_info(cd, info); | |
334 | 129 if (options->image.enable_read_ahead) |
9 | 130 { |
131 read_ahead_info = collection_prev_by_info(cd, info); | |
132 if (!read_ahead_info) read_ahead_info = collection_next_by_info(cd, info); | |
133 } | |
134 } | |
135 | |
136 if (info) | |
137 { | |
334 | 138 image_change_from_collection(imd, cd, info, image_zoom_get_default(imd, options->image.zoom_mode)); |
9 | 139 |
138 | 140 if (read_ahead_info) image_prebuffer_set(imd, read_ahead_info->fd); |
9 | 141 } |
442 | 142 |
9 | 143 } |
144 | |
145 static void view_collection_step_to_end(ViewWindow *vw, gint last) | |
146 { | |
147 ImageWindow *imd = view_window_active_image(vw); | |
148 CollectionData *cd; | |
149 CollectInfo *info; | |
150 CollectInfo *read_ahead_info = NULL; | |
151 | |
152 cd = image_get_collection(imd, &info); | |
153 | |
154 if (!cd || !info) return; | |
155 | |
156 if (last) | |
157 { | |
158 info = collection_get_last(cd); | |
334 | 159 if (options->image.enable_read_ahead) read_ahead_info = collection_prev_by_info(cd, info); |
9 | 160 } |
161 else | |
162 { | |
163 info = collection_get_first(cd); | |
334 | 164 if (options->image.enable_read_ahead) read_ahead_info = collection_next_by_info(cd, info); |
9 | 165 } |
166 | |
167 if (info) | |
168 { | |
334 | 169 image_change_from_collection(imd, cd, info, image_zoom_get_default(imd, options->image.zoom_mode)); |
138 | 170 if (read_ahead_info) image_prebuffer_set(imd, read_ahead_info->fd); |
9 | 171 } |
172 } | |
173 | |
174 static void view_list_step(ViewWindow *vw, gint next) | |
175 { | |
176 ImageWindow *imd = view_window_active_image(vw); | |
138 | 177 FileData *fd; |
9 | 178 GList *work; |
179 GList *work_ahead; | |
180 | |
181 if (!vw->list) return; | |
182 | |
138 | 183 fd = image_get_fd(imd); |
184 if (!fd) return; | |
9 | 185 |
186 if (g_list_position(vw->list, vw->list_pointer) >= 0) | |
187 { | |
188 work = vw->list_pointer; | |
189 } | |
190 else | |
191 { | |
192 gint found = FALSE; | |
193 | |
194 work = vw->list; | |
195 while (work && !found) | |
196 { | |
138 | 197 FileData *temp; |
9 | 198 |
199 temp = work->data; | |
200 | |
138 | 201 if (fd == temp) |
9 | 202 { |
203 found = TRUE; | |
204 } | |
205 else | |
206 { | |
207 work = work->next; | |
208 } | |
209 } | |
210 } | |
211 if (!work) return; | |
212 | |
213 work_ahead = NULL; | |
214 if (next) | |
215 { | |
216 work = work->next; | |
217 if (work) work_ahead = work->next; | |
218 } | |
219 else | |
220 { | |
221 work = work->prev; | |
222 if (work) work_ahead = work->prev; | |
223 } | |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
224 |
9 | 225 if (!work) return; |
226 | |
227 vw->list_pointer = work; | |
138 | 228 fd = work->data; |
334 | 229 image_change_fd(imd, fd, image_zoom_get_default(imd, options->image.zoom_mode)); |
9 | 230 |
334 | 231 if (options->image.enable_read_ahead && work_ahead) |
9 | 232 { |
138 | 233 FileData *next_fd = work_ahead->data; |
234 image_prebuffer_set(imd, next_fd); | |
9 | 235 } |
236 } | |
237 | |
238 static void view_list_step_to_end(ViewWindow *vw, gint last) | |
239 { | |
240 ImageWindow *imd = view_window_active_image(vw); | |
138 | 241 FileData *fd; |
9 | 242 GList *work; |
243 GList *work_ahead; | |
244 | |
245 if (!vw->list) return; | |
246 | |
247 if (last) | |
248 { | |
249 work = g_list_last(vw->list); | |
250 work_ahead = work->prev; | |
251 } | |
252 else | |
253 { | |
254 work = vw->list; | |
255 work_ahead = work->next; | |
256 } | |
257 | |
258 vw->list_pointer = work; | |
138 | 259 fd = work->data; |
334 | 260 image_change_fd(imd, fd, image_zoom_get_default(imd, options->image.zoom_mode)); |
9 | 261 |
334 | 262 if (options->image.enable_read_ahead && work_ahead) |
9 | 263 { |
138 | 264 FileData *next_fd = work_ahead->data; |
265 image_prebuffer_set(imd, next_fd); | |
9 | 266 } |
267 } | |
268 | |
269 static void view_step_next(ViewWindow *vw) | |
270 { | |
271 if (vw->ss) | |
272 { | |
273 view_slideshow_next(vw); | |
274 } | |
275 else if (vw->list) | |
276 { | |
277 view_list_step(vw, TRUE); | |
278 } | |
279 else | |
280 { | |
281 view_collection_step(vw, TRUE); | |
282 } | |
283 } | |
284 | |
285 static void view_step_prev(ViewWindow *vw) | |
286 { | |
287 if (vw->ss) | |
288 { | |
289 view_slideshow_prev(vw); | |
290 } | |
291 else if (vw->list) | |
292 { | |
293 view_list_step(vw, FALSE); | |
294 } | |
295 else | |
296 { | |
297 view_collection_step(vw, FALSE); | |
298 } | |
299 } | |
300 | |
301 static void view_step_to_end(ViewWindow *vw, gint last) | |
302 { | |
303 if (vw->list) | |
304 { | |
305 view_list_step_to_end(vw, last); | |
306 } | |
307 else | |
308 { | |
309 view_collection_step_to_end(vw, last); | |
310 } | |
311 } | |
312 | |
1 | 313 /* |
314 *----------------------------------------------------------------------------- | |
315 * view window keyboard | |
316 *----------------------------------------------------------------------------- | |
317 */ | |
318 | |
9 | 319 static void view_window_menu_pos_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) |
320 { | |
321 ViewWindow *vw = data; | |
322 ImageWindow *imd; | |
323 | |
324 imd = view_window_active_image(vw); | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
325 gdk_window_get_origin(imd->pr->window, x, y); |
9 | 326 popup_menu_position_clamp(menu, x, y, 0); |
327 } | |
328 | |
1 | 329 static gint view_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
330 { | |
9 | 331 ViewWindow *vw = data; |
332 ImageWindow *imd; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
333 gint stop_signal; |
9 | 334 GtkWidget *menu; |
1 | 335 gint x = 0; |
336 gint y = 0; | |
337 | |
9 | 338 imd = view_window_active_image(vw); |
339 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
340 stop_signal = TRUE; |
1 | 341 switch (event->keyval) |
342 { | |
9 | 343 case GDK_Left: case GDK_KP_Left: |
1 | 344 x -= 1; |
345 break; | |
9 | 346 case GDK_Right: case GDK_KP_Right: |
1 | 347 x += 1; |
348 break; | |
9 | 349 case GDK_Up: case GDK_KP_Up: |
1 | 350 y -= 1; |
351 break; | |
9 | 352 case GDK_Down: case GDK_KP_Down: |
1 | 353 y += 1; |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
354 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
355 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
356 stop_signal = FALSE; |
1 | 357 break; |
9 | 358 } |
359 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
360 if (x != 0 || y!= 0) |
9 | 361 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
362 if (event->state & GDK_SHIFT_MASK) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
363 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
364 x *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
365 y *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
366 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
367 |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
368 keyboard_scroll_calc(&x, &y, event); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
369 image_scroll(imd, x, y); |
1 | 370 } |
371 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
372 if (stop_signal) return stop_signal; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
373 |
1 | 374 if (event->state & GDK_CONTROL_MASK) |
375 { | |
376 gint n = -1; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
377 |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
378 stop_signal = TRUE; |
1 | 379 switch (event->keyval) |
380 { | |
381 case '1': | |
382 n = 0; | |
383 break; | |
384 case '2': | |
385 n = 1; | |
386 break; | |
387 case '3': | |
388 n = 2; | |
389 break; | |
390 case '4': | |
391 n = 3; | |
392 break; | |
393 case '5': | |
394 n = 4; | |
395 break; | |
396 case '6': | |
397 n = 5; | |
398 break; | |
399 case '7': | |
400 n = 6; | |
401 break; | |
402 case '8': | |
403 n = 7; | |
404 break; | |
9 | 405 case '9': |
406 n = 8; | |
407 break; | |
408 case '0': | |
409 n = 9; | |
410 break; | |
411 case 'C': case 'c': | |
138 | 412 file_util_copy(image_get_fd(imd), NULL, NULL, imd->widget); |
9 | 413 break; |
414 case 'M': case 'm': | |
138 | 415 file_util_move(image_get_fd(imd), NULL, NULL, imd->widget); |
9 | 416 break; |
417 case 'R': case 'r': | |
138 | 418 file_util_rename(image_get_fd(imd), NULL, imd->widget); |
9 | 419 break; |
420 case 'D': case 'd': | |
138 | 421 file_util_delete(image_get_fd(imd), NULL, imd->widget); |
9 | 422 break; |
423 case 'P': case 'p': | |
479
5212d4fed37f
Ensure Properties dialog is displayed above fullscreen window.
zas_
parents:
475
diff
changeset
|
424 info_window_new(image_get_fd(imd), NULL, vw->fs ? vw->fs->window : NULL); |
9 | 425 break; |
426 case 'W': case 'w': | |
427 view_window_close(vw); | |
428 break; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
429 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
430 stop_signal = FALSE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
431 break; |
1 | 432 } |
433 if (n != -1) | |
434 { | |
60
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
435 if (!editor_window_flag_set(n)) |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
436 { |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
437 view_fullscreen_toggle(vw, TRUE); |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
438 } |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
439 imd = view_window_active_image(vw); |
753 | 440 file_util_start_editor_from_file(n, image_get_fd(imd), imd->widget); |
1 | 441 } |
442 } | |
9 | 443 else if (event->state & GDK_SHIFT_MASK) |
1 | 444 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
445 stop_signal = TRUE; |
9 | 446 switch (event->keyval) |
447 { | |
448 case 'R': case 'r': | |
449 image_alter(imd, ALTER_ROTATE_180); | |
450 break; | |
451 case 'M': case 'm': | |
452 image_alter(imd, ALTER_MIRROR); | |
453 break; | |
454 case 'F': case 'f': | |
455 image_alter(imd, ALTER_FLIP); | |
456 break; | |
82
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
457 case 'G': case 'g': |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
458 image_alter(imd, ALTER_DESATURATE); |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
459 break; |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
460 case 'P': case 'p': |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
461 { |
138 | 462 FileData *fd; |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
463 |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
464 view_fullscreen_toggle(vw, TRUE); |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
465 imd = view_window_active_image(vw); |
138 | 466 fd = image_get_fd(imd); |
467 print_window_new(fd, | |
468 fd ? g_list_append(NULL, file_data_ref(fd)) : NULL, | |
469 filelist_copy(vw->list), vw->window); | |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
470 } |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
471 break; |
9 | 472 default: |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
473 stop_signal = FALSE; |
9 | 474 break; |
475 } | |
1 | 476 } |
442 | 477 else |
1 | 478 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
479 stop_signal = TRUE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
480 switch (event->keyval) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
481 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
482 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
|
483 case GDK_BackSpace: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
484 case 'B': case 'b': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
485 view_step_prev(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
486 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
487 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
|
488 case GDK_space: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
489 case 'N': case 'n': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
490 view_step_next(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
491 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
492 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
|
493 view_step_to_end(vw, FALSE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
494 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
495 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
|
496 view_step_to_end(vw, TRUE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
497 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
498 case '+': case '=': case GDK_KP_Add: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
499 image_zoom_adjust(imd, get_zoom_increment()); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
500 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
501 case '-': case GDK_KP_Subtract: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
502 image_zoom_adjust(imd, -get_zoom_increment()); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
503 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
504 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
|
505 image_zoom_set(imd, 0.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
506 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
507 case 'Z': case 'z': case GDK_KP_Divide: case '1': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
508 image_zoom_set(imd, 1.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
509 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
510 case '2': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
511 image_zoom_set(imd, 2.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
512 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
513 case '3': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
514 image_zoom_set(imd, 3.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
515 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
516 case '4': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
517 image_zoom_set(imd, 4.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
518 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
519 case '7': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
520 image_zoom_set(imd, -4.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
521 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
522 case '8': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
523 image_zoom_set(imd, -3.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
524 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
525 case '9': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
526 image_zoom_set(imd, -2.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
527 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
528 case 'W': case 'w': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
529 image_zoom_set_fill_geometry(imd, FALSE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
530 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
531 case 'H': case 'h': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
532 image_zoom_set_fill_geometry(imd, TRUE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
533 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
534 case 'R': case 'r': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
535 image_reload(imd); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
536 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
537 case 'S': case 's': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
538 if (vw->ss) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
539 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
540 view_slideshow_stop(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
541 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
542 else |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
543 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
544 view_slideshow_start(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
545 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
546 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
547 case 'P': case 'p': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
548 slideshow_pause_toggle(vw->ss); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
549 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
550 case 'F': case 'f': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
551 case 'V': case 'v': |
86
cade6a52a165
Mon Oct 23 05:34:29 2006 John Ellis <johne@verizon.net>
gqview
parents:
84
diff
changeset
|
552 case GDK_F11: |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
553 view_fullscreen_toggle(vw, FALSE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
554 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
555 case 'I': case 'i': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
556 view_overlay_toggle(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
557 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
558 case ']': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
559 image_alter(imd, ALTER_ROTATE_90); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
560 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
561 case '[': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
562 image_alter(imd, ALTER_ROTATE_90_CC); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
563 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
564 case GDK_Delete: case GDK_KP_Delete: |
341
15c6b94545a2
Move safe_delete* and in place rename options to file_ops
zas_
parents:
339
diff
changeset
|
565 if (options->file_ops.enable_delete_key) |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
566 { |
138 | 567 file_util_delete(image_get_fd(imd), NULL, imd->widget); |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
568 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
569 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
570 case GDK_Escape: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
571 if (vw->fs) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
572 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
573 view_fullscreen_toggle(vw, TRUE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
574 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
575 else |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
576 { |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
577 view_window_close(vw); |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
578 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
579 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
580 case GDK_Menu: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
581 case GDK_F10: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
582 menu = view_popup_menu(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
583 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
584 view_window_menu_pos_cb, vw, 0, GDK_CURRENT_TIME); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
585 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
586 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
587 stop_signal = FALSE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
588 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
589 } |
1 | 590 } |
591 | |
592 return stop_signal; | |
593 } | |
594 | |
595 /* | |
596 *----------------------------------------------------------------------------- | |
597 * view window main routines | |
598 *----------------------------------------------------------------------------- | |
442 | 599 */ |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
600 static void button_cb(ImageWindow *imd, GdkEventButton *event, gpointer data) |
9 | 601 { |
602 ViewWindow *vw = data; | |
603 GtkWidget *menu; | |
604 | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
605 switch (event->button) |
9 | 606 { |
448
a73cc0fa14d0
Use explicit names for mouse buttons instead of numbers.
zas_
parents:
446
diff
changeset
|
607 case MOUSE_BUTTON_LEFT: |
9 | 608 view_step_next(vw); |
609 break; | |
448
a73cc0fa14d0
Use explicit names for mouse buttons instead of numbers.
zas_
parents:
446
diff
changeset
|
610 case MOUSE_BUTTON_MIDDLE: |
9 | 611 view_step_prev(vw); |
612 break; | |
448
a73cc0fa14d0
Use explicit names for mouse buttons instead of numbers.
zas_
parents:
446
diff
changeset
|
613 case MOUSE_BUTTON_RIGHT: |
9 | 614 menu = view_popup_menu(vw); |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
615 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time); |
9 | 616 break; |
617 default: | |
618 break; | |
619 } | |
620 } | |
621 | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
622 static void scroll_cb(ImageWindow *imd, GdkEventScroll *event, gpointer data) |
1 | 623 { |
9 | 624 ViewWindow *vw = data; |
625 | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
626 if (event->state & GDK_CONTROL_MASK) |
9 | 627 { |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
628 switch (event->direction) |
9 | 629 { |
630 case GDK_SCROLL_UP: | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
631 image_zoom_adjust_at_point(imd, get_zoom_increment(), event->x, event->y); |
9 | 632 break; |
633 case GDK_SCROLL_DOWN: | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
634 image_zoom_adjust_at_point(imd, -get_zoom_increment(), event->x, event->y); |
9 | 635 break; |
636 default: | |
637 break; | |
638 } | |
639 } | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
640 else if ( (event->state & GDK_SHIFT_MASK) != (guint) (options->mousewheel_scrolls)) |
9 | 641 { |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
642 switch (event->direction) |
9 | 643 { |
644 case GDK_SCROLL_UP: | |
645 image_scroll(imd, 0, -MOUSEWHEEL_SCROLL_SIZE); | |
646 break; | |
647 case GDK_SCROLL_DOWN: | |
648 image_scroll(imd, 0, MOUSEWHEEL_SCROLL_SIZE); | |
649 break; | |
650 case GDK_SCROLL_LEFT: | |
651 image_scroll(imd, -MOUSEWHEEL_SCROLL_SIZE, 0); | |
652 break; | |
653 case GDK_SCROLL_RIGHT: | |
654 image_scroll(imd, MOUSEWHEEL_SCROLL_SIZE, 0); | |
655 break; | |
656 default: | |
657 break; | |
658 } | |
659 } | |
660 else | |
661 { | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
662 switch (event->direction) |
9 | 663 { |
664 case GDK_SCROLL_UP: | |
665 view_step_prev(vw); | |
666 break; | |
667 case GDK_SCROLL_DOWN: | |
668 view_step_next(vw); | |
669 break; | |
670 default: | |
671 break; | |
672 } | |
673 } | |
674 } | |
675 | |
676 static void view_image_set_buttons(ViewWindow *vw, ImageWindow *imd) | |
677 { | |
678 image_set_button_func(imd, button_cb, vw); | |
679 image_set_scroll_func(imd, scroll_cb, vw); | |
680 } | |
681 | |
682 static void view_fullscreen_stop_func(FullScreenData *fs, gpointer data) | |
683 { | |
684 ViewWindow *vw = data; | |
685 | |
686 vw->fs = NULL; | |
687 | |
688 if (vw->ss) vw->ss->imd = vw->imd; | |
1 | 689 } |
690 | |
9 | 691 static void view_fullscreen_toggle(ViewWindow *vw, gint force_off) |
4 | 692 { |
9 | 693 if (force_off && !vw->fs) return; |
694 | |
695 if (vw->fs) | |
696 { | |
621 | 697 if (image_osd_get(vw->imd) & OSD_SHOW_INFO) |
698 image_osd_set(vw->imd, image_osd_get(vw->fs->imd)); | |
699 | |
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
94
diff
changeset
|
700 fullscreen_stop(vw->fs); |
9 | 701 } |
702 else | |
703 { | |
704 vw->fs = fullscreen_start(vw->window, vw->imd, view_fullscreen_stop_func, vw); | |
705 | |
706 view_image_set_buttons(vw, vw->fs->imd); | |
707 g_signal_connect(G_OBJECT(vw->fs->window), "key_press_event", | |
708 G_CALLBACK(view_window_key_press_cb), vw); | |
709 | |
710 if (vw->ss) vw->ss->imd = vw->fs->imd; | |
711 | |
621 | 712 if (image_osd_get(vw->imd) & OSD_SHOW_INFO) |
9 | 713 { |
621 | 714 image_osd_set(vw->fs->imd, image_osd_get(vw->imd)); |
614 | 715 image_osd_set(vw->imd, OSD_SHOW_NOTHING); |
9 | 716 } |
717 } | |
718 } | |
719 | |
720 static void view_overlay_toggle(ViewWindow *vw) | |
721 { | |
722 ImageWindow *imd; | |
723 | |
724 imd = view_window_active_image(vw); | |
481
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
479
diff
changeset
|
725 |
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
479
diff
changeset
|
726 image_osd_toggle(imd); |
9 | 727 } |
728 | |
729 static void view_slideshow_next(ViewWindow *vw) | |
730 { | |
731 if (vw->ss) slideshow_next(vw->ss); | |
4 | 732 } |
733 | |
9 | 734 static void view_slideshow_prev(ViewWindow *vw) |
735 { | |
736 if (vw->ss) slideshow_prev(vw->ss); | |
737 } | |
738 | |
739 static void view_slideshow_stop_func(SlideShowData *fs, gpointer data) | |
740 { | |
741 ViewWindow *vw = data; | |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
742 GList *work; |
138 | 743 FileData *fd; |
9 | 744 |
745 vw->ss = NULL; | |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
746 |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
747 work = vw->list; |
138 | 748 fd = image_get_fd(view_window_active_image(vw)); |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
749 while (work) |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
750 { |
138 | 751 FileData *temp; |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
752 |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
753 temp = work->data; |
138 | 754 if (fd == temp) |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
755 { |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
756 vw->list_pointer = work; |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
757 work = NULL; |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
758 } |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
759 else |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
760 { |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
761 work = work->next; |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
762 } |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
763 } |
9 | 764 } |
765 | |
766 static void view_slideshow_start(ViewWindow *vw) | |
4 | 767 { |
9 | 768 if (!vw->ss) |
769 { | |
770 CollectionData *cd; | |
771 CollectInfo *info; | |
772 | |
773 if (vw->list) | |
774 { | |
138 | 775 vw->ss = slideshow_start_from_filelist(view_window_active_image(vw), |
776 filelist_copy(vw->list), | |
9 | 777 view_slideshow_stop_func, vw); |
778 vw->list_pointer = NULL; | |
779 return; | |
780 } | |
781 | |
782 cd = image_get_collection(view_window_active_image(vw), &info); | |
783 if (cd && info) | |
784 { | |
785 vw->ss = slideshow_start_from_collection(view_window_active_image(vw), cd, | |
786 view_slideshow_stop_func, vw, info); | |
787 } | |
788 } | |
789 } | |
790 | |
791 static void view_slideshow_stop(ViewWindow *vw) | |
792 { | |
793 if (vw->ss) slideshow_free(vw->ss); | |
794 } | |
795 | |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
796 static void view_window_destroy_cb(GtkWidget *widget, gpointer data) |
9 | 797 { |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
798 ViewWindow *vw = data; |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
799 |
9 | 800 view_window_list = g_list_remove(view_window_list, vw); |
801 | |
802 view_slideshow_stop(vw); | |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
803 fullscreen_stop(vw->fs); |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
804 |
138 | 805 filelist_free(vw->list); |
797 | 806 |
807 file_data_unregister_notify_func(view_window_notify_cb, vw); | |
808 | |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
809 g_free(vw); |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
810 } |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
811 |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
812 static void view_window_close(ViewWindow *vw) |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
813 { |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
814 view_slideshow_stop(vw); |
9 | 815 view_fullscreen_toggle(vw, TRUE); |
816 gtk_widget_destroy(vw->window); | |
4 | 817 } |
818 | |
1 | 819 static gint view_window_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data) |
820 { | |
9 | 821 ViewWindow *vw = data; |
822 | |
823 view_window_close(vw); | |
1 | 824 return TRUE; |
825 } | |
826 | |
138 | 827 static ViewWindow *real_view_window_new(FileData *fd, GList *list, CollectionData *cd, CollectInfo *info) |
1 | 828 { |
9 | 829 ViewWindow *vw; |
1 | 830 GtkAllocation req_size; |
9 | 831 GdkGeometry geometry; |
1 | 832 gint w, h; |
9 | 833 |
138 | 834 if (!fd && !list && (!cd || !info)) return NULL; |
9 | 835 |
836 vw = g_new0(ViewWindow, 1); | |
837 vw->fs = NULL; | |
838 vw->ss = NULL; | |
839 vw->list = NULL; | |
840 vw->list_pointer = NULL; | |
841 | |
289
6a7298988a7a
Simplify and unify gtk_window creation with the help of
zas_
parents:
288
diff
changeset
|
842 vw->window = window_new(GTK_WINDOW_TOPLEVEL, "view", PIXBUF_INLINE_ICON_VIEW, NULL, NULL); |
9 | 843 |
844 geometry.min_width = 8; | |
845 geometry.min_height = 8; | |
846 gtk_window_set_geometry_hints(GTK_WINDOW(vw->window), NULL, &geometry, GDK_HINT_MIN_SIZE); | |
1 | 847 |
9 | 848 gtk_window_set_resizable(GTK_WINDOW(vw->window), TRUE); |
442 | 849 gtk_container_set_border_width(GTK_CONTAINER(vw->window), 0); |
9 | 850 |
851 vw->imd = image_new(FALSE); | |
852 | |
339
de1c2cd06fce
Rename user_specified_window_background and window_background_color
zas_
parents:
334
diff
changeset
|
853 image_background_set_color(vw->imd, options->image.use_custom_border_color ? &options->image.border_color : NULL); |
9 | 854 |
288
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
855 image_attach_window(vw->imd, vw->window, NULL, GQ_APPNAME, TRUE); |
9 | 856 |
857 image_auto_refresh(vw->imd, 0); | |
858 image_top_window_set_sync(vw->imd, TRUE); | |
859 | |
860 gtk_container_add(GTK_CONTAINER(vw->window), vw->imd->widget); | |
861 gtk_widget_show(vw->imd->widget); | |
862 | |
863 view_window_dnd_init(vw); | |
1 | 864 |
9 | 865 view_image_set_buttons(vw, vw->imd); |
1 | 866 |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
867 g_signal_connect(G_OBJECT(vw->window), "destroy", |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
868 G_CALLBACK(view_window_destroy_cb), vw); |
9 | 869 g_signal_connect(G_OBJECT(vw->window), "delete_event", |
870 G_CALLBACK(view_window_delete_cb), vw); | |
871 g_signal_connect(G_OBJECT(vw->window), "key_press_event", | |
872 G_CALLBACK(view_window_key_press_cb), vw); | |
873 if (cd && info) | |
874 { | |
334 | 875 image_change_from_collection(vw->imd, cd, info, image_zoom_get_default(NULL, options->image.zoom_mode)); |
876 if (options->image.enable_read_ahead) | |
9 | 877 { |
878 CollectInfo * r_info = collection_next_by_info(cd, info); | |
879 if (!r_info) r_info = collection_prev_by_info(cd, info); | |
138 | 880 if (r_info) image_prebuffer_set(vw->imd, r_info->fd); |
9 | 881 } |
882 } | |
883 else if (list) | |
884 { | |
885 view_window_set_list(vw, list); | |
886 vw->list_pointer = vw->list; | |
334 | 887 image_change_fd(vw->imd, (FileData *)vw->list->data, image_zoom_get_default(NULL, options->image.zoom_mode)); |
1 | 888 |
334 | 889 if (options->image.enable_read_ahead) |
9 | 890 { |
891 GList *work = vw->list->next; | |
138 | 892 if (work) image_prebuffer_set(vw->imd, (FileData *)work->data); |
9 | 893 } |
894 } | |
895 else | |
896 { | |
334 | 897 image_change_fd(vw->imd, fd, image_zoom_get_default(NULL, options->image.zoom_mode)); |
9 | 898 } |
1 | 899 |
9 | 900 if (image_zoom_get(vw->imd) == 0.0) |
901 { | |
531 | 902 image_get_image_size(vw->imd, &w, &h); |
9 | 903 } |
904 else | |
905 { | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
906 pixbuf_renderer_get_scaled_size(PIXBUF_RENDERER(vw->imd->pr), &w, &h); |
9 | 907 } |
334 | 908 if (options->image.limit_window_size) |
1 | 909 { |
334 | 910 gint mw = gdk_screen_width() * options->image.max_window_size / 100; |
911 gint mh = gdk_screen_height() * options->image.max_window_size / 100; | |
1 | 912 |
913 if (w > mw) w = mw; | |
914 if (h > mh) h = mh; | |
915 } | |
916 | |
9 | 917 gtk_window_set_default_size(GTK_WINDOW(vw->window), w, h); |
1 | 918 req_size.x = req_size.y = 0; |
919 req_size.width = w; | |
920 req_size.height = h; | |
9 | 921 gtk_widget_size_allocate(GTK_WIDGET(vw->window), &req_size); |
922 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
923 gtk_widget_set_size_request(vw->imd->pr, w, h); |
9 | 924 |
925 gtk_widget_show(vw->window); | |
926 | |
927 view_window_list = g_list_append(view_window_list, vw); | |
928 | |
797 | 929 file_data_register_notify_func(view_window_notify_cb, vw, NOTIFY_PRIORITY_LOW); |
930 | |
9 | 931 return vw; |
932 } | |
933 | |
934 static void view_window_collection_unref_cb(GtkWidget *widget, gpointer data) | |
935 { | |
936 CollectionData *cd = data; | |
937 | |
938 collection_unref(cd); | |
939 } | |
940 | |
138 | 941 void view_window_new(FileData *fd) |
9 | 942 { |
780
44128da39e13
Drop initialization to NULL since filelist_read() will take care of it.
zas_
parents:
753
diff
changeset
|
943 GList *list; |
44128da39e13
Drop initialization to NULL since filelist_read() will take care of it.
zas_
parents:
753
diff
changeset
|
944 |
781
2d2cca2bceb0
Replace hardcoded collection filename extension by a macro (GQ_COLLECTION_EXT).
zas_
parents:
780
diff
changeset
|
945 if (file_extension_match(fd->path, GQ_COLLECTION_EXT)) |
9 | 946 { |
947 ViewWindow *vw; | |
948 CollectionData *cd; | |
949 CollectInfo *info; | |
950 | |
138 | 951 cd = collection_new(fd->path); |
358 | 952 if (collection_load(cd, fd->path, COLLECTION_LOAD_NONE)) |
9 | 953 { |
954 info = collection_get_first(cd); | |
955 } | |
956 else | |
957 { | |
958 collection_unref(cd); | |
959 cd = NULL; | |
960 info = NULL; | |
961 } | |
962 vw = real_view_window_new(NULL, NULL, cd, info); | |
963 if (vw && cd) | |
964 { | |
965 g_signal_connect(G_OBJECT(vw->window), "destroy", | |
966 G_CALLBACK(view_window_collection_unref_cb), cd); | |
967 } | |
968 } | |
783 | 969 else if (isdir(fd->path) && filelist_read(fd, &list, NULL)) |
780
44128da39e13
Drop initialization to NULL since filelist_read() will take care of it.
zas_
parents:
753
diff
changeset
|
970 { |
44128da39e13
Drop initialization to NULL since filelist_read() will take care of it.
zas_
parents:
753
diff
changeset
|
971 list = filelist_sort_path(list); |
44128da39e13
Drop initialization to NULL since filelist_read() will take care of it.
zas_
parents:
753
diff
changeset
|
972 list = filelist_filter(list, FALSE); |
9 | 973 real_view_window_new(NULL, list, NULL, NULL); |
138 | 974 filelist_free(list); |
9 | 975 } |
976 else | |
977 { | |
138 | 978 real_view_window_new(fd, NULL, NULL, NULL); |
9 | 979 } |
980 } | |
981 | |
982 void view_window_new_from_list(GList *list) | |
983 { | |
984 real_view_window_new(NULL, list, NULL, NULL); | |
985 } | |
986 | |
987 void view_window_new_from_collection(CollectionData *cd, CollectInfo *info) | |
988 { | |
989 real_view_window_new(NULL, NULL, cd, info); | |
990 } | |
991 | |
992 /* | |
993 *----------------------------------------------------------------------------- | |
994 * public | |
995 *----------------------------------------------------------------------------- | |
996 */ | |
997 | |
998 void view_window_colors_update(void) | |
999 { | |
1000 GList *work; | |
1 | 1001 |
9 | 1002 work = view_window_list; |
1003 while (work) | |
1004 { | |
1005 ViewWindow *vw = work->data; | |
1006 work = work->next; | |
1007 | |
339
de1c2cd06fce
Rename user_specified_window_background and window_background_color
zas_
parents:
334
diff
changeset
|
1008 image_background_set_color(vw->imd, options->image.use_custom_border_color ? &options->image.border_color : NULL); |
9 | 1009 } |
1010 } | |
1011 | |
1012 gint view_window_find_image(ImageWindow *imd, gint *index, gint *total) | |
1013 { | |
1014 GList *work; | |
1015 | |
1016 work = view_window_list; | |
1017 while (work) | |
1018 { | |
1019 ViewWindow *vw = work->data; | |
1020 work = work->next; | |
1021 | |
1022 if (vw->imd == imd || | |
1023 (vw->fs && vw->fs->imd == imd)) | |
1024 { | |
1025 if (vw->ss) | |
1026 { | |
1027 gint n; | |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1028 gint t; |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1029 |
9 | 1030 n = g_list_length(vw->ss->list_done); |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1031 t = n + g_list_length(vw->ss->list); |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1032 if (n == 0) n = t; |
9 | 1033 if (index) *index = n - 1; |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1034 if (total) *total = t; |
9 | 1035 } |
1036 else | |
1037 { | |
1038 if (index) *index = g_list_position(vw->list, vw->list_pointer); | |
1039 if (total) *total = g_list_length(vw->list); | |
1040 } | |
1041 return TRUE; | |
1042 } | |
1043 } | |
1044 | |
1045 return FALSE; | |
1 | 1046 } |
1047 | |
1048 /* | |
1049 *----------------------------------------------------------------------------- | |
1050 * view window menu routines and callbacks | |
1051 *----------------------------------------------------------------------------- | |
442 | 1052 */ |
1 | 1053 |
9 | 1054 static void view_new_window_cb(GtkWidget *widget, gpointer data) |
1 | 1055 { |
9 | 1056 ViewWindow *vw = data; |
1057 CollectionData *cd; | |
1058 CollectInfo *info; | |
1059 | |
1060 cd = image_get_collection(vw->imd, &info); | |
1061 | |
1062 if (cd && info) | |
1063 { | |
1064 view_window_new_from_collection(cd, info); | |
1065 } | |
1066 else | |
1067 { | |
138 | 1068 view_window_new(image_get_fd(vw->imd)); |
9 | 1069 } |
1 | 1070 } |
1071 | |
9 | 1072 static void view_edit_cb(GtkWidget *widget, gpointer data) |
1 | 1073 { |
9 | 1074 ViewWindow *vw; |
60
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1075 ImageWindow *imd; |
9 | 1076 gint n; |
1077 | |
1078 vw = submenu_item_get_data(widget); | |
1079 n = GPOINTER_TO_INT(data); | |
1080 if (!vw) return; | |
1081 | |
60
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1082 if (!editor_window_flag_set(n)) |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1083 { |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1084 view_fullscreen_toggle(vw, TRUE); |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1085 } |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1086 |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1087 imd = view_window_active_image(vw); |
753 | 1088 file_util_start_editor_from_file(n, image_get_fd(imd), imd->widget); |
1 | 1089 } |
1090 | |
9 | 1091 static void view_alter_cb(GtkWidget *widget, gpointer data) |
1092 { | |
1093 ViewWindow *vw; | |
1094 AlterType type; | |
1095 | |
1096 vw = submenu_item_get_data(widget); | |
1097 type = GPOINTER_TO_INT(data); | |
1098 | |
1099 if (!vw) return; | |
1100 image_alter(vw->imd, type); | |
1101 } | |
1102 | |
1103 static void view_info_cb(GtkWidget *widget, gpointer data) | |
3 | 1104 { |
9 | 1105 ViewWindow *vw = data; |
1106 ImageWindow *imd; | |
1107 | |
1108 imd = view_window_active_image(vw); | |
479
5212d4fed37f
Ensure Properties dialog is displayed above fullscreen window.
zas_
parents:
475
diff
changeset
|
1109 info_window_new(image_get_fd(imd), NULL, vw->fs ? vw->fs->window : NULL); |
9 | 1110 } |
1111 | |
1112 static void view_wallpaper_cb(GtkWidget *widget, gpointer data) | |
1113 { | |
1114 ViewWindow *vw = data; | |
1115 ImageWindow *imd; | |
1116 | |
1117 imd = view_window_active_image(vw); | |
1118 image_to_root_window(imd, (image_zoom_get(imd) == 0.0)); | |
3 | 1119 } |
1120 | |
1 | 1121 static void view_zoom_in_cb(GtkWidget *widget, gpointer data) |
1122 { | |
9 | 1123 ViewWindow *vw = data; |
1124 | |
1125 image_zoom_adjust(view_window_active_image(vw), get_zoom_increment()); | |
1 | 1126 } |
1127 | |
1128 static void view_zoom_out_cb(GtkWidget *widget, gpointer data) | |
1129 { | |
9 | 1130 ViewWindow *vw = data; |
1131 | |
1132 image_zoom_adjust(view_window_active_image(vw), -get_zoom_increment()); | |
1 | 1133 } |
1134 | |
1135 static void view_zoom_1_1_cb(GtkWidget *widget, gpointer data) | |
1136 { | |
9 | 1137 ViewWindow *vw = data; |
1138 | |
1139 image_zoom_set(view_window_active_image(vw), 1.0); | |
1 | 1140 } |
1141 | |
1142 static void view_zoom_fit_cb(GtkWidget *widget, gpointer data) | |
1143 { | |
9 | 1144 ViewWindow *vw = data; |
1145 | |
1146 image_zoom_set(view_window_active_image(vw), 0.0); | |
1 | 1147 } |
1148 | |
1149 static void view_copy_cb(GtkWidget *widget, gpointer data) | |
1150 { | |
9 | 1151 ViewWindow *vw = data; |
1152 ImageWindow *imd; | |
1153 | |
1154 imd = view_window_active_image(vw); | |
138 | 1155 file_util_copy(image_get_fd(imd), NULL, NULL, imd->widget); |
1 | 1156 } |
1157 | |
1158 static void view_move_cb(GtkWidget *widget, gpointer data) | |
1159 { | |
9 | 1160 ViewWindow *vw = data; |
1161 ImageWindow *imd; | |
1162 | |
1163 imd = view_window_active_image(vw); | |
138 | 1164 file_util_move(image_get_fd(imd), NULL, NULL, imd->widget); |
1 | 1165 } |
1166 | |
1167 static void view_rename_cb(GtkWidget *widget, gpointer data) | |
1168 { | |
9 | 1169 ViewWindow *vw = data; |
1170 ImageWindow *imd; | |
1171 | |
1172 imd = view_window_active_image(vw); | |
138 | 1173 file_util_rename(image_get_fd(imd), NULL, imd->widget); |
1 | 1174 } |
1175 | |
1176 static void view_delete_cb(GtkWidget *widget, gpointer data) | |
1177 { | |
9 | 1178 ViewWindow *vw = data; |
1179 ImageWindow *imd; | |
1180 | |
1181 imd = view_window_active_image(vw); | |
138 | 1182 file_util_delete(image_get_fd(imd), NULL, imd->widget); |
9 | 1183 } |
1184 | |
497 | 1185 static void view_copy_path_cb(GtkWidget *widget, gpointer data) |
1186 { | |
1187 ViewWindow *vw = data; | |
1188 ImageWindow *imd; | |
1189 | |
1190 imd = view_window_active_image(vw); | |
1191 file_util_copy_path_to_clipboard(image_get_fd(imd)); | |
1192 } | |
1193 | |
9 | 1194 static void view_fullscreen_cb(GtkWidget *widget, gpointer data) |
1195 { | |
1196 ViewWindow *vw = data; | |
1197 | |
1198 view_fullscreen_toggle(vw, FALSE); | |
1199 } | |
1200 | |
1201 static void view_slideshow_start_cb(GtkWidget *widget, gpointer data) | |
1202 { | |
1203 ViewWindow *vw = data; | |
1204 | |
1205 view_slideshow_start(vw); | |
1206 } | |
1207 | |
1208 static void view_slideshow_stop_cb(GtkWidget *widget, gpointer data) | |
1209 { | |
1210 ViewWindow *vw = data; | |
1211 | |
1212 view_slideshow_stop(vw); | |
1213 } | |
1214 | |
1215 static void view_slideshow_pause_cb(GtkWidget *widget, gpointer data) | |
1216 { | |
1217 ViewWindow *vw = data; | |
1218 | |
1219 slideshow_pause_toggle(vw->ss); | |
1 | 1220 } |
1221 | |
1222 static void view_close_cb(GtkWidget *widget, gpointer data) | |
1223 { | |
9 | 1224 ViewWindow *vw = data; |
1225 | |
1226 view_window_close(vw); | |
1227 } | |
1228 | |
783 | 1229 static LayoutWindow *view_new_layout_with_fd(FileData *fd) |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1230 { |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1231 LayoutWindow *nw; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1232 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1233 nw = layout_new(NULL, FALSE, FALSE); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1234 layout_sort_set(nw, options->file_sort.method, options->file_sort.ascending); |
783 | 1235 layout_set_fd(nw, fd); |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1236 return nw; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1237 } |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1238 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1239 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1240 static void view_set_layout_path_cb(GtkWidget *widget, gpointer data) |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1241 { |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1242 ViewWindow *vw = data; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1243 LayoutWindow *lw; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1244 ImageWindow *imd; |
442 | 1245 |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1246 imd = view_window_active_image(vw); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1247 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1248 if (!imd || !imd->image_fd) return; |
442 | 1249 |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1250 lw = layout_find_by_image_fd(imd); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1251 if (lw) |
783 | 1252 layout_set_fd(lw, imd->image_fd); |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1253 else |
783 | 1254 view_new_layout_with_fd(imd->image_fd); |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1255 view_window_close(vw); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1256 } |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1257 |
9 | 1258 static GtkWidget *view_popup_menu(ViewWindow *vw) |
1259 { | |
1260 GtkWidget *menu; | |
1261 GtkWidget *item; | |
1262 | |
1263 menu = popup_menu_short_lived(); | |
1264 | |
1265 menu_item_add_stock(menu, _("Zoom _in"), GTK_STOCK_ZOOM_IN, G_CALLBACK(view_zoom_in_cb), vw); | |
1266 menu_item_add_stock(menu, _("Zoom _out"), GTK_STOCK_ZOOM_OUT, G_CALLBACK(view_zoom_out_cb), vw); | |
1267 menu_item_add_stock(menu, _("Zoom _1:1"), GTK_STOCK_ZOOM_100, G_CALLBACK(view_zoom_1_1_cb), vw); | |
1268 menu_item_add_stock(menu, _("Fit image to _window"), GTK_STOCK_ZOOM_FIT, G_CALLBACK(view_zoom_fit_cb), vw); | |
1269 menu_item_add_divider(menu); | |
1270 | |
1271 item = submenu_add_edit(menu, NULL, G_CALLBACK(view_edit_cb), vw); | |
1272 menu_item_add_divider(item); | |
1273 menu_item_add(item, _("Set as _wallpaper"), G_CALLBACK(view_wallpaper_cb), vw); | |
1274 | |
1275 submenu_add_alter(menu, G_CALLBACK(view_alter_cb), vw); | |
1276 | |
1277 menu_item_add_stock(menu, _("_Properties"), GTK_STOCK_PROPERTIES, G_CALLBACK(view_info_cb), vw); | |
1278 | |
1279 menu_item_add_stock(menu, _("View in _new window"), GTK_STOCK_NEW, G_CALLBACK(view_new_window_cb), vw); | |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1280 item = menu_item_add(menu, _("_Go to directory view"), G_CALLBACK(view_set_layout_path_cb), vw); |
9 | 1281 |
1282 menu_item_add_divider(menu); | |
1283 menu_item_add_stock(menu, _("_Copy..."), GTK_STOCK_COPY, G_CALLBACK(view_copy_cb), vw); | |
1284 menu_item_add(menu, _("_Move..."), G_CALLBACK(view_move_cb), vw); | |
1285 menu_item_add(menu, _("_Rename..."), G_CALLBACK(view_rename_cb), vw); | |
1286 menu_item_add_stock(menu, _("_Delete..."), GTK_STOCK_DELETE, G_CALLBACK(view_delete_cb), vw); | |
497 | 1287 if (options->show_copy_path) |
1288 menu_item_add(menu, _("_Copy path"), G_CALLBACK(view_copy_path_cb), vw); | |
9 | 1289 |
1290 menu_item_add_divider(menu); | |
1291 | |
1292 if (vw->ss) | |
1293 { | |
1294 menu_item_add(menu, _("_Stop slideshow"), G_CALLBACK(view_slideshow_stop_cb), vw); | |
1295 if (slideshow_paused(vw->ss)) | |
1296 { | |
1297 item = menu_item_add(menu, _("Continue slides_how"), | |
1298 G_CALLBACK(view_slideshow_pause_cb), vw); | |
1299 } | |
1300 else | |
1301 { | |
1302 item = menu_item_add(menu, _("Pause slides_how"), | |
1303 G_CALLBACK(view_slideshow_pause_cb), vw); | |
1304 } | |
1305 } | |
1306 else | |
1307 { | |
1308 item = menu_item_add(menu, _("_Start slideshow"), G_CALLBACK(view_slideshow_start_cb), vw); | |
1309 gtk_widget_set_sensitive(item, (vw->list != NULL) || view_window_contains_collection(vw)); | |
1310 item = menu_item_add(menu, _("Pause slides_how"), G_CALLBACK(view_slideshow_pause_cb), vw); | |
1311 gtk_widget_set_sensitive(item, FALSE); | |
1312 } | |
1313 | |
1314 if (vw->fs) | |
1315 { | |
1316 menu_item_add(menu, _("Exit _full screen"), G_CALLBACK(view_fullscreen_cb), vw); | |
1317 } | |
1318 else | |
1319 { | |
1320 menu_item_add(menu, _("_Full screen"), G_CALLBACK(view_fullscreen_cb), vw); | |
1321 } | |
1322 | |
1323 menu_item_add_divider(menu); | |
1324 menu_item_add_stock(menu, _("C_lose window"), GTK_STOCK_CLOSE, G_CALLBACK(view_close_cb), vw); | |
1325 | |
1326 return menu; | |
1327 } | |
1328 | |
1329 /* | |
1330 *------------------------------------------------------------------- | |
1331 * dnd confirm dir | |
1332 *------------------------------------------------------------------- | |
1333 */ | |
1334 | |
1335 typedef struct { | |
1336 ViewWindow *vw; | |
1337 GList *list; | |
1338 } CViewConfirmD; | |
1339 | |
1340 static void view_dir_list_cancel(GtkWidget *widget, gpointer data) | |
1341 { | |
1342 /* do nothing */ | |
1343 } | |
1344 | |
1345 static void view_dir_list_do(ViewWindow *vw, GList *list, gint skip, gint recurse) | |
1346 { | |
1347 GList *work; | |
1348 | |
1349 view_window_set_list(vw, NULL); | |
1350 | |
1351 work = list; | |
1352 while (work) | |
1353 { | |
138 | 1354 FileData *fd = work->data; |
9 | 1355 work = work->next; |
1356 | |
138 | 1357 if (isdir(fd->path)) |
9 | 1358 { |
1359 if (!skip) | |
1360 { | |
1361 GList *list = NULL; | |
1362 | |
1363 if (recurse) | |
1364 { | |
783 | 1365 list = filelist_recursive(fd); |
9 | 1366 } |
1367 else | |
138 | 1368 { /*FIXME */ |
783 | 1369 filelist_read(fd, &list, NULL); |
138 | 1370 list = filelist_sort_path(list); |
1371 list = filelist_filter(list, FALSE); | |
9 | 1372 } |
1373 if (list) vw->list = g_list_concat(vw->list, list); | |
1374 } | |
1375 } | |
1376 else | |
1377 { | |
1378 /* FIXME: no filtering here */ | |
138 | 1379 vw->list = g_list_append(vw->list, file_data_ref(fd)); |
9 | 1380 } |
1381 } | |
1382 | |
1383 if (vw->list) | |
1384 { | |
138 | 1385 FileData *fd; |
9 | 1386 |
1387 vw->list_pointer = vw->list; | |
138 | 1388 fd = vw->list->data; |
334 | 1389 image_change_fd(vw->imd, fd, image_zoom_get_default(vw->imd, options->image.zoom_mode)); |
9 | 1390 |
1391 work = vw->list->next; | |
334 | 1392 if (options->image.enable_read_ahead && work) |
9 | 1393 { |
138 | 1394 fd = work->data; |
1395 image_prebuffer_set(vw->imd, fd); | |
9 | 1396 } |
1397 } | |
1398 else | |
1399 { | |
334 | 1400 image_change_fd(vw->imd, NULL, image_zoom_get_default(vw->imd, options->image.zoom_mode)); |
9 | 1401 } |
1402 } | |
1403 | |
1404 static void view_dir_list_add(GtkWidget *widget, gpointer data) | |
1405 { | |
1406 CViewConfirmD *d = data; | |
1407 view_dir_list_do(d->vw, d->list, FALSE, FALSE); | |
1408 } | |
1409 | |
1410 static void view_dir_list_recurse(GtkWidget *widget, gpointer data) | |
1411 { | |
1412 CViewConfirmD *d = data; | |
1413 view_dir_list_do(d->vw, d->list, FALSE, TRUE); | |
1414 } | |
1415 | |
1416 static void view_dir_list_skip(GtkWidget *widget, gpointer data) | |
1417 { | |
1418 CViewConfirmD *d = data; | |
1419 view_dir_list_do(d->vw, d->list, TRUE, FALSE); | |
1420 } | |
1421 | |
1422 static void view_dir_list_destroy(GtkWidget *widget, gpointer data) | |
1423 { | |
1424 CViewConfirmD *d = data; | |
442 | 1425 filelist_free(d->list); |
1426 g_free(d); | |
9 | 1427 } |
1428 | |
1429 static GtkWidget *view_confirm_dir_list(ViewWindow *vw, GList *list) | |
1430 { | |
1431 GtkWidget *menu; | |
1432 CViewConfirmD *d; | |
1433 | |
1434 d = g_new(CViewConfirmD, 1); | |
1435 d->vw = vw; | |
1436 d->list = list; | |
1437 | |
1438 menu = popup_menu_short_lived(); | |
1439 g_signal_connect(G_OBJECT(menu), "destroy", | |
1440 G_CALLBACK(view_dir_list_destroy), d); | |
1441 | |
1442 menu_item_add_stock(menu, _("Dropped list includes folders."), GTK_STOCK_DND_MULTIPLE, NULL, NULL); | |
1443 menu_item_add_divider(menu); | |
1444 menu_item_add_stock(menu, _("_Add contents"), GTK_STOCK_OK, G_CALLBACK(view_dir_list_add), d); | |
1445 menu_item_add_stock(menu, _("Add contents _recursive"), GTK_STOCK_ADD, G_CALLBACK(view_dir_list_recurse), d); | |
1446 menu_item_add_stock(menu, _("_Skip folders"), GTK_STOCK_REMOVE, G_CALLBACK(view_dir_list_skip), d); | |
1447 menu_item_add_divider(menu); | |
1448 menu_item_add_stock(menu, _("Cancel"), GTK_STOCK_CANCEL, G_CALLBACK(view_dir_list_cancel), d); | |
1449 | |
1450 return menu; | |
1 | 1451 } |
1452 | |
9 | 1453 /* |
1454 *----------------------------------------------------------------------------- | |
1455 * image drag and drop routines | |
1456 *----------------------------------------------------------------------------- | |
1457 */ | |
1458 | |
1459 static void view_window_get_dnd_data(GtkWidget *widget, GdkDragContext *context, | |
1460 gint x, gint y, | |
1461 GtkSelectionData *selection_data, guint info, | |
1462 guint time, gpointer data) | |
1 | 1463 { |
9 | 1464 ViewWindow *vw = data; |
1465 ImageWindow *imd; | |
1466 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1467 if (gtk_drag_get_source_widget(context) == vw->imd->pr) return; |
9 | 1468 |
1469 imd = vw->imd; | |
1470 | |
1471 if (info == TARGET_URI_LIST || info == TARGET_APP_COLLECTION_MEMBER) | |
1472 { | |
1473 CollectionData *source; | |
1474 GList *list; | |
1475 GList *info_list; | |
1476 | |
1477 if (info == TARGET_URI_LIST) | |
1478 { | |
1479 GList *work; | |
1480 | |
138 | 1481 list = uri_filelist_from_text((gchar *)selection_data->data, TRUE); |
9 | 1482 |
1483 work = list; | |
1484 while (work) | |
1485 { | |
138 | 1486 FileData *fd = work->data; |
1487 if (isdir(fd->path)) | |
9 | 1488 { |
1489 GtkWidget *menu; | |
1490 menu = view_confirm_dir_list(vw, list); | |
1491 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, time); | |
1492 return; | |
1493 } | |
1494 work = work->next; | |
1495 } | |
1496 | |
138 | 1497 list = filelist_filter(list, FALSE); |
9 | 1498 |
1499 source = NULL; | |
1500 info_list = NULL; | |
1501 } | |
1502 else | |
1503 { | |
1504 source = collection_from_dnd_data((gchar *)selection_data->data, &list, &info_list); | |
1505 } | |
1506 | |
1507 if (list) | |
1508 { | |
138 | 1509 FileData *fd; |
9 | 1510 |
138 | 1511 fd = list->data; |
1512 if (isfile(fd->path)) | |
9 | 1513 { |
1514 view_slideshow_stop(vw); | |
1515 view_window_set_list(vw, NULL); | |
1 | 1516 |
9 | 1517 if (source && info_list) |
1518 { | |
334 | 1519 image_change_from_collection(imd, source, info_list->data, image_zoom_get_default(imd, options->image.zoom_mode)); |
9 | 1520 } |
1521 else | |
1522 { | |
1523 if (list->next) | |
1524 { | |
1525 vw->list = list; | |
1526 list = NULL; | |
1527 | |
1528 vw->list_pointer = vw->list; | |
1529 } | |
334 | 1530 image_change_fd(imd, fd, image_zoom_get_default(imd, options->image.zoom_mode)); |
9 | 1531 } |
1532 } | |
1533 } | |
138 | 1534 filelist_free(list); |
9 | 1535 g_list_free(info_list); |
1536 } | |
1537 } | |
1538 | |
1539 static void view_window_set_dnd_data(GtkWidget *widget, GdkDragContext *context, | |
1540 GtkSelectionData *selection_data, guint info, | |
1541 guint time, gpointer data) | |
1542 { | |
1543 ViewWindow *vw = data; | |
138 | 1544 FileData *fd; |
9 | 1545 |
138 | 1546 fd = image_get_fd(vw->imd); |
1 | 1547 |
138 | 1548 if (fd) |
9 | 1549 { |
1550 gchar *text = NULL; | |
1551 gint len; | |
1552 gint plain_text; | |
1553 GList *list; | |
1 | 1554 |
9 | 1555 switch (info) |
1556 { | |
1557 case TARGET_URI_LIST: | |
1558 plain_text = FALSE; | |
1559 break; | |
1560 case TARGET_TEXT_PLAIN: | |
1561 default: | |
1562 plain_text = TRUE; | |
1563 break; | |
1564 } | |
138 | 1565 list = g_list_append(NULL, fd); |
1566 text = uri_text_from_filelist(list, &len, plain_text); | |
9 | 1567 g_list_free(list); |
1568 if (text) | |
1569 { | |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
497
diff
changeset
|
1570 gtk_selection_data_set(selection_data, selection_data->target, |
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
497
diff
changeset
|
1571 8, (guchar *)text, len); |
9 | 1572 g_free(text); |
1573 } | |
1574 } | |
1575 else | |
1576 { | |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
497
diff
changeset
|
1577 gtk_selection_data_set(selection_data, selection_data->target, |
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
497
diff
changeset
|
1578 8, NULL, 0); |
9 | 1579 } |
1 | 1580 } |
1581 | |
9 | 1582 static void view_window_dnd_init(ViewWindow *vw) |
1583 { | |
1584 ImageWindow *imd; | |
1 | 1585 |
9 | 1586 imd = vw->imd; |
1587 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1588 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK, |
9 | 1589 dnd_file_drag_types, dnd_file_drag_types_count, |
1590 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1591 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get", |
9 | 1592 G_CALLBACK(view_window_set_dnd_data), vw); |
1593 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1594 gtk_drag_dest_set(imd->pr, |
9 | 1595 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, |
1596 dnd_file_drop_types, dnd_file_drop_types_count, | |
442 | 1597 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1598 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received", |
9 | 1599 G_CALLBACK(view_window_get_dnd_data), vw); |
1600 } | |
1601 | |
1602 /* | |
1603 *----------------------------------------------------------------------------- | |
1604 * maintenance (for rename, move, remove) | |
1605 *----------------------------------------------------------------------------- | |
1606 */ | |
1607 | |
797 | 1608 static void view_real_removed(ViewWindow *vw, FileData *fd) |
9 | 1609 { |
1610 ImageWindow *imd; | |
138 | 1611 FileData *image_fd; |
9 | 1612 |
1613 imd = view_window_active_image(vw); | |
138 | 1614 image_fd = image_get_fd(imd); |
9 | 1615 |
138 | 1616 if (image_fd && image_fd == fd) |
9 | 1617 { |
1618 if (vw->list) | |
1619 { | |
1620 view_list_step(vw, TRUE); | |
138 | 1621 if (image_get_fd(imd) == image_fd) |
9 | 1622 { |
1623 view_list_step(vw, FALSE); | |
1624 } | |
1625 } | |
1626 else if (view_window_contains_collection(vw)) | |
1627 { | |
1628 view_collection_step(vw, TRUE); | |
138 | 1629 if (image_get_fd(imd) == image_fd) |
9 | 1630 { |
1631 view_collection_step(vw, FALSE); | |
1632 } | |
1633 } | |
138 | 1634 if (image_get_fd(imd) == image_fd) |
9 | 1635 { |
334 | 1636 image_change_fd(imd, NULL, image_zoom_get_default(imd, options->image.zoom_mode)); |
9 | 1637 } |
1638 } | |
1639 | |
1640 if (vw->list) | |
1641 { | |
1642 GList *work; | |
1643 GList *old; | |
1644 | |
1645 old = vw->list_pointer; | |
1646 | |
1647 work = vw->list; | |
1648 while (work) | |
1649 { | |
138 | 1650 FileData *chk_fd; |
9 | 1651 GList *chk_link; |
1652 | |
138 | 1653 chk_fd = work->data; |
9 | 1654 chk_link = work; |
1655 work = work->next; | |
1656 | |
138 | 1657 if (chk_fd == fd) |
9 | 1658 { |
1659 if (vw->list_pointer == chk_link) | |
1660 { | |
1661 vw->list_pointer = (chk_link->next) ? chk_link->next : chk_link->prev; | |
1662 } | |
138 | 1663 vw->list = g_list_remove(vw->list, chk_fd); |
1664 file_data_unref(chk_fd); | |
9 | 1665 } |
1666 } | |
1667 | |
1668 /* handles stepping correctly when same image is in the list more than once */ | |
1669 if (old && old != vw->list_pointer) | |
1670 { | |
138 | 1671 FileData *fd; |
9 | 1672 |
1673 if (vw->list_pointer) | |
1674 { | |
138 | 1675 fd = vw->list_pointer->data; |
9 | 1676 } |
1677 else | |
1678 { | |
138 | 1679 fd = NULL; |
9 | 1680 } |
1681 | |
334 | 1682 image_change_fd(imd, fd, image_zoom_get_default(imd, options->image.zoom_mode)); |
9 | 1683 } |
1684 } | |
1685 | |
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
94
diff
changeset
|
1686 image_osd_update(imd); |
9 | 1687 } |
1688 | |
797 | 1689 static void view_window_notify_cb(FileData *fd, NotifyType type, gpointer data) |
9 | 1690 { |
797 | 1691 ViewWindow *vw = data; |
9 | 1692 |
803 | 1693 if (type != NOTIFY_TYPE_CHANGE || !fd->change) return; |
797 | 1694 |
1695 switch(fd->change->type) | |
9 | 1696 { |
797 | 1697 case FILEDATA_CHANGE_MOVE: |
1698 case FILEDATA_CHANGE_RENAME: | |
1699 break; | |
1700 case FILEDATA_CHANGE_COPY: | |
1701 break; | |
1702 case FILEDATA_CHANGE_DELETE: | |
1703 view_real_removed(vw, fd); | |
1704 break; | |
1705 case FILEDATA_CHANGE_UNSPECIFIED: | |
1706 break; | |
9 | 1707 } |
1708 } |