]> err.no Git - mapper/commitdiff
MapIntegration: A bit more work
authorKaj-Michael Lang <milang@tal.org>
Mon, 2 Jun 2008 15:07:07 +0000 (18:07 +0300)
committerKaj-Michael Lang <milang@tal.org>
Mon, 2 Jun 2008 15:07:07 +0000 (18:07 +0300)
do-configure.sh
src/cb.c
src/map-download.c
src/path.c
src/path.h
src/route.c

index 7a28416f45fee3a9153d522d53dc78a2af66ad57..80d6675046178b431590236e73da6d915f7cdc7f 100755 (executable)
@@ -11,7 +11,7 @@ case "$1" in
        ./configure --prefix=/usr --sysconfdir=/etc \
                --enable-maintainer-mode --enable-debug \
                --enable-gpsd --enable-gst --enable-hal \
-               --enable-btdbus \
+               --enable-btdbus --enable-gtk-doc \
                --enable-cairo --enable-opengl
  ;;
  hildon)
index 57979e7935c90407caad70614192ed71347561f4..afe97fbaa68c7404061a1bb379444132ccab357d 100644 (file)
--- a/src/cb.c
+++ b/src/cb.c
@@ -109,14 +109,14 @@ return TRUE;
 gboolean 
 menu_cb_route_distnext(GtkAction *action)
 {
-route_show_distance_to_next(_route);
+path_show_distance_to_next(_route);
 return TRUE;
 }
 
 gboolean 
 menu_cb_route_distlast(GtkAction *action)
 {
-route_show_distance_to_last(_route);
+path_show_distance_to_last(_route);
 return TRUE;
 }
 
@@ -125,7 +125,6 @@ menu_cb_route_reset(GtkAction *action)
 {
 path_find_nearest_point(_route);
 gtk_map_refresh(_map);
-MACRO_QUEUE_DRAW_AREA();
 return TRUE;
 }
 
