Add:Core:Added svn version in navit -v output
[navit-package] / navit / layout.c
index 8e2cb0e..890e366 100644 (file)
 
 #include <glib.h>
 #include <string.h>
+#include "item.h"
+#include "attr.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,*font_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 ((font_attr=attr_search(attrs, NULL, attr_font))) {
+               l->font = g_strdup(font_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;
 }
 
@@ -88,7 +101,7 @@ polygon_new(struct color *color)
 
 struct element *
 polyline_new(struct color *color, int width, int directed,
-             int *dash_table, int dash_num)
+             int dash_offset, int *dash_table, int dash_num)
 {
        struct element *e;
        int i;
@@ -98,6 +111,7 @@ polyline_new(struct color *color, int width, int directed,
        e->color=*color;
        e->u.polyline.width=width;
        e->u.polyline.directed=directed;
+       e->u.polyline.dash_offset = dash_offset;
        e->u.polyline.dash_num=dash_num;
        for (i=0; i<dash_num; i++)
                e->u.polyline.dash_table[i] = dash_table[i];
@@ -156,3 +170,17 @@ image_new(void)
        return e;       
 }
 
+struct element *
+arrows_new(struct attr **attrs)
+{
+       struct element *e;
+       struct attr *color=attr_search(attrs, NULL, attr_color);
+
+       e = g_malloc0(sizeof(*e));
+       e->type=element_arrows;
+       if (color)
+               e->color=*color->u.color;
+
+       return e;       
+}
+