void file_wordexp_destroy(struct file_wordexp *wexp);
int file_get_param(struct file *file, struct param_list *param, int count);
int file_version(struct file *file, int byname);
+void file_init(void);
/* end of prototypes */
#endif
void graphics_get_text_bbox(struct graphics *this_, struct graphics_font *font, char *text, int dx, int dy, struct point *ret);
void graphics_overlay_disable(struct graphics *this_, int disable);
void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img);
+int graphics_draw_drag(struct graphics *this_, struct point *p);
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, struct layout *l, int callback);
static void
gui_gtk_destinations_init(struct gui_priv *this)
{
- navit_add_callback(this->nav, callback_new_attr_1(gui_gtk_destinations_update, attr_destination, this));
+ navit_add_callback(this->nav, callback_new_attr_1(callback_cast(gui_gtk_destinations_update), attr_destination, this));
gui_gtk_destinations_update(this);
}
static void
gui_gtk_bookmarks_init(struct gui_priv *this)
{
- navit_add_callback(this->nav, callback_new_attr_1(gui_gtk_bookmarks_update, attr_bookmark_map, this));
+ navit_add_callback(this->nav, callback_new_attr_1(callback_cast(gui_gtk_bookmarks_update), attr_bookmark_map, this));
gui_gtk_bookmarks_update(this);
}
ret->on=*on;
if (off)
ret->off=*off;
- ret->get_attr=navit_get_attr;
- ret->set_attr=navit_set_attr;
- ret->remove_cb=navit_remove_callback;
+ ret->get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))navit_get_attr;
+ ret->set_attr=(int (*)(void *, struct attr *))navit_set_attr;
+ ret->remove_cb=(void (*)(void *, struct callback *))navit_remove_callback;
ret->instance=this->nav;
- ret->cb=callback_new_attr_2(gui_internal_button_attr_callback, on->type, this, ret);
+ ret->cb=callback_new_attr_2(callback_cast(gui_internal_button_attr_callback), on->type, this, ret);
navit_add_callback(this->nav, ret->cb);
gui_internal_button_attr_update(this, ret);
return ret;
if (off)
ret->off=*off;
ret->deflt=deflt;
- ret->get_attr=map_get_attr;
- ret->set_attr=map_set_attr;
- ret->remove_cb=map_remove_callback;
+ ret->get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))map_get_attr;
+ ret->set_attr=(int (*)(void *, struct attr *))map_set_attr;
+ ret->remove_cb=(void (*)(void *, struct callback *))map_remove_callback;
ret->instance=map;
ret->redraw=1;
- ret->cb=callback_new_attr_2(gui_internal_button_attr_callback, on->type, this, ret);
+ ret->cb=callback_new_attr_2(callback_cast(gui_internal_button_attr_callback), on->type, this, ret);
map_add_callback(map, ret->cb);
gui_internal_button_attr_update(this, ret);
return ret;
static struct widget *
gui_internal_cmd_pois_item(struct gui_priv *this, struct coord *center, struct item *item, struct coord *c, int dist)
{
- char coordbuf[64];
- struct param_list param[5];
char distbuf[32];
char dirbuf[32];
char *type;
static gint
gui_internal_cmd_pois_sort_num(gconstpointer a, gconstpointer b, gpointer user_data)
{
- struct widget *wa=a;
- struct widget *wb=b;
+ const struct widget *wa=a;
+ const struct widget *wb=b;
struct widget *wac=wa->children->data;
struct widget *wbc=wb->children->data;
int ia,ib;
static void
gui_internal_cmd_view_in_browser(struct gui_priv *this, struct widget *wm)
{
- struct widget *w,*wb;
struct map_rect *mr;
struct item *item;
struct attr attr;
struct coord_geo g;
struct coord c;
char *coord,*name;
- int display_attributes=(wm->data == 2);
- int display_view_on_map=(wm->data != 1);
- int display_items=(wm->data == 1);
- int display_streets=(wm->data == 3);
+ int display_attributes=(wm->data == (void *)2);
+ int display_view_on_map=(wm->data != (void *)1);
+ int display_items=(wm->data == (void *)1);
+ int display_streets=(wm->data == (void *)3);
#if 0
switch ((int)wm->data) {
{
GList *l;
gui_internal_widget_children_destroy(this, this->list);
- char *text, *name;
+ char *text=NULL, *name=NULL;
dbg(0,"%s now '%s'\n", wm->name, wm->text);
if (wm->text && g_utf8_strlen(wm->text, -1) >= 2) {
struct attr search_attr;
struct attr attr,attrp;
this->ignore_button=ignore;
+ this->clickp_valid=this->vehicle_valid=0;
navit_block(this->nav, 1);
graphics_overlay_disable(gra, 1);
struct gui_priv *this=data;
this->root.w=w;
this->root.h=h;
- dbg(0,"w=%d h=%d children=%p\n", w, h, this->root.children);
+ dbg(1,"w=%d h=%d children=%p\n", w, h, this->root.children);
navit_resize(this->nav, w, h);
if (this->root.children) {
gui_internal_prune_menu(this, NULL);
case NAVIT_KEY_ZOOM_OUT:
navit_zoom_out(this->nav, 2, NULL);
break;
+ case NAVIT_KEY_RETURN:
+ gui_internal_cmd_menu(this, NULL, 0);
+ break;
}
return;
}
this->gra=gra;
this->win=win;
transform_get_size(trans, &this->root.w, &this->root.h);
- this->resize_cb=callback_new_attr_1(gui_internal_resize, attr_resize, this);
+ this->resize_cb=callback_new_attr_1(callback_cast(gui_internal_resize), attr_resize, this);
graphics_add_callback(gra, this->resize_cb);
- this->button_cb=callback_new_attr_1(gui_internal_button, attr_button, this);
+ this->button_cb=callback_new_attr_1(callback_cast(gui_internal_button), attr_button, this);
graphics_add_callback(gra, this->button_cb);
- this->motion_cb=callback_new_attr_1(gui_internal_motion, attr_motion, this);
+ this->motion_cb=callback_new_attr_1(callback_cast(gui_internal_motion), attr_motion, this);
graphics_add_callback(gra, this->motion_cb);
- this->keypress_cb=callback_new_attr_1(gui_internal_keypress, attr_keypress, this);
+ this->keypress_cb=callback_new_attr_1(callback_cast(gui_internal_keypress), attr_keypress, this);
graphics_add_callback(gra, this->keypress_cb);
this->background=graphics_gc_new(gra);
graphics_gc_set_foreground(this->background, &cb);
this->menu_on_map_click=attr->u.num;
else
this->menu_on_map_click=1;
- navit_command_register(nav,"gui_internal_menu",callback_new_3(gui_internal_cmd_menu,this,NULL,1));
- navit_command_register(nav,"gui_internal_fullscreen",callback_new_2(gui_internal_cmd_fullscreen,this,NULL));
+ navit_command_register(nav,"gui_internal_menu",callback_new_3(callback_cast(gui_internal_cmd_menu),this,NULL,(void *)1));
+ navit_command_register(nav,"gui_internal_fullscreen",callback_new_2(callback_cast(gui_internal_cmd_fullscreen),this,NULL));
if( (attr=attr_search(attrs,NULL,attr_font_size)))
{
* @param flags Sizing flags for the row
* @returns The new table_row widget.
*/
-struct widget * gui_internal_widget_table_row_new(struct gui_priv * this, enum flags flags)
+static struct widget * gui_internal_widget_table_row_new(struct gui_priv * this, enum flags flags)
{
struct widget * widget = g_new0(struct widget,1);
widget->type=widget_table_row;
void gui_internal_table_pack(struct gui_priv * this, struct widget * w)
{
- struct widget * row_widget=NULL;
int height=0;
int width=0;
int count=0;
GList * cur_row = NULL;
GList * current_desc=NULL;
struct table_data * table_data = (struct table_data*)w->data;
- int idx=0;
int is_skipped=0;
struct table_column_desc * dim=NULL;
}
-gchar *get_home_directory(void)
+static gchar *get_home_directory(void)
{
static gchar *homedir = NULL;
void
main_init(char *program)
{
- GError *error = NULL;
- char *config_file = NULL;
char *s;
int l;
- int opt;
- GList *list = NULL, *li;
-
#ifndef _WIN32
signal(SIGCHLD, sigchld);
struct navit * main_get_navit(struct iter *iter);
void main_add_navit(struct navit *nav);
void main_remove_navit(struct navit *nav);
+void main_init(char *program);
+void main_init_nls(void);
int main(int argc, char **argv);
/* end of prototypes */
#include "layout.h"
#include "log.h"
#include "attr.h"
+#include "event.h"
+#include "file.h"
#include "navit_nls.h"
/**
GHashTable *bookmarks_hash;
struct point pressed, last, current;
int button_pressed,moved,popped;
- struct event_timer *button_timeout, *motion_timeout;
+ struct event_timeout *button_timeout, *motion_timeout;
struct callback *motion_timeout_callback;
int ignore_button;
struct log *textfile_debug_log;
}
-int
+void
navit_ignore_button(struct navit *this_)
{
this_->ignore_button=1;
{
int border=16;
- callback_list_call_attr_4(this_->attr_cbl, attr_button, this_, pressed, button, p);
+ callback_list_call_attr_4(this_->attr_cbl, attr_button, this_, (void *)pressed, (void *)button, p);
if (this_->ignore_button) {
this_->ignore_button=0;
return 0;
{
struct navit *this=data;
if (! this->popup_callback)
- this->popup_callback=callback_new_1(navit_popup, this);
+ this->popup_callback=callback_new_1(callback_cast(navit_popup), this);
navit_handle_button(this, pressed, button, p, this->popup_callback);
}
transform_setup(this_->trans, ¢er, zoom, 0);
this_->displaylist=graphics_displaylist_new();
this_->commands=g_hash_table_new(g_str_hash, g_str_equal);
- navit_command_register(this_, "zoom_in", callback_new_3(navit_zoom_in, this_, 2, NULL));
- navit_command_register(this_, "zoom_out", callback_new_3(navit_zoom_out, this_, 2, NULL));
+ navit_command_register(this_, "zoom_in", callback_new_3(callback_cast(navit_zoom_in), this_, (void *)2, NULL));
+ navit_command_register(this_, "zoom_out", callback_new_3(callback_cast(navit_zoom_out), this_, (void *)2, NULL));
return this_;
}
if (this_->gra)
return 0;
this_->gra=gra;
- this_->resize_callback=callback_new_attr_1(navit_resize, attr_resize, this_);
+ this_->resize_callback=callback_new_attr_1(callback_cast(navit_resize), attr_resize, this_);
graphics_add_callback(gra, this_->resize_callback);
- this_->button_callback=callback_new_attr_1(navit_button, attr_button, this_);
+ this_->button_callback=callback_new_attr_1(callback_cast(navit_button), attr_button, this_);
graphics_add_callback(gra, this_->button_callback);
- this_->motion_callback=callback_new_attr_1(navit_motion, attr_motion, this_);
+ this_->motion_callback=callback_new_attr_1(callback_cast(navit_motion), attr_motion, this_);
graphics_add_callback(gra, this_->motion_callback);
return 1;
}
* @param limit Limits the number of entries in the "backlog". Set to 0 for "infinite"
*/
static void
-navit_append_coord(struct navit *this_, char *file, struct pcoord *c, char *type, char *description, GHashTable *h, int limit)
+navit_append_coord(struct navit *this_, char *file, struct pcoord *c, const char *type, const char *description, GHashTable *h, int limit)
{
FILE *f;
int offset=0;
int numc,readc;
int fd;
const char *prostr;
- struct callback *cb;
f=fopen(file, "r");
if (!f)
}
}
-static int
-parse_line(FILE *f, char *buffer, char **name, struct pcoord *c)
-{
- int pos;
- char *s,*i;
- struct coord co;
- char *cp;
- enum projection pro = projection_mg;
- *name=NULL;
- if (! fgets(buffer, 2048, f))
- return -3;
- cp = buffer;
- pos=coord_parse(cp, pro, &co);
- if (!pos)
- return -2;
- if (!cp[pos] || cp[pos] == '\n')
- return -1;
- cp[strlen(cp)-1]='\0';
- s=cp+pos+1;
- if (!strncmp(s,"type=", 5)) {
- i=strchr(s, '"');
- if (i) {
- s=i+1;
- i=strchr(s, '"');
- if (i)
- *i='\0';
- }
- }
- *name=s;
- c->x = co.x;
- c->y = co.y;
- c->pro = pro;
- return pos;
-}
-
/*
* navit_get_user_data_directory
*
if (create && !file_exists(dir)) {
dbg(0,"creating dir %s\n", dir);
if (file_mkdir(dir,0)) {
- perror(dir);
- return;
+ dbg(0,"failed creating dir %s\n", dir);
+ return NULL;
}
}
char buffer[3];
f=fopen(destination_file,"r");
if (f) {
- if(!fseek(f, -2, SEEK_END) && fread(buffer, 2, 1, f) == 1 && buffer[0]!='\n' || buffer[1]!='\n')
+ if(!fseek(f, -2, SEEK_END) && fread(buffer, 2, 1, f) == 1 && (buffer[0]!='\n' || buffer[1]!='\n'))
active=1;
fclose(f);
}
{
if (block) {
this_->blocked |= 1;
- return;
+ return 0;
}
if (this_->blocked & 2) {
this_->blocked=0;
if (! cb)
return 1;
callback_call_1(cb, command);
+ return 0;
}
void
int navit_get_width(struct navit *this_);
int navit_check_route(struct navit *this_);
int navit_get_height(struct navit *this_);
-int navit_ignore_button(struct navit *this_);
+void navit_ignore_button(struct navit *this_);
int navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback);
void navit_handle_motion(struct navit *this_, struct point *p);
void navit_zoom_in(struct navit *this_, int factor, struct point *p);
struct graphics *navit_get_graphics(struct navit *this_);
void navit_set_destination(struct navit *this_, struct pcoord *c, char *description);
void navit_add_bookmark(struct navit *this_, struct pcoord *c, const char *description);
+void navit_say(struct navit *this_, char *text);
void navit_speak(struct navit *this_);
void navit_window_roadbook_destroy(struct navit *this_);
void navit_window_roadbook_new(struct navit *this_);
struct search_list_result;
struct search_list *search_list_new(struct mapset *ms);
void search_list_search(struct search_list *this_, struct attr *search_attr, int partial);
+int search_list_select(struct search_list *this_, enum attr_type attr_type, int id, int mode);
struct search_list_result *search_list_get_result(struct search_list *this_);
void search_list_destroy(struct search_list *this_);
+void search_init(void);
/* end of prototypes */
#ifdef __cplusplus
}
{
GError *error = NULL;
char *config_file = NULL;
- char *s;
- int l;
int opt;
GList *list = NULL, *li;