};
enum attr_type
-attr_from_name(char *name)
+attr_from_name(const char *name)
{
int i;
}
struct attr *
-attr_new_from_text(char *name, char *value)
+attr_new_from_text(const char *name, const char *value)
{
enum attr_type attr;
struct attr *ret;
case attr_item_type:
ret->u.item_type=item_from_name(value);
break;
+ case attr_data:
+ ret->u.str=value;
+ break;
default:
dbg(1,"default\n");
g_free(ret);
} u;
};
-enum attr_type attr_from_name(char *name);
-char * attr_to_name(enum attr_type attr);
-struct attr * attr_new_from_text(char *name, char *value);
-struct attr * attr_search(struct attr **attrs, struct attr *last, enum attr_type attr);
+/* prototypes */
+enum attr_type;
+struct attr;
+enum attr_type attr_from_name(const char *name);
+char *attr_to_name(enum attr_type attr);
+struct attr *attr_new_from_text(const char *name, const char *value);
+struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type attr);
void attr_free(struct attr *attr);
-
+/* end of prototypes */
#endif
ATTR2(type_int_begin,0x00020000)
ATTR(id)
ATTR(limit)
+ATTR(w)
+ATTR(h)
ATTR2(type_int_end,0x0002ffff)
ATTR2(type_string_begin,0x00030000)
ATTR(label)
+ATTR(data)
ATTR(country_all)
ATTR(country_iso3)
ATTR(country_iso2)
#include <Python.h>
#include <fcntl.h>
#include "coord.h"
+#include "projection.h"
#include "map.h"
#include "mapset.h"
#include "plugin.h"
if (!PyArg_ParseTuple(args, "ss:navit.map", &type, &filename))
return NULL;
ret=PyObject_NEW(mapObject, &map_Type);
- ret->m=map_new(type,filename,NULL);
+ ret->m=map_new(type,NULL);
return (PyObject *)ret;
}
#include <math.h>
#include "plugin.h"
#include "data.h"
+#include "projection.h"
#include "map.h"
#include "maptype.h"
#include "item.h"
#include "attr.h"
#include "coord.h"
#include "transform.h"
-#include "projection.h"
#include <stdio.h>
#include "attr.h"
#include "coord.h"
}
static struct map_methods map_methods_garmin_img = {
+ projection_garmin,
+ "iso8859-1",
map_destroy_garmin_img,
map_charset_garmin_img,
map_projection_garmin_img,
};
static struct map_priv *
-map_new_garmin_img(struct map_methods *meth, char *filename)
+map_new_garmin_img(struct map_methods *meth, struct attr **attrs)
{
struct map_priv *m;
+ struct attr *data=attr_search(attrs, NULL, attr_data);
+ if (! data)
+ return NULL;
+
*meth=map_methods_garmin_img;
m=g_new(struct map_priv, 1);
m->id=++map_id;
- m->filename=g_strdup(filename);
+ m->filename=g_strdup(data->u.str);
return m;
}
#include "debug.h"
#include "plugin.h"
#include "maptype.h"
-#include "projection.h"
#include "mg.h"
-struct map_priv * map_new_mg(struct map_methods *meth, char *dirname, struct attr **attrs, char **charset, enum projection *pro);
+struct map_priv * map_new_mg(struct map_methods *meth, struct attr **attrs);
static int map_id;
}
static struct map_methods map_methods_mg = {
+ projection_mg,
+ "iso8859-1",
map_destroy_mg,
map_rect_new_mg,
map_rect_destroy_mg,
};
struct map_priv *
-map_new_mg(struct map_methods *meth, char *dirname, struct attr **attrs, char **charset, enum projection *pro)
+map_new_mg(struct map_methods *meth, struct attr **attrs)
{
struct map_priv *m;
- int i,maybe_missing,len=strlen(dirname);
- char filename[len+16];
+ int i,maybe_missing;
+ struct attr *data;
+ char *filename;
*meth=map_methods_mg;
- *charset="iso8859-1";
- *pro=projection_mg;
+ data=attr_search(attrs, NULL, attr_data);
+ if (! data)
+ return NULL;
m=g_new(struct map_priv, 1);
m->id=++map_id;
- m->dirname=g_strdup(dirname);
- strcpy(filename, dirname);
- filename[len]='/';
+ m->dirname=g_strdup(data->u.str);
for (i = 0 ; i < file_end ; i++) {
if (file[i]) {
- strcpy(filename+len+1, file[i]);
+ filename=g_strdup_printf("%s/%s", data->u.str, file[i]);
m->file[i]=file_create_caseinsensitive(filename);
if (! m->file[i]) {
maybe_missing=(i == file_border_ply || i == file_height_ply || i == file_sea_ply);
if (! maybe_missing)
g_warning("Failed to load %s", filename);
}
+ g_free(filename);
}
}
#include "attr.h"
#include "coord.h"
#include "data.h"
+#include "projection.h"
#include "map.h"
#include "file.h"
#include <math.h>
#include "debug.h"
#include "plugin.h"
+#include "projection.h"
#include "map.h"
#include "maptype.h"
#include "item.h"
#include "attr.h"
#include "coord.h"
#include "transform.h"
-#include "projection.h"
#include "textfile.h"
}
static struct map_methods map_methods_textfile = {
+ projection_mg,
+ "iso8859-1",
map_destroy_textfile,
map_rect_new_textfile,
map_rect_destroy_textfile,
};
static struct map_priv *
-map_new_textfile(struct map_methods *meth, char *filename, struct attr **attrs, char **charset, enum projection *pro)
+map_new_textfile(struct map_methods *meth, struct attr **attrs)
{
struct map_priv *m;
- dbg(1,"map_new_textfile %s\n",filename);
+ struct attr *data=attr_search(attrs, NULL, attr_data);
+ if (! data)
+ return NULL;
+ dbg(1,"map_new_textfile %s\n", data->u.str);
*meth=map_methods_textfile;
- *charset="iso8859-1";
- *pro=projection_mg;
m=g_new(struct map_priv, 1);
m->id=++map_id;
- m->filename=g_strdup(filename);
+ m->filename=g_strdup(data->u.str);
return m;
}
#include "draw_info.h"
#include "point.h"
#include "graphics.h"
+#include "projection.h"
#include "map.h"
#include "coord.h"
#include "transform.h"
-#include "projection.h"
#include "plugin.h"
#include "profile.h"
#include "mapset.h"
};
struct graphics *
-graphics_new(const char *type)
+graphics_new(const char *type, struct attr **attrs)
{
struct graphics *this_;
- struct graphics_priv * (*new)(struct graphics_methods *meth);
+ struct graphics_priv * (*new)(struct graphics_methods *meth, struct attr **attrs);
new=plugin_get_graphics_type(type);
if (! new)
return NULL;
this_=g_new0(struct graphics, 1);
- this_->priv=(*new)(&this_->meth);
+ this_->priv=(*new)(&this_->meth, attrs);
return this_;
}
/* prototypes */
enum draw_mode_num;
+struct attr;
struct color;
struct displayitem;
struct displaylist;
struct point;
struct route;
struct transformation;
-struct graphics *graphics_new(const char *type);
+struct graphics *graphics_new(const char *type, struct attr **attrs);
void graphics_init(struct graphics *this_);
void *graphics_get_data(struct graphics *this_, char *type);
void graphics_register_resize_callback(struct graphics *this_, void (*callback)(void *data, int w, int h), void *data);
void graphics_draw_circle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int r);
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, struct route *route);
void graphics_draw(struct graphics *gra, struct displaylist *displaylist, GList *mapsets, struct transformation *trans, GList *layouts, struct route *route);
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);
struct displaylist *graphics_displaylist_new(void);
-void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, GList *layouts, struct route *route);
struct item *graphics_displayitem_get_item(struct displayitem *di);
char *graphics_displayitem_get_label(struct displayitem *di);
int graphics_displayitem_within_dist(struct displayitem *di, struct point *p, int dist);
}
static struct graphics_priv *
-graphics_gtk_drawing_area_new(struct graphics_methods *meth)
+graphics_gtk_drawing_area_new(struct graphics_methods *meth, struct attr **attrs)
{
GtkWidget *draw;
static struct graphics_priv *
-graphics_null_new(struct graphics_methods *meth)
+graphics_null_new(struct graphics_methods *meth, struct attr **attrs)
{
*meth=graphics_methods;
return &graphics_priv;
};
static struct graphics_priv *
-graphics_opengl_new(struct graphics_methods *meth)
+graphics_opengl_new(struct graphics_methods *meth, struct attr **attrs)
{
struct graphics_priv *this=g_new0(struct graphics_priv,1);
*meth=graphics_methods;
#include "plugin.h"
struct gui *
-gui_new(struct navit *nav, const char *type, int w, int h)
+gui_new(struct navit *nav, const char *type, struct attr **attrs)
{
struct gui *this_;
- struct gui_priv *(*guitype_new)(struct navit *nav, struct gui_methods *meth, int w, int h);
+ struct gui_priv *(*guitype_new)(struct navit *nav, struct gui_methods *meth, struct attr **attrs);
guitype_new=plugin_get_gui_type(type);
if (! guitype_new)
return NULL;
this_=g_new0(struct gui, 1);
- this_->priv=guitype_new(nav, &this_->meth, w, h);
+ this_->priv=guitype_new(nav, &this_->meth, attrs);
return this_;
}
};
/* prototypes */
+struct attr;
struct callback;
struct coord;
struct datawindow;
struct menu;
struct navit;
struct statusbar;
-struct gui *gui_new(struct navit *nav, const char *type, int w, int h);
+struct gui *gui_new(struct navit *nav, const char *type, struct attr **attrs);
struct statusbar *gui_statusbar_new(struct gui *gui);
struct menu *gui_menubar_new(struct gui *gui);
struct menu *gui_toolbar_new(struct gui *gui);
}
static struct gui_priv *
-gui_gtk_new(struct navit *nav, struct gui_methods *meth, int w, int h)
+gui_gtk_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs)
{
struct gui_priv *this;
+ int w=792, h=547;
*meth=gui_gtk_methods;
-
+
this=g_new0(struct gui_priv, 1);
this->nav=nav;
this->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
}
static struct gui_priv *
-gui_sdl_new(struct navit *nav, struct gui_methods *meth, int w, int h)
+gui_sdl_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs)
{
dbg(1,"Begin SDL init\n");
struct gui_priv *this_;
}
enum item_type
-item_from_name(char *name)
+item_from_name(const char *name)
{
int i;
void item_attr_rewind(struct item *it);
int item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr);
struct item *item_new(char *type, int zoom);
-enum item_type item_from_name(char *name);
+enum item_type item_from_name(const char *name);
char *item_to_name(enum item_type item);
struct item_hash *item_hash_new(void);
void item_hash_insert(struct item_hash *h, struct item *item, void *val);
#include <string.h>
#include "debug.h"
#include "coord.h"
+#include "projection.h"
#include "map.h"
#include "maptype.h"
#include "transform.h"
-#include "projection.h"
#include "item.h"
#include "plugin.h"
#include "country.h"
struct map {
struct map_methods meth;
struct map_priv *priv;
- char *filename;
char *type;
- char *charset;
+ char *filename;
int active;
- enum projection projection;
};
struct map_rect {
};
struct map *
-map_new(const char *type, const char *filename, struct attr **attrs)
+map_new(const char *type, struct attr **attrs)
{
struct map *m;
- struct map_priv *(*maptype_new)(struct map_methods *meth, const char *name, struct attr *attrs, char **charset, enum projection *pro);
+ struct map_priv *(*maptype_new)(struct map_methods *meth, struct attr **attrs);
+ struct attr *data=attr_search(attrs, NULL, attr_data);
+
maptype_new=plugin_get_map_type(type);
if (! maptype_new)
m=g_new0(struct map, 1);
m->active=1;
- m->filename=g_strdup(filename);
m->type=g_strdup(type);
- m->priv=maptype_new(&m->meth, filename, attrs, &m->charset, &m->projection);
+ if (data)
+ m->filename=g_strdup(data->u.str);
+ m->priv=maptype_new(&m->meth, attrs);
return m;
}
int
map_requires_conversion(struct map *this)
{
- return (this->charset != NULL);
+ return (this->meth.charset != NULL);
}
char *
map_convert_string(struct map *this, char *str)
{
- return g_convert(str, -1,"utf-8",this->charset,NULL,NULL,NULL);
+ return g_convert(str, -1,"utf-8",this->meth.charset,NULL,NULL,NULL);
}
void
enum projection
map_projection(struct map *this)
{
- return this->projection;
+ return this->meth.pro;
}
void
};
struct map_methods {
+ enum projection pro;
+ char *charset;
void (*map_destroy)(struct map_priv *priv);
struct map_rect_priv * (*map_rect_new)(struct map_priv *map, struct map_selection *sel);
void (*map_rect_destroy)(struct map_rect_priv *mr);
struct map_rect;
struct map_search;
struct map_selection;
-struct map *map_new(const char *type, const char *filename, struct attr **attrs);
-char * map_convert_string(struct map *this, char *str);
-void map_convert_free(char *str);
+struct map *map_new(const char *type, struct attr **attrs);
char *map_get_filename(struct map *this);
char *map_get_type(struct map *this);
int map_get_active(struct map *this);
void map_set_active(struct map *this, int active);
+int map_requires_conversion(struct map *this);
+char *map_convert_string(struct map *this, char *str);
+void map_convert_free(char *str);
enum projection map_projection(struct map *this);
void map_destroy(struct map *m);
struct map_rect *map_rect_new(struct map *m, struct map_selection *sel);
struct map_search *map_search_new(struct map *m, struct item *item, struct attr *search_attr, int partial);
struct item *map_search_get_item(struct map_search *this);
void map_search_destroy(struct map_search *this);
-int map_requires_conversion(struct map *this);
+/* end of prototypes */
#include "debug.h"
#include "item.h"
#include "mapset.h"
+#include "projection.h"
#include "map.h"
struct mapset {
#include <glib.h>
+#include "projection.h"
#include "map.h"
#include "maptype.h"
#include "route.h"
#include "transform.h"
#include "mapset.h"
+#include "projection.h"
#include "map.h"
#include "navit.h"
#include "callback.h"
#include "callback.h"
#include "gui.h"
#include "item.h"
+#include "projection.h"
#include "map.h"
#include "mapset.h"
#include "main.h"
#include "coord.h"
#include "point.h"
#include "transform.h"
-#include "projection.h"
#include "param.h"
#include "menu.h"
#include "graphics.h"
#include "speech.h"
#include "track.h"
#include "vehicle.h"
+#include "color.h"
#define _(STRING) gettext(STRING)
int update_curr;
int follow;
int follow_curr;
+ struct color c;
struct menu *menu;
struct cursor *cursor;
struct vehicle *vehicle;
struct gui *main_loop_gui;
+static void navit_cursor_update(struct navit *this_, struct cursor *cursor);
void
navit_add_mapset(struct navit *this_, struct mapset *ms)
}
struct navit *
-navit_new(const char *ui, const char *graphics, struct coord *center, enum projection pro, int zoom)
+navit_new(struct coord *center, enum projection pro, int zoom)
{
struct navit *this_=g_new0(struct navit, 1);
FILE *f;
transform_setup(this_->trans, center, zoom, 0);
this_->displaylist=graphics_displaylist_new();
- this_->gui=gui_new(this_, ui, 792, 547);
- if (! this_->gui) {
- g_warning("failed to create gui '%s'", ui);
- navit_destroy(this_);
- return NULL;
- }
+ return this_;
+}
+
+void
+navit_set_gui(struct navit *this_, struct gui *gui)
+{
+ this_->gui=gui;
if (gui_has_main_loop(this_->gui)) {
if (! main_loop_gui) {
main_loop_gui=this_->gui;
} else {
g_warning("gui with main loop already active, ignoring this instance");
- navit_destroy(this_);
- return NULL;
+ return;
}
}
this_->menubar=gui_menubar_new(this_->gui);
this_->toolbar=gui_toolbar_new(this_->gui);
this_->statusbar=gui_statusbar_new(this_->gui);
- this_->gra=graphics_new(graphics);
- if (! this_->gra) {
- g_warning("failed to create graphics '%s'", graphics);
- navit_destroy(this_);
- return NULL;
- }
+}
+
+void
+navit_set_graphics(struct navit *this_, struct graphics *gra)
+{
+ this_->gra=gra;
graphics_register_resize_callback(this_->gra, navit_resize, this_);
graphics_register_button_callback(this_->gra, navit_button, this_);
- if (gui_set_graphics(this_->gui, this_->gra)) {
- g_warning("failed to connect graphics '%s' to gui '%s'\n", graphics, ui);
- navit_destroy(this_);
- return NULL;
- }
- graphics_init(this_->gra);
- return this_;
}
static void
}
struct navit_window_items *
-navit_window_items_new(char *name, int distance)
+navit_window_items_new(const char *name, int distance)
{
struct navit_window_items *nwi=g_new0(struct navit_window_items, 1);
nwi->name=g_strdup(name);
{
struct menu *men;
struct mapset *ms;
+ GList *l;
+ struct navit_vehicle *nv;
+ if (!this_->gui || !this_->gra || gui_set_graphics(this_->gui, this_->gra)) {
+ g_warning("failed to connect graphics to gui\n");
+ navit_destroy(this_);
+ return;
+ }
+ graphics_init(this_->gra);
+ l=this_->vehicles;
+ while (l) {
+ nv=l->data;
+ nv->cursor=cursor_new(this_->gra, nv->vehicle, &nv->c, this_->trans);
+ nv->update_cb=callback_new_1(callback_cast(navit_cursor_update), this_);
+ cursor_add_callback(nv->cursor, nv->update_cb);
+ l=g_list_next(l);
+ }
if (this_->mapsets) {
ms=this_->mapsets->data;
if (this_->route)
cursor_c=cursor_pos_get(cursor);
dir=cursor_get_dir(cursor);
speed=cursor_get_speed(cursor);
- pro=vehicle_projection(this_->vehicle);
+ pro=vehicle_projection(this_->vehicle->vehicle);
if (!transform(this_->trans, pro, cursor_c, &pnt) || !transform_within_border(this_->trans, &pnt, border)) {
if (!this_->cursor_flag)
nv->name=g_strdup(name);
nv->update_curr=nv->update=update;
nv->follow_curr=nv->follow=follow;
- nv->cursor=cursor_new(this_->gra, v, c, this_->trans);
- nv->update_cb=callback_new_1(callback_cast(navit_cursor_update), this_);
- cursor_add_callback(nv->cursor, nv->update_cb);
+ nv->c=*c;
this_->vehicles=g_list_append(this_->vehicles, nv);
return nv;
#endif
extern struct gui *main_loop_gui;
/* prototypes */
-enum projection;
enum item_type;
+enum projection;
struct callback;
struct color;
struct coord;
struct displaylist;
+struct graphics;
struct gui;
struct layout;
struct mapset;
struct navigation;
struct navit;
struct navit_vehicle;
+struct navit_window_items;
struct point;
struct route;
struct speech;
void navit_draw_displaylist(struct navit *this_);
void navit_zoom_in(struct navit *this_, int factor);
void navit_zoom_out(struct navit *this_, int factor);
-struct navit *navit_new(const char *ui, const char *graphics, struct coord *center, enum projection pro, int zoom);
+struct navit *navit_new(struct coord *center, enum projection pro, int zoom);
+void navit_set_gui(struct navit *this_, struct gui *gui);
+void navit_set_graphics(struct navit *this_, struct graphics *gra);
void navit_set_destination(struct navit *this_, struct coord *c, char *description);
void navit_add_bookmark(struct navit *this_, struct coord *c, char *description);
void navit_add_menu_layouts(struct navit *this_, struct menu *men);
void navit_add_menu_vehicles(struct navit *this_, struct menu *men);
void navit_add_menu_vehicle(struct navit *this_, struct menu *men);
void navit_speak(struct navit *this_);
-void navit_window_roadbook_new(struct navit *this_);
void navit_window_roadbook_destroy(struct navit *this_);
-struct navit_window_items * navit_window_items_new(char *name, int distance);
+void navit_window_roadbook_new(struct navit *this_);
+struct navit_window_items *navit_window_items_new(const char *name, int distance);
void navit_window_items_add_item(struct navit_window_items *nwi, enum item_type type);
void navit_add_window_items(struct navit *this_, struct navit_window_items *nwi);
void navit_add_menu_windows_items(struct navit *this_, struct menu *men);
<plugin path="graphics/null/.libs/libgraphics_null.so" active="no" />
</plugins>
<debug name="navit:do_draw" level="0" />
-<navit gui="gtk" graphics="gtk_drawing_area" center="5031.51 N 735.83 E" zoom="8192" >
-<!-- For SDL, use rather the following line
-<navit gui="sdl" graphics="opengl" center="5031.51 N 305.83 E" zoom="128" >
+<navit center="5031.51 N 735.83 E" zoom="8192" >
+ <gui type="gtk" />
+ <graphics type="gtk_drawing_area" />
+<!-- For SDL, use rather the following lines
+ <gui type="sdl" />
+ <graphics type="opengl" />
-->
<vehicle name="Meins" enabled="yes" source="gpsd://localhost" color="#0000ff"/>
PLUGIN_FUNC1(draw, struct container *, co)
PLUGIN_FUNC3(popup, struct container *, map, struct popup *, p, struct popup_item **, list)
struct navit;
-PLUGIN_TYPE(graphics, (struct graphics_methods *meth))
-PLUGIN_TYPE(gui, (struct navit *nav, struct gui_methods *meth, int w, int h))
-PLUGIN_TYPE(map, (struct map_methods *meth, char *data, struct attr **attr, char **charset, enum projection *pro))
+PLUGIN_TYPE(graphics, (struct graphics_methods *meth, struct attr **attr))
+PLUGIN_TYPE(gui, (struct navit *nav, struct gui_methods *meth, struct attr **attr))
+PLUGIN_TYPE(map, (struct map_methods *meth, struct attr **attr))
PLUGIN_TYPE(osd, (struct osd_methods *meth))
PLUGIN_TYPE(speech, (char *data, struct speech_methods *meth))
PLUGIN_TYPE(vehicle, (struct vehicle_methods *meth))
#include "debug.h"
#include "profile.h"
#include "coord.h"
+#include "projection.h"
#include "map.h"
#include "mapset.h"
#include "item.h"
#include "point.h"
-#include "projection.h"
struct street_data *
route_info_street(struct route_info *rinf)
#include <glib.h>
#include "debug.h"
+#include "projection.h"
#include "map.h"
#include "mapset.h"
#include "coord.h"
#include "coord.h"
#include "item.h"
#include "route.h"
+#include "projection.h"
#include "map.h"
#include "mapset.h"
#include "coord.h"
#include "layout.h"
#include "mapset.h"
+#include "projection.h"
#include "map.h"
#include "navigation.h"
#include "navit.h"
#include "plugin.h"
-#include "projection.h"
#include "route.h"
#include "speech.h"
#include "track.h"
#include "vehicle.h"
+#include "point.h"
+#include "graphics.h"
+#include "gui.h"
#include "xmlconfig.h"
} *xmlstate_root;
-static struct attr ** convert_to_attr(struct xmlstate *state)
+static struct attr ** convert_to_attrs(struct xmlstate *state)
{
const gchar **attribute_name=state->attribute_names;
const gchar **attribute_value=state->attribute_values;
count++;
attribute_name++;
}
- ret=g_new(struct attr, count+1);
+ ret=g_new(struct attr *, count+1);
attribute_name=state->attribute_names;
count=0;
while (*attribute_name) {
static int
xmlconfig_navit(struct xmlstate *state)
{
- const char *value,*gui,*graphics;
+ const char *value;
int zoom=0;
struct coord c;
enum projection pro=projection_mg;
c.x=1300000;
c.y=7000000;
}
- gui=find_attribute(state, "gui", 0);
- if (! gui)
- gui="gtk";
- graphics=find_attribute(state, "graphics", 0);
- if (! graphics)
- graphics="gtk_drawing_area";
- state->element_object = navit_new(gui, graphics, &c, pro, zoom);
+ state->element_object = navit_new(&c, pro, zoom);
+ if (! state->element_object)
+ return 0;
+ return 1;
+}
+
+static int
+xmlconfig_graphics(struct xmlstate *state)
+{
+ struct attr **attrs;
+ const char *type=find_attribute(state, "type", 1);
+ if (! type)
+ return 0;
+ attrs=convert_to_attrs(state);
+ state->element_object = graphics_new(type, attrs);
+ if (! state->element_object)
+ return 0;
+ navit_set_graphics(state->parent->element_object, state->element_object);
+ return 1;
+}
+
+static int
+xmlconfig_gui(struct xmlstate *state)
+{
+ struct attr **attrs;
+ const char *type=find_attribute(state, "type", 1);
+ if (! type)
+ return 0;
+ attrs=convert_to_attrs(state);
+ state->element_object = gui_new(state->parent->element_object, type, attrs);
if (! state->element_object)
return 0;
+ navit_set_gui(state->parent->element_object, state->element_object);
return 1;
}
static int
xmlconfig_map(struct xmlstate *state)
{
- struct attr **attr;
+ struct attr **attrs;
const char *type=find_attribute(state, "type", 1);
- const char *data=find_attribute(state, "data", 1);
- if (! type || ! data)
+ if (! type)
return 0;
- attr=convert_to_attr(state);
- state->element_object = map_new(type, data, attr);
+ attrs=convert_to_attrs(state);
+ state->element_object = map_new(type, attrs);
if (! state->element_object)
return 0;
if (!find_boolean(state, "active", 1, 0))
} elements[] = {
{ "debug", NULL, xmlconfig_debug},
{ "navit", NULL, xmlconfig_navit},
+ { "graphics", "navit", xmlconfig_graphics},
+ { "gui", "navit", xmlconfig_gui},
{ "layout", "navit", xmlconfig_layout},
{ "layer", "layout", xmlconfig_layer},
{ "item", "layer", xmlconfig_item},
include $(top_srcdir)/Makefile.inc
-xpm_DATA = camping.xpm car_dealer.xpm flag_bk_tr.xpm flag_bk_wh.xpm flag_bl_wh.xpm fuel.xpm hospital.xpm hotel.xpm parking.xpm restaurant.xpm unknown.xpm
+xpm_DATA = camping.xpm car_dealer.xpm flag_bk_tr.xpm flag_bk_wh.xpm flag_bl_wh.xpm fuel.xpm hospital.xpm hotel.xpm parking.xpm restaurant.xpm unknown.xpm burgerking.ico
EXTRA_DIST = $(xpm_DATA)
+burgerking.ico:
+ wget http://www.burgerking.de/favicon.ico -O burgerking.ico