/[zanavi_public1]/navit/navit/layout.c
ZANavi

Diff of /navit/navit/layout.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 50 Revision 51
51 struct attr *name_attr, *color_attr, *order_delta_attr, *font_attr, *day_attr, *night_attr, *active_attr; 51 struct attr *name_attr, *color_attr, *order_delta_attr, *font_attr, *day_attr, *night_attr, *active_attr;
52 52
53 if (!(name_attr = attr_search(attrs, NULL, attr_name))) 53 if (!(name_attr = attr_search(attrs, NULL, attr_name)))
54 { 54 {
55 return NULL; 55 return NULL;
56 }
57
56 } l = g_new0(struct layout, 1); 58 l = g_new0(struct layout, 1);
57 l->name = g_strdup(name_attr->u.str); 59 l->name = g_strdup(name_attr->u.str);
60
58 if ((font_attr = attr_search(attrs, NULL, attr_font))) 61 if ((font_attr = attr_search(attrs, NULL, attr_font)))
59 { 62 {
60 l->font = g_strdup(font_attr->u.str); 63 l->font = g_strdup(font_attr->u.str);
61 } 64 }
65
62 if ((day_attr = attr_search(attrs, NULL, attr_daylayout))) 66 if ((day_attr = attr_search(attrs, NULL, attr_daylayout)))
63 { 67 {
64 l->dayname = g_strdup(day_attr->u.str); 68 l->dayname = g_strdup(day_attr->u.str);
65 } 69 }
70
66 if ((night_attr = attr_search(attrs, NULL, attr_nightlayout))) 71 if ((night_attr = attr_search(attrs, NULL, attr_nightlayout)))
67 { 72 {
68 l->nightname = g_strdup(night_attr->u.str); 73 l->nightname = g_strdup(night_attr->u.str);
69 } 74 }
75
70 if ((color_attr = attr_search(attrs, NULL, attr_color))) 76 if ((color_attr = attr_search(attrs, NULL, attr_color)))
71 { 77 {
72 l->color = *color_attr->u.color; 78 l->color = *color_attr->u.color;
73 } 79 }
74 else 80 else
75 { 81 {
76 l->color = def_color; 82 l->color = def_color;
77 } 83 }
84
78 if ((order_delta_attr = attr_search(attrs, NULL, attr_order_delta))) 85 if ((order_delta_attr = attr_search(attrs, NULL, attr_order_delta)))
79 { 86 {
80 l->order_delta = order_delta_attr->u.num; 87 l->order_delta = order_delta_attr->u.num;
81 } 88 }
89
82 if ((active_attr = attr_search(attrs, NULL, attr_active))) 90 if ((active_attr = attr_search(attrs, NULL, attr_active)))
83 { 91 {
84 l->active = active_attr->u.num; 92 l->active = active_attr->u.num;
85 } 93 }
94
86 return l; 95 return l;
87} 96}
88 97
89struct attr_iter 98struct attr_iter
90{ 99{
399static void element_set_color(struct element *e, struct attr **attrs) 408static void element_set_color(struct element *e, struct attr **attrs)
400{ 409{
401 struct attr *color; 410 struct attr *color;
402 color = attr_search(attrs, NULL, attr_color); 411 color = attr_search(attrs, NULL, attr_color);
403 if (color) 412 if (color)
413 {
404 e->color = *color->u.color; 414 e->color = *color->u.color;
415 }
416}
417
418static void element_set_nightcol_color(struct color *c, struct color *c2, struct attr **attrs)
419{
420 struct attr *color;
421 color = attr_search(attrs, NULL, attr_nightcol);
422 if (color)
423 {
424 *c = *color->u.color;
425 dbg(0, "nightcol set %d %d %d\n", c->r, c->g, c->b);
426 }
427 else
428 {
429 if (c2)
430 {
431 *c = *c2;
432 }
433 }
405} 434}
406 435
407static void element_set_background_color(struct color *c, struct attr **attrs) 436static void element_set_background_color(struct color *c, struct attr **attrs)
408{ 437{
409 struct attr *color; 438 struct attr *color;
410 color = attr_search(attrs, NULL, attr_background_color); 439 color = attr_search(attrs, NULL, attr_background_color);
411 if (color) 440 if (color)
441 {
412 *c = *color->u.color; 442 *c = *color->u.color;
443 }
413} 444}
414 445
415static void element_set_text_size(struct element *e, struct attr **attrs) 446static void element_set_text_size(struct element *e, struct attr **attrs)
416{ 447{
417 struct attr *text_size; 448 struct attr *text_size;
418 text_size = attr_search(attrs, NULL, attr_text_size); 449 text_size = attr_search(attrs, NULL, attr_text_size);
450
419 if (text_size) 451 if (text_size)
452 {
420 e->text_size = text_size->u.num; 453 e->text_size = text_size->u.num;
454 }
421} 455}
422 456
423static void element_set_polyline_width(struct element *e, struct attr **attrs) 457static void element_set_polyline_width(struct element *e, struct attr **attrs)
424{ 458{
425 struct attr *width; 459 struct attr *width;
512 struct element *e; 546 struct element *e;
513 547
514 e = g_new0(struct element, 1); 548 e = g_new0(struct element, 1);
515 e->type = element_polyline; 549 e->type = element_polyline;
516 element_set_color(e, attrs); 550 element_set_color(e, attrs);
551 element_set_nightcol_color(&e->u.polyline.nightcol, &e->color, attrs);
517 element_set_polyline_width(e, attrs); 552 element_set_polyline_width(e, attrs);
518 element_set_polyline_directed(e, attrs); 553 element_set_polyline_directed(e, attrs);
519 element_set_polyline_dash(e, attrs); 554 element_set_polyline_dash(e, attrs);
520 element_set_polyline_offset(e, attrs); 555 element_set_polyline_offset(e, attrs);
521 return (struct polyline *) e; 556 return (struct polyline *) e;

Legend:
Removed from v.50  
changed lines
  Added in v.51

   
Visit the ZANavi Wiki