ATTR(accesskey)
ATTR(http_method)
ATTR(http_header)
+ATTR(progress)
ATTR2(0x0003ffff,type_string_end)
ATTR2(0x00040000,type_special_begin)
ATTR(order)
this_->meth.draw_text(this_->priv, gc1->priv, gc2 ? gc2->priv : NULL, font->priv, text, p, dx, dy);
}
+
/**
* FIXME
* @param <>
return gra->font[size];
}
+void graphics_draw_text_std(struct graphics *this_, int text_size, char *text, struct point *p)
+{
+ struct graphics_font *font=get_font(this_, text_size);
+ struct point bbox[4];
+ int i;
+
+ graphics_get_text_bbox(this_, font, text, 0x10000, 0, bbox, 0);
+ for (i = 0 ; i < 4 ; i++) {
+ bbox[i].x+=p->x;
+ bbox[i].y+=p->y;
+ }
+ graphics_draw_rectangle(this_, this_->gc[2], &bbox[1], bbox[2].x-bbox[0].x, bbox[0].y-bbox[1].y+5);
+ graphics_draw_text(this_, this_->gc[1], this_->gc[2], font, text, p, 0x10000, 0);
+}
+
char *
graphics_icon_path(char *icon)
{
+
/**
* FIXME
* @param <>
while ((item=map_rect_get_item(displaylist->mr))) {
int label_count=0;
char *labels[2];
- struct hash_entry *entry=get_hash_entry(displaylist, item->type);
+ struct hash_entry *entry;
+ if (item == &busy_item) {
+ if (displaylist->workload)
+ return;
+ else
+ continue;
+ }
+ entry=get_hash_entry(displaylist, item->type);
if (!entry)
continue;
count=item_coord_get_within_selection(item, ca, item->type < type_line ? 1: max, displaylist->sel);
/* prototypes */
enum attr_type;
-enum item_type;
enum draw_mode_num;
+enum item_type;
struct attr;
struct attr_iter;
struct callback;
void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img);
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_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int flags);
map_new(struct attr *parent, struct attr **attrs)
{
struct map *m;
- struct map_priv *(*maptype_new)(struct map_methods *meth, struct attr **attrs);
+ struct map_priv *(*maptype_new)(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl);
struct attr *type=attr_search(attrs, NULL, attr_type);
if (! type) {
m=g_new0(struct map, 1);
m->attrs=attr_list_dup(attrs);
- m->priv=maptype_new(&m->meth, attrs);
+ m->attr_cbl=callback_list_new();
+ m->priv=maptype_new(&m->meth, attrs, m->attr_cbl);
if (! m->priv) {
- attr_list_free(m->attrs);
- g_free(m);
+ map_destroy(m);
m=NULL;
}
- if (m)
- m->attr_cbl=callback_list_new();
return m;
}
void
map_destroy(struct map *m)
{
- m->meth.map_destroy(m->priv);
+ if (m->priv)
+ m->meth.map_destroy(m->priv);
attr_list_free(m->attrs);
callback_list_destroy(m->attr_cbl);
g_free(m);
#include "profile.h"
#include "command.h"
#include "navit_nls.h"
+#include "map.h"
#include "util.h"
#include "messages.h"
#include "vehicleprofile.h"
GList *windows_items;
struct navit_vehicle *vehicle;
struct callback_list *attr_cbl;
- struct callback *nav_speech_cb, *roadbook_callback, *popup_callback, *route_cb;
+ struct callback *nav_speech_cb, *roadbook_callback, *popup_callback, *route_cb, *progress_cb;
struct datawindow *roadbook_window;
struct map *former_destination;
struct point pressed, last, current;
}
static void
+navit_map_progress(struct navit *this_)
+{
+ struct map *map;
+ struct mapset *ms;
+ struct mapset_handle *msh;
+ struct attr attr;
+ struct point p;
+ p.x=10;
+ p.y=32;
+
+ ms=this_->mapsets->data;
+ msh=mapset_open(ms);
+ while (msh && (map=mapset_next(msh, 0))) {
+ if (map_get_attr(map, attr_progress, &attr, NULL)) {
+ char *str=g_strdup_printf("%s ",attr.u.str);
+ graphics_draw_text_std(this_->gra, 32, str, &p);
+ g_free(str);
+ p.y+=32;
+ graphics_draw_mode(this_->gra, draw_mode_end);
+ }
+ }
+ mapset_close(msh);
+}
+
+static void
navit_redraw_route(struct navit *this_, struct route *route, struct attr *attr)
{
int updated;
if (callback)
callback_list_call_attr_1(this_->attr_cbl, attr_graphics_ready, this_);
if (this_->ready == 3)
- navit_draw(this_);
+ navit_draw_async(this_, 1);
}
static void
navit_set_vehicle(this_, this_->vehicle);
dbg(2,"Adding dynamic maps to mapset %p\n",this_->mapsets);
if (this_->mapsets) {
+ struct mapset_handle *msh;
ms=this_->mapsets->data;
+ this_->progress_cb=callback_new_attr_1(callback_cast(navit_map_progress), attr_progress, this_);
+ msh=mapset_open(ms);
+ while (msh && (map=mapset_next(msh, 0))) {
+ map_add_callback(map, this_->progress_cb);
+ }
+ mapset_close(msh);
+
if (this_->route) {
if ((map=route_get_map(this_->route)))
mapset_add_attr(ms, &(struct attr){attr_map,.u.map=map});
PLUGIN_FUNC3(popup, struct container *, map, struct popup *, p, struct popup_item **, list)
PLUGIN_TYPE(graphics, (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl))
PLUGIN_TYPE(gui, (struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui))
-PLUGIN_TYPE(map, (struct map_methods *meth, struct attr **attrs))
+PLUGIN_TYPE(map, (struct map_methods *meth, struct attr **attrs, struct callback_list *cbl))
PLUGIN_TYPE(osd, (struct navit *nav, struct osd_methods *meth, struct attr **attrs))
PLUGIN_TYPE(speech, (struct speech_methods *meth, struct attr **attrs, struct attr *parent))
PLUGIN_TYPE(vehicle, (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs))