mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 20:46:08 +01:00
Added zoom buffer command
Now you can adjust the zoom level by typing commands like "25Z" etc.
This commit is contained in:
parent
a7ebea0a10
commit
e0f8bdc3b4
2
Makefile
2
Makefile
@ -11,7 +11,7 @@ DOBJECTS = ${SOURCE:.c=.do}
|
||||
all: options ${PROJECT}
|
||||
|
||||
options:
|
||||
@echo ${PROJECT} buld options:
|
||||
@echo ${PROJECT} build options:
|
||||
@echo "CFLAGS = ${CFLAGS}"
|
||||
@echo "LDFLAGS = ${LDFLAGS}"
|
||||
@echo "DFLAGS = ${DFLAGS}"
|
||||
|
@ -107,6 +107,7 @@ BufferCommand buffer_commands[] = {
|
||||
{"^zI$", bcmd_zoom, { ZOOM_IN } },
|
||||
{"^zO$", bcmd_zoom, { ZOOM_OUT } },
|
||||
{"^z0$", bcmd_zoom, { ZOOM_ORIGINAL } },
|
||||
{"^[0-9]+Z$", bcmd_zoom, { ZOOM_SPECIFIC } },
|
||||
};
|
||||
|
||||
/* special commands */
|
||||
|
22
zathura.c
22
zathura.c
@ -24,8 +24,8 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN,
|
||||
BOTTOM, TOP, HIDE, NORMAL, HIGHLIGHT,
|
||||
INSERT, VISUAL, DELETE_LAST_WORD, DEFAULT,
|
||||
ERROR, WARNING, NEXT_GROUP, PREVIOUS_GROUP,
|
||||
ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, FORWARD,
|
||||
BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH,
|
||||
ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC,
|
||||
FORWARD, BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH,
|
||||
CONTINUOUS };
|
||||
|
||||
/* typedefs */
|
||||
@ -1984,11 +1984,29 @@ bcmd_zoom(char* buffer, Argument* argument)
|
||||
{
|
||||
if((Zathura.PDF.scale + ZOOM_STEP) <= ZOOM_MAX)
|
||||
Zathura.PDF.scale += ZOOM_STEP;
|
||||
else
|
||||
Zathura.PDF.scale = ZOOM_MAX;
|
||||
}
|
||||
else if(argument->n == ZOOM_OUT)
|
||||
{
|
||||
if((Zathura.PDF.scale - ZOOM_STEP) >= ZOOM_MIN)
|
||||
Zathura.PDF.scale -= ZOOM_STEP;
|
||||
else
|
||||
Zathura.PDF.scale = ZOOM_MIN;
|
||||
}
|
||||
else if(argument->n == ZOOM_SPECIFIC)
|
||||
{
|
||||
int b_length = strlen(buffer);
|
||||
if(b_length < 1)
|
||||
return;
|
||||
|
||||
int value = atoi(g_strndup(buffer, b_length - 1));
|
||||
if(value <= ZOOM_MIN)
|
||||
Zathura.PDF.scale = ZOOM_MIN;
|
||||
else if(value >= ZOOM_MAX)
|
||||
Zathura.PDF.scale = ZOOM_MAX;
|
||||
else
|
||||
Zathura.PDF.scale = value;
|
||||
}
|
||||
else
|
||||
Zathura.PDF.scale = 100;
|
||||
|
Loading…
Reference in New Issue
Block a user