osd_core.c (navit-0.5.5) | : | osd_core.c (navit-0.5.6) | ||
---|---|---|---|---|
/** | /** | |||
* Navit, a modular navigation system. | * Navit, a modular navigation system. | |||
* Copyright (C) 2005-2008 Navit Team | * Copyright (C) 2005-2008 Navit Team | |||
* | * | |||
* This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License | * modify it under the terms of the GNU General Public License | |||
* version 2 as published by the Free Software Foundation. | * version 2 as published by the Free Software Foundation. | |||
* | * | |||
* This program is distributed in the hope that it will be useful, | * This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | |||
* along with this program; if not, write to the | * along with this program; if not, write to the | |||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |||
* Boston, MA 02110-1301, USA. | * Boston, MA 02110-1301, USA. | |||
*/ | */ | |||
#include "config.h" | #include "config.h" | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#define _USE_MATH_DEFINES 1 | #define _USE_MATH_DEFINES 1 | |||
#endif /* _MSC_VER */ | #endif /* _MSC_VER */ | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <math.h> | #include <math.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <glib.h> | #include <glib.h> | |||
skipping to change at line 451 | skipping to change at line 451 | |||
struct mapset_handle *msh; | struct mapset_handle *msh; | |||
struct map *map = NULL; | struct map *map = NULL; | |||
struct item *item = NULL; | struct item *item = NULL; | |||
if(!(ms=navit_get_mapset(nav))) { | if(!(ms=navit_get_mapset(nav))) { | |||
return; | return; | |||
} | } | |||
msh=mapset_open(ms); | msh=mapset_open(ms); | |||
while ((map=mapset_next(msh, 1))) { | while ((map=mapset_next(msh, 1))) { | |||
struct attr attr; | struct attr attr; | |||
if(map_get_attr(map, attr_name, &attr, NULL)) { | if(map_get_attr(map, attr_name, &attr, NULL)) { | |||
if( ! strcmp(this->map_name, attr.u.str) ) { | if(!strcmp(this->map_name, attr.u.str) ) { | |||
mr=map_rect_new(map, NULL); | mr=map_rect_new(map, NULL); | |||
if (mr) { | if (mr) { | |||
while ((item=map_rect_get_item(mr))) { | while ((item=map_rect_get_item(mr))) { | |||
struct attr item_attr; | struct attr item_attr; | |||
if(item_attr_get(item, attr_name, &item_attr)) { | if(item_attr_get(item, attr_name, &item_attr)) { | |||
if (!strcmp(item_attr.u.str,this->item_name)) { | if (!strcmp(item_attr.u.str,this->item_name)) { | |||
//item found, get coords | //item found, get coords | |||
struct coord c; | struct coord c; | |||
this->coord_num=0; | this->coord_num=0; | |||
while (item_coord_get(item,&c,1)) { | while (item_coord_get(item,&c,1)) { | |||
skipping to change at line 740 | skipping to change at line 740 | |||
lines=0; | lines=0; | |||
next=buffer; | next=buffer; | |||
last=buffer; | last=buffer; | |||
while ((next=strstr(next, "\\n"))) { | while ((next=strstr(next, "\\n"))) { | |||
last = next; | last = next; | |||
lines++; | lines++; | |||
next++; | next++; | |||
} | } | |||
while (*last) { | while (*last) { | |||
if (! g_ascii_isspace(*last)) { | if (!g_ascii_isspace(*last)) { | |||
lines++; | lines++; | |||
break; | break; | |||
} | } | |||
last++; | last++; | |||
} | } | |||
dbg(lvl_debug,"align=%d", align); | dbg(lvl_debug,"align=%d", align); | |||
switch (align & 51) { | switch (align & 51) { | |||
case 1: | case 1: | |||
p.y=0; | p.y=0; | |||
skipping to change at line 829 | skipping to change at line 829 | |||
double spd = 0; | double spd = 0; | |||
double curr_spd = 0; | double curr_spd = 0; | |||
int remainder; | int remainder; | |||
int days; | int days; | |||
int hours; | int hours; | |||
int mins; | int mins; | |||
int secs; | int secs; | |||
int imperial=0; | int imperial=0; | |||
char buffer [256+1]=""; | char buffer[256+1]=""; | |||
char buffer2[256+1]=""; | char buffer2[256+1]=""; | |||
if(nav) { | if(nav) { | |||
if (navit_get_attr(nav, attr_vehicle, &vehicle_attr, NULL)) | if (navit_get_attr(nav, attr_vehicle, &vehicle_attr, NULL)) | |||
curr_vehicle=vehicle_attr.u.vehicle; | curr_vehicle=vehicle_attr.u.vehicle; | |||
if (navit_get_attr(nav, attr_imperial, &imperial_attr, NULL)) | if (navit_get_attr(nav, attr_imperial, &imperial_attr, NULL)) | |||
imperial=imperial_attr.u.num; | imperial=imperial_attr.u.num; | |||
} | } | |||
if(0==curr_vehicle) | if(0==curr_vehicle) | |||
skipping to change at line 902 | skipping to change at line 902 | |||
remainder = remainder % (60*60); | remainder = remainder % (60*60); | |||
mins = remainder / (60); | mins = remainder / (60); | |||
remainder = remainder % (60); | remainder = remainder % (60); | |||
secs = remainder; | secs = remainder; | |||
if(0<days) { | if(0<days) { | |||
time_buffer = g_strdup_printf("%02dd %02d:%02d:%02d",days,hours,mins,sec s); | time_buffer = g_strdup_printf("%02dd %02d:%02d:%02d",days,hours,mins,sec s); | |||
} else { | } else { | |||
time_buffer = g_strdup_printf("%02d:%02d:%02d",hours,mins,secs); | time_buffer = g_strdup_printf("%02d:%02d:%02d",hours,mins,secs); | |||
} | } | |||
buffer [0] = 0; | buffer[0] = 0; | |||
buffer2[0] = 0; | buffer2[0] = 0; | |||
if(this->text) { | if(this->text) { | |||
str_replace(buffer,this->text,"${avg_spd}",spd_buffer); | str_replace(buffer,this->text,"${avg_spd}",spd_buffer); | |||
str_replace(buffer2,buffer,"${distance}",dist_buffer); | str_replace(buffer2,buffer,"${distance}",dist_buffer); | |||
str_replace(buffer,buffer2,"${time}",time_buffer); | str_replace(buffer,buffer2,"${time}",time_buffer); | |||
str_replace(buffer2,buffer,"${acceleration}",acc_buffer); | str_replace(buffer2,buffer,"${acceleration}",acc_buffer); | |||
str_replace(buffer,buffer2,"${max_spd}",max_spd_buffer); | str_replace(buffer,buffer2,"${max_spd}",max_spd_buffer); | |||
} | } | |||
g_free(time_buffer); | g_free(time_buffer); | |||
skipping to change at line 2444 | skipping to change at line 2444 | |||
if(dCurrDist <= speed*750.0/130.0) { //at speed 130 distance limit is 7 50m | if(dCurrDist <= speed*750.0/130.0) { //at speed 130 distance limit is 7 50m | |||
if(this_->announce_state==eNoWarn && this_->announce_on) { | if(this_->announce_state==eNoWarn && this_->announce_on) { | |||
this_->announce_state=eWarningTold; //warning told | this_->announce_state=eWarningTold; //warning told | |||
navit_say(navit, _("Look out! Camera!")); | navit_say(navit, _("Look out! Camera!")); | |||
} | } | |||
} else { | } else { | |||
this_->announce_state=eNoWarn; | this_->announce_state=eNoWarn; | |||
} | } | |||
if(this_->text) { | if(this_->text) { | |||
char buffer [256]=""; | char buffer[256]=""; | |||
char buffer2[256]=""; | char buffer2[256]=""; | |||
char dir_str[16]; | char dir_str[16]; | |||
char spd_str[16]; | char spd_str[16]; | |||
buffer [0] = 0; | buffer[0] = 0; | |||
buffer2[0] = 0; | buffer2[0] = 0; | |||
osd_fill_with_bgcolor(&opc->osd_item); | osd_fill_with_bgcolor(&opc->osd_item); | |||
str_replace(buffer,this_->text,"${distance}",format_distance(dCurrDi st,"",imperial)); | str_replace(buffer,this_->text,"${distance}",format_distance(dCurrDi st,"",imperial)); | |||
str_replace(buffer2,buffer,"${camera_type}",(0<=idx && idx<=CAM_TRAF FIPAX)?camera_t_strs[idx]:""); | str_replace(buffer2,buffer,"${camera_type}",(0<=idx && idx<=CAM_TRAF FIPAX)?camera_t_strs[idx]:""); | |||
str_replace(buffer,buffer2,"${camera_dir}",(0<=dir_idx && dir_idx<=C AMDIR_TWO)?camdir_t_strs[dir_idx]:""); | str_replace(buffer,buffer2,"${camera_dir}",(0<=dir_idx && dir_idx<=C AMDIR_TWO)?camdir_t_strs[dir_idx]:""); | |||
sprintf(dir_str,"%d",dir); | sprintf(dir_str,"%d",dir); | |||
sprintf(spd_str,"%d",spd); | sprintf(spd_str,"%d",spd); | |||
str_replace(buffer2,buffer,"${direction}",dir_str); | str_replace(buffer2,buffer,"${direction}",dir_str); | |||
skipping to change at line 2661 | skipping to change at line 2661 | |||
} | } | |||
if( tracking_speed <= routespeed ) { | if( tracking_speed <= routespeed ) { | |||
this->announce_state=eNoWarn; //no warning | this->announce_state=eNoWarn; //no warning | |||
osd_color = this->green; | osd_color = this->green; | |||
img = this->img_passive; | img = this->img_passive; | |||
} else { | } else { | |||
osd_color = this->red; | osd_color = this->red; | |||
img = this->img_active; | img = this->img_active; | |||
} | } | |||
} else { | } else { | |||
osd_color = this-> grey; | osd_color = this->grey; | |||
img = this->img_off; | img = this->img_off; | |||
this->announce_state = eNoWarn; | this->announce_state = eNoWarn; | |||
} | } | |||
} else { | } else { | |||
//when tracking is not available display grey | //when tracking is not available display grey | |||
osd_color = this->grey; | osd_color = this->grey; | |||
img = this->img_off; | img = this->img_off; | |||
this->announce_state = eNoWarn; | this->announce_state = eNoWarn; | |||
} | } | |||
if(this->img_active && this->img_passive && this->img_off) { | if(this->img_active && this->img_passive && this->img_off) { | |||
skipping to change at line 2865 | skipping to change at line 2865 | |||
static char *osd_text_format_attr(struct attr *attr, char *format, int imperial) { | static char *osd_text_format_attr(struct attr *attr, char *format, int imperial) { | |||
struct tm tm, text_tm, text_tm0; | struct tm tm, text_tm, text_tm0; | |||
time_t textt; | time_t textt; | |||
int days=0; | int days=0; | |||
char buffer[1024]; | char buffer[1024]; | |||
switch (attr->type) { | switch (attr->type) { | |||
case attr_position_speed: | case attr_position_speed: | |||
return format_speed(*attr->u.numd,"",format,imperial); | return format_speed(*attr->u.numd,"",format,imperial); | |||
case attr_position_height: | case attr_position_height: | |||
/** | ||||
* johnk 8/13/2020 | ||||
* if format is "feet" then return feet | ||||
* else | ||||
* if format is "imperial" | ||||
* return meters or feet as controlled by "imperial" | ||||
* return meters | ||||
*/ | ||||
if (format && | ||||
(!strcmp(format, "feet") || (!strcmp(format, "imperial") && impe | ||||
rial == 1))) { | ||||
return (format_float_0(*attr->u.numd * FEET_PER_METER) ); | ||||
} | ||||
return (format_float_0(*attr->u.numd) ); | ||||
case attr_position_direction: | case attr_position_direction: | |||
return format_float_0(*attr->u.numd); | return format_float_0(*attr->u.numd); | |||
case attr_position_magnetic_direction: | case attr_position_magnetic_direction: | |||
return g_strdup_printf("%ld",attr->u.num); | return g_strdup_printf("%ld",attr->u.num); | |||
case attr_position_coord_geo: | case attr_position_coord_geo: | |||
if ((!format) || (!strcmp(format,"pos_degminsec"))) { | if ((!format) || (!strcmp(format,"pos_degminsec"))) { | |||
coord_format(attr->u.coord_geo->lat,attr->u.coord_geo->lng,DEGREES_M INUTES_SECONDS,buffer,sizeof(buffer)); | coord_format(attr->u.coord_geo->lat,attr->u.coord_geo->lng,DEGREES_M INUTES_SECONDS,buffer,sizeof(buffer)); | |||
return g_strdup(buffer); | return g_strdup(buffer); | |||
} else if (!strcmp(format,"pos_degmin")) { | } else if (!strcmp(format,"pos_degmin")) { | |||
coord_format(attr->u.coord_geo->lat,attr->u.coord_geo->lng,DEGREES_M INUTES,buffer,sizeof(buffer)); | coord_format(attr->u.coord_geo->lat,attr->u.coord_geo->lng,DEGREES_M INUTES,buffer,sizeof(buffer)); | |||
skipping to change at line 2933 | skipping to change at line 2946 | |||
return format_time(&text_tm, days); | return format_time(&text_tm, days); | |||
case attr_length: | case attr_length: | |||
case attr_destination_length: | case attr_destination_length: | |||
if (!format) | if (!format) | |||
break; | break; | |||
if (!strcmp(format,"named")) | if (!strcmp(format,"named")) | |||
return format_distance(attr->u.num,"",imperial); | return format_distance(attr->u.num,"",imperial); | |||
if (!strcmp(format,"value") || !strcmp(format,"unit")) { | if (!strcmp(format,"value") || !strcmp(format,"unit")) { | |||
char *ret,*tmp=format_distance(attr->u.num," ",imperial); | char *ret,*tmp=format_distance(attr->u.num," ",imperial); | |||
char *pos=strchr(tmp,' '); | char *pos=strchr(tmp,' '); | |||
if (! pos) | if (!pos) | |||
return tmp; | return tmp; | |||
*pos++='\0'; | *pos++='\0'; | |||
if (!strcmp(format,"value")) | if (!strcmp(format,"value")) | |||
return tmp; | return tmp; | |||
ret=g_strdup(pos); | ret=g_strdup(pos); | |||
g_free(tmp); | g_free(tmp); | |||
return ret; | return ret; | |||
} | } | |||
break; | break; | |||
case attr_position_time_iso8601: | case attr_position_time_iso8601: | |||
if ((!format) || (!strcmp(format,"iso8601"))) { | if ((!format) || (!strcmp(format,"iso8601"))) { | |||
break; | break; | |||
} else { | } else { | |||
if (strstr(format, "local;") == format) { | if (strstr(format, "local;") == format) { | |||
textt = iso8601_to_secs(attr->u.str); | textt = iso8601_to_secs(attr->u.str); | |||
memcpy ((void *) &tm, (void *) localtime(&textt), sizeof(tm)); | memcpy((void *) &tm, (void *) localtime(&textt), sizeof(tm)); | |||
strftime(buffer, sizeof(buffer), (char *)(format + 6), &tm); | strftime(buffer, sizeof(buffer), (char *)(format + 6), &tm); | |||
} else if ((sscanf(format, "%*c%2d:%2d;", &(text_tm.tm_hour), &(text _tm.tm_min)) == 2) && (strchr("+-", format[0]))) { | } else if ((sscanf(format, "%*c%2d:%2d;", &(text_tm.tm_hour), &(text _tm.tm_min)) == 2) && (strchr("+-", format[0]))) { | |||
if (strchr("-", format[0])) { | if (strchr("-", format[0])) { | |||
textt = iso8601_to_secs(attr->u.str) - text_tm.tm_hour * 360 0 - text_tm.tm_min * 60; | textt = iso8601_to_secs(attr->u.str) - text_tm.tm_hour * 360 0 - text_tm.tm_min * 60; | |||
} else { | } else { | |||
textt = iso8601_to_secs(attr->u.str) + text_tm.tm_hour * 360 0 + text_tm.tm_min * 60; | textt = iso8601_to_secs(attr->u.str) + text_tm.tm_hour * 360 0 + text_tm.tm_min * 60; | |||
} | } | |||
memcpy ((void *) &tm, (void *) gmtime(&textt), sizeof(tm)); | memcpy((void *) &tm, (void *) gmtime(&textt), sizeof(tm)); | |||
strftime(buffer, sizeof(buffer), &format[strcspn(format, ";") + 1], &tm); | strftime(buffer, sizeof(buffer), &format[strcspn(format, ";") + 1], &tm); | |||
} else { | } else { | |||
sscanf(attr->u.str, "%4d-%2d-%2dT%2d:%2d:%2d", &(tm.tm_year), &( tm.tm_mon), &(tm.tm_mday), &(tm.tm_hour), &(tm.tm_min), | sscanf(attr->u.str, "%4d-%2d-%2dT%2d:%2d:%2d", &(tm.tm_year), &( tm.tm_mon), &(tm.tm_mday), &(tm.tm_hour), &(tm.tm_min), | |||
&(tm.tm_sec)); | &(tm.tm_sec)); | |||
// the tm structure definition is kinda weird and needs some ext ra voodoo | // the tm structure definition is kinda weird and needs some ext ra voodoo | |||
tm.tm_year-=1900; | tm.tm_year-=1900; | |||
tm.tm_mon--; | tm.tm_mon--; | |||
// get weekday and day of the year | // get weekday and day of the year | |||
mktime(&tm); | mktime(&tm); | |||
strftime(buffer, sizeof(buffer), format, &tm); | strftime(buffer, sizeof(buffer), format, &tm); | |||
skipping to change at line 3181 | skipping to change at line 3194 | |||
lines=0; | lines=0; | |||
next=str; | next=str; | |||
last=str; | last=str; | |||
while ((next=strstr(next, "\\n"))) { | while ((next=strstr(next, "\\n"))) { | |||
last = next; | last = next; | |||
lines++; | lines++; | |||
next++; | next++; | |||
} | } | |||
while (*last) { | while (*last) { | |||
if (! g_ascii_isspace(*last)) { | if (!g_ascii_isspace(*last)) { | |||
lines++; | lines++; | |||
break; | break; | |||
} | } | |||
last++; | last++; | |||
} | } | |||
dbg(lvl_debug,"this->align=%d", this->align); | dbg(lvl_debug,"this->align=%d", this->align); | |||
switch (this->align & 51) { | switch (this->align & 51) { | |||
case 1: | case 1: | |||
p.y=0; | p.y=0; | |||
skipping to change at line 3303 | skipping to change at line 3316 | |||
// find plain text before | // find plain text before | |||
if (start!=str) { | if (start!=str) { | |||
oti = oti_new(oti); | oti = oti_new(oti); | |||
oti->static_text=1; | oti->static_text=1; | |||
oti->text=g_strdup(str); | oti->text=g_strdup(str); | |||
} | } | |||
end=strstr(start,"}"); | end=strstr(start,"}"); | |||
if (! end) | if (!end) | |||
break; | break; | |||
*end++='\0'; | *end++='\0'; | |||
key=start; | key=start; | |||
subkey=osd_text_split(key,NULL); | subkey=osd_text_split(key,NULL); | |||
oti = oti_new(oti); | oti = oti_new(oti); | |||
oti->section=attr_from_name(key); | oti->section=attr_from_name(key); | |||
skipping to change at line 3491 | skipping to change at line 3504 | |||
do_draw=1; | do_draw=1; | |||
} | } | |||
if (do_draw) { | if (do_draw) { | |||
osd_fill_with_bgcolor(&opc->osd_item); | osd_fill_with_bgcolor(&opc->osd_item); | |||
if (this->active) { | if (this->active) { | |||
image = g_strdup_printf(this->icon_src, strength); | image = g_strdup_printf(this->icon_src, strength); | |||
gr_image = graphics_image_new_scaled(opc->osd_item.gr, image, this-> icon_w, this->icon_h); | gr_image = graphics_image_new_scaled(opc->osd_item.gr, image, this-> icon_w, this->icon_h); | |||
if (gr_image) { | if (gr_image) { | |||
p.x = (opc->osd_item.w - gr_image->width) / 2; | p.x = (opc->osd_item.w - gr_image->width) / 2; | |||
p.y = (opc->osd_item.h - gr_image->height) / 2; | p.y = (opc->osd_item.h - gr_image->height) / 2; | |||
graphics_draw_image(opc->osd_item.gr, opc->osd_item. graphic_fg , &p, gr_image); | graphics_draw_image(opc->osd_item.gr, opc->osd_item.graphic_fg, &p, gr_image); | |||
graphics_image_free(opc->osd_item.gr, gr_image); | graphics_image_free(opc->osd_item.gr, gr_image); | |||
} | } | |||
g_free(image); | g_free(image); | |||
} | } | |||
graphics_draw_mode(opc->osd_item.gr, draw_mode_end); | graphics_draw_mode(opc->osd_item.gr, draw_mode_end); | |||
} | } | |||
} | } | |||
static void osd_gps_status_init(struct osd_priv_common *opc, struct navit *nav) { | static void osd_gps_status_init(struct osd_priv_common *opc, struct navit *nav) { | |||
osd_set_std_graphic(nav, &opc->osd_item, (struct osd_priv *)opc); | osd_set_std_graphic(nav, &opc->osd_item, (struct osd_priv *)opc); | |||
skipping to change at line 3576 | skipping to change at line 3589 | |||
struct graphics_image *gr_image; | struct graphics_image *gr_image; | |||
char *image; | char *image; | |||
osd_fill_with_bgcolor(&opc->osd_item); | osd_fill_with_bgcolor(&opc->osd_item); | |||
if (this->active) { | if (this->active) { | |||
image = g_strdup_printf(this->icon_src, this->strength); | image = g_strdup_printf(this->icon_src, this->strength); | |||
gr_image = graphics_image_new_scaled(opc->osd_item.gr, image, this->icon _w, this->icon_h); | gr_image = graphics_image_new_scaled(opc->osd_item.gr, image, this->icon _w, this->icon_h); | |||
if (gr_image) { | if (gr_image) { | |||
p.x = (opc->osd_item.w - gr_image->width) / 2; | p.x = (opc->osd_item.w - gr_image->width) / 2; | |||
p.y = (opc->osd_item.h - gr_image->height) / 2; | p.y = (opc->osd_item.h - gr_image->height) / 2; | |||
graphics_draw_image(opc->osd_item.gr, opc->osd_item. graphic_fg, &p , gr_image); | graphics_draw_image(opc->osd_item.gr, opc->osd_item.graphic_fg, &p, gr_image); | |||
graphics_image_free(opc->osd_item.gr, gr_image); | graphics_image_free(opc->osd_item.gr, gr_image); | |||
} | } | |||
g_free(image); | g_free(image); | |||
} | } | |||
graphics_draw_mode(opc->osd_item.gr, draw_mode_end); | graphics_draw_mode(opc->osd_item.gr, draw_mode_end); | |||
} | } | |||
static void osd_volume_click(struct osd_priv_common *opc, struct navit *nav, int pressed, int button, struct point *p) { | static void osd_volume_click(struct osd_priv_common *opc, struct navit *nav, int pressed, int button, struct point *p) { | |||
struct volume *this = (struct volume *)opc->data; | struct volume *this = (struct volume *)opc->data; | |||
skipping to change at line 3608 | skipping to change at line 3621 | |||
this->strength=0; | this->strength=0; | |||
if (this->strength > 5) | if (this->strength > 5) | |||
this->strength=5; | this->strength=5; | |||
osd_volume_draw(opc, nav, NULL); | osd_volume_draw(opc, nav, NULL); | |||
} | } | |||
} | } | |||
static void osd_volume_init(struct osd_priv_common *opc, struct navit *nav) { | static void osd_volume_init(struct osd_priv_common *opc, struct navit *nav) { | |||
struct volume *this = (struct volume *)opc->data; | struct volume *this = (struct volume *)opc->data; | |||
osd_set_std_graphic(nav, &opc->osd_item, (struct osd_priv *)opc); | osd_set_std_graphic(nav, &opc->osd_item, (struct osd_priv *)opc); | |||
navit_add_callback(nav, this->click_cb = callback_new_attr_1(callback_cast ( osd_volume_click), attr_button, opc)); | navit_add_callback(nav, this->click_cb = callback_new_attr_1(callback_cast(o sd_volume_click), attr_button, opc)); | |||
osd_volume_draw(opc, nav, NULL); | osd_volume_draw(opc, nav, NULL); | |||
} | } | |||
static struct osd_priv *osd_volume_new(struct navit *nav, struct osd_methods *me th, | static struct osd_priv *osd_volume_new(struct navit *nav, struct osd_methods *me th, | |||
struct attr **attrs) { | struct attr **attrs) { | |||
struct volume *this = g_new0(struct volume, 1); | struct volume *this = g_new0(struct volume, 1); | |||
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1); | struct osd_priv_common *opc = g_new0(struct osd_priv_common,1); | |||
struct attr *attr; | struct attr *attr; | |||
opc->data = (void*)this; | opc->data = (void*)this; | |||
skipping to change at line 3791 | skipping to change at line 3804 | |||
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1); | struct osd_priv_common *opc = g_new0(struct osd_priv_common,1); | |||
opc->data = (void*)this; | opc->data = (void*)this; | |||
opc->osd_item.font_size = 200; | opc->osd_item.font_size = 200; | |||
opc->osd_item.navit = nav; | opc->osd_item.navit = nav; | |||
opc->osd_item.meth.draw = osd_draw_cast(osd_scale_draw); | opc->osd_item.meth.draw = osd_draw_cast(osd_scale_draw); | |||
meth->set_attr = set_std_osd_attr; | meth->set_attr = set_std_osd_attr; | |||
osd_set_std_attr(attrs, &opc->osd_item, TRANSPARENT_BG | ITEM_HAS_TEXT); | osd_set_std_attr(attrs, &opc->osd_item, TRANSPARENT_BG | ITEM_HAS_TEXT); | |||
navit_add_callback(nav, this->navit_init_cb = callback_new_attr_1(callback_c ast (osd_scale_init), attr_graphics_ready, | navit_add_callback(nav, this->navit_init_cb = callback_new_attr_1(callback_c ast(osd_scale_init), attr_graphics_ready, | |||
opc)); | opc)); | |||
return (struct osd_priv *) opc; | return (struct osd_priv *) opc; | |||
} | } | |||
struct auxmap { | struct auxmap { | |||
struct displaylist *displaylist; | struct displaylist *displaylist; | |||
struct transformation *ntrans; | struct transformation *ntrans; | |||
struct transformation *trans; | struct transformation *trans; | |||
struct layout *layout; | struct layout *layout; | |||
skipping to change at line 3855 | skipping to change at line 3868 | |||
static void osd_auxmap_init(struct osd_priv_common *opc, struct navit *nav) { | static void osd_auxmap_init(struct osd_priv_common *opc, struct navit *nav) { | |||
struct auxmap *this = (struct auxmap *)opc->data; | struct auxmap *this = (struct auxmap *)opc->data; | |||
struct graphics *gra; | struct graphics *gra; | |||
struct attr attr; | struct attr attr; | |||
struct map_selection sel; | struct map_selection sel; | |||
struct pcoord center= { projection_mg, 0, 0}; | struct pcoord center= { projection_mg, 0, 0}; | |||
struct color red= {0xffff,0x0,0x0,0xffff}; | struct color red= {0xffff,0x0,0x0,0xffff}; | |||
this->nav=nav; | this->nav=nav; | |||
if (! navit_get_attr(nav, attr_graphics, &attr, NULL)) | if (!navit_get_attr(nav, attr_graphics, &attr, NULL)) | |||
return; | return; | |||
gra=attr.u.graphics; | gra=attr.u.graphics; | |||
graphics_add_callback(gra, callback_new_attr_1(callback_cast(osd_auxmap_draw ), attr_postdraw, opc)); | graphics_add_callback(gra, callback_new_attr_1(callback_cast(osd_auxmap_draw ), attr_postdraw, opc)); | |||
if (! navit_get_attr(nav, attr_transformation, &attr, NULL)) | if (!navit_get_attr(nav, attr_transformation, &attr, NULL)) | |||
return; | return; | |||
this->ntrans=attr.u.transformation; | this->ntrans=attr.u.transformation; | |||
if (! navit_get_attr(nav, attr_displaylist, &attr, NULL)) | if (!navit_get_attr(nav, attr_displaylist, &attr, NULL) ) | |||
return; | return; | |||
this->displaylist=attr.u.displaylist; | this->displaylist=attr.u.displaylist; | |||
if (! navit_get_attr(nav, attr_layout, &attr, NULL)) | if (!navit_get_attr(nav, attr_layout, &attr, NULL)) | |||
return; | return; | |||
this->layout=attr.u.layout; | this->layout=attr.u.layout; | |||
osd_set_std_graphic(nav, &opc->osd_item, NULL); | osd_set_std_graphic(nav, &opc->osd_item, NULL); | |||
graphics_init(opc->osd_item.gr); | graphics_init(opc->osd_item.gr); | |||
this->red=graphics_gc_new(gra); | this->red=graphics_gc_new(gra); | |||
graphics_gc_set_foreground(this->red,&red); | graphics_gc_set_foreground(this->red,&red); | |||
graphics_gc_set_linewidth(this->red,3); | graphics_gc_set_linewidth(this->red,3); | |||
memset(&sel, 0, sizeof(sel)); | memset(&sel, 0, sizeof(sel)); | |||
sel.u.p_rect.rl.x=opc->osd_item.w; | sel.u.p_rect.rl.x=opc->osd_item.w; | |||
sel.u.p_rect.rl.y=opc->osd_item.h; | sel.u.p_rect.rl.y=opc->osd_item.h; | |||
End of changes. 23 change blocks. | ||||
22 lines changed or deleted | 36 lines changed or added |