aboutsummaryrefslogtreecommitdiff
path: root/fastiv-view.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-13 09:50:04 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-13 09:51:16 +0100
commita1db89d91cb7498c962a9183eebf2e1d3070ca62 (patch)
treed37d469b5e68a41fa644e5853e771df4a55ea0ed /fastiv-view.c
parent73dd5bf1a08c0c6ca1d1312e4e966267a1afda08 (diff)
downloadfiv-a1db89d91cb7498c962a9183eebf2e1d3070ca62.tar.gz
fiv-a1db89d91cb7498c962a9183eebf2e1d3070ca62.tar.xz
fiv-a1db89d91cb7498c962a9183eebf2e1d3070ca62.zip
Make scaling accessible from the keyboard
Diffstat (limited to 'fastiv-view.c')
-rw-r--r--fastiv-view.c14
1 files 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;
}