navit_SOURCES = block.c command.c compass.c coord.c country.c cursor.c data_window.c debug.c destination.c \
display.c file.c graphics.c log.c main.c map-common.c map-skelimpl.c map-skels.c map-srv.c \
- map-stubs.c map_data.c menu.c navigation.c param.c phrase.c plugin.c poly.c popup.c \
+ map-stubs.c map_data.c menu.c navigation.c osd.c param.c phrase.c plugin.c poly.c popup.c \
profile.c route.c search.c speech.c street.c street_name.c town.c transform.c tree.c track.c \
util.c vehicle.c block.h command.h compass.h config.h container.h coord.h country.h \
cursor.h data.h data_window.h data_window_int.h debug.h destination.h display.h draw_info.h \
file.h graphics.h gtkext.h log.h main.h map-share.h map.h map_data.h menu.h navigation.h \
- param.h phrase.h plugin.h point.h poly.h popup.h route.h search.h speech.h statusbar.h \
+ osd.h param.h phrase.h plugin.h point.h poly.h popup.h route.h search.h speech.h statusbar.h \
street.h street_data.h street_name.h toolbar.h town.h transform.h tree.h track.h util.h vehicle.h
navit_LDADD = @PACKAGE_LIBS@ gui/gtk/gtk.o graphics/gtk_drawing_area/gtk_drawing_area.o -Lfib-1.0 -lfib
struct transformation *trans;
struct graphics *gra;
struct compass *compass;
+ struct osd *osd;
struct display_list *disp[display_end];
struct map_data *map_data;
struct menu *menu;
cursor_draw(this, &pnt, vehicle_speed_get(v), vehicle_dir_get(v));
}
compass_draw(this->co->compass, this->co);
+ osd_draw(this->co->osd, this->co);
}
extern void *vehicle;
#endif
window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- keyboard = build_keyboard(NULL, "/usr/share/gtkeyboard/key/DE.key");
+ keyboard = build_keyboard(NULL, gettext("/usr/share/gtkeyboard/key/DE.key"));
vbox = gtk_vbox_new(FALSE, 0);
table = gtk_table_new(3, 8, FALSE);
entry_country = gtk_entry_new();
- label_country = gtk_label_new("Land");
+ label_country = gtk_label_new(gettext("Land"));
entry_postal = gtk_entry_new();
- label_postal = gtk_label_new("PLZ");
+ label_postal = gtk_label_new(gettext("PLZ"));
entry_city = gtk_entry_new();
- label_city = gtk_label_new("Ort");
+ label_city = gtk_label_new(gettext("Ort"));
entry_district = gtk_entry_new();
- label_district = gtk_label_new("Ortsteil/Gemeinde");
+ label_district = gtk_label_new(gettext("Ortsteil/Gemeinde"));
hseparator1 = gtk_vseparator_new();
entry_street = gtk_entry_new();
- label_street = gtk_label_new("Strasse");
+ label_street = gtk_label_new(gettext("Strasse"));
entry_number = gtk_entry_new();
- label_number = gtk_label_new("Nummer");
+ label_number = gtk_label_new(gettext("Nummer"));
listbox = gtk_clist_new(9);
for (i=0 ; i < row_count ; i++) {
gtk_clist_append(GTK_CLIST(listbox), text);
gtk_clist_columns_autosize (GTK_CLIST(listbox));
hseparator2 = gtk_vseparator_new();
- button1 = gtk_button_new_with_label("Karte");
- button2 = gtk_button_new_with_label("Ziel");
+ button1 = gtk_button_new_with_label(gettext("Karte"));
+ button2 = gtk_button_new_with_label(gettext("Ziel"));
gtk_table_attach(GTK_TABLE(table), label_country, 0, 1, 0, 1, 0, GTK_FILL|GTK_EXPAND, 0, 0);
gtk_table_attach(GTK_TABLE(table), label_postal, 1, 2, 0, 1, 0, GTK_FILL|GTK_EXPAND, 0, 0);
gtk_widget_show_all(window2);
- gtk_entry_set_text(GTK_ENTRY(entry_country),"Deutschland");
+ gtk_entry_set_text(GTK_ENTRY(entry_country),gettext("base_country"));
return 0;
}
gra->gc_set_linewidth(gra->gc[GC_STREET_BIG2_B], bw[3]);
gra->gc_set_linewidth(gra->gc[GC_STREET_ROUTE], w[3]+7+w[3]/2);
+#ifdef DEBUG
profile_timer(NULL);
+#endif
graphics_draw(co->map_data, file_border_ply, co, display_rail, plimit, 48, poly_draw_block);
graphics_draw(co->map_data, file_woodland_ply, co, display_wood, plimit, 48, poly_draw_block);
graphics_draw(co->map_data, file_other_ply, co, display_other, plimit, 48, poly_draw_block);
if (scale < 256) {
graphics_draw(co->map_data, file_rail_ply, co, display_rail, plimit, 48, poly_draw_block);
}
+#ifdef DEBUG
profile_timer("map_draw");
+#endif
plugin_call_draw(co);
+#ifdef DEBUG
profile_timer("plugin");
+#endif
+
#if 0
draw_poly(map, &co->d_tunnel_ply, "Tunnel", 0, 11, plimit);
#endif
display_draw(disp[display_poi], gra, gra->gc[GC_BLACK], NULL);
+#ifdef DEBUG
profile_timer("display_draw");
-
+#endif
if (scale < 2) {
display_labels(disp[display_street], gra, gra->gc[GC_TEXT_FG], gra->gc[GC_TEXT_BG], gra->font[1]);
display_labels(disp[display_street1], gra, gra->gc[GC_TEXT_FG], gra->gc[GC_TEXT_BG], gra->font[1]);
for (i = display_town ; i < display_town+0x10 ; i++)
display_draw(disp[i], gra, gra->gc[GC_BLACK], NULL);
display_draw(disp[display_bti], gra, gra->gc[GC_BLACK], NULL);
+#ifdef DEBUG
profile_timer("labels");
+#endif
gra->draw_mode(gra, draw_mode_end);
for (i = 0 ; i < data_window_type_end; i++) {
data_window_end(co->data_window[i]);
#include "container.h"
#include "debug.h"
+#include "osd.h"
+
void *speech_handle;
struct container *co;
gtk_init(&argc, &argv);
gdk_rgb_init();
+// i18n basic support
+
+ bindtextdomain( "navit", "./locale" );
+ textdomain( "navit" );
+
map_data_default=load_maps(NULL);
plugin_load();
co=gui_gtk_window(1300000,7000000,8192);
co->cursor=cursor_new(co,co->vehicle);
}
} else {
- g_warning("Environment-Variable GPSDATA not set - No gps tracking. Set it to file:filename or gpsd://host[:port]");
+ g_warning(gettext("Environment-Variable GPSDATA not set - No gps tracking. Set it to file:filename or gpsd://host[:port]"));
}
co->speech=speech_new();
if (! co->speech)
- g_warning("Can't connect to speechd, no speech output available");
+ g_warning(gettext("Can't connect to speechd, no speech output available"));
speech_handle=co->speech;
if (co->vehicle)
co->compass=compass_new(co);
if (co->vehicle)
+ co->osd=osd_new(co);
+ if (co->vehicle)
co->track=track_new(co->map_data);
#include "speech.h"
#include "navigation.h"
#include "data_window.h"
+#include "osd.h"
struct data_window *navigation_window;
if (dist < 100) {
dist=(dist+5)/10;
dist*=10;
- sprintf(dst,"%d meter", dist);
+ sprintf(dst,gettext("%d meter"), dist);
return;
}
if (dist < 250) {
dist=(dist+13)/25;
dist*=25;
- sprintf(dst,"%d meter", dist);
+ sprintf(dst,gettext("%d meter"), dist);
return;
}
if (dist < 500) {
dist=(dist+25)/50;
dist*=50;
- sprintf(dst,"%d meter", dist);
+ sprintf(dst,gettext("%d meter"), dist);
return;
}
if (dist < 1000) {
dist=(dist+50)/100;
dist*=100;
- sprintf(dst,"%d meter", dist);
+ sprintf(dst,gettext("%d meter"), dist);
return;
}
if (dist < 5000) {
dist=(dist+50)/100;
if (dist % 10)
- sprintf(dst,"%d,%d kilometer", dist/10,dist%10);
+ sprintf(dst,gettext("%d,%d kilometer"), dist/10,dist%10);
else
- sprintf(dst,"%d kilometer", dist/10);
+ sprintf(dst,gettext("%d kilometer"), dist/10);
return;
}
if (dist < 100000) {
dist=(dist+500)/1000;
- sprintf(dst,"%d kilometer", dist);
+ sprintf(dst,gettext("%d kilometer"), dist);
return;
}
dist=(dist+5000)/10000;
dist*=10;
- sprintf(dst,"%d kilometer", dist);
+ sprintf(dst,gettext("%d kilometer"), dist);
}
static void
int delta,navmode=1,add_dir,level;
struct param_list param_list[20];
+
+ extern struct container *co;
+ char roadname[256];
char angle_old[30],angle_new[30],angle_delta[30],cross_roads[30],position[30],distance[30];
char command[256],*p,*dir,*strength;
sprintf(distance,"%d", old->length);
param_list[9].value=distance;
add_dir=1;
- dir="rechts";
+ dir=gettext("rechts");
if (delta < 0) {
- dir="links";
+ dir=gettext("links");
delta=-delta;
}
if (delta < 45) {
- strength="leicht ";
+ strength=gettext("leicht ");
} else if (delta < 105) {
strength="";
} else if (delta < 165) {
- strength="scharf ";
+ strength=gettext("scharf ");
} else {
+#ifdef DEBUG
printf("delta=%d\n", delta);
- strength="unbekannt ";
+#endif
+ strength=gettext("unbekannt ");
}
level=0;
if (navmode) {
if (old->length < 20) {
level=1;
- sprintf(command,"Jetzt ");
+ sprintf(command,gettext("Jetzt "));
} else if (old->length <= 200) {
level=2;
get_distance(dist, old->length);
- sprintf(command,"In %sn ", dist);
+ sprintf(command,gettext("In %sn "), dist);
} else if (old->length <= 500) {
level=3;
- sprintf(command,"In Kürze ");
+ sprintf(command,gettext("In Kürze "));
} else {
level=4;
get_distance(dist, old->length);
- sprintf(command,"Dem Strassenverlauf %s folgen", dist);
+ sprintf(command,gettext("Dem Strassenverlauf %s folgen"), dist);
add_dir=0;
}
} else {
- sprintf(command,"Dem Strassenverlauf %d Meter folgen, dann ", old->length);
+ sprintf(command,gettext("Dem Strassenverlauf %d Meter folgen, dann "), old->length);
add_dir=1;
}
if (add_dir) {
- p=command+strlen(command);
+/* p=command+strlen(command);
strcpy(p,strength);
p+=strlen(p);
strcpy(p,dir);
p+=strlen(p);
- strcpy(p," abbiegen");
+ strcpy(p,gettext(" abbiegen"));*/
+ sprintf(command,gettext(" %s %s abbiegen"),strength,dir);
+ p=command+strlen(command);
}
param_list[10].value=command;
if (flag) {
+ sprintf(roadname,"%s %s",old->name1,old->name2);
+ osd_set_next_command(command,roadname);
if (level != old_level) {
printf("command='%s'\n", command);
if (speech_handle)
--- /dev/null
+//#include <math.h>
+#include <stdio.h>
+#include <glib.h>
+#include "point.h"
+//#include "coord.h"
+#include "graphics.h"
+//#include "transform.h"
+//#include "route.h"
+#include "vehicle.h"
+#include "container.h"
+#include "osd.h"
+
+struct osd {
+ struct graphics *gr;
+ struct graphics_gc *bg;
+ struct graphics_gc *white;
+ struct graphics_gc *green;
+ struct graphics_font *font;
+
+ char command[256];
+ char road_name[256];
+};
+
+void
+osd_set_next_command(char *new_command,char *new_road){
+ extern struct container *co;
+ struct osd *this=co->osd;
+ strcpy(this->command,new_command);
+ strcpy(this->road_name,new_road);
+ osd_draw(this, co);
+}
+
+void
+osd_draw(struct osd *osd, struct container *co)
+{
+ double *speed;
+ struct point p;
+
+ if (! co->vehicle)
+ return;
+
+ speed=vehicle_speed_get(co->vehicle);
+ osd->gr->draw_mode(osd->gr, draw_mode_begin);
+ p.x=0;
+ p.y=0;
+ osd->gr->draw_rectangle(osd->gr, osd->bg, &p, 360, 80);
+ p.x=10;
+ p.y=20;
+// osd->gr->draw_text(osd->gr, osd->green, NULL, osd->font, osd->command, &p, 0x13000, 0);
+ char osd_data[256];
+ sprintf(osd_data,"%.1f km/h",(*speed));
+ osd->gr->draw_text(osd->gr, osd->green, NULL, osd->font, osd_data, &p, 0x13000, 0);
+ p.x=10;
+ p.y=40;
+ osd->gr->draw_text(osd->gr, osd->green, NULL, osd->font, osd->command, &p, 0x13000, 0);
+// osd->gr->draw_text(osd->gr, osd->green, NULL, osd->font, "Overlay", &p, 0x10000, 0);
+// printf("Text %s should appear\n",osd->command);
+ osd->gr->draw_mode(osd->gr, draw_mode_end);
+}
+
+
+struct osd *
+osd_new(struct container *co)
+{
+ printf("Spawning an OSD\n");
+ struct osd *this=g_new0(struct osd, 1);
+ struct point p;
+ p.x=100;
+ p.y=10;
+ this->gr=co->gra->overlay_new(co->gra, &p, 360, 80);
+ this->bg=this->gr->gc_new(this->gr);
+ this->gr->gc_set_foreground(this->bg, 0, 0, 0);
+ this->white=this->gr->gc_new(this->gr);
+ this->gr->gc_set_foreground(this->white, 0xffff, 0xffff, 0xffff);
+ this->gr->gc_set_linewidth(this->white, 10);
+ this->green=this->gr->gc_new(this->gr);
+ this->gr->gc_set_foreground(this->green, 0x0, 0xffff, 0x0);
+ this->gr->gc_set_linewidth(this->green, 10);
+
+ this->font=this->gr->font_new(this->gr, 200);
+ osd_draw(this, co);
+ return this;
+}
--- /dev/null
+struct osd * osd_new(struct container *co);
+void osd_draw(struct osd *comp, struct container *co);
gettimeofday(&curr, NULL);
msec=(curr.tv_usec-last.tv_usec)/1000+
(curr.tv_sec-last.tv_sec)*1000;
- if (msec >= 100)
+ if (msec >= 100) {
printf("%s:%d msec\n", where, msec);
- else {
+ } else {
usec=(curr.tv_usec-last.tv_usec)+(curr.tv_sec-last.tv_sec)*1000*1000;
printf("%s:%d usec\n", where, usec);
}
-
}
gettimeofday(&last, NULL);
}
track_free_lines(struct track *tr)
{
struct track_line *tl=tr->lines,*next;
+#ifdef DEBUG
printf("track_free_lines(tr=%p)\n", tr);
-
+#endif
while (tl) {
next=tl->next;
if (! tl->linenum) {
tr->curr[1]=tm->c[1];
tr->last_out=tm->lpnt;
- printf("pos 0x%lx,0x%lx value %d dist %d angle %d vs %d (%d)\n", c->x, c->y, tm->value, dist, angle, tm->angle, track_angle_delta(angle, tm->angle, 0));
+ // printf("pos 0x%lx,0x%lx value %d dist %d angle %d vs %d (%d)\n", c->x, c->y, tm->value, dist, angle, tm->angle, track_angle_delta(angle, tm->angle, 0));
g_assert(dist < 10000);
#if 0
profile_timer("track_update end");