From a1db89d91cb7498c962a9183eebf2e1d3070ca62 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sat, 13 Nov 2021 09:50:04 +0100 Subject: Make scaling accessible from the keyboard --- fastiv-view.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fastiv-view.c b/fastiv-view.c index 52d2ed4..a8b879e 100644 --- a/fastiv-view.c +++ b/fastiv-view.c @@ -169,6 +169,8 @@ fastiv_view_draw(GtkWidget *widget, cairo_t *cr) return TRUE; } +#define SCALE_STEP 1.4 + static gboolean fastiv_view_scroll_event(GtkWidget *widget, GdkEventScroll *event) { @@ -178,11 +180,11 @@ fastiv_view_scroll_event(GtkWidget *widget, GdkEventScroll *event) switch (event->direction) { case GDK_SCROLL_UP: - self->scale *= 1.4; + self->scale *= SCALE_STEP; gtk_widget_queue_resize(widget); return TRUE; case GDK_SCROLL_DOWN: - self->scale /= 1.4; + self->scale /= SCALE_STEP; gtk_widget_queue_resize(widget); return TRUE; default: @@ -202,6 +204,14 @@ fastiv_view_key_press_event(GtkWidget *widget, GdkEventKey *event) self->scale = 1; gtk_widget_queue_resize(widget); return TRUE; + case GDK_KEY_plus: + self->scale *= SCALE_STEP; + gtk_widget_queue_resize(widget); + return TRUE; + case GDK_KEY_minus: + self->scale /= SCALE_STEP; + gtk_widget_queue_resize(widget); + return TRUE; } return FALSE; } -- cgit v1.2.3-70-g09d2