Fix:Core:Fixed follow cursor functionality
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 30 Jul 2009 07:31:03 +0000 (07:31 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 30 Jul 2009 07:31:03 +0000 (07:31 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@2426 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/attr_def.h
navit/navit/gui/internal/gui_internal.c
navit/navit/navit.c

index 3459bb1..331b04f 100644 (file)
@@ -139,7 +139,7 @@ ATTR2(0x00028000,type_boolean_begin)
 /* boolean */
 ATTR(overwrite)
 ATTR(active)
-ATTR(cursor)
+ATTR(follow_cursor)
 ATTR(orientation_removeme)
 ATTR(tracking)
 ATTR(menubar)
@@ -311,6 +311,7 @@ ATTR(transformation)
 ATTR(vehicleprofile)
 ATTR(roadprofile)
 ATTR(announcement)
+ATTR(cursor)
 ATTR2(0x0008ffff,type_object_end)
 ATTR2(0x00090000,type_coord_begin)
 ATTR2(0x0009ffff,type_coord_end)
index 2e79e9b..1309f3d 100644 (file)
@@ -3332,7 +3332,7 @@ gui_internal_cmd_rules(struct gui_priv *this, struct widget *wm, void *data)
                        &on, &off));
        on.u.num=1;
        off.u.num=0;
-       on.type=off.type=attr_cursor;
+       on.type=off.type=attr_follow_cursor;
        gui_internal_widget_append(w,
                gui_internal_button_navit_attr_new(this, _("Map follows Vehicle"), gravity_left_center|orientation_horizontal|flags_fill,
                        &on, &off));
index 92c9716..bd0a7e0 100644 (file)
@@ -138,6 +138,7 @@ struct navit {
        struct vehicleprofile *vehicleprofile;
        GList *vehicleprofiles;
        int pitch;
+       int follow_cursor;
 };
 
 struct gui *main_loop_gui;
@@ -645,6 +646,7 @@ navit_new(struct attr *parent, struct attr **attrs)
        this_->autozoom_secs = 10;
        this_->autozoom_min = 7;
        this_->autozoom_active = 0;
+       this_->follow_cursor = 1;
 
        this_->trans = transform_new();
        transform_from_geo(pro, &g, &co);
@@ -1676,6 +1678,10 @@ navit_set_attr_do(struct navit *this_, struct attr *attr, int init)
        case attr_message:
                navit_add_message(this_, attr->u.str);
                break;
+       case attr_follow_cursor:
+               attr_updated=(this_->follow_cursor != !!attr->u.num);
+               this_->follow_cursor=!!attr->u.num;
+               break;
        default:
                return 0;
        }
@@ -2055,7 +2061,7 @@ navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv)
                gui_disable_suspend(this_->gui);
 
        transform(this_->trans, pro, &nv->coord, &cursor_pnt, 1, 0, 0, NULL);
-       if (this_->button_pressed != 1 && nv->follow_curr <= nv->follow && 
+       if (this_->button_pressed != 1 && this_->follow_cursor && nv->follow_curr <= nv->follow && 
                (nv->follow_curr == 1 || !transform_within_border(this_->trans, &cursor_pnt, border)))
                navit_set_center_cursor(this_);
        else