nsxiv43a04c4
Revised scale mode and zoom level handling
- Scale mode is not reset to default value upon image loading anymore - New default key binding to change mode to scale-down - Removed scale mode setting from config.h - Removed -d command line option, as this is now the default at startup
+21 −33
5 files changed
- M README.md +6 −6
- M config.def.h +2 −9
- M image.c +1 −1
- M options.c +3 −6
- M sxiv.1 +9 −11
| @@ -70,7 +70,6 @@ of small previews is displayed, making it easy to choose an image to open. | |||
| 70 | 70 | ||
| 71 | 71 | -b Do not show info bar on bottom of window | |
| 72 | 72 | -c Remove all orphaned cache files from thumbnail cache and exit | |
| 73 | − | -d Scale all images to 100%, but fit large images into window | |
| 74 | 73 | -F Use size-hints to make the window fixed/floating | |
| 75 | 74 | -f Start in fullscreen mode | |
| 76 | 75 | -G GAMMA Set image gamma to GAMMA (-32..32) | |
| @@ -83,11 +82,11 @@ of small previews is displayed, making it easy to choose an image to open. | |||
| 83 | 82 | -q Be quiet, disable warnings | |
| 84 | 83 | -r Search given directories recursively for images | |
| 85 | 84 | -S DELAY Enable slideshow and set slideshow delay to DELAY seconds | |
| 86 | − | -s Scale all images to fit into window | |
| 85 | + | -s Fit images to window | |
| 87 | 86 | -t Start in thumbnail mode | |
| 88 | 87 | -v Print version information and exit | |
| 89 | 88 | -Z Same as `-z 100' | |
| 90 | − | -z ZOOM Scale all images to current zoom level, use ZOOM at startup | |
| 89 | + | -z ZOOM Set zoom level to ZOOM percent | |
| 91 | 90 | ||
| 92 | 91 | **Key mappings:** | |
| 93 | 92 | ||
| @@ -132,9 +131,10 @@ of small previews is displayed, making it easy to choose an image to open. | |||
| 132 | 131 | + Zoom in | |
| 133 | 132 | - Zoom out | |
| 134 | 133 | = Set zoom level to 100%, or [count]% | |
| 135 | − | w Fit image into window | |
| 136 | − | e Fit image width to window width | |
| 137 | − | E Fit image height to window height | |
| 134 | + | w Set zoom level to 100%, but fit large images into window | |
| 135 | + | W Fit image to window | |
| 136 | + | e Fit image to window width | |
| 137 | + | E Fit image to window height | |
| 138 | 138 | ||
| 139 | 139 | h,j,k,l Pan image 1/5 of window width/height or [count] pixels | |
| 140 | 140 | left/down/up/right (also with arrow keys) | |
| @@ -23,14 +23,6 @@ static const char * const BAR_FG_COLOR = "#EEEEEE"; | |||
| 23 | 23 | #endif | |
| 24 | 24 | #ifdef _IMAGE_CONFIG | |
| 25 | 25 | ||
| 26 | − | /* how should images be scaled when they are loaded? | |
| 27 | − | * (also controllable via -d/-s/-Z/-z options) | |
| 28 | − | * SCALE_DOWN: 100%, but fit large images into window, | |
| 29 | − | * SCALE_FIT: fit all images into window, | |
| 30 | − | * SCALE_ZOOM: use current zoom level, 100% at startup | |
| 31 | − | */ | |
| 32 | − | static const scalemode_t SCALE_MODE = SCALE_DOWN; | |
| 33 | − | ||
| 34 | 26 | /* levels (in percent) to use when zooming via '-' and '+': | |
| 35 | 27 | * (first/last value is used as min/max zoom level) | |
| 36 | 28 | */ | |
| @@ -138,7 +130,8 @@ static const keymap_t keys[] = { | |||
| 138 | 130 | { 0, XK_minus, i_zoom, (arg_t) -1 }, | |
| 139 | 131 | { 0, XK_KP_Subtract, i_zoom, (arg_t) -1 }, | |
| 140 | 132 | { 0, XK_equal, i_set_zoom, (arg_t) 100 }, | |
| 141 | − | { 0, XK_w, i_fit_to_win, (arg_t) SCALE_FIT }, | |
| 133 | + | { 0, XK_w, i_fit_to_win, (arg_t) SCALE_DOWN }, | |
| 134 | + | { 0, XK_W, i_fit_to_win, (arg_t) SCALE_FIT }, | |
| 142 | 135 | { 0, XK_e, i_fit_to_win, (arg_t) SCALE_WIDTH }, | |
| 143 | 136 | { 0, XK_E, i_fit_to_win, (arg_t) SCALE_HEIGHT }, | |
| 144 | 137 | ||
| @@ -74,6 +74,7 @@ void img_init(img_t *img, win_t *win) | |||
| 74 | 74 | ||
| 75 | 75 | img->im = NULL; | |
| 76 | 76 | img->win = win; | |
| 77 | + | img->scalemode = options->scalemode; | |
| 77 | 78 | img->zoom = options->zoom; | |
| 78 | 79 | img->zoom = MAX(img->zoom, zoom_min); | |
| 79 | 80 | img->zoom = MIN(img->zoom, zoom_max); | |
| @@ -333,7 +334,6 @@ bool img_load(img_t *img, const fileinfo_t *file) | |||
| 333 | 334 | ||
| 334 | 335 | img->w = imlib_image_get_width(); | |
| 335 | 336 | img->h = imlib_image_get_height(); | |
| 336 | − | img->scalemode = options->scalemode; | |
| 337 | 337 | img->checkpan = true; | |
| 338 | 338 | img->dirty = true; | |
| 339 | 339 | ||
| @@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options; | |||
| 33 | 33 | ||
| 34 | 34 | void print_usage(void) | |
| 35 | 35 | { | |
| 36 | − | printf("usage: sxiv [-bcdFfhioqrstvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] " | |
| 36 | + | printf("usage: sxiv [-bcFfhioqrstvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] " | |
| 37 | 37 | "[-N NAME] [-S DELAY] [-z ZOOM] FILES...\n"); | |
| 38 | 38 | } | |
| 39 | 39 | ||
| @@ -52,7 +52,7 @@ void parse_options(int argc, char **argv) | |||
| 52 | 52 | _options.recursive = false; | |
| 53 | 53 | _options.startnum = 0; | |
| 54 | 54 | ||
| 55 | − | _options.scalemode = SCALE_MODE; | |
| 55 | + | _options.scalemode = SCALE_DOWN; | |
| 56 | 56 | _options.zoom = 1.0; | |
| 57 | 57 | _options.gamma = 0; | |
| 58 | 58 | _options.slideshow = 0; | |
| @@ -67,7 +67,7 @@ void parse_options(int argc, char **argv) | |||
| 67 | 67 | _options.thumb_mode = false; | |
| 68 | 68 | _options.clean_cache = false; | |
| 69 | 69 | ||
| 70 | − | while ((opt = getopt(argc, argv, "bcdFfG:g:hin:N:oqrS:stvZz:")) != -1) { | |
| 70 | + | while ((opt = getopt(argc, argv, "bcFfG:g:hin:N:oqrS:stvZz:")) != -1) { | |
| 71 | 71 | switch (opt) { | |
| 72 | 72 | case '?': | |
| 73 | 73 | print_usage(); | |
| @@ -78,9 +78,6 @@ void parse_options(int argc, char **argv) | |||
| 78 | 78 | case 'c': | |
| 79 | 79 | _options.clean_cache = true; | |
| 80 | 80 | break; | |
| 81 | − | case 'd': | |
| 82 | − | _options.scalemode = SCALE_DOWN; | |
| 83 | − | break; | |
| 84 | 81 | case 'F': | |
| 85 | 82 | _options.fixed_win = true; | |
| 86 | 83 | break; | |
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | sxiv \- Simple X Image Viewer | |
| 4 | 4 | .SH SYNOPSIS | |
| 5 | 5 | .B sxiv | |
| 6 | − | .RB [ \-bcdFfhiopqrstvZ ] | |
| 6 | + | .RB [ \-bcFfhioqrstvZ ] | |
| 7 | 7 | .RB [ \-G | |
| 8 | 8 | .IR GAMMA ] | |
| 9 | 9 | .RB [ \-g | |
| @@ -38,9 +38,6 @@ Do not show info bar on bottom of window. | |||
| 38 | 38 | .B \-c | |
| 39 | 39 | Remove all orphaned cache files from the thumbnail cache directory and exit. | |
| 40 | 40 | .TP | |
| 41 | − | .B \-d | |
| 42 | − | Scale all images to 100%, but fit large images into window. | |
| 43 | − | .TP | |
| 44 | 41 | .B \-F | |
| 45 | 42 | Make the window fixed/floating by setting the minimum and maximum width/height | |
| 46 | 43 | size-hints to the window width/height. | |
| @@ -84,7 +81,7 @@ Search the given directories recursively for images to view. | |||
| 84 | 81 | Start in slideshow mode. Set the delay between images to DELAY seconds. | |
| 85 | 82 | .TP | |
| 86 | 83 | .B \-s | |
| 87 | − | Scale all images to fit into window. | |
| 84 | + | Fit images to window. | |
| 88 | 85 | .TP | |
| 89 | 86 | .B \-t | |
| 90 | 87 | Start in thumbnail mode. | |
| @@ -96,9 +93,7 @@ Print version information to standard output and exit. | |||
| 96 | 93 | The same as `\-z 100'. | |
| 97 | 94 | .TP | |
| 98 | 95 | .BI "\-z " ZOOM | |
| 99 | − | Scale all images to the current zoom level, use a zoom level of | |
| 100 | − | .I ZOOM | |
| 101 | − | at startup. | |
| 96 | + | Set zoom level to ZOOM percent. | |
| 102 | 97 | .SH GENERAL KEYBOARD COMMANDS | |
| 103 | 98 | The following keyboard commands are available in both image and thumbnail mode: | |
| 104 | 99 | .TP | |
| @@ -229,13 +224,16 @@ Set zoom level to 100%, or | |||
| 229 | 224 | .IR count %. | |
| 230 | 225 | .TP | |
| 231 | 226 | .B w | |
| 232 | − | Set zoom level to fit image into window. | |
| 227 | + | Set zoom level to 100%, but fit large images into window. | |
| 228 | + | .TP | |
| 229 | + | .B W | |
| 230 | + | Fit image to window. | |
| 233 | 231 | .TP | |
| 234 | 232 | .B e | |
| 235 | − | Set zoom level to fit image width to window width. | |
| 233 | + | Fit image to window width. | |
| 236 | 234 | .TP | |
| 237 | 235 | .B E | |
| 238 | − | Set zoom level to fit image height to window height. | |
| 236 | + | Fit image to window height. | |
| 239 | 237 | .SS Panning | |
| 240 | 238 | .TP | |
| 241 | 239 | .BR h ", " Left | |