Ticket #1029: odometer2.diff
File odometer2.diff, 2.8 KB (added by antiram, 10 years ago) |
---|
-
home/navit/_navit_develop/work/navit_repo/navit/navit/osd/core/osd_core.c
81 81 struct odometer; 82 82 83 83 int set_std_osd_attr(struct osd_priv_common*opc, struct attr*the_attr); 84 static void osd_odometer_reset(struct osd_priv_common *opc , int force);84 static void osd_odometer_reset(struct osd_priv_common *opc); 85 85 static void osd_cmd_odometer_reset(struct navit *this, char *function, struct attr **in, struct attr ***out, int *valid); 86 86 static void osd_odometer_draw(struct osd_priv_common *opc, struct navit *nav, struct vehicle *v); 87 87 static struct osd_text_item * oti_new(struct osd_text_item * parent); … … 522 522 { 523 523 if (in && in[0] && ATTR_IS_STRING(in[0]->type) && in[0]->u.str) { 524 524 GList* list = odometer_list; 525 struct odometer *odm; 525 526 while(list) { 526 if(!strcmp(((struct odometer*)((struct osd_priv_common *)(list->data))->data)->name,in[0]->u.str)) { 527 osd_odometer_reset(list->data,1); 528 osd_odometer_draw(list->data,this,NULL); 527 odm = (struct odometer*) ((struct osd_priv_common *) (list->data))->data; 528 if (!strcmp(odm->name, in[0]->u.str)) { 529 double curr_time; 530 struct timeval tv; 531 gettimeofday(&tv, NULL); 532 curr_time = (double) (tv.tv_usec) / 1000000.0 + tv.tv_sec; 533 odm->last_click_time = curr_time; 534 osd_odometer_reset(list->data); 535 osd_odometer_draw(list->data,this,NULL); 529 536 } 530 537 list = g_list_next(list); 531 538 } … … 775 782 776 783 777 784 static void 778 osd_odometer_reset(struct osd_priv_common *opc , int force)785 osd_odometer_reset(struct osd_priv_common *opc) 779 786 { 780 787 struct odometer *this = (struct odometer *)opc->data; 781 788 782 if(!this->bDisableReset || force) { 783 this->bActive = 0; 784 this->sum_dist = 0; 785 this->sum_time = 0; 786 this->max_speed = 0; 787 this->last_start_time = 0; 788 this->last_coord.x = -1; 789 this->last_coord.y = -1; 790 } 789 this->sum_dist = 0; 790 this->sum_time = 0; 791 this->max_speed = 0; 792 this->last_start_time = 0; 793 this->last_coord.x = -1; 794 this->last_coord.y = -1; 791 795 } 792 796 793 797 static void … … 821 825 822 826 this->bActive ^= 1; //toggle active flag 823 827 824 if (curr_time-double_click_timewin <= this->last_click_time) { //double click handling 825 osd_odometer_reset(opc,0); 828 if (curr_time-double_click_timewin <= this->last_click_time && !this->bDisableReset) { //double click handling 829 this->bActive = 0; 830 osd_odometer_reset(opc); 826 831 } 827 832 828 833 this->last_click_time = curr_time;