@@ -169,7 +168,7 @@ return TRUE;
 gboolean 
 menu_cb_track_insert_mark(GtkAction *action)
 {
-if (track_insert_mark(_track)) {
+if (path_insert_mark(_track)) {
        path_tree_view_update_store(track_tree_view, _track);
 }
 return TRUE;
@@ -178,21 +177,21 @@ return TRUE;
 gboolean 
 menu_cb_track_distlast(GtkAction *action)
 {
-track_show_distance_from_last(_track);
+path_show_distance_from_last(_track);
 return TRUE;
 }
 
 gboolean 
 menu_cb_track_distfirst(GtkAction *action)
 {
-track_show_distance_from_first(_track);
+path_show_distance_from_first(_track);
 return TRUE;
 }
 
 gboolean 
 menu_cb_track_clear(GtkAction *action)
 {
-track_clear(_track);
+path_clear(_track);
 path_tree_view_update_store(track_tree_view, _track);
 return TRUE;
 }
@@ -471,7 +470,7 @@ if ((_enable_gps = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))) {
        if (_gps->io.conn > RCVR_OFF)
                gps_conn_set_state(_gps, RCVR_OFF);
        gps_disconnect(_gps);
-       track_add(_track, NULL);
+       path_add_break(_track);
        _speed_excess=FALSE;
 }
 if (_enable_gps==FALSE)
@@ -708,19 +707,19 @@ switch (_action[custom_key]) {
                }
        break;
        case CUSTOM_ACTION_ROUTE_DISTNEXT:
-               route_show_distance_to_next(_route);
+               path_show_distance_to_next(_route);
        break;
        case CUSTOM_ACTION_ROUTE_DISTLAST:
-               route_show_distance_to_last(_route);
+               path_show_distance_to_last(_route);
        break;
        case CUSTOM_ACTION_TRACK_BREAK:
                path_insert_break(_track);
        break;
        case CUSTOM_ACTION_TRACK_DISTLAST:
-               track_show_distance_from_last(_track);
+               path_show_distance_from_last(_track);
        break;
        case CUSTOM_ACTION_TRACK_DISTFIRST:
-               track_show_distance_from_first(_track);
+               path_show_distance_from_first(_track);
        break;
        case CUSTOM_ACTION_TOGGLE_GPS:
                set_action_activate("gps_enable", !_enable_gps);
index fd6b66e3017cc67effb15dd893d4fa39b8b751de..2f07badd833e5fd337b7842cb895d1d7f78ffe22 100644 (file)
@@ -133,8 +133,7 @@ while (_curl_multi && (msg = curl_multi_info_read(_curl_multi, &num_msgs))) {
                        /* Now, parse the autoroute and update the display. */
                        if (_autoroute_data.enabled && gpx_parse(&_route, _autoroute_data.rdl_data.bytes, _autoroute_data.rdl_data.bytes_read, 0)) {
                                /* Find the nearest route point, if we're connected. */
-                               route_find_nearest_point(_route);
-                               map_force_redraw();
+                               path_find_nearest_point(_route);
                        }
                        route_cancel_autoroute(_route, TRUE);   /* We're done. Clean up. */
                } else {
index 8c1567acfcd7d0a0b79dfcd4b2eebfbefec14ded..06a5221c1e5ea64b3f18b34c5e23bcfffae5b234 100644 (file)
@@ -206,6 +206,9 @@ if (path->whead + wsize != path->wcap) {
 return FALSE;
 }
 
+/**
+ * Append a waypoint to path at given lat, lon with description desc
+ */
 gboolean
 path_add_waypoint(Path *path, gdouble lat, gdouble lon, gchar *desc)
 {
@@ -213,20 +216,27 @@ guint unitx, unity;
 
 latlon2unit(lat, lon, unitx, unity);
 MACRO_PATH_INCREMENT_TAIL(*path);
-path->tail->unitx = unitx;
-path->tail->unity = unity;
-path->tail->time = 0;
-path->tail->altitude = NAN;
+path->tail->unitx=unitx;
+path->tail->unity=unity;
+path->tail->time=0;
+path->tail->altitude=NAN;
 
 MACRO_PATH_INCREMENT_WTAIL(*path);
-path->wtail->point = path->tail;
-path->wtail->desc = desc;
+path->wtail->point=path->tail;
+path->wtail->desc=desc;
 
 path_find_nearest_point(path);
 
+g_signal_emit(G_OBJECT(path), signals[NEW_WAYPOINT], 0, NULL);
+
 return TRUE;
 }
 
+/**
+ * Append a path point to path
+ *
+ * Returns: TRUE if the new point was added. FALSE is returned if new point distance was under sensitivity setting.
+ */
 gboolean
 path_add_point(Path *path, GpsData *gps)
 {
@@ -235,8 +245,7 @@ guint unitx, unity;
 g_return_val_if_fail(path, FALSE);
 
 if (!gps) {
-       MACRO_PATH_INCREMENT_TAIL(*path);
-       *path->tail=_point_null;
+       path_add_break(path);
        return FALSE;
 }
 
@@ -261,13 +270,14 @@ if (abs((gint)unitx-path->tail->unitx) > path->sensitivity || abs((gint)unity-pa
        g_debug("TRACK: %f %f (%d)", path->length, path->avgspeed, path->points);
 
        g_signal_emit(G_OBJECT(path), signals[NEW_POINT], 0, NULL);
+       return TRUE;
 }
 
-return TRUE;
+return FALSE;
 }
 
 gboolean 
-path_insert_break(Path *path)
+path_add_break(Path *path)
 {
 g_return_val_if_fail(path, FALSE);
 g_return_val_if_fail(path->tail, FALSE);
index b0c5ff2fcffa29ac475a03c6c4d93077c0a60307..d21200911a639fa7f7e0bd932dcfc4dfd87dbf41 100644 (file)
@@ -169,7 +169,7 @@ gdouble path_get_distance_to(Path *path, Point *point, gdouble lat, gdouble lon)
 void path_find_nearest_point(Path *path);
 gboolean path_update_nears(Path *route, Point *point, gboolean quick);
 
-gboolean path_insert_break(Path *path);
+gboolean path_add_break(Path *path);
 void path_insert_mark_text(Path *path, gchar *text);
 void path_insert_mark_autonumber(Path *path);
 void path_insert_mark_audio(Path *path, gchar *audio);
index 53470245301aca27f49ff835cfb18b02dc9db2b6..d5d9ac228ba500f42ed75269711cdf77078924be 100644 (file)
@@ -64,7 +64,7 @@ if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) {
        route_cancel_autoroute(route, FALSE);
        announced_waypoint=NULL;
        path_clear(route);
-       route_find_nearest_point(route);
+       path_find_nearest_point(route);
        r=TRUE;
 }
 
@@ -129,7 +129,7 @@ if (file_open_get_contents(&_route_dir_uri, &buffer, &size)) {
 
                MACRO_BANNER_SHOW_INFO(_window, _("Route Opened"));
                /* Find the nearest route point, if we're connected. */
-               route_find_nearest_point(route);
+               path_find_nearest_point(route);
                route_set_destination_from_last(route, &_dest);
                return TRUE;
        } else {
@@ -445,7 +445,7 @@ while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
                GtkTreeIter iter;
 
                /* Find the nearest route point, if we're connected. */
-               route_find_nearest_point(route);
+               path_find_nearest_point(route);
 
                /* Cancel any autoroute that might be occurring. */
                route_cancel_autoroute(route, FALSE);