ATTR(vocabulary_distances)
ATTR(announce_name_systematic_first)
ATTR(antialias)
+ATTR(order_delta)
ATTR2(0x00028000,type_boolean_begin)
/* boolean */
ATTR(overwrite)
ATTR(src)
ATTR(path)
ATTR2(0x0003ffff,type_string_end)
-ATTR(order_limit)
+ATTR(order)
ATTR2(0x00050000,type_double_start)
ATTR(position_height)
ATTR(position_speed)
p.x=0;
p.y=0;
// FIXME find a better place to set the background color
- graphics_gc_set_background(gra->gc[0], l->color);
- graphics_gc_set_foreground(gra->gc[0], l->color);
+ graphics_gc_set_background(gra->gc[0], &l->color);
+ graphics_gc_set_foreground(gra->gc[0], &l->color);
gra->meth.background_gc(gra->priv, gra->gc[0]->priv);
gra->meth.draw_mode(gra->priv, draw_mode_begin);
gra->meth.draw_rectangle(gra->priv, gra->gc[0]->priv, &p, 32767, 32767);
- xdisplay_draw(displaylist->dl, gra, l, order);
+ xdisplay_draw(displaylist->dl, gra, l, order+l->order_delta);
if (callback)
callback_list_call_attr_0(gra->cbl, attr_postdraw);
gra->meth.draw_mode(gra->priv, draw_mode_end);
}
#endif
profile(0,NULL);
+ dbg(0,"delta=%d\n", l->order_delta);
+ order+=l->order_delta;
do_draw(displaylist, trans, mapsets, order);
// profile(1,"do_draw");
graphics_displaylist_draw(gra, displaylist, trans, l, 1);
#include <glib.h>
#include <string.h>
+#include "item.h"
#include "layout.h"
-struct layout * layout_new(const char *name, struct color *color)
+struct layout * layout_new(struct attr *parent, struct attr **attrs)
{
struct layout *l;
+ struct color def_color = {0xffff, 0xefef, 0xb7b7, 0xffff};
+ struct attr *name_attr,*color_attr,*order_delta_attr;
+
+ if (! (name_attr=attr_search(attrs, NULL, attr_name)))
+ return NULL;
l = g_new0(struct layout, 1);
- l->name = g_strdup(name);
- l->color = g_new0(struct color,1);
- *(l->color) = *color;
+ l->name = g_strdup(name_attr->u.str);
+ if ((color_attr=attr_search(attrs, NULL, attr_color)))
+ l->color = *color_attr->u.color;
+ else
+ l->color = def_color;
+ if ((order_delta_attr=attr_search(attrs, NULL, attr_order_delta)))
+ l->order_delta=order_delta_attr->u.num;
return l;
}
struct layer { char *name; int details; GList *itemtypes; };
-struct layout { char *name; struct color *color; GList *layers; };
+struct layout { char *name; struct color color; GList *layers; int order_delta; };
/* prototypes */
enum item_type;
struct itemtype;
struct layer;
struct layout;
-struct layout *layout_new(const char *name, struct color *color);
+struct layout *layout_new(struct attr *parent, struct attr **attrs);
struct layer *layer_new(const char *name, int details);
void layout_add_layer(struct layout *layout, struct layer *layer);
struct itemtype *itemtype_new(int order_min, int order_max);
}
void
-navit_add_layout(struct navit *this_, struct layout *lay)
-{
- this_->layouts = g_list_append(this_->layouts, lay);
- if(!this_->layout_current) {
- this_->layout_current=lay;
- }
-}
-
-void
navit_draw(struct navit *this_)
{
GList *l;
return navit_set_gui(this_, attr->u.gui);
case attr_graphics:
return navit_set_graphics(this_, attr->u.graphics);
+ case attr_layout:
+ this_->layouts = g_list_append(this_->layouts, attr->u.layout);
+ if(!this_->layout_current)
+ this_->layout_current=attr->u.layout;
+ return 1;
case attr_route:
this_->route=attr->u.route;
route_set_projection(this_->route, transform_get_projection(this_->trans));
struct index_item {
struct item_bin item;
struct rect r;
- struct attr_bin attr_order_limit;
+ struct attr_bin attr_order;
short min;
short max;
struct attr_bin attr_zipfile_ref;
ii.item.type=type_submap;
ii.item.clen=4;
- ii.attr_order_limit.len=2;
- ii.attr_order_limit.type=attr_order_limit;
+ ii.attr_order.len=2;
+ ii.attr_order.type=attr_order;
ii.attr_zipfile_ref.len=2;
ii.attr_zipfile_ref.type=attr_zipfile_ref;
}
static int
-xmlconfig_layout(struct xmlstate *state)
-{
- const char *name=find_attribute(state, "name", 1);
- struct color color = {0xffff, 0xefef, 0xb7b7, 0xffff};
-
- if (! name)
- return 0;
- find_color(state, 0, &color);
- state->element_attr.u.data = layout_new(name, &color);
- if (! state->element_attr.u.data)
- return 0;
- navit_add_layout(state->parent->element_attr.u.data, state->element_attr.u.data);
- return 1;
-}
-
-static int
xmlconfig_layer(struct xmlstate *state)
{
const char *name=find_attribute(state, "name", 1);
{ "navit", "config", NULL, NEW(navit_new), ADD(navit_add_attr), INIT(navit_init), DESTROY(navit_destroy)},
{ "graphics", "navit", NULL, NEW(graphics_new), NULL, NULL, NULL},
{ "gui", "navit", NULL, NEW(gui_new), NULL, NULL, NULL},
- { "layout", "navit", xmlconfig_layout},
+ { "layout", "navit", NULL, NEW(layout_new), NULL, NULL, NULL},
{ "layer", "layout", xmlconfig_layer},
{ "item", "layer", xmlconfig_item},
{ "circle", "item", xmlconfig_circle},