]> err.no Git - mapper/commitdiff
Don't use negative heading. Speak distance information only if we are centered on...
authorKaj-Michael Lang <milang@tal.org>
Sat, 3 Nov 2007 15:06:37 +0000 (17:06 +0200)
committerKaj-Michael Lang <milang@tal.org>
Sat, 3 Nov 2007 15:06:37 +0000 (17:06 +0200)
src/map.c

index d027167bd90b521c06164241624ff0691407800e..2b1bfb4517af267b823278c5c763faf644364efc 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -1035,14 +1035,17 @@ gchar buffer[64];
 if (_dest.valid) {
        dt=calculate_distance(lat, lon, _dest.lat, _dest.lon);
        dh=calculate_course(lat, lon, _dest.lat, _dest.lon);
-       snprintf(buffer, sizeof(buffer), "%.02f %s (%0.02f)", dt * UNITS_CONVERT[_units], UNITS_TEXT[_units], dh);
+       snprintf(buffer, sizeof(buffer), "%.02f %s (%0.02f)", dt * UNITS_CONVERT[_units], UNITS_TEXT[_units], dh<0 ? 360+dh : dh);
        gtk_label_set_label(GTK_LABEL(info_banner.distance), buffer);
        if (dt<0.005 && dest_reached==FALSE) {
-               speak_text("You have reached your destination.");
+               if (_center_mode>0)
+                       speak_text("You have reached your destination.");
                dest_reached=TRUE;
        } else if (dt<prev_dt-KM10KNOTS) {
-               snprintf(buffer, sizeof(buffer), "Distance to destination: %.02f %s", dt * UNITS_CONVERT[_units], UNITS_TEXT[_units]);
-               speak_text(buffer);
+               if (_center_mode>0) {
+                       snprintf(buffer, sizeof(buffer), "Distance to destination: %.02f %s", dt * UNITS_CONVERT[_units], UNITS_TEXT[_units]);
+                       speak_text(buffer);
+               }
                prev_dt=dt;
        } else if (dt>prev_dt+KM10KNOTS/4) {
                prev_dt=dt;
@@ -1137,6 +1140,7 @@ press[0] = x;
 press[1] = y;
 before[0] = press[0];
 before[1] = press[1];
+_center_mode=CENTER_MANUAL;
 map_drag_id=g_signal_connect(G_OBJECT(_map_widget), "motion_notify_event", G_CALLBACK(map_follow_move_cb), NULL);
 }