From 0f7e97d1e902972be2b541e5222e807841e6833a Mon Sep 17 00:00:00 2001 From: martin-s Date: Thu, 17 Mar 2011 13:52:55 +0000 Subject: [PATCH] Add:Core:Make optionally display a label at cursor git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4357 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/graphics.c | 5 +++-- navit/navit/graphics.h | 2 +- navit/navit/vehicle.c | 10 ++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/navit/navit/graphics.c b/navit/navit/graphics.c index 692e85b..ae0e39a 100644 --- a/navit/navit/graphics.c +++ b/navit/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/navit/graphics.h b/navit/navit/graphics.h index 2e5ba24..f18b7e3 100644 --- a/navit/navit/graphics.h +++ b/navit/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/navit/vehicle.c b/navit/navit/vehicle.c index bec635e..6245eaa 100644 --- a/navit/navit/vehicle.c +++ b/navit/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; -- 2.7.4