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