2 * This file is part of mapper
4 * Copyright (C) 2007 Kaj-Michael Lang
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 /* Handle speach and graphical announcements */
25 #include <glib/gstdio.h>
26 #include <glib/gi18n.h>
30 #include "ui-common.h"
33 #include "announcements.h"
36 static gboolean enable_speach=TRUE;
37 static gboolean enable_gui=TRUE;
39 #define SPEAK(s) { if (enable_speach) speak_text(s); }
42 announce_distance_to_destination(gdouble distance, gchar *unit, gdouble climit)
45 if (distance>climit) {
46 g_snprintf(buffer, sizeof(buffer), _("Distance to destination: %.01f %s"), distance, unit);
48 g_snprintf(buffer, sizeof(buffer), _("Distance to destination: %.02f %s"), distance, unit);
51 MACRO_BANNER_SHOW_INFO(_window, buffer);
55 announce_destination_reached(void)
57 gchar *msg=_("You have reached your destination.");
59 MACRO_BANNER_SHOW_INFO(_window, msg);
63 announce_over_speed_limit(guint limit)
65 gchar *msg=_("Warning, you are over speed limit!");
67 MACRO_BANNER_SHOW_INFO(_window, msg);
73 announce_continue(gchar *to_name, gchar *to_ref)
80 announce_turn(gdouble direction, gchar *to_name, gchar *to_ref, gdouble next_wpt_dist, gchar unit)
85 turn=(direction > 0) ? _("left") : _("right");
86 /* amount=(fabs(direction)<25) ? */
87 g_snprintf(buffer, sizeof(buffer), "Turn %s to %s, %s. Continue on %s ",
89 to_name ? to_name : "",
91 to_ref ? to_ref : to_name ? );