/[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 30 Revision 31
1/**
2 * ZANavi, Zoff Android Navigation system.
3 * Copyright (C) 2011-2012 Zoff <zoff@zoff.cc>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
1/** 20/**
2 * Navit, a modular navigation system. 21 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2009 Navit Team 22 * Copyright (C) 2005-2009 Navit Team
4 * 23 *
5 * This program is free software; you can redistribute it and/or 24 * This program is free software; you can redistribute it and/or
26#include "debug.h" 45#include "debug.h"
27 46
28struct layout * layout_new(struct attr *parent, struct attr **attrs) 47struct layout * layout_new(struct attr *parent, struct attr **attrs)
29{ 48{
30 struct layout *l; 49 struct layout *l;
31 struct color def_color = 50 struct color def_color = { COLOR_BACKGROUND_ };
32 { COLOR_BACKGROUND_ };
33 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;
34 52
35 if (!(name_attr = attr_search(attrs, NULL, attr_name))) 53 if (!(name_attr = attr_search(attrs, NULL, attr_name)))
36 { 54 {
37 return NULL; 55 return NULL;
38 }
39 l = g_new0(struct layout, 1); 56 } l = g_new0(struct layout, 1);
40 l->name = g_strdup(name_attr->u.str); 57 l->name = g_strdup(name_attr->u.str);
41 if ((font_attr = attr_search(attrs, NULL, attr_font))) 58 if ((font_attr = attr_search(attrs, NULL, attr_font)))
42 { 59 {
43 l->font = g_strdup(font_attr->u.str); 60 l->font = g_strdup(font_attr->u.str);
44 } 61 }
201 } 218 }
202 else 219 else
203 { 220 {
204 this->sequence_range = NULL; 221 this->sequence_range = NULL;
205 } 222 }
206 dbg(2, "ret=%p\n", this); 223 //dbg(2, "ret=%p\n", this);
207 return this; 224 return this;
208} 225}
209 226
210void cursor_destroy(struct cursor *this_) 227void cursor_destroy(struct cursor *this_)
211{ 228{
418 435
419 dash = attr_search(attrs, NULL, attr_dash); 436 dash = attr_search(attrs, NULL, attr_dash);
420 if (dash) 437 if (dash)
421 { 438 {
422 /* 439 /*
423 for (i = 0; i < 4; i++) 440 for (i = 0; i < 4; i++)
424 { 441 {
425 if (!dash->u.dash[i]) 442 if (!dash->u.dash[i])
426 { 443 {
427 break; 444 break;
428 } 445 }
429 dbg(0,"1 i=%d d=%d\n", i, dash->u.dash[i]); 446 dbg(0,"1 i=%d d=%d\n", i, dash->u.dash[i]);
430 //e->u.polyline.dash_table[i] = atoi(dash->u.dash[i]); 447 //e->u.polyline.dash_table[i] = atoi(dash->u.dash[i]);
431 e->u.polyline.dash_table[i] = dash->u.dash[i]; 448 e->u.polyline.dash_table[i] = dash->u.dash[i];
432 } 449 }
433 */ 450 */
434 i=0; 451 i = 0;
435 if (!dash->u.dash[i]) 452 if (!dash->u.dash[i])
436 { 453 {
437 } 454 }
438 else 455 else
439 { 456 {
498 515
499struct circle * 516struct circle *
500circle_new(struct attr *parent, struct attr **attrs) 517circle_new(struct attr *parent, struct attr **attrs)
501{ 518{
502 struct element *e; 519 struct element *e;
503 struct color color_black = 520 struct color color_black = { COLOR_BLACK_ };
504 { COLOR_BLACK_ };
505 struct color color_white = 521 struct color color_white = { COLOR_WHITE_ };
506 { COLOR_WHITE_ };
507 522
508 e = g_new0(struct element, 1); 523 e = g_new0(struct element, 1);
509 e->type = element_circle; 524 e->type = element_circle;
510 e->color = color_black; 525 e->color = color_black;
511 e->u.circle.background_color = color_white; 526 e->u.circle.background_color = color_white;
520 535
521struct text * 536struct text *
522text_new(struct attr *parent, struct attr **attrs) 537text_new(struct attr *parent, struct attr **attrs)
523{ 538{
524 struct element *e; 539 struct element *e;
525 struct color color_black = 540 struct color color_black = { COLOR_BLACK_ };
526 { COLOR_BLACK_ };
527 struct color color_white = 541 struct color color_white = { COLOR_WHITE_ };
528 { COLOR_WHITE_ };
529 542
530 e = g_new0(struct element, 1); 543 e = g_new0(struct element, 1);
531 e->type = element_text; 544 e->type = element_text;
532 element_set_text_size(e, attrs); 545 element_set_text_size(e, attrs);
533 e->color = color_black; 546 e->color = color_black;

Legend:
Removed from v.30  
changed lines
  Added in v.31

   
Visit the ZANavi Wiki