Let image loader backend decide how to process image buffer
[geeqie.git] / src / slideshow.h
1 /*
2  * Copyright (C) 2004 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: John Ellis
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef SLIDESHOW_H
23 #define SLIDESHOW_H
24
25 #include <glib.h>
26
27 struct CollectInfo;
28 struct CollectionData;
29 struct FileData;
30 struct ImageWindow;
31 struct LayoutWindow;
32
33 #define SLIDESHOW_SUBSECOND_PRECISION 10
34 #define SLIDESHOW_MIN_SECONDS    0.1
35 #define SLIDESHOW_MAX_SECONDS 86399.0 /* 24 hours - 1 sec */
36
37 /*
38  * It works like this, it uses path_list, if that does not exist, it uses
39  * CollectionData, then finally falls back to the layout listing.
40  */
41
42 struct SlideShowData
43 {
44         LayoutWindow *lw;        /**< use this window to display the slideshow */
45         ImageWindow *imd;        /**< use this window only if lw is not available,
46                                     @FIXME it is probably required only by img-view.cc and should be dropped with it */
47
48         GList *filelist;
49         CollectionData *cd;
50         FileData *dir_fd;
51
52         GList *list;
53         GList *list_done;
54
55         FileData *slide_fd;
56
57         guint slide_count;
58         guint timeout_id; /**< event source id */
59
60         gboolean from_selection;
61
62         void (*stop_func)(SlideShowData *, gpointer);
63         gpointer stop_data;
64
65         gboolean paused;
66 };
67
68 void slideshow_free(SlideShowData *ss);
69
70 gboolean slideshow_should_continue(SlideShowData *ss);
71
72 void slideshow_next(SlideShowData *ss);
73 void slideshow_prev(SlideShowData *ss);
74
75 SlideShowData *slideshow_start_from_filelist(LayoutWindow *target_lw, ImageWindow *imd, GList *list,
76                                               void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data);
77 SlideShowData *slideshow_start_from_collection(LayoutWindow *target_lw, ImageWindow *imd, CollectionData *cd,
78                                                void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data,
79                                                CollectInfo *start_info);
80 SlideShowData *slideshow_start(LayoutWindow *lw, gint start_point,
81                                void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data);
82
83 gboolean slideshow_paused(SlideShowData *ss);
84 void slideshow_pause_set(SlideShowData *ss, gboolean paused);
85 gboolean slideshow_pause_toggle(SlideShowData *ss);
86
87
88 #endif
89 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */