ATTR(source)
ATTR(description)
ATTR(gc_type)
+ATTR(layout)
ATTR2(0x0003ffff,type_string_end)
ATTR(order_limit)
ATTR2(0x00050000,type_double_start)
}
static void
-xdisplay_draw_layout(GHashTable *display_list, struct graphics *gra, struct layout *l, int order)
+xdisplay_draw(GHashTable *display_list, struct graphics *gra, struct layout *l, int order)
{
GList *lays;
struct layer *lay;
}
}
-static void
-xdisplay_draw(GHashTable *display_list, struct graphics *gra, GList *layouts, int order)
-{
- struct layout *l;
-
- while (layouts) {
- l=layouts->data;
- xdisplay_draw_layout(display_list, gra, l, order);
- return;
- layouts=g_list_next(layouts);
- }
-}
-
extern void *route_selection;
static void
}
void
-graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, GList *layouts)
+graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l)
{
int order=transform_get_order(trans);
// FIXME find a better place to set the background color
- graphics_gc_set_background(gra->gc[0], ((struct layout *)layouts->data)->color);
- graphics_gc_set_foreground(gra->gc[0], ((struct layout *)layouts->data)->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);
- xdisplay_draw(displaylist->dl, gra, layouts, order);
+ xdisplay_draw(displaylist->dl, gra, l, order);
gra->meth.draw_mode(gra->priv, draw_mode_end);
}
void
-graphics_draw(struct graphics *gra, struct displaylist *displaylist, GList *mapsets, struct transformation *trans, GList *layouts)
+graphics_draw(struct graphics *gra, struct displaylist *displaylist, GList *mapsets, struct transformation *trans, struct layout *l)
{
int order=transform_get_order(trans);
profile(0,NULL);
do_draw(displaylist, trans, mapsets, order);
profile(1,"do_draw");
- graphics_displaylist_draw(gra, displaylist, trans, layouts);
+ graphics_displaylist_draw(gra, displaylist, trans, l);
profile(1,"xdisplay_draw");
profile(0,"end");
struct graphics_image;
struct item;
struct point;
+struct layout;
struct graphics *graphics_new(const char *type, struct attr **attrs);
struct graphics *graphics_overlay_new(struct graphics *parent, struct point *p, int w, int h);
void graphics_init(struct graphics *this_);
void graphics_draw_rectangle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int w, int h);
void display_add(struct displaylist *displaylist, struct item *item, int count, struct point *pnt, char *label);
int graphics_ready(struct graphics *this_);
-void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, GList *layouts);
+void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l);
void graphics_displaylist_move(struct displaylist *displaylist, int dx, int dy);
-void graphics_draw(struct graphics *gra, struct displaylist *displaylist, GList *mapsets, struct transformation *trans, GList *layouts);
+void graphics_draw(struct graphics *gra, struct displaylist *displaylist, GList *mapsets, struct transformation *trans, struct layout *l);
struct displaylist_handle *graphics_displaylist_open(struct displaylist *displaylist);
struct displayitem *graphics_displaylist_next(struct displaylist_handle *dlh);
void graphics_displaylist_close(struct displaylist_handle *dlh);
#include "track.h"
#include "vehicle.h"
#include "color.h"
+#include "layout.h"
#define _(STRING) gettext(STRING)
/**
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
struct navit_vehicle *nv;
transform_setup_source_rect(this_->trans);
- graphics_draw(this_->gra, this_->displaylist, this_->mapsets, this_->trans, this_->layouts);
+ graphics_draw(this_->gra, this_->displaylist, this_->mapsets, this_->trans, this_->layout_current);
l=this_->vehicles;
while (l) {
nv=l->data;
navit_draw_displaylist(struct navit *this_)
{
if (this_->ready)
- graphics_displaylist_draw(this_->gra, this_->displaylist, this_->trans, this_->layouts);
+ graphics_displaylist_draw(this_->gra, this_->displaylist, this_->trans, this_->layout_current);
}
static void
if (dx || dy) {
this_->last=this_->current;
graphics_displaylist_move(this_->displaylist, dx, dy);
- graphics_displaylist_draw(this_->gra, this_->displaylist, this_->trans, this_->layouts);
+ graphics_displaylist_draw(this_->gra, this_->displaylist, this_->trans, this_->layout_current);
this_->moved=1;
}
this_->motion_timeout=0;
void
navit_add_menu_layouts(struct navit *this_, struct menu *men)
{
- menu_add(men, "Test", menu_type_menu, NULL);
+ GList *layouts;
+ struct layout *l;
+
+ layouts = this_->layouts;
+ while (layouts) {
+ l=layouts->data;
+ menu_add(men, l->name, menu_type_menu, NULL);
+ layouts=g_list_next(layouts);
+ }
}
void
int
navit_set_attr(struct navit *this_, struct attr *attr)
{
+ GList *layouts;
+ struct layout *l;
int dir=0, orient_old=0, attr_updated=0;
switch (attr->type) {
attr_updated=1;
}
break;
+ case attr_layout:
+ layouts = this_->layouts;
+ while (layouts) {
+ l=layouts->data;
+ if(!strcmp(attr->u.str,l->name) && this_->layout_current!=l) {
+ this_->layout_current=l;
+ attr_updated=1;
+ }
+ layouts=g_list_next(layouts);
+ }
+ break;
default:
return 0;
}