summaryrefslogtreecommitdiffstats
path: root/commands.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-08-19 18:46:17 +0200
committerBert <ber.t@gmx.com>2011-08-19 18:46:17 +0200
commitbb577d274dbd9981a726092a504466bc9b5c9bdb (patch)
treef3bbf611ddd904f80dfe20bb4d1171d1dc45ed3d /commands.c
parent8b3ae5027e9490bd7edfeea3d3cd2fbc5ec4beaf (diff)
downloadnsxiv-bb577d274dbd9981a726092a504466bc9b5c9bdb.tar.zst
Added command to toggle gif animations
Diffstat (limited to 'commands.c')
-rw-r--r--commands.c22
1 files changed, 20 insertions, 2 deletions
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)