Re: slideshow RFEs
John Ellis <[email protected]> Sun, 18 Jan 2004 03:04:15 -0500
| Newsgroups | gmane.comp.gnome.apps.gqview.devel |
|---|---|
| Message-ID | <[email protected]> |
[email protected] wrote: > > For slideshow view I am looking for 3 related enhancements. I have a lot > of pictures to sift through and 1 second flip time > will take forever... > > I would like to see some option toggle boxes for the following ideas: > > During slideshow, > 1) don't flip until previous picture completely displays > 2) don't flip until next image has finished preloading > 3) once the current image displays, specify the amount of time (in > milliseconds) the current image should be displayed before being allowed > to flip to next image It will be a bit late for this to make it into 1.4 in entirety, but a few steps can be made for this now. > Probably there would need to be a toggle box to select between > milliseconds and seconds. Will tenths of a second (down to 0.1) be okay? If so, refer to how the 'zoom increment' is adjusted on the 'image' tab. Should be very simple to convert this way, and could be included before the next _stable_ release 1.4.0 > The current issues is that I can now specify the slideshow speed in > milliseconds; however, this method isn't perfect for me, > if I set it too fast then the images don't display completely. Setting it > slow enough for all my images to display completely causes a large time > waste across all the other pictures where I don't need such a slow speed. > If I could start the slideshow counter to just after the image completely > displays, that would be a great alternative until someone (maybe me) can > implement the above 3 RFE's. Diving into coding this: I am attaching a patch (this will be included with 1.3.8) that adds a image_set_complete_func() to set a image completed function. The set function will be called when the current image is finished rendering to the screen, and when the next image is finished preloading (assuming preloading is enabled). slideshow.c can be changed to take advantage of this, and wait until the complete function is called to change the image and/or update/start the timeout for the next image. I can do this too, if you are willing to wait until I get around to it - but that may not be for a few weeks or so... probably after 1.4.0. This little change to image.c is less involved, and since I know it very well, can help you avoid possible problems finding the points where an image is 'completed'. Greetings, John -- John Ellis <[email protected]> http://gqview.sourceforge.net <GQview> | http://gqapplets.sourceforge.net http://gqmpeg.sourceforge.net <GQmpeg> | <panel applets>
image_complete_vfunc.patch
(text/plain, 4.9 KB)
Index: image.c
===================================================================
RCS file: /devel/cvs/gqview/src/image.c,v
retrieving revision 1.78.2.18
diff -u -r1.78.2.18 image.c
--- image.c 22 Dec 2003 02:27:19 -0000 1.78.2.18
+++ image.c 18 Jan 2004 07:23:59 -0000
@@ -110,6 +110,7 @@
static void image_update_title(ImageWindow *imd);
static void image_update_util(ImageWindow *imd);
+static void image_complete_util(ImageWindow *imd, gint preload);
static void image_button_do(ImageWindow *imd, GdkEvent *event, gint button);
@@ -497,6 +498,8 @@
if (!imd->pixbuf || (!imd->draw_queue && !imd->draw_queue_2pass) || imd->draw_idle_id == -1)
{
+ if (!imd->completed) image_complete_util(imd, FALSE);
+
imd->draw_idle_id = -1;
return FALSE;
}
@@ -558,6 +561,8 @@
if (!imd->draw_queue && !imd->draw_queue_2pass)
{
+ if (!imd->completed) image_complete_util(imd, FALSE);
+
imd->draw_idle_id = -1;
return FALSE;
}
@@ -1072,7 +1077,17 @@
static void image_update_util(ImageWindow *imd)
{
- if (imd->update_func) imd->update_func(imd, imd->update_data);
+ if (imd->func_update) imd->func_update(imd, imd->data_update);
+}
+
+static void image_complete_util(ImageWindow *imd, gint preload)
+{
+ if (debug) printf("image load completed \"%s\" (%s)\n",
+ (preload) ? imd->read_ahead_path : imd->image_path,
+ (preload) ? "preload" : "current");
+
+ if (!preload) imd->completed = TRUE;
+ if (imd->func_complete) imd->func_complete(imd, preload, imd->data_complete);
}
static void image_scroll_real(ImageWindow *imd, gint x, gint y)
@@ -1459,6 +1474,8 @@
}
image_loader_free(imd->read_ahead_il);
imd->read_ahead_il = NULL;
+
+ image_complete_util(imd, TRUE);
}
static void image_read_ahead_error_cb(ImageLoader *il, gpointer data)
@@ -1483,6 +1500,7 @@
if (!image_loader_start(imd->read_ahead_il, image_read_ahead_done_cb, imd))
{
image_read_ahead_cancel(imd);
+ image_complete_util(imd, TRUE);
}
}
@@ -1693,6 +1711,8 @@
if (imd->il) return FALSE;
+ imd->completed = FALSE;
+
if (image_post_buffer_get(imd))
{
if (debug) printf("from post buffer: %s\n", imd->image_path);
@@ -1721,6 +1741,9 @@
image_loader_free(imd->il);
imd->il = NULL;
+
+ image_complete_util(imd, FALSE);
+
return FALSE;
}
@@ -2083,13 +2106,22 @@
}
void image_set_update_func(ImageWindow *imd,
- void (*update_func)(ImageWindow *imd, gpointer data),
+ void (*func)(ImageWindow *imd, gpointer data),
gpointer data)
{
- imd->update_func = update_func;
- imd->update_data = data;
+ imd->func_update = func;
+ imd->data_update = data;
}
+void image_set_complete_func(ImageWindow *imd,
+ void (*func)(ImageWindow *, gint preload, gpointer),
+ gpointer data)
+{
+ imd->func_complete = func;
+ imd->data_complete = data;
+}
+
+
static void image_button_do(ImageWindow *imd, GdkEvent *event, gint button)
{
void (*func)(ImageWindow *, guint32 time, gdouble x, gdouble y, guint state, gpointer);
@@ -2663,6 +2695,8 @@
imd->read_ahead_il = NULL;
imd->read_ahead_pixbuf = NULL;
imd->read_ahead_path = NULL;
+
+ imd->completed = FALSE;
imd->auto_refresh_id = -1;
imd->auto_refresh_interval = -1;
Index: image.h
===================================================================
RCS file: /devel/cvs/gqview/src/image.h,v
retrieving revision 1.19.2.2
diff -u -r1.19.2.2 image.h
--- image.h 9 May 2003 19:36:41 -0000 1.19.2.2
+++ image.h 18 Jan 2004 06:48:33 -0000
@@ -20,11 +20,14 @@
void image_attach_window(ImageWindow *imd, GtkWidget *window,
const gchar *title, const gchar *title_right, gint show_zoom);
void image_set_update_func(ImageWindow *imd,
- void (*update_func)(ImageWindow *imd, gpointer data),
+ void (*func)(ImageWindow *imd, gpointer data),
gpointer data);
void image_set_button_func(ImageWindow *imd, gint button,
void (*func)(ImageWindow *, guint32 time, gdouble x, gdouble y, guint state, gpointer),
gpointer data);
+void image_set_complete_func(ImageWindow *imd,
+ void (*func)(ImageWindow *, gint preload, gpointer),
+ gpointer data);
/* path, name */
const gchar *image_get_path(ImageWindow *imd);
Index: typedefs.h
===================================================================
RCS file: /devel/cvs/gqview/src/typedefs.h,v
retrieving revision 1.44.2.18
diff -u -r1.44.2.18 typedefs.h
--- typedefs.h 10 Jan 2004 12:33:23 -0000 1.44.2.18
+++ typedefs.h 18 Jan 2004 07:14:48 -0000
@@ -267,8 +267,13 @@
gchar *title_right; /* window title to display right of file name */
gint title_show_zoom; /* option to include zoom in window title */
- void (*update_func)(ImageWindow *, gpointer);
- gpointer update_data;
+ gint completed;
+
+ void (*func_update)(ImageWindow *, gpointer);
+ void (*func_complete)(ImageWindow *, gint preload, gpointer);
+
+ gpointer data_update;
+ gpointer data_complete;
/* button functions */
void (*func_btn1)(ImageWindow *, guint32 time, gdouble x, gdouble y, guint state, gpointer);