Add:Core:New attribute use_mousewheel to prevent accidential zoom in or out
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 25 Nov 2008 20:53:40 +0000 (20:53 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 25 Nov 2008 20:53:40 +0000 (20:53 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@1756 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/attr_def.h
navit/navit.c

index 5238bf5..5aca623 100644 (file)
@@ -112,6 +112,7 @@ ATTR(town_id) /* fixme? */
 ATTR(street_id) /* fixme? */  
 ATTR(district_id) /* fixme? */
 ATTR(drag_bitmap)
+ATTR(use_mousewheel)
 ATTR2(0x0002ffff,type_int_end)
 ATTR2(0x00030000,type_string_begin)
 ATTR(type)
index ed3d69f..d6c8a1a 100644 (file)
@@ -132,6 +132,7 @@ struct navit {
        int blocked;
        int w,h;
        int drag_bitmap;
+       int use_mousewheel;
        GHashTable *commands;
        struct callback *resize_callback,*button_callback,*motion_callback;
 };
@@ -282,11 +283,11 @@ navit_handle_button(struct navit *this_, int pressed, int button, struct point *
                        navit_set_center_screen(this_, p);
                if (button == 3)
                        popup(this_, button, p);
-               if (button == 4) {
+               if (button == 4 && this_->use_mousewheel) {
                        this_->zoomed = 1;
                        navit_zoom_in(this_, 2, p);
                }
-               if (button == 5) {
+               if (button == 5 && this_->use_mousewheel) {
                        this_->zoomed = 1;
                        navit_zoom_out(this_, 2, p);
                }
@@ -482,6 +483,7 @@ navit_new(struct attr *parent, struct attr **attrs)
 
        this_->last_moved = 0;
        this_->center_timeout = 10;
+       this_->use_mousewheel = 1;
 
        for (;*attrs; attrs++) {
                switch((*attrs)->type) {
@@ -506,6 +508,9 @@ navit_new(struct attr *parent, struct attr **attrs)
                case attr_drag_bitmap:
                        this_->drag_bitmap=!!(*attrs)->u.num;
                        break;
+               case attr_use_mousewheel:
+                       this_->use_mousewheel=!!(*attrs)->u.num;
+                       break;
                case attr_timeout:
                        this_->center_timeout = (*attrs)->u.num;
                        break;