Added sliding scale for slideshow speed adjustement.

Note: Use slowest (leftmost) speed setting to disable automatic slide advancement.
This commit is contained in:
William Kendrick 2006-08-27 23:57:04 +00:00
parent 20f1da1afd
commit 53ce047918
4 changed files with 142 additions and 42 deletions

View file

@ -13,11 +13,17 @@ $Id$
* Interface improvements: * Interface improvements:
----------------------- -----------------------
* New slideshow tool! ("Slides", available in "Open" dialog.) * New slideshow tool! ("Slides", available in "Open" dialog.)
Select each image to play, in the order you want them, then click "Play". Select each image to play, in the order you want them, and use the
sliding scale to adjust speed, then click "Play" to begin the show.
Space, Enter, Right and mouseclicks advance manually. + The "Next" button and [Space], [Enter] and [Right Arrow] keys
Left goes to the previous image. advance to the next slide manually. (Clicking anywhere in the image
Escape or "Back" button at lower right ends playback. advances, as well.)
+ The [Left Arrow] key goes to the previous slide.
+ The "Back" button and [Escape] ends playback.
Note: Use slowest (leftmost) speed setting to disable automatic
slide advancement.
* Modified "Text" tool so that it correctly handles the 16-bit unicode * Modified "Text" tool so that it correctly handles the 16-bit unicode
characters that SDL sends. characters that SDL sends.

View file

@ -425,7 +425,7 @@ Available Tools
picture. (You will be asked to confirm.) picture. (You will be asked to confirm.)
* Click the blue "Slides" (slide projector) button at * Click the blue "Slides" (slide projector) button at
the lower left to go to slideshow mode. See "Slides, the lower left to go to slideshow mode. See "Slides",
below, for details. below, for details.
* Or click the red "Back" arrow button at the lower * Or click the red "Back" arrow button at the lower
@ -600,25 +600,33 @@ Available Tools
Click each of the images you wish to display in a Click each of the images you wish to display in a
slideshow-style presentation, one by one. A digit will slideshow-style presentation, one by one. A digit will
appear over each image, letting you know which order it will appear over each image, letting you know in which order they
be displayed in. will be displayed.
Click a selected image to unselect it (take it out of your You can click a selected image to unselect it (take it out
slideshow). Any images you had clicked after it will go up of your slideshow).
one in the slideshow order.
Click the "Play" icon to begin the slideshow. Note: If you A sliding scale at the lower left of the screen (next to the
didn't select ANY images, then ALL images will be played in "Play" button) can be used to adjust the speed of the
the slideshow. Click "Back" to return to the "Open" dialog. slideshow, from slowest to fastest. Choose the leftmost
setting to disable automatic advancement -- you will need to
press a key or click to go to the next slide (see below).
When you're ready, click the "Play" button to begin the
slideshow. (Note: If you hadn't selected ANY images, then
ALL images will be played in the slideshow.)
During the slideshow, press [Space], [Enter] or [Return] or During the slideshow, press [Space], [Enter] or [Return] or
the [Right Arrow], or click anywhere in the picture, to the [Right Arrow], or click the "Next" button at the lower
manually advance to the next slide. Press [Left] to go back left, to manually advance to the next slide. Press [Left] to
to the previous slide. go back to the previous slide.
Press [Escape] or click the "Back" button at the lower right Press [Escape], or click the "Back" button at the lower
to exit the slideshow and return to the image list, where right, to exit the slideshow and return to the slideshow
you may change which images to show in the slideshow. image selection screen.
Click "Back" in the slideshow image selection screen to
return to the "Open" dialog.
Quit Quit

View file

@ -624,7 +624,7 @@ New Breed Software</p>
align=right> align=right>
<p>Click the blue "Slides" (slide projector) button at the lower <p>Click the blue "Slides" (slide projector) button at the lower
left to go to slideshow mode. See "<a href="#slides">Slides</a>, left to go to slideshow mode. See "<a href="#slides">Slides</a>",
below, for details.</p> below, for details.</p>
<br clear=all> <br clear=all>
@ -843,26 +843,32 @@ New Breed Software</p>
<p>Click each of the images you wish to display in a slideshow-style <p>Click each of the images you wish to display in a slideshow-style
presentation, one by one. A digit will appear over each image, presentation, one by one. A digit will appear over each image,
letting you know which order it will be displayed in.</p> letting you know in which order they will be displayed.</p>
<p>Click a selected image to unselect it (take it out of your <p>You can click a selected image to unselect it (take it out of your
slideshow). Any images you had clicked after it will go up one in slideshow).</p>
the slideshow order.</p>
<p>Click the "Play" icon to begin the slideshow. Note: If you didn't <p>A sliding scale at the lower left of the screen (next to the "Play"
select ANY images, then ALL images will be played in the slideshow. button) can be used to adjust the speed of the slideshow, from slowest
Click "Back" to return to the "Open" dialog.</p> to fastest. Choose the leftmost setting to disable automatic
advancement &mdash; you will need to press a key or click to go to
the next slide (see below).</p>
<p>When you're ready, click the "Play" button to begin the slideshow.
(Note: If you hadn't selected ANY images, then ALL images will be
played in the slideshow.)</p>
<p>During the slideshow, press <b>[Space]</b>, <b>[Enter]</b> or <p>During the slideshow, press <b>[Space]</b>, <b>[Enter]</b> or
<b>[Return]</b> or the <b>[Right&nbsp;Arrow]</b>, or click anywhere <b>[Return]</b> or the <b>[Right&nbsp;Arrow]</b>, or click the "Next"
in the picture, to manually advance to the next slide. button at the lower left, to manually advance to the next slide.
Press <b>[Left]</b> to go back to the previous slide.</p> Press <b>[Left]</b> to go back to the previous slide.</p>
<p>Press <b>[Escape]</b> or click the "Back" button at the <p>Press <b>[Escape]</b>, or click the "Back" button at the
lower right to exit the slideshow and return to the image list, lower right, to exit the slideshow and return to the slideshow
where you may change which images to show in the slideshow.</p> image selection screen.</p>
<!-- FIXME: Add playback speed control! --> <p>Click "Back" in the slideshow image selection screen to return to
the "Open" dialog.</p>
<br clear=all> <br clear=all>
</dd> </dd>

View file

@ -953,7 +953,8 @@ static SDL_Surface **img_brushes;
static SDL_Surface *img_shapes[NUM_SHAPES], *img_shape_names[NUM_SHAPES]; static SDL_Surface *img_shapes[NUM_SHAPES], *img_shape_names[NUM_SHAPES];
static SDL_Surface *img_magics[NUM_MAGICS], *img_magic_names[NUM_MAGICS]; static SDL_Surface *img_magics[NUM_MAGICS], *img_magic_names[NUM_MAGICS];
static SDL_Surface *img_openlabels_open, *img_openlabels_erase, static SDL_Surface *img_openlabels_open, *img_openlabels_erase,
*img_openlabels_slideshow, *img_openlabels_back, *img_openlabels_play; *img_openlabels_slideshow, *img_openlabels_back, *img_openlabels_play,
*img_openlabels_next;
static SDL_Surface *img_tux[NUM_TIP_TUX]; static SDL_Surface *img_tux[NUM_TIP_TUX];
@ -6941,6 +6942,7 @@ static void create_button_labels(void)
img_openlabels_erase = do_render_button_label(gettext_noop("Erase")); img_openlabels_erase = do_render_button_label(gettext_noop("Erase"));
img_openlabels_slideshow = do_render_button_label(gettext_noop("Slides")); img_openlabels_slideshow = do_render_button_label(gettext_noop("Slides"));
img_openlabels_back = do_render_button_label(gettext_noop("Back")); img_openlabels_back = do_render_button_label(gettext_noop("Back"));
img_openlabels_next = do_render_button_label(gettext_noop("Next"));
img_openlabels_play = do_render_button_label(gettext_noop("Play")); img_openlabels_play = do_render_button_label(gettext_noop("Play"));
} }
@ -10429,6 +10431,7 @@ static void cleanup(void)
free_surface(&img_openlabels_slideshow); free_surface(&img_openlabels_slideshow);
free_surface(&img_openlabels_erase); free_surface(&img_openlabels_erase);
free_surface(&img_openlabels_back); free_surface(&img_openlabels_back);
free_surface(&img_openlabels_next);
free_surface(&img_openlabels_play); free_surface(&img_openlabels_play);
free_surface(&img_progress); free_surface(&img_progress);
@ -12579,6 +12582,10 @@ void do_slideshow(void)
SDL_Event event; SDL_Event event;
SDLKey key; SDLKey key;
char *freeme; char *freeme;
int speeds;
float x_per, y_per;
int xx, yy;
SDL_Surface *btn, *blnk;
do_setcursor(cursor_watch); do_setcursor(cursor_watch);
@ -12973,6 +12980,38 @@ void do_slideshow(void)
dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - img_openlabels_back->h; dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - img_openlabels_back->h;
SDL_BlitSurface(img_openlabels_back, NULL, screen, &dest); SDL_BlitSurface(img_openlabels_back, NULL, screen, &dest);
/* Speed control: */
speeds = 10;
x_per = 96.0 / speeds;
y_per = 48.0 / speeds;
for (i = 0; i < speeds; i++)
{
xx = ceil(x_per);
yy = ceil(y_per * i);
if (i <= speed)
btn = thumbnail(img_btn_down, xx, yy, 0);
else
btn = thumbnail(img_btn_up, xx, yy, 0);
blnk = thumbnail(img_btn_off, xx, 48 - yy, 0);
/* FIXME: Check for NULL! */
dest.x = 96 + 48 + (i * x_per);
dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - 48;
SDL_BlitSurface(blnk, NULL, screen, &dest);
dest.x = 96 + 48 + (i * x_per);
dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - (y_per * i);
SDL_BlitSurface(btn, NULL, screen, &dest);
SDL_FreeSurface(btn);
SDL_FreeSurface(blnk);
}
SDL_Flip(screen); SDL_Flip(screen);
@ -13140,6 +13179,34 @@ void do_slideshow(void)
update_list = 1; update_list = 1;
} }
else if (event.button.x >= 96 + 48 && event.button.x < 96 + 48 + 96 &&
event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET) - 48 &&
event.button.y < (48 * 7 + 40 + HEIGHTOFFSET))
{
/* Speed slider */
int old_speed, control_sound, click_x;
old_speed = speed;
click_x = event.button.x - 96 - 48;
speed = ((10 * click_x) / 96);
control_sound = -1;
if (speed < old_speed)
control_sound = SND_SHRINK;
else if (speed > old_speed)
control_sound = SND_GROW;
if (control_sound != -1)
{
playsound(screen, 0, control_sound, 0, SNDPOS_CENTER,
SNDDIST_NEAR);
update_list = 1;
}
}
else if (event.button.x >= (WINDOW_WIDTH - 96 - 48) && else if (event.button.x >= (WINDOW_WIDTH - 96 - 48) &&
event.button.x < (WINDOW_WIDTH - 96) && event.button.x < (WINDOW_WIDTH - 96) &&
event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET) - 48 && event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET) - 48 &&
@ -13204,11 +13271,9 @@ void do_slideshow(void)
do_setcursor(cursor_down); do_setcursor(cursor_down);
} }
else if (((event.button.x >= 96 && event.button.x < 96 + 48) || else if (((event.button.x >= 96 && event.button.x < 96 + 48 + 96) ||
(event.button.x >= (WINDOW_WIDTH - 96 - 48) && (event.button.x >= (WINDOW_WIDTH - 96 - 48) &&
event.button.x < (WINDOW_WIDTH - 96)) || event.button.x < (WINDOW_WIDTH - 96))) &&
(event.button.x >= (WINDOW_WIDTH - 96 - 48 - 48) &&
event.button.x < (WINDOW_WIDTH - 48 - 96))) &&
event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET) - 48 && event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET) - 48 &&
event.button.y < (48 * 7 + 40 + HEIGHTOFFSET)) event.button.y < (48 * 7 + 40 + HEIGHTOFFSET))
{ {
@ -13343,6 +13408,17 @@ void play_slideshow(int * selected, int num_selected, char * dirname,
SDL_BlitSurface(img_openlabels_back, NULL, screen, &dest); SDL_BlitSurface(img_openlabels_back, NULL, screen, &dest);
/* "Next" button: */
dest.x = 0;
dest.y = screen->h - 48;
SDL_BlitSurface(img_play, NULL, screen, &dest);
dest.x = (48 - img_openlabels_next->w) / 2;
dest.y = screen->h - img_openlabels_next->h;
SDL_BlitSurface(img_openlabels_next, NULL, screen, &dest);
SDL_Flip(screen); SDL_Flip(screen);
@ -13421,10 +13497,11 @@ void play_slideshow(int * selected, int num_selected, char * dirname,
{ {
/* Deal with mouse pointer shape! */ /* Deal with mouse pointer shape! */
if (event.button.x >= screen->w - 48 && if ((event.button.x >= screen->w - 48 ||
event.button.x < 48) &&
event.button.y >= screen->h - 48) event.button.y >= screen->h - 48)
{ {
/* Back button */ /* Back or Next buttons */
do_setcursor(cursor_hand); do_setcursor(cursor_hand);
} }
@ -13442,8 +13519,11 @@ void play_slideshow(int * selected, int num_selected, char * dirname,
/* Automatically skip to the next one after time expires: */ /* Automatically skip to the next one after time expires: */
if (SDL_GetTicks() >= last_ticks + speed * 1000) if (speed != 0)
next = 1; {
if (SDL_GetTicks() >= last_ticks + (10 - speed) * 500)
next = 1;
}
} }
while (!next); while (!next);
} }