diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | commands.c | 58 | ||||
-rw-r--r-- | config.def.h | 8 | ||||
-rw-r--r-- | image.c | 4 | ||||
-rw-r--r-- | main.c | 41 | ||||
-rw-r--r-- | util.c | 9 | ||||
-rw-r--r-- | util.h | 1 |
7 files changed, 8 insertions, 115 deletions
@@ -1,4 +1,4 @@ -VERSION = git-20111217 +VERSION = git-20120211 CC = gcc CFLAGS = -ansi -Wall -pedantic -O2 @@ -36,7 +36,6 @@ void load_image(int); void redraw(void); void reset_cursor(void); void animate(void); -void slideshow(void); void set_timeout(timeout_f, int, bool); void reset_timeout(timeout_f); @@ -65,10 +64,6 @@ bool it_switch_mode(arg_t a) { tns_init(&tns, filecnt, &win); img_close(&img, false); reset_timeout(reset_cursor); - if (img.slideshow) { - img.slideshow = false; - reset_timeout(slideshow); - } tns.sel = fileidx; tns.dirty = true; mode = MODE_THUMB; @@ -335,59 +330,6 @@ bool i_rotate(arg_t a) { return false; } -bool i_toggle_slideshow(arg_t a) { - if (mode == MODE_IMAGE) { - if (img.slideshow) { - img.slideshow = false; - reset_timeout(slideshow); - return true; - } else if (fileidx + 1 < filecnt) { - img.slideshow = true; - set_timeout(slideshow, img.ss_delay, true); - return true; - } - } - return false; -} - -bool i_adjust_slideshow(arg_t a) { - long d = (long) a; - int i; - - if (mode != MODE_IMAGE || !img.slideshow) - return false; - - if (d < 0) { - for (i = ARRLEN(ss_delays) - 2; i >= 0; i--) { - if (img.ss_delay > ss_delays[i] * 1000) { - img.ss_delay = ss_delays[i] * 1000; - return true; - } - } - } else { - for (i = 1; i < ARRLEN(ss_delays); i++) { - if (img.ss_delay < ss_delays[i] * 1000) { - img.ss_delay = ss_delays[i] * 1000; - return true; - } - } - } - return false; -} - -bool i_reset_slideshow(arg_t a) { - if (mode != MODE_IMAGE || !img.slideshow) - return false; - - if (prefix > 0) { - img.ss_delay = MIN(prefix, ss_delays[ARRLEN(ss_delays) - 1]); - img.ss_delay = MAX(img.ss_delay, ss_delays[0]) * 1000; - } else { - img.ss_delay = SLIDESHOW_DELAY * 1000; - } - return true; -} - bool i_toggle_antialias(arg_t a) { if (mode == MODE_IMAGE) { img_toggle_antialias(&img); diff --git a/config.def.h b/config.def.h index 777cb80..5316341 100644 --- a/config.def.h +++ b/config.def.h @@ -43,9 +43,6 @@ static const float zoom_levels[] = { 100.0, 150.0, 200.0, 400.0, 800.0 }; -/* default slideshow delay (in sec, overwritten via -S option): */ -enum { SLIDESHOW_DELAY = 5 }; - /* default settings for multi-frame gif images: */ enum { GIF_DELAY = 100, /* delay time (in ms) */ @@ -119,11 +116,6 @@ static const keymap_t keys[] = { { false, XK_less, i_rotate, (arg_t) DIR_LEFT }, { false, XK_greater, i_rotate, (arg_t) DIR_RIGHT }, - { false, XK_s, i_toggle_slideshow, (arg_t) None }, - { true, XK_plus, i_adjust_slideshow, (arg_t) +1 }, - { true, XK_minus, i_adjust_slideshow, (arg_t) -1 }, - { true, XK_equal, i_reset_slideshow, (arg_t) None }, - { false, XK_a, i_toggle_antialias, (arg_t) None }, { false, XK_A, it_toggle_alpha, (arg_t) None }, @@ -68,8 +68,6 @@ void img_init(img_t *img, win_t *win) { img->dirty = false; img->aa = options->aa; img->alpha = true; - img->slideshow = false; - img->ss_delay = SLIDESHOW_DELAY * 1000; img->multi.cap = img->multi.cnt = 0; img->multi.animate = false; } @@ -725,7 +723,7 @@ bool img_frame_animate(img_t *img, bool restart) { return false; if (img->multi.sel + 1 >= img->multi.cnt) { - if (restart || (GIF_LOOP && !img->slideshow)) { + if (restart || GIF_LOOP) { img_frame_goto(img, 0); } else { img->multi.animate = false; @@ -52,7 +52,6 @@ typedef struct { void redraw(void); void reset_cursor(void); void animate(void); -void slideshow(void); appmode_t mode; img_t img; @@ -71,7 +70,6 @@ timeout_t timeouts[] = { { { 0, 0 }, false, redraw }, { { 0, 0 }, false, reset_cursor }, { { 0, 0 }, false, animate }, - { { 0, 0 }, false, slideshow }, }; void cleanup(void) { @@ -220,10 +218,9 @@ void load_image(int new) { void update_title(void) { int n; - char sshow_info[16]; char frame_info[16]; - float size, time; - const char *size_unit, *time_unit; + float size; + const char *size_unit; if (mode == MODE_THUMB) { n = snprintf(win_title, TITLE_LEN, "sxiv: [%d/%d] %s", @@ -233,14 +230,6 @@ void update_title(void) { size = filesize; size_readable(&size, &size_unit); - if (img.slideshow) { - time = img.ss_delay / 1000.0; - time_readable(&time, &time_unit); - snprintf(sshow_info, sizeof(sshow_info), "*%d%s* ", - (int) time, time_unit); - } else { - sshow_info[0] = '\0'; - } if (img.multi.cnt > 0) snprintf(frame_info, sizeof(frame_info), "{%d/%d} ", img.multi.sel + 1, img.multi.cnt); @@ -248,10 +237,10 @@ void update_title(void) { frame_info[0] = '\0'; n = snprintf(win_title, TITLE_LEN, - "sxiv: [%d/%d] <%dx%d:%d%%> (%.2f%s) %s%s%s", + "sxiv: [%d/%d] <%dx%d:%d%%> (%.2f%s) %s%s", fileidx + 1, filecnt, img.w, img.h, (int) (img.zoom * 100.0), size, size_unit, - sshow_info, frame_info, files[fileidx].name); + frame_info, files[fileidx].name); } if (n >= TITLE_LEN) { @@ -263,17 +252,10 @@ void update_title(void) { } void redraw(void) { - if (mode == MODE_IMAGE) { + if (mode == MODE_IMAGE) img_render(&img); - if (img.slideshow && !img.multi.animate) { - if (fileidx + 1 < filecnt) - set_timeout(slideshow, img.ss_delay, true); - else - img.slideshow = false; - } - } else { + else tns_render(&tns); - } update_title(); reset_timeout(redraw); reset_cursor(); @@ -307,17 +289,6 @@ void animate(void) { } } -void slideshow(void) { - if (mode == MODE_IMAGE && !img.multi.animate) { - if (fileidx + 1 < filecnt) { - load_image(fileidx + 1); - redraw(); - } else { - img.slideshow = false; - } - } -} - bool keymask(const keymap_t *k, unsigned int state) { return (k->ctrl ? ControlMask : 0) == (state & ControlMask); } @@ -134,15 +134,6 @@ void size_readable(float *size, const char **unit) { *unit = units[MIN(i, ARRLEN(units) - 1)]; } -void time_readable(float *time, const char **unit) { - const char *units[] = { "s", "m", "h" }; - int i; - - for (i = 0; i < ARRLEN(units) && *time >= 60.0; i++) - *time /= 60.0; - *unit = units[MIN(i, ARRLEN(units) - 1)]; -} - char* absolute_path(const char *filename) { size_t len; const char *basename; @@ -71,7 +71,6 @@ void die(const char*, ...); ssize_t get_line(char**, size_t*, FILE*); void size_readable(float*, const char**); -void time_readable(float*, const char**); char* absolute_path(const char*); |