| @@ -17,6 +17,7 @@ |
| 17 | 17 | | */ |
| 18 | 18 | | |
| 19 | 19 | | #define _POSIX_C_SOURCE 200112L |
| 20 | + | #define _IMAGE_CONFIG |
| 20 | 21 | | |
| 21 | 22 | | #include <stdlib.h> |
| 22 | 23 | | #include <string.h> |
| @@ -27,6 +28,7 @@ |
| 27 | 28 | | #include "image.h" |
| 28 | 29 | | #include "thumbs.h" |
| 29 | 30 | | #include "util.h" |
| 31 | + | #include "config.h" |
| 30 | 32 | | |
| 31 | 33 | | void cleanup(void); |
| 32 | 34 | | void remove_file(int, bool); |
| @@ -48,6 +50,10 @@ extern int filecnt, fileidx; |
| 48 | 50 | | |
| 49 | 51 | | extern int prefix; |
| 50 | 52 | | |
| 53 | + | const int ss_delays[] = { |
| 54 | + | 1, 2, 3, 5, 10, 15, 20, 30, 60, 120, 180, 300, 600 |
| 55 | + | }; |
| 56 | + | |
| 51 | 57 | | bool it_quit(arg_t a) { |
| 52 | 58 | | cleanup(); |
| 53 | 59 | | exit(EXIT_SUCCESS); |
| @@ -118,7 +124,7 @@ bool i_navigate(arg_t a) { |
| 118 | 124 | | long n = (long) a; |
| 119 | 125 | | |
| 120 | 126 | | if (mode == MODE_IMAGE) { |
| 121 | | − | if (prefix) |
| 127 | + | if (prefix > 0) |
| 122 | 128 | | n *= prefix; |
| 123 | 129 | | n += fileidx; |
| 124 | 130 | | if (n < 0) |
| @@ -345,22 +351,22 @@ bool i_toggle_slideshow(arg_t a) { |
| 345 | 351 | | |
| 346 | 352 | | bool i_adjust_slideshow(arg_t a) { |
| 347 | 353 | | long d = (long) a; |
| 348 | | − | int i, delays[] = { 1, 2, 3, 5, 10, 15, 20, 30, 60, 120, 180, 300, 600 }; |
| 354 | + | int i; |
| 349 | 355 | | |
| 350 | 356 | | if (mode != MODE_IMAGE || !img.slideshow) |
| 351 | 357 | | return false; |
| 352 | 358 | | |
| 353 | 359 | | if (d < 0) { |
| 354 | | − | for (i = ARRLEN(delays) - 2; i >= 0; i--) { |
| 355 | | − | if (img.ss_delay > delays[i] * 1000) { |
| 356 | | − | img.ss_delay = delays[i] * 1000; |
| 360 | + | for (i = ARRLEN(ss_delays) - 2; i >= 0; i--) { |
| 361 | + | if (img.ss_delay > ss_delays[i] * 1000) { |
| 362 | + | img.ss_delay = ss_delays[i] * 1000; |
| 357 | 363 | | return true; |
| 358 | 364 | | } |
| 359 | 365 | | } |
| 360 | 366 | | } else { |
| 361 | | − | for (i = 1; i < ARRLEN(delays); i++) { |
| 362 | | − | if (img.ss_delay < delays[i] * 1000) { |
| 363 | | − | img.ss_delay = delays[i] * 1000; |
| 367 | + | for (i = 1; i < ARRLEN(ss_delays); i++) { |
| 368 | + | if (img.ss_delay < ss_delays[i] * 1000) { |
| 369 | + | img.ss_delay = ss_delays[i] * 1000; |
| 364 | 370 | | return true; |
| 365 | 371 | | } |
| 366 | 372 | | } |
| @@ -368,6 +374,19 @@ bool i_adjust_slideshow(arg_t a) { |
| 368 | 374 | | return false; |
| 369 | 375 | | } |
| 370 | 376 | | |
| 377 | + | bool i_reset_slideshow(arg_t a) { |
| 378 | + | if (mode != MODE_IMAGE || !img.slideshow) |
| 379 | + | return false; |
| 380 | + | |
| 381 | + | if (prefix > 0) { |
| 382 | + | img.ss_delay = MIN(prefix, ss_delays[ARRLEN(ss_delays) - 1]); |
| 383 | + | img.ss_delay = MAX(img.ss_delay, ss_delays[0]) * 1000; |
| 384 | + | } else { |
| 385 | + | img.ss_delay = SLIDESHOW_DELAY * 1000; |
| 386 | + | } |
| 387 | + | return true; |
| 388 | + | } |
| 389 | + | |
| 371 | 390 | | bool i_toggle_antialias(arg_t a) { |
| 372 | 391 | | if (mode == MODE_IMAGE) { |
| 373 | 392 | | img_toggle_antialias(&img); |