mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-27 14:36:00 +01:00
Implemented buffer commands goto and zoom
This commit is contained in:
parent
92c59f4548
commit
af83daf16f
2 changed files with 23 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
/* settings */
|
/* settings */
|
||||||
static const int DEFAULT_WIDTH = 800;
|
static const int DEFAULT_WIDTH = 800;
|
||||||
static const int DEFAULT_HEIGHT = 600;
|
static const int DEFAULT_HEIGHT = 600;
|
||||||
|
static const float ZOOM_STEP = 0.1;
|
||||||
|
|
||||||
/* completion */
|
/* completion */
|
||||||
static const char FORMAT_COMMAND[] = "<b>%s</b>";
|
static const char FORMAT_COMMAND[] = "<b>%s</b>";
|
||||||
|
|
24
zathura.c
24
zathura.c
|
@ -110,8 +110,6 @@ typedef struct
|
||||||
{
|
{
|
||||||
PopplerPage *page;
|
PopplerPage *page;
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
double scale;
|
|
||||||
int rotate;
|
|
||||||
} Page;
|
} Page;
|
||||||
|
|
||||||
/* zathura */
|
/* zathura */
|
||||||
|
@ -171,6 +169,8 @@ struct
|
||||||
Page *pages;
|
Page *pages;
|
||||||
int page_number;
|
int page_number;
|
||||||
int number_of_pages;
|
int number_of_pages;
|
||||||
|
double scale;
|
||||||
|
int rotate;
|
||||||
} PDF;
|
} PDF;
|
||||||
|
|
||||||
} Zathura;
|
} Zathura;
|
||||||
|
@ -543,7 +543,7 @@ sc_navigate(Argument* argument)
|
||||||
void
|
void
|
||||||
sc_rotate(Argument* argument)
|
sc_rotate(Argument* argument)
|
||||||
{
|
{
|
||||||
|
Zathura.PDF.rotate = (Zathura.PDF.rotate + 90) % 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1058,13 +1058,29 @@ Completion* cc_open(char* input)
|
||||||
void
|
void
|
||||||
bcmd_goto(char* buffer, Argument* argument)
|
bcmd_goto(char* buffer, Argument* argument)
|
||||||
{
|
{
|
||||||
|
int b_length = strlen(buffer);
|
||||||
|
|
||||||
|
if(b_length < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
char* b_value = g_strndup(buffer, b_length - 1);
|
||||||
|
int value = atoi(b_value);
|
||||||
|
|
||||||
|
set_page(value - 1);
|
||||||
|
update_status();
|
||||||
|
|
||||||
|
g_free(b_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
bcmd_zoom(char* buffer, Argument* argument)
|
bcmd_zoom(char* buffer, Argument* argument)
|
||||||
{
|
{
|
||||||
|
if(argument->n == ZOOM_IN)
|
||||||
|
Zathura.PDF.scale += ZOOM_STEP;
|
||||||
|
else if(argument->n == ZOOM_OUT)
|
||||||
|
Zathura.PDF.scale -= ZOOM_STEP;
|
||||||
|
else
|
||||||
|
Zathura.PDF.scale = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* special command implementation */
|
/* special command implementation */
|
||||||
|
|
Loading…
Reference in a new issue