annotate src/slideshow.c @ 1333:bdc19836c33d

Really fix up color profiles options tests. Add an indicator of the embedded color profile when recognized (a * just after sRGB or AdobeRGB compatible).
author zas_
date Fri, 27 Feb 2009 23:25:31 +0000
parents 8b89e3ff286b
children 249bf204004a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 138
diff changeset
2 * Geeqie
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
3 * (C) 2004 John Ellis
1284
8b89e3ff286b Add year 2009 to copyright info everywhere.
zas_
parents: 1281
diff changeset
4 * Copyright (C) 2008 - 2009 The Geeqie Team
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
5 *
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
6 * Author: John Ellis
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
7 *
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
11 */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
12
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
13
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 196
diff changeset
14 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
15 #include "collect.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
16 #include "image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
17 #include "slideshow.h"
586
905688aa2317 split filelist.c to filefilter.c and filedata.c
nadvornik
parents: 517
diff changeset
18 #include "filedata.h"
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
19
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
20 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
21 #include "layout_image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
22 #include "ui_fileops.h"
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
23
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
24
744
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
25 static void slideshow_timer_stop(SlideShowData *ss);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
26
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
27
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
28 void slideshow_free(SlideShowData *ss)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
29 {
89
b3149a34d0dd Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
30 if (!ss) return;
b3149a34d0dd Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
31
744
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
32 slideshow_timer_stop(ss);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
33
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
34 if (ss->stop_func) ss->stop_func(ss, ss->stop_data);
3
gqview
parents: 1
diff changeset
35
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
36 if (ss->filelist) filelist_free(ss->filelist);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
37 if (ss->cd) collection_unref(ss->cd);
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 745
diff changeset
38 file_data_unref(ss->dir_fd);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
39
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
40 g_list_free(ss->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
41 g_list_free(ss->list_done);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
42
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
43 file_data_unref(ss->slide_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
44
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
45 g_free(ss);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
46 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
47
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
48 static GList *generate_list(SlideShowData *ss)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
49 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
50 GList *list = NULL;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
51
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
52 if (ss->from_selection)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
53 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
54 list = layout_selection_list_by_index(ss->layout);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
55 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
56 else
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
57 {
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 586
diff changeset
58 guint i;
517
d84f2210a73c 6 for() vs 201 for (): winner is for ().
zas_
parents: 516
diff changeset
59 for (i = 0; i < ss->slide_count; i++)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
60 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
61 list = g_list_prepend(list, GINT_TO_POINTER(i));
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
62 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
63 list = g_list_reverse(list);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
64 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
65
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
66 return list;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
67 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
68
1281
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
69 static void ptr_array_add(gpointer data, GPtrArray *array)
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
70 {
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
71 g_ptr_array_add(array, data);
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
72 }
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
73
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
74 static void list_prepend(gpointer data, GList **list)
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
75 {
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
76 *list = g_list_prepend(*list, data);
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
77 }
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
78
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
79 static GPtrArray *generate_ptr_array_from_list(GList *src_list)
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
80 {
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
81 GPtrArray *arr = g_ptr_array_sized_new(g_list_length(src_list));
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
82
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
83 g_list_foreach(src_list, (GFunc) ptr_array_add, arr);
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
84
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
85 return arr;
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
86 }
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
87
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
88 static void swap(GPtrArray *array, guint index1, guint index2)
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
89 {
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
90 gpointer temp = g_ptr_array_index(array, index1);
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
91
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
92 g_ptr_array_index(array, index1) = g_ptr_array_index(array, index2);
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
93 g_ptr_array_index(array, index2) = temp;
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
94 }
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
95
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
96 static void ptr_array_random_shuffle(GPtrArray *array)
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
97 {
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
98 guint i;
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
99 for (i = 0; i < array->len; ++i)
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
100 {
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
101 guint p = (double)rand() / ((double)RAND_MAX + 1.0) * array->len;
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
102 swap(array, i, p);
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
103 }
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
104 }
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
105
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
106 static GList *generate_random_list(SlideShowData *ss)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
107 {
1281
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
108 GList *src_list;
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
109 GPtrArray *src_array;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
110 GList *list = NULL;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
111
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
112 src_list = generate_list(ss);
1281
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
113 src_array = generate_ptr_array_from_list(src_list);
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
114 g_list_free(src_list);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
115
1281
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
116 ptr_array_random_shuffle(src_array);
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
117 g_ptr_array_foreach(src_array, (GFunc) list_prepend, &list);
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
118 g_ptr_array_free(src_array, TRUE);
f539958d7bd8 Speed up random slideshow, startup time decreases from minutes to seconds when amount of images is big. Patch by Kjell Morgenstern.
zas_
parents: 1055
diff changeset
119
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
120 return list;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
121 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
122
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
123 static void slideshow_list_init(SlideShowData *ss, gint start_index)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
124 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
125 if (ss->list_done)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
126 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
127 g_list_free(ss->list_done);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
128 ss->list_done = NULL;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
129 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
130
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
131 if (ss->list) g_list_free(ss->list);
3
gqview
parents: 1
diff changeset
132
326
509b84801d66 Rename slideshow options.
zas_
parents: 318
diff changeset
133 if (options->slideshow.random)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
134 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
135 ss->list = generate_random_list(ss);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
136 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
137 else
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
138 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
139 ss->list = generate_list(ss);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
140 if (start_index >= 0)
3
gqview
parents: 1
diff changeset
141 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
142 /* start with specified image by skipping to it */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
143 gint i = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
144
516
b7e99bfeadc9 Convert the minority of while() to while ().
zas_
parents: 513
diff changeset
145 while (ss->list && i < start_index)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
146 {
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 475
diff changeset
147 ss->list_done = g_list_prepend(ss->list_done, ss->list->data);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
148 ss->list = g_list_remove(ss->list, ss->list->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
149 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
150 }
3
gqview
parents: 1
diff changeset
151 }
gqview
parents: 1
diff changeset
152 }
gqview
parents: 1
diff changeset
153 }
gqview
parents: 1
diff changeset
154
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
155 gint slideshow_should_continue(SlideShowData *ss)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
156 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
157 FileData *imd_fd;
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 745
diff changeset
158 FileData *dir_fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
159
89
b3149a34d0dd Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
160 if (!ss) return FALSE;
b3149a34d0dd Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
161
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
162 imd_fd = image_get_fd(ss->imd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
163
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
164 if ( ((imd_fd == NULL) != (ss->slide_fd == NULL)) ||
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
165 (imd_fd && ss->slide_fd && imd_fd != ss->slide_fd) ) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
166
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
167 if (ss->filelist) return TRUE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
168
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
169 if (ss->cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
170 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
171 if (g_list_length(ss->cd->list) == ss->slide_count)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
172 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
173 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
174 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
175 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
176
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
177 if (!ss->layout) return FALSE;
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 745
diff changeset
178 dir_fd = ss->layout->dir_fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
179
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 745
diff changeset
180 if (dir_fd && ss->dir_fd && dir_fd == ss->dir_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
181 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
182 if (ss->from_selection && ss->slide_count == layout_selection_count(ss->layout, NULL)) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
183 if (!ss->from_selection && ss->slide_count == layout_list_count(ss->layout, NULL)) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
184 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
185
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
186 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
187 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
188
745
41dc324ee014 slideshow_next(), slideshow_prev(): move code to common slideshow_move(), reducing code redundancy.
zas_
parents: 744
diff changeset
189 static gint slideshow_step(SlideShowData *ss, gboolean forward)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
190 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
191 gint row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
192
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
193 if (!slideshow_should_continue(ss))
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
194 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
195 return FALSE;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
196 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
197
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
198 if (forward)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
199 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
200 if (!ss->list) return TRUE;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
201
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
202 row = GPOINTER_TO_INT(ss->list->data);
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 475
diff changeset
203 ss->list_done = g_list_prepend(ss->list_done, ss->list->data);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
204 ss->list = g_list_remove(ss->list, ss->list->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
205 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
206 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
207 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
208 if (!ss->list_done || !ss->list_done->next) return TRUE;
3
gqview
parents: 1
diff changeset
209
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
210 ss->list = g_list_prepend(ss->list, ss->list_done->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
211 ss->list_done = g_list_remove(ss->list_done, ss->list_done->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
212 row = GPOINTER_TO_INT(ss->list_done->data);
3
gqview
parents: 1
diff changeset
213 }
gqview
parents: 1
diff changeset
214
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
215 file_data_unref(ss->slide_fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
216 ss->slide_fd = NULL;
3
gqview
parents: 1
diff changeset
217
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
218 if (ss->filelist)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
219 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
220 ss->slide_fd = file_data_ref((FileData *)g_list_nth_data(ss->filelist, row));
885
ad420f2eb789 Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents: 783
diff changeset
221 image_change_fd(ss->imd, ss->slide_fd, image_zoom_get_default(ss->imd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
222 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
223 else if (ss->cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
224 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
225 CollectInfo *info;
3
gqview
parents: 1
diff changeset
226
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
227 info = g_list_nth_data(ss->cd->list, row);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
228 ss->slide_fd = file_data_ref(info->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
229
885
ad420f2eb789 Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents: 783
diff changeset
230 image_change_from_collection(ss->imd, ss->cd, info, image_zoom_get_default(ss->imd));
3
gqview
parents: 1
diff changeset
231 }
gqview
parents: 1
diff changeset
232 else
gqview
parents: 1
diff changeset
233 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
234 ss->slide_fd = file_data_ref(layout_list_get_fd(ss->layout, row));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
235
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
236 if (ss->from_selection)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
237 {
885
ad420f2eb789 Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents: 783
diff changeset
238 image_change_fd(ss->imd, ss->slide_fd, image_zoom_get_default(ss->imd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
239 layout_status_update_info(ss->layout, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
240 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
241 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
242 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
243 layout_image_set_index(ss->layout, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
244 }
3
gqview
parents: 1
diff changeset
245 }
gqview
parents: 1
diff changeset
246
326
509b84801d66 Rename slideshow options.
zas_
parents: 318
diff changeset
247 if (!ss->list && options->slideshow.repeat)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
248 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
249 slideshow_list_init(ss, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
250 }
3
gqview
parents: 1
diff changeset
251
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
252 if (!ss->list)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
253 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
254 return FALSE;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
255 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
256
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
257 /* read ahead */
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
258
334
df868b947aa0 Rename image-related options.
zas_
parents: 326
diff changeset
259 if (options->image.enable_read_ahead)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
260 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
261 gint r;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
262 if (forward)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
263 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
264 if (!ss->list) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
265 r = GPOINTER_TO_INT(ss->list->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
266 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
267 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
268 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
269 if (!ss->list_done || !ss->list_done->next) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
270 r = GPOINTER_TO_INT(ss->list_done->next->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
271 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
272
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
273 if (ss->filelist)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
274 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
275 image_prebuffer_set(ss->imd, g_list_nth_data(ss->filelist, r));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
276 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
277 else if (ss->cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
278 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
279 CollectInfo *info;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
280 info = g_list_nth_data(ss->cd->list, r);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
281 if (info) image_prebuffer_set(ss->imd, info->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
282 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
283 else if (ss->from_selection)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
284 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
285 image_prebuffer_set(ss->imd, layout_list_get_fd(ss->layout, r));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
286 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
287 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
288
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
289 return TRUE;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
290 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
291
3
gqview
parents: 1
diff changeset
292 static gint slideshow_loop_cb(gpointer data)
gqview
parents: 1
diff changeset
293 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
294 SlideShowData *ss = data;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
295
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
296 if (ss->paused) return TRUE;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
297
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
298 if (!slideshow_step(ss, TRUE))
3
gqview
parents: 1
diff changeset
299 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
300 ss->timeout_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
301 slideshow_free(ss);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
302 return FALSE;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
303 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
304
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
305 return TRUE;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
306 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
307
744
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
308 static void slideshow_timer_stop(SlideShowData *ss)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
309 {
744
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
310 if (ss->timeout_id == -1) return;
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
311
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
312 g_source_remove(ss->timeout_id);
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
313 ss->timeout_id = -1;
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
314 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
315
744
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
316 static void slideshow_timer_reset(SlideShowData *ss)
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
317 {
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
318 if (options->slideshow.delay < 1) options->slideshow.delay = 1;
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
319
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
320 if (ss->timeout_id != -1) g_source_remove(ss->timeout_id);
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
321 ss->timeout_id = g_timeout_add(options->slideshow.delay * 1000 / SLIDESHOW_SUBSECOND_PRECISION,
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
322 slideshow_loop_cb, ss);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
323 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
324
745
41dc324ee014 slideshow_next(), slideshow_prev(): move code to common slideshow_move(), reducing code redundancy.
zas_
parents: 744
diff changeset
325 static void slideshow_move(SlideShowData *ss, gboolean forward)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
326 {
89
b3149a34d0dd Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
327 if (!ss) return;
b3149a34d0dd Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
328
745
41dc324ee014 slideshow_next(), slideshow_prev(): move code to common slideshow_move(), reducing code redundancy.
zas_
parents: 744
diff changeset
329 if (!slideshow_step(ss, forward))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
330 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
331 slideshow_free(ss);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
332 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
333 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
334
744
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
335 slideshow_timer_reset(ss);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
336 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
337
745
41dc324ee014 slideshow_next(), slideshow_prev(): move code to common slideshow_move(), reducing code redundancy.
zas_
parents: 744
diff changeset
338 void slideshow_next(SlideShowData *ss)
41dc324ee014 slideshow_next(), slideshow_prev(): move code to common slideshow_move(), reducing code redundancy.
zas_
parents: 744
diff changeset
339 {
41dc324ee014 slideshow_next(), slideshow_prev(): move code to common slideshow_move(), reducing code redundancy.
zas_
parents: 744
diff changeset
340 slideshow_move(ss, TRUE);
41dc324ee014 slideshow_next(), slideshow_prev(): move code to common slideshow_move(), reducing code redundancy.
zas_
parents: 744
diff changeset
341 }
41dc324ee014 slideshow_next(), slideshow_prev(): move code to common slideshow_move(), reducing code redundancy.
zas_
parents: 744
diff changeset
342
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
343 void slideshow_prev(SlideShowData *ss)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
344 {
745
41dc324ee014 slideshow_next(), slideshow_prev(): move code to common slideshow_move(), reducing code redundancy.
zas_
parents: 744
diff changeset
345 slideshow_move(ss, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
346 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
347
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
348 static SlideShowData *real_slideshow_start(ImageWindow *imd, LayoutWindow *lw,
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
349 GList *filelist, gint start_point,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
350 CollectionData *cd, CollectInfo *start_info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
351 void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
352 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
353 SlideShowData *ss;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
354 gint start_index = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
355
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
356 if (!filelist && !cd && layout_list_count(lw, NULL) < 1) return NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
357
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
358 ss = g_new0(SlideShowData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
359
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
360 ss->imd = imd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
361
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
362 ss->filelist = filelist;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
363 ss->cd = cd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
364 ss->layout = lw;
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 745
diff changeset
365 ss->dir_fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
366
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
367 ss->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
368 ss->list_done = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
369
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
370 ss->from_selection = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
371
119
197b8d2e52ce Thu Nov 30 09:55:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 89
diff changeset
372 ss->stop_func = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
373
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
374 ss->timeout_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
375 ss->paused = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
376
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
377 if (ss->filelist)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
378 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
379 ss->slide_count = g_list_length(ss->filelist);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
380 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
381 else if (ss->cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
382 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
383 collection_ref(ss->cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
384 ss->slide_count = g_list_length(ss->cd->list);
326
509b84801d66 Rename slideshow options.
zas_
parents: 318
diff changeset
385 if (!options->slideshow.random && start_info)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
386 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
387 start_index = g_list_index(ss->cd->list, start_info);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
388 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
389 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
390 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
391 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
392 /* layout method */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
393
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
394 ss->slide_count = layout_selection_count(ss->layout, NULL);
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 745
diff changeset
395 ss->dir_fd = file_data_ref(ss->layout->dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
396 if (ss->slide_count < 2)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
397 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
398 ss->slide_count = layout_list_count(ss->layout, NULL);
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 586
diff changeset
399 if (!options->slideshow.random && start_point >= 0 && (guint) start_point < ss->slide_count)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
400 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
401 start_index = start_point;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
402 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
403 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
404 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
405 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
406 ss->from_selection = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
407 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
408 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
409
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
410 slideshow_list_init(ss, start_index);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
411
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
412 ss->slide_fd = file_data_ref(image_get_fd(ss->imd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
413 if (slideshow_step(ss, TRUE))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
414 {
744
eb7e0d3206a2 Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
zas_
parents: 736
diff changeset
415 slideshow_timer_reset(ss);
119
197b8d2e52ce Thu Nov 30 09:55:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 89
diff changeset
416
197b8d2e52ce Thu Nov 30 09:55:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 89
diff changeset
417 ss->stop_func = stop_func;
197b8d2e52ce Thu Nov 30 09:55:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 89
diff changeset
418 ss->stop_data = stop_data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
419 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
420 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
421 {
119
197b8d2e52ce Thu Nov 30 09:55:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 89
diff changeset
422 slideshow_free(ss);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
423 ss = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
424 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
425
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
426 return ss;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
427 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
428
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 119
diff changeset
429 SlideShowData *slideshow_start_from_filelist(ImageWindow *imd, GList *list,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
430 void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
431 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
432 return real_slideshow_start(imd, NULL, list, -1, NULL, NULL, stop_func, stop_data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
433 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
434
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
435 SlideShowData *slideshow_start_from_collection(ImageWindow *imd, CollectionData *cd,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
436 void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
437 CollectInfo *start_info)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
438 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
439 return real_slideshow_start(imd, NULL, NULL, -1, cd, start_info, stop_func, stop_data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
440 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
441
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
442 SlideShowData *slideshow_start(ImageWindow *imd, LayoutWindow *lw, gint start_point,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
443 void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
444 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
445 return real_slideshow_start(imd, lw, NULL, start_point, NULL, NULL, stop_func, stop_data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
446 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
447
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
448 gint slideshow_paused(SlideShowData *ss)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
449 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
450 if (!ss) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
451
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
452 return ss->paused;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
453 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
454
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
455 void slideshow_pause_set(SlideShowData *ss, gint paused)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
456 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
457 if (!ss) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
458
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
459 ss->paused = paused;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
460 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
461
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
462 gint slideshow_pause_toggle(SlideShowData *ss)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
463 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
464 slideshow_pause_set(ss, !slideshow_paused(ss));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
465 return slideshow_paused(ss);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 3
diff changeset
466 }
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1000
diff changeset
467 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */