Ticket #648: osd_core.c.patch

File osd_core.c.patch, 2.6 KB (added by chr, 11 years ago)

make the idle text color user selectable with 'text_color'

  • navit/osd/core/osd_core.c

     
    171171        struct graphics_gc *white;
    172172        struct callback *click_cb;
    173173        char *text;                 //text of label attribute for this osd
     174        struct color idle_color;    //text color when counter is idle
    174175
    175176        int bActive;                //counting or not
    176177        double sum_dist;            //sum of distance ofprevious intervals in meters
     
    306307        osd_set_std_graphic(nav, &this->osd_item, (struct osd_priv *)this);
    307308
    308309        this->orange = graphics_gc_new(this->osd_item.gr);
    309         c.r = 0xFFFF;
    310         c.g = 0xA5A5;
    311         c.b = 0x0000;
    312         c.a = 65535;
    313         graphics_gc_set_foreground(this->orange, &c);
     310        graphics_gc_set_foreground(this->orange, &this->idle_color);
    314311        graphics_gc_set_linewidth(this->orange, this->width);
    315312
    316313        this->white = graphics_gc_new(this->osd_item.gr);
     
    364361                this->text = NULL;
    365362
    366363
    367 
    368364        osd_set_std_attr(attrs, &this->osd_item, 2);
    369365        attr = attr_search(attrs, NULL, attr_width);
    370366        this->width=attr ? attr->u.num : 2;
     367        attr = attr_search(attrs, NULL, attr_text_color);
     368        this->idle_color=attr ? *attr->u.color : ((struct color) {0xffff,0xa5a5,0x0000,0xffff}); // text idle_color defaults to orange
    371369        navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_odometer_init), attr_graphics_ready, this));
    372370        return (struct osd_priv *) this;
    373371}
     
    380378        int width;
    381379        struct graphics_gc *orange,*white;
    382380        struct callback *click_cb;
     381        struct color idle_color;    //text color when counter is idle
    383382
    384383        int bActive;                //counting or not
    385384        time_t current_base_time;   //base time of currently measured time interval
     
    465464        osd_set_std_graphic(nav, &this->osd_item, (struct osd_priv *)this);
    466465
    467466        this->orange = graphics_gc_new(this->osd_item.gr);
    468         c.r = 0xFFFF;
    469         c.g = 0xA5A5;
    470         c.b = 0x0000;
    471         c.a = 65535;
    472         graphics_gc_set_foreground(this->orange, &c);
     467        graphics_gc_set_foreground(this->orange, &this->idle_color);
    473468        graphics_gc_set_linewidth(this->orange, this->width);
    474469
    475470        this->white = graphics_gc_new(this->osd_item.gr);
     
    512507        osd_set_std_attr(attrs, &this->osd_item, 2);
    513508        attr = attr_search(attrs, NULL, attr_width);
    514509        this->width=attr ? attr->u.num : 2;
     510        attr = attr_search(attrs, NULL, attr_text_color);
     511        this->idle_color=attr ? *attr->u.color : ((struct color) {0xffff,0xa5a5,0x0000,0xffff}); // text idle_color defaults to orange
    515512        navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_stopwatch_init), attr_graphics_ready, this));
    516513        return (struct osd_priv *) this;
    517514}