From bb577d274dbd9981a726092a504466bc9b5c9bdb Mon Sep 17 00:00:00 2001 From: Bert Date: Fri, 19 Aug 2011 18:46:17 +0200 Subject: Added command to toggle gif animations --- commands.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'commands.c') diff --git a/commands.c b/commands.c index b0f7b08..51f7a55 100644 --- a/commands.c +++ b/commands.c @@ -41,7 +41,7 @@ extern int filecnt, fileidx; extern int timo_cursor; extern int timo_redraw; -extern int timo_delay; +extern int timo_adelay; int it_quit(arg_t a) { cleanup(); @@ -149,7 +149,24 @@ int it_last(arg_t a) { } int i_navigate_frame(arg_t a) { - return img_frame_navigate(&img, (int) a); + if (mode == MODE_IMAGE && !img.multi.animate) + return img_frame_navigate(&img, (int) a); + else + return 0; +} + +int i_toggle_animation(arg_t a) { + if (mode != MODE_IMAGE) + return 0; + + if (img.multi.animate) { + timo_adelay = 0; + img.multi.animate = 0; + return 0; + } else { + timo_adelay = img_frame_animate(&img, 1); + return 1; + } } int it_move(arg_t a) { @@ -239,6 +256,7 @@ int i_zoom(arg_t a) { if (mode != MODE_IMAGE) return 0; + if (scale > 0) return img_zoom_in(&img, &win); else if (scale < 0) -- cgit v1.2.3-54-g00ecf