diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2017-11-30 21:53:48 +0000 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2017-11-30 21:53:48 +0000 |
commit | 8a2094efa4b6b7096306c5b0ef5f489185592894 (patch) | |
tree | c22b1268ad20f71512de7fef114a8dc36e23d966 | |
parent | e99cd40716674d15e3ca4176b5722cda42da43a4 (diff) | |
download | imv-8a2094efa4b6b7096306c5b0ef5f489185592894.tar.gz |
Merge a,s,S flags to -s <mode>
-rw-r--r-- | doc/imv.1.txt | 7 | ||||
-rw-r--r-- | src/imv.c | 35 |
2 files changed, 28 insertions, 14 deletions
diff --git a/doc/imv.1.txt b/doc/imv.1.txt index 46662f4..fab4a0d 100644 --- a/doc/imv.1.txt +++ b/doc/imv.1.txt @@ -34,8 +34,11 @@ Options *-a*:: Default to displaying images at actual size. -*-s*:: - Default to shrinking images to fit the window, but not expanding them. +*-s* <none|shrink|full>:: + Set scaling mode to use. 'none' will show each image at its actual size. + 'shrink' will scale down the image to fit inside the window. 'full' will + both scale up and scale down the image to fit perfectly inside the window. + Defaults to 'full'. *-S*:: Default to scaling images to fit the window perfectly. @@ -308,6 +308,19 @@ static bool parse_slideshow_duration(struct imv *imv, const char *duration) return true; } +static enum scaling_mode parse_scaling_mode(const char *mode) +{ + if (!strcmp(mode, "shrink")) { + return SCALING_DOWN; + } + + if (!strcmp(mode, "full")) { + return SCALING_FULL; + } + + return SCALING_NONE; +} + static int load_paths_from_stdin(void *data) { struct imv *imv = data; @@ -339,19 +352,17 @@ bool imv_parse_args(struct imv *imv, int argc, char **argv) int o; - while((o = getopt(argc, argv, "frasSudxhln:b:e:t:")) != -1) { + while((o = getopt(argc, argv, "frudxhls:n:b:e:t:")) != -1) { switch(o) { - case 'f': imv->fullscreen = true; break; - case 'r': imv->recursive_load = true; break; - case 'a': imv->scaling_mode = SCALING_NONE; break; - case 's': imv->scaling_mode = SCALING_DOWN; break; - case 'S': imv->scaling_mode = SCALING_FULL; break; - case 'u': imv->nearest_neighbour = true; break; - case 'd': imv->overlay_enabled = true; break; - case 'x': imv->loop_input = false; break; - case 'l': imv->list_files_at_exit = true; break; - case 'n': imv->starting_path = optarg; break; - case 'e': imv->font_name = strdup(optarg); break; + case 'f': imv->fullscreen = true; break; + case 'r': imv->recursive_load = true; break; + case 's': imv->scaling_mode = parse_scaling_mode(optarg); break; + case 'u': imv->nearest_neighbour = true; break; + case 'd': imv->overlay_enabled = true; break; + case 'x': imv->loop_input = false; break; + case 'l': imv->list_files_at_exit = true; break; + case 'n': imv->starting_path = optarg; break; + case 'e': imv->font_name = strdup(optarg); break; case 'h': fprintf(stdout, "imv %s\n" |