Add:osd/core:added support for autostart in odometer osd
authortegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 3 Dec 2010 21:30:04 +0000 (21:30 +0000)
committertegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 3 Dec 2010 21:30:04 +0000 (21:30 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@3753 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/attr_def.h
navit/navit/osd/core/osd_core.c

index 268df0e..55e25e9 100644 (file)
@@ -219,6 +219,7 @@ ATTR(search_active)
 ATTR(unsuspend)
 ATTR(announce_on)
 ATTR(disable_reset)
+ATTR(autostart)
 ATTR2(0x0002ffff,type_int_end)
 ATTR2(0x00030000,type_string_begin)
 ATTR(type)
index 3c0b23b..f319c3f 100644 (file)
@@ -187,6 +187,7 @@ struct odometer {
        struct color idle_color;    //text color when counter is idle
 
        int bDisableReset;         
+       int bAutoStart;         
        int bActive;                //counting or not
        double sum_dist;            //sum of distance ofprevious intervals in meters
        int sum_time;               //sum of time of previous intervals in seconds (needed for avg spd calculation)
@@ -404,6 +405,9 @@ osd_odometer_init(struct odometer *this, struct navit *nav)
 
        navit_add_callback(nav, this->click_cb = callback_new_attr_1(callback_cast (osd_odometer_click), attr_button, this));
 
+       if(this->bAutoStart) {
+               this->bActive = 1;
+       }
        osd_odometer_draw(this, nav, NULL);
 }
 
@@ -475,6 +479,12 @@ osd_odometer_new(struct navit *nav, struct osd_methods *meth,
        else
                this->bDisableReset = 0;
 
+       attr = attr_search(attrs, NULL, attr_autostart);
+       if (attr)
+               this->bAutoStart = attr->u.num;
+       else
+               this->bAutoStart = 0;
+
        osd_set_std_attr(attrs, &this->osd_item, 2);
        attr = attr_search(attrs, NULL, attr_width);
        this->width=attr ? attr->u.num : 2;