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