From c224e1f486a7100c7933a6e35e988a853496168d Mon Sep 17 00:00:00 2001 From: kraxel Date: Mon, 10 Apr 2006 07:43:01 +0000 Subject: autoscale first, misc fixes --- fbgs | 4 ++-- fbi.c | 8 ++++++-- fbi.man | 1 + fbiconfig.c | 5 +++++ fbiconfig.h | 2 ++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fbgs b/fbgs index bbb6444..7f4a9ac 100755 --- a/fbgs +++ b/fbgs @@ -1,8 +1,8 @@ #!/bin/bash # tmp dir -DIR="${TMPDIR-/var/tmp}/fbps-$$" -mkdir -p $DIR || exit 1 +DIR="$(mktemp -dtp ${TMPDIR-/var/tmp} fbgs-XXXXXX)" +test -d "$DIR" || exit 1 trap "rm -rf $DIR" EXIT # parse options diff --git a/fbi.c b/fbi.c index ca5ae0b..8135524 100644 --- a/fbi.c +++ b/fbi.c @@ -120,6 +120,7 @@ static float fbgamma = 1; /* Command line options. */ int autodown; int autoup; +int autofirst; int comments; int transparency = 40; @@ -155,8 +156,8 @@ usage(char *name) "\n", name); - cfg_help_cmdline(fbi_cmd,4,20,0); - cfg_help_cmdline(fbi_cfg,4,20,40); + cfg_help_cmdline(stderr,fbi_cmd,4,20,0); + cfg_help_cmdline(stderr,fbi_cfg,4,20,40); fprintf(stderr, "\n" @@ -1181,6 +1182,7 @@ main(int argc, char *argv[]) once = GET_ONCE(); autoup = GET_AUTO_UP(); autodown = GET_AUTO_DOWN(); + autofirst = GET_AUTO_FIRST(); fitwidth = GET_FIT_WIDTH(); statusline = GET_VERBOSE(); textreading = GET_TEXT_MODE(); @@ -1259,6 +1261,8 @@ main(int argc, char *argv[]) scale = 1; if (scale > 1 && !autoup) scale = 1; + if (autofirst) + autoup = autodown = 0; } if (scale != 1) { snprintf(linebuffer, sizeof(linebuffer), diff --git a/fbi.man b/fbi.man index 854fb75..c0cedbf 100644 --- a/fbi.man +++ b/fbi.man @@ -96,6 +96,7 @@ V enable/disable status line H display textbox with brief help I display textbox with some EXIF info g jump to image # +s set zoom to % .fi .P The Return vs. Space key thing can be used to create a file list while diff --git a/fbiconfig.c b/fbiconfig.c index a6d1061..eec7fd0 100644 --- a/fbiconfig.c +++ b/fbiconfig.c @@ -60,6 +60,11 @@ struct cfg_cmdline fbi_cfg[] = { .option = { O_AUTO_DOWN }, .yesno = 1, .desc = " like the above, but downscale only", + },{ + .cmdline = "autofirst", + .option = { O_AUTO_FIRST }, + .yesno = 1, + .desc = " autoscale first image only", },{ .cmdline = "fitwidth", .option = { O_FIT_WIDTH }, diff --git a/fbiconfig.h b/fbiconfig.h index 49ca23c..099907b 100644 --- a/fbiconfig.h +++ b/fbiconfig.h @@ -12,6 +12,7 @@ #define O_AUTO_UP O_OPTIONS, "auto-up" #define O_AUTO_DOWN O_OPTIONS, "auto-down" +#define O_AUTO_FIRST O_OPTIONS, "auto-first" #define O_FIT_WIDTH O_OPTIONS, "fit-width" #define O_QUIET O_OPTIONS, "quiet" #define O_VERBOSE O_OPTIONS, "verbose" @@ -41,6 +42,7 @@ #define GET_AUTO_UP() cfg_get_bool(O_AUTO_UP, 0) #define GET_AUTO_DOWN() cfg_get_bool(O_AUTO_DOWN, 0) +#define GET_AUTO_FIRST() cfg_get_bool(O_AUTO_DOWN, 0) #define GET_FIT_WIDTH() cfg_get_bool(O_FIT_WIDTH, 0) #define GET_QUIET() cfg_get_bool(O_QUIET, 0) #define GET_VERBOSE() cfg_get_bool(O_VERBOSE, 1) -- cgit