mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-13 07:23:45 +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}
|
all: options ${PROJECT}
|
||||||
|
|
||||||
options:
|
options:
|
||||||
@echo ${PROJECT} buld options:
|
@echo ${PROJECT} build options:
|
||||||
@echo "CFLAGS = ${CFLAGS}"
|
@echo "CFLAGS = ${CFLAGS}"
|
||||||
@echo "LDFLAGS = ${LDFLAGS}"
|
@echo "LDFLAGS = ${LDFLAGS}"
|
||||||
@echo "DFLAGS = ${DFLAGS}"
|
@echo "DFLAGS = ${DFLAGS}"
|
||||||
|
@ -107,6 +107,7 @@ BufferCommand buffer_commands[] = {
|
|||||||
{"^zI$", bcmd_zoom, { ZOOM_IN } },
|
{"^zI$", bcmd_zoom, { ZOOM_IN } },
|
||||||
{"^zO$", bcmd_zoom, { ZOOM_OUT } },
|
{"^zO$", bcmd_zoom, { ZOOM_OUT } },
|
||||||
{"^z0$", bcmd_zoom, { ZOOM_ORIGINAL } },
|
{"^z0$", bcmd_zoom, { ZOOM_ORIGINAL } },
|
||||||
|
{"^[0-9]+Z$", bcmd_zoom, { ZOOM_SPECIFIC } },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* special commands */
|
/* special commands */
|
||||||
|
22
zathura.c
22
zathura.c
@ -24,8 +24,8 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN,
|
|||||||
BOTTOM, TOP, HIDE, NORMAL, HIGHLIGHT,
|
BOTTOM, TOP, HIDE, NORMAL, HIGHLIGHT,
|
||||||
INSERT, VISUAL, DELETE_LAST_WORD, DEFAULT,
|
INSERT, VISUAL, DELETE_LAST_WORD, DEFAULT,
|
||||||
ERROR, WARNING, NEXT_GROUP, PREVIOUS_GROUP,
|
ERROR, WARNING, NEXT_GROUP, PREVIOUS_GROUP,
|
||||||
ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, FORWARD,
|
ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC,
|
||||||
BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH,
|
FORWARD, BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH,
|
||||||
CONTINUOUS };
|
CONTINUOUS };
|
||||||
|
|
||||||
/* typedefs */
|
/* typedefs */
|
||||||
@ -1984,11 +1984,29 @@ bcmd_zoom(char* buffer, Argument* argument)
|
|||||||
{
|
{
|
||||||
if((Zathura.PDF.scale + ZOOM_STEP) <= ZOOM_MAX)
|
if((Zathura.PDF.scale + ZOOM_STEP) <= ZOOM_MAX)
|
||||||
Zathura.PDF.scale += ZOOM_STEP;
|
Zathura.PDF.scale += ZOOM_STEP;
|
||||||
|
else
|
||||||
|
Zathura.PDF.scale = ZOOM_MAX;
|
||||||
}
|
}
|
||||||
else if(argument->n == ZOOM_OUT)
|
else if(argument->n == ZOOM_OUT)
|
||||||
{
|
{
|
||||||
if((Zathura.PDF.scale - ZOOM_STEP) >= ZOOM_MIN)
|
if((Zathura.PDF.scale - ZOOM_STEP) >= ZOOM_MIN)
|
||||||
Zathura.PDF.scale -= ZOOM_STEP;
|
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
|
else
|
||||||
Zathura.PDF.scale = 100;
|
Zathura.PDF.scale = 100;
|
||||||
|
Loading…
Reference in New Issue
Block a user