Krolyxon
Commit 43a04c4

Branches

Refs →

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
Author
Bert Münnich
Date
2014-02-04 23:03 +0100
Parent
524d9de
Commit
43a04c4757f4a20c3b9b1487ea7894c0f3e73708

+21 −33

5 files changed

  1. M README.md +6 −6
  2. M config.def.h +2 −9
  3. M image.c +1 −1
  4. M options.c +3 −6
  5. M sxiv.1 +9 −11
M README.md View
@@ -70,7 +70,6 @@ of small previews is displayed, making it easy to choose an image to open.
7070
7171 -b Do not show info bar on bottom of window
7272 -c Remove all orphaned cache files from thumbnail cache and exit
73− -d Scale all images to 100%, but fit large images into window
7473 -F Use size-hints to make the window fixed/floating
7574 -f Start in fullscreen mode
7675 -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.
8382 -q Be quiet, disable warnings
8483 -r Search given directories recursively for images
8584 -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
8786 -t Start in thumbnail mode
8887 -v Print version information and exit
8988 -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
9190
9291 **Key mappings:**
9392
@@ -132,9 +131,10 @@ of small previews is displayed, making it easy to choose an image to open.
132131 + Zoom in
133132 - Zoom out
134133 = 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
138138
139139 h,j,k,l Pan image 1/5 of window width/height or [count] pixels
140140 left/down/up/right (also with arrow keys)
M config.def.h View
@@ -23,14 +23,6 @@ static const char * const BAR_FG_COLOR = "#EEEEEE";
2323 #endif
2424 #ifdef _IMAGE_CONFIG
2525
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−
3426 /* levels (in percent) to use when zooming via '-' and '+':
3527 * (first/last value is used as min/max zoom level)
3628 */
@@ -138,7 +130,8 @@ static const keymap_t keys[] = {
138130 { 0, XK_minus, i_zoom, (arg_t) -1 },
139131 { 0, XK_KP_Subtract, i_zoom, (arg_t) -1 },
140132 { 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 },
142135 { 0, XK_e, i_fit_to_win, (arg_t) SCALE_WIDTH },
143136 { 0, XK_E, i_fit_to_win, (arg_t) SCALE_HEIGHT },
144137
M image.c View
@@ -74,6 +74,7 @@ void img_init(img_t *img, win_t *win)
7474
7575 img->im = NULL;
7676 img->win = win;
77+ img->scalemode = options->scalemode;
7778 img->zoom = options->zoom;
7879 img->zoom = MAX(img->zoom, zoom_min);
7980 img->zoom = MIN(img->zoom, zoom_max);
@@ -333,7 +334,6 @@ bool img_load(img_t *img, const fileinfo_t *file)
333334
334335 img->w = imlib_image_get_width();
335336 img->h = imlib_image_get_height();
336− img->scalemode = options->scalemode;
337337 img->checkpan = true;
338338 img->dirty = true;
339339
M options.c View
@@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options;
3333
3434 void print_usage(void)
3535 {
36− printf("usage: sxiv [-bcdFfhioqrstvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
36+ printf("usage: sxiv [-bcFfhioqrstvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
3737 "[-N NAME] [-S DELAY] [-z ZOOM] FILES...\n");
3838 }
3939
@@ -52,7 +52,7 @@ void parse_options(int argc, char **argv)
5252 _options.recursive = false;
5353 _options.startnum = 0;
5454
55− _options.scalemode = SCALE_MODE;
55+ _options.scalemode = SCALE_DOWN;
5656 _options.zoom = 1.0;
5757 _options.gamma = 0;
5858 _options.slideshow = 0;
@@ -67,7 +67,7 @@ void parse_options(int argc, char **argv)
6767 _options.thumb_mode = false;
6868 _options.clean_cache = false;
6969
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) {
7171 switch (opt) {
7272 case '?':
7373 print_usage();
@@ -78,9 +78,6 @@ void parse_options(int argc, char **argv)
7878 case 'c':
7979 _options.clean_cache = true;
8080 break;
81− case 'd':
82− _options.scalemode = SCALE_DOWN;
83− break;
8481 case 'F':
8582 _options.fixed_win = true;
8683 break;
M sxiv.1 View
@@ -3,7 +3,7 @@
33 sxiv \- Simple X Image Viewer
44 .SH SYNOPSIS
55 .B sxiv
6−.RB [ \-bcdFfhiopqrstvZ ]
6+.RB [ \-bcFfhioqrstvZ ]
77 .RB [ \-G
88 .IR GAMMA ]
99 .RB [ \-g
@@ -38,9 +38,6 @@ Do not show info bar on bottom of window.
3838 .B \-c
3939 Remove all orphaned cache files from the thumbnail cache directory and exit.
4040 .TP
41−.B \-d
42−Scale all images to 100%, but fit large images into window.
43−.TP
4441 .B \-F
4542 Make the window fixed/floating by setting the minimum and maximum width/height
4643 size-hints to the window width/height.
@@ -84,7 +81,7 @@ Search the given directories recursively for images to view.
8481 Start in slideshow mode. Set the delay between images to DELAY seconds.
8582 .TP
8683 .B \-s
87−Scale all images to fit into window.
84+Fit images to window.
8885 .TP
8986 .B \-t
9087 Start in thumbnail mode.
@@ -96,9 +93,7 @@ Print version information to standard output and exit.
9693 The same as `\-z 100'.
9794 .TP
9895 .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.
10297 .SH GENERAL KEYBOARD COMMANDS
10398 The following keyboard commands are available in both image and thumbnail mode:
10499 .TP
@@ -229,13 +224,16 @@ Set zoom level to 100%, or
229224 .IR count %.
230225 .TP
231226 .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.
233231 .TP
234232 .B e
235−Set zoom level to fit image width to window width.
233+Fit image to window width.
236234 .TP
237235 .B E
238−Set zoom level to fit image height to window height.
236+Fit image to window height.
239237 .SS Panning
240238 .TP
241239 .BR h ", " Left