mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-31 08:44:55 +01:00
Update scale variable
This commit is contained in:
parent
0c611cd2ff
commit
b08a17e4a6
2 changed files with 12 additions and 7 deletions
|
@ -1,9 +1,9 @@
|
||||||
/* 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;
|
static const float ZOOM_STEP = 10;
|
||||||
static const float ZOOM_MIN = 0.1;
|
static const float ZOOM_MIN = 10;
|
||||||
static const float ZOOM_MAX = 4.1;
|
static const float ZOOM_MAX = 400;
|
||||||
|
|
||||||
/* completion */
|
/* completion */
|
||||||
static const char FORMAT_COMMAND[] = "<b>%s</b>";
|
static const char FORMAT_COMMAND[] = "<b>%s</b>";
|
||||||
|
|
13
zathura.c
13
zathura.c
|
@ -169,7 +169,7 @@ struct
|
||||||
Page *pages;
|
Page *pages;
|
||||||
int page_number;
|
int page_number;
|
||||||
int number_of_pages;
|
int number_of_pages;
|
||||||
double scale;
|
int scale;
|
||||||
int rotate;
|
int rotate;
|
||||||
} PDF;
|
} PDF;
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ update_status()
|
||||||
gtk_label_set_markup((GtkLabel*) Zathura.Global.status_text, Zathura.State.filename);
|
gtk_label_set_markup((GtkLabel*) Zathura.Global.status_text, Zathura.State.filename);
|
||||||
|
|
||||||
/* update state */
|
/* update state */
|
||||||
char* zoom_level = (Zathura.PDF.scale != 0) ? g_strdup_printf("%f%%", Zathura.PDF.scale) : "";
|
char* zoom_level = (Zathura.PDF.scale != 0) ? g_strdup_printf("%d%%", Zathura.PDF.scale) : "";
|
||||||
char* status_text = g_strdup_printf("%s %s", zoom_level, Zathura.State.pages);
|
char* status_text = g_strdup_printf("%s %s", zoom_level, Zathura.State.pages);
|
||||||
gtk_label_set_markup((GtkLabel*) Zathura.Global.status_state, status_text);
|
gtk_label_set_markup((GtkLabel*) Zathura.Global.status_state, status_text);
|
||||||
|
|
||||||
|
@ -937,8 +937,9 @@ cmd_open(int argc, char** argv)
|
||||||
|
|
||||||
Zathura.PDF.number_of_pages = poppler_document_get_n_pages(Zathura.PDF.document);
|
Zathura.PDF.number_of_pages = poppler_document_get_n_pages(Zathura.PDF.document);
|
||||||
Zathura.PDF.file = file;
|
Zathura.PDF.file = file;
|
||||||
Zathura.PDF.scale = 1.0;
|
Zathura.PDF.scale = 100;
|
||||||
Zathura.PDF.rotate = 0;
|
Zathura.PDF.rotate = 0;
|
||||||
|
Zathura.PDF.pages = malloc(Zathura.PDF.number_of_pages * sizeof(Page));
|
||||||
Zathura.State.filename = file;
|
Zathura.State.filename = file;
|
||||||
|
|
||||||
set_page(0);
|
set_page(0);
|
||||||
|
@ -1091,7 +1092,7 @@ bcmd_zoom(char* buffer, Argument* argument)
|
||||||
Zathura.PDF.scale -= ZOOM_STEP;
|
Zathura.PDF.scale -= ZOOM_STEP;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Zathura.PDF.scale = 1.0;
|
Zathura.PDF.scale = 100;
|
||||||
|
|
||||||
update_status();
|
update_status();
|
||||||
}
|
}
|
||||||
|
@ -1108,6 +1109,10 @@ gboolean
|
||||||
cb_destroy(GtkWidget* widget, gpointer data)
|
cb_destroy(GtkWidget* widget, gpointer data)
|
||||||
{
|
{
|
||||||
pango_font_description_free(Zathura.Style.font);
|
pango_font_description_free(Zathura.Style.font);
|
||||||
|
|
||||||
|
if(Zathura.PDF.document)
|
||||||
|
free(Zathura.PDF.pages);
|
||||||
|
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue