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
This commit is contained in:
Bert Münnich 2014-02-04 23:03:53 +01:00
parent 524d9de877
commit 43a04c4757
5 changed files with 21 additions and 33 deletions

View File

@ -70,7 +70,6 @@ of small previews is displayed, making it easy to choose an image to open.
-b Do not show info bar on bottom of window
-c Remove all orphaned cache files from thumbnail cache and exit
-d Scale all images to 100%, but fit large images into window
-F Use size-hints to make the window fixed/floating
-f Start in fullscreen mode
-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.
-q Be quiet, disable warnings
-r Search given directories recursively for images
-S DELAY Enable slideshow and set slideshow delay to DELAY seconds
-s Scale all images to fit into window
-s Fit images to window
-t Start in thumbnail mode
-v Print version information and exit
-Z Same as `-z 100'
-z ZOOM Scale all images to current zoom level, use ZOOM at startup
-z ZOOM Set zoom level to ZOOM percent
**Key mappings:**
@ -132,9 +131,10 @@ of small previews is displayed, making it easy to choose an image to open.
+ Zoom in
- Zoom out
= Set zoom level to 100%, or [count]%
w Fit image into window
e Fit image width to window width
E Fit image height to window height
w Set zoom level to 100%, but fit large images into window
W Fit image to window
e Fit image to window width
E Fit image to window height
h,j,k,l Pan image 1/5 of window width/height or [count] pixels
left/down/up/right (also with arrow keys)

View File

@ -23,14 +23,6 @@ static const char * const BAR_FG_COLOR = "#EEEEEE";
#endif
#ifdef _IMAGE_CONFIG
/* how should images be scaled when they are loaded?
* (also controllable via -d/-s/-Z/-z options)
* SCALE_DOWN: 100%, but fit large images into window,
* SCALE_FIT: fit all images into window,
* SCALE_ZOOM: use current zoom level, 100% at startup
*/
static const scalemode_t SCALE_MODE = SCALE_DOWN;
/* levels (in percent) to use when zooming via '-' and '+':
* (first/last value is used as min/max zoom level)
*/
@ -138,7 +130,8 @@ static const keymap_t keys[] = {
{ 0, XK_minus, i_zoom, (arg_t) -1 },
{ 0, XK_KP_Subtract, i_zoom, (arg_t) -1 },
{ 0, XK_equal, i_set_zoom, (arg_t) 100 },
{ 0, XK_w, i_fit_to_win, (arg_t) SCALE_FIT },
{ 0, XK_w, i_fit_to_win, (arg_t) SCALE_DOWN },
{ 0, XK_W, i_fit_to_win, (arg_t) SCALE_FIT },
{ 0, XK_e, i_fit_to_win, (arg_t) SCALE_WIDTH },
{ 0, XK_E, i_fit_to_win, (arg_t) SCALE_HEIGHT },

View File

@ -74,6 +74,7 @@ void img_init(img_t *img, win_t *win)
img->im = NULL;
img->win = win;
img->scalemode = options->scalemode;
img->zoom = options->zoom;
img->zoom = MAX(img->zoom, zoom_min);
img->zoom = MIN(img->zoom, zoom_max);
@ -333,7 +334,6 @@ bool img_load(img_t *img, const fileinfo_t *file)
img->w = imlib_image_get_width();
img->h = imlib_image_get_height();
img->scalemode = options->scalemode;
img->checkpan = true;
img->dirty = true;

View File

@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options;
void print_usage(void)
{
printf("usage: sxiv [-bcdFfhioqrstvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
printf("usage: sxiv [-bcFfhioqrstvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
"[-N NAME] [-S DELAY] [-z ZOOM] FILES...\n");
}
@ -52,7 +52,7 @@ void parse_options(int argc, char **argv)
_options.recursive = false;
_options.startnum = 0;
_options.scalemode = SCALE_MODE;
_options.scalemode = SCALE_DOWN;
_options.zoom = 1.0;
_options.gamma = 0;
_options.slideshow = 0;
@ -67,7 +67,7 @@ void parse_options(int argc, char **argv)
_options.thumb_mode = false;
_options.clean_cache = false;
while ((opt = getopt(argc, argv, "bcdFfG:g:hin:N:oqrS:stvZz:")) != -1) {
while ((opt = getopt(argc, argv, "bcFfG:g:hin:N:oqrS:stvZz:")) != -1) {
switch (opt) {
case '?':
print_usage();
@ -78,9 +78,6 @@ void parse_options(int argc, char **argv)
case 'c':
_options.clean_cache = true;
break;
case 'd':
_options.scalemode = SCALE_DOWN;
break;
case 'F':
_options.fixed_win = true;
break;

20
sxiv.1
View File

@ -3,7 +3,7 @@
sxiv \- Simple X Image Viewer
.SH SYNOPSIS
.B sxiv
.RB [ \-bcdFfhiopqrstvZ ]
.RB [ \-bcFfhioqrstvZ ]
.RB [ \-G
.IR GAMMA ]
.RB [ \-g
@ -38,9 +38,6 @@ Do not show info bar on bottom of window.
.B \-c
Remove all orphaned cache files from the thumbnail cache directory and exit.
.TP
.B \-d
Scale all images to 100%, but fit large images into window.
.TP
.B \-F
Make the window fixed/floating by setting the minimum and maximum width/height
size-hints to the window width/height.
@ -84,7 +81,7 @@ Search the given directories recursively for images to view.
Start in slideshow mode. Set the delay between images to DELAY seconds.
.TP
.B \-s
Scale all images to fit into window.
Fit images to window.
.TP
.B \-t
Start in thumbnail mode.
@ -96,9 +93,7 @@ Print version information to standard output and exit.
The same as `\-z 100'.
.TP
.BI "\-z " ZOOM
Scale all images to the current zoom level, use a zoom level of
.I ZOOM
at startup.
Set zoom level to ZOOM percent.
.SH GENERAL KEYBOARD COMMANDS
The following keyboard commands are available in both image and thumbnail mode:
.TP
@ -229,13 +224,16 @@ Set zoom level to 100%, or
.IR count %.
.TP
.B w
Set zoom level to fit image into window.
Set zoom level to 100%, but fit large images into window.
.TP
.B W
Fit image to window.
.TP
.B e
Set zoom level to fit image width to window width.
Fit image to window width.
.TP
.B E
Set zoom level to fit image height to window height.
Fit image to window height.
.SS Panning
.TP
.BR h ", " Left