From 53d9ddd557f5c7543a14402a2a01b0119eadbbfa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Sun, 25 Jan 2015 22:41:22 +0100 Subject: [PATCH] Add mouse vertical scrolling. --- data/gui.glade | 149 +++++++++++++++++++++--------------------- src/ui/drawing_area.c | 17 +++++ 2 files changed, 93 insertions(+), 73 deletions(-) diff --git a/data/gui.glade b/data/gui.glade index 8b559af..6140265 100644 --- a/data/gui.glade +++ b/data/gui.glade @@ -1,6 +1,7 @@ + - + FileAccel @@ -98,13 +99,82 @@ True False gtk-missing-image - 1 + 1 True False gtk-missing-image + + False + 5 + dialog + + + False + vertical + 2 + + + False + end + + + gtk-cancel + True + True + True + True + + + False + True + 0 + + + + + gtk-open + True + True + True + True + True + True + + + False + True + 1 + + + + + False + True + end + 0 + + + + + + + + + openfiledialog-cancel + openfiledialog-ok + + + + -100 + 100 + 0.10000000000000001 + 10 + + + False 400 @@ -321,10 +391,12 @@ True True False - + GDK_STRUCTURE_MASK | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK - + + + True @@ -374,73 +446,4 @@ - - False - 5 - dialog - - - False - vertical - 2 - - - False - end - - - gtk-cancel - True - True - True - True - - - False - True - 0 - - - - - gtk-open - True - True - True - True - True - True - - - False - True - 1 - - - - - False - True - end - 0 - - - - - - - - - openfiledialog-cancel - openfiledialog-ok - - - - -100 - 100 - 0.10000000000000001 - 10 - - - diff --git a/src/ui/drawing_area.c b/src/ui/drawing_area.c index 8eefe5f..491906e 100644 --- a/src/ui/drawing_area.c +++ b/src/ui/drawing_area.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "../debug.h" #include "drawing_area.h" @@ -148,3 +149,19 @@ void drawing_area_unrealize (GtkWidget *widget, gpointer data) { /* Code */ } + +void drawing_area_event_scroll (GtkWidget *widget, GdkEventScroll *event, gpointer user_data) +{ + assert(event->type == GDK_SCROLL); + + switch(event->direction) { + case GDK_SCROLL_UP: + camera_pos_y++; + gtk_widget_queue_draw(widget); + break; + case GDK_SCROLL_DOWN: + camera_pos_y--; + gtk_widget_queue_draw(widget); + break; + } +} -- 2.30.2