#include "config.h"
-#define _GNU_SOURCE
-
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "ui-common.h"
#include "speak.h"
-gchar *SPEED_LOCATION_TEXT[SPEED_LOCATION_ENUM_COUNT];
-
static gboolean
speed_excess(void)
{
return TRUE;
}
-void
-speed_limit(void)
-{
-GdkGC *gc;
-gfloat cur_speed;
-gchar *buffer;
-static guint x = 0, y = 0, width = 0, height = 0;
-
-cur_speed = _gps.speed * UNITS_CONVERT[_units];
-
-if (cur_speed > _speed_limit) {
- gc = _speed_limit_gc1;
- if (!_speed_excess) {
- _speed_excess = TRUE;
- g_timeout_add(5000, (GSourceFunc) speed_excess, NULL);
- }
-} else {
- gc = _speed_limit_gc2;
- _speed_excess = FALSE;
-}
-buffer = g_strdup_printf("%0.0f", cur_speed);
-pango_layout_set_text(_speed_limit_layout, buffer, -1);
-pango_layout_get_pixel_size(_speed_limit_layout, &width, &height);
-
-gtk_widget_queue_draw_area(_map_widget, x - 5, y - 5, width * 3 + 15, height + 5);
-gdk_window_process_all_updates();
-
-switch (_speed_location) {
- case SPEED_LOCATION_TOP_RIGHT:
- x = _map_widget->allocation.width - 10 - width;
- y = 5;
- break;
- case SPEED_LOCATION_BOTTOM_RIGHT:
- x = _map_widget->allocation.width - 10 - width;
- y = _map_widget->allocation.height - 10 - height;
- break;
- case SPEED_LOCATION_BOTTOM_LEFT:
- x = 10;
- y = _map_widget->allocation.height - 10 - height;
- break;
- default:
- x = 10;
- y = 10;
- break;
-}
-
-gdk_draw_layout(_map_widget->window, gc, x, y, _speed_limit_layout);
-g_free(buffer);
-}