diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-03-17 13:52:55 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-03-17 13:52:55 +0000 |
commit | fd84109d1bf9081fcc4f53ca25f838ac6587898f (patch) | |
tree | 8e6131c6bb0b744ac1d41d057d48779b8c2ee3ca | |
parent | af81dc48daec6befea39e81c2be0aa7f1eb1947d (diff) | |
download | navit-fd84109d1bf9081fcc4f53ca25f838ac6587898f.tar.gz |
Add:Core:Make optionally display a label at cursor
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4357 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r-- | navit/graphics.c | 5 | ||||
-rw-r--r-- | navit/graphics.h | 2 | ||||
-rw-r--r-- | navit/vehicle.c | 10 |
3 files changed, 12 insertions, 5 deletions
diff --git a/navit/graphics.c b/navit/graphics.c index 692e85b90..ae0e39a1e 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -274,6 +274,7 @@ struct graphics * graphics_overlay_new(struct graphics *parent, struct point *p, pr.lu.y=0; pr.rl.x=w; pr.rl.y=h; + this_->font_size=20; graphics_set_rect(this_, &pr); if (!this_->priv) { g_free(this_); @@ -1853,7 +1854,7 @@ static void xdisplay_draw_elements(struct graphics *gra, struct displaylist *dis } void -graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transformation *t) +graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transformation *t, char *label) { GList *es; struct display_context dc; @@ -1865,7 +1866,7 @@ graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transfor di->item.id_hi=0; di->item.id_lo=0; di->item.map=NULL; - di->label=NULL; + di->label=label; dc.gra=gra; dc.gc=NULL; dc.gc_background=NULL; diff --git a/navit/graphics.h b/navit/graphics.h index 2e5ba24a0..f18b7e3aa 100644 --- a/navit/graphics.h +++ b/navit/graphics.h @@ -175,7 +175,7 @@ int graphics_draw_drag(struct graphics *this_, struct point *p); void graphics_background_gc(struct graphics *this_, struct graphics_gc *gc); void graphics_draw_text_std(struct graphics *this_, int text_size, char *text, struct point *p); char *graphics_icon_path(char *icon); -void graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transformation *t); +void graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transformation *t, char *label); void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int flags); void graphics_draw(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb, int flags); int graphics_draw_cancel(struct graphics *gra, struct displaylist *displaylist); diff --git a/navit/vehicle.c b/navit/vehicle.c index bec635eea..6245eaa9c 100644 --- a/navit/vehicle.c +++ b/navit/vehicle.c @@ -379,12 +379,18 @@ vehicle_draw_do(struct vehicle *this_, int lazy) int angle=this_->angle; int sequence=this_->sequence; struct attr **attr; + char *label=NULL; int match=0; if (!this_->cursor || !this_->cursor->attrs || !this_->gra) return; - + attr=this_->attrs; + while (attr && *attr) { + if ((*attr)->type == attr_name) + label=(*attr)->u.str; + attr++; + } transform_set_yaw(this_->trans, -this_->angle); graphics_draw_mode(this_->gra, draw_mode_begin); p.x=0; @@ -398,7 +404,7 @@ vehicle_draw_do(struct vehicle *this_, int lazy) if (speed >= itm->speed_range.min && speed <= itm->speed_range.max && angle >= itm->angle_range.min && angle <= itm->angle_range.max && sequence >= itm->sequence_range.min && sequence <= itm->sequence_range.max) { - graphics_draw_itemgra(this_->gra, itm, this_->trans); + graphics_draw_itemgra(this_->gra, itm, this_->trans, label); } if (sequence < itm->sequence_range.max) match=1; |