]> err.no Git - mapper/commitdiff
Misc adjustments
authorKaj-Michael Lang <milang@tal.org>
Wed, 11 Jun 2008 14:09:53 +0000 (17:09 +0300)
committerKaj-Michael Lang <milang@tal.org>
Wed, 11 Jun 2008 14:09:53 +0000 (17:09 +0300)
14 files changed:
src/config-gconf.c
src/gps-bluetooth-bluez-dbus.c
src/gps.h
src/gpx.c [deleted file]
src/gpx.h [deleted file]
src/map-download.c
src/mapper.c
src/poi-gui.c
src/poi.c
src/route.c
src/settings-gui.c
src/track.c
src/ui-common.h
src/utils.h

index 28dd16ce3abbfc8d4bfd326d9c2e5fa556977374..5739f9f15327ab33d2fde88c9bbff8bf8b529446 100644 (file)
 #include "utils.h"
 #include "mapper-types.h"
 #include "latlon.h"
-#include "map.h"
 #include "route.h"
 #include "db.h"
 #include "poi.h"
 #include "gps.h"
 #include "ui-common.h"
 #include "settings.h"
-#include "gpx.h"
 #include "filter.h"
 #include "dialogs.h"
 #include "map-tile-repo.h"
@@ -294,7 +292,6 @@ gconf_client_set_float(gconf_client, GCONF_KEY_LAT, _gps->data.lat, NULL);
 gconf_client_set_float(gconf_client, GCONF_KEY_LON, _gps->data.lon, NULL);
 
 /* Save last center latitude/longitude. */
-unit2latlon(_center.unitx, _center.unity, center_lat, center_lon);
 gconf_client_set_float(gconf_client, GCONF_KEY_CENTER_LAT, center_lat, NULL);
 gconf_client_set_float(gconf_client, GCONF_KEY_CENTER_LON, center_lon, NULL);
 
@@ -392,7 +389,7 @@ GConfValue *value;
 gchar *config_dir;
 gchar *str;
 gint i;
-CenterMode _center_mode = CENTER_LEAD;
+GtkMapCenterMode _center_mode = CENTER_LEAD;
 UnitType _units = UNITS_KM;
 guint _degformat = DDPDDDDD;
 InfoFontSize _info_font_size = INFO_FONT_MEDIUM;
@@ -540,8 +537,6 @@ config_load_position(_dest, GCONF_KEY_POSITION_DEST);
        } else {
                center_lon = _gps->data.lon;
        }
-
-       latlon2unit(center_lat, center_lon, _center.unitx, _center.unity);
 }
 
 config_load_repo();
@@ -549,13 +544,12 @@ config_load_repo();
 /* Get last Zoom Level.  Default is 12. */
 value = gconf_client_get(gconf_client, GCONF_KEY_ZOOM, NULL);
 if (value) {
-       _zoom = gconf_value_get_int(value) / _curr_repo->view_zoom_steps * _curr_repo->view_zoom_steps;
+       _zoom=gconf_value_get_int(value) / _curr_repo->view_zoom_steps * _curr_repo->view_zoom_steps;
        gconf_value_free(value);
 } else {
-       _zoom = 12 / _curr_repo->view_zoom_steps * _curr_repo->view_zoom_steps;
+       _zoom=12 / _curr_repo->view_zoom_steps * _curr_repo->view_zoom_steps;
 }
-BOUND(_zoom, 0, MAX_ZOOM - 1);
-_world_size_tiles = unit2tile(WORLD_SIZE_UNITS);
+BOUND(_zoom, 0, 20);
 
 /* Get Route Directory.  Default is NULL. */
 _route_dir_uri = gconf_client_get_string(gconf_client, GCONF_KEY_ROUTEDIR, NULL);
index 0ac413e180228bad326d07259f0f2a1ea4c37d12..7762eaee7c40825fcafcdae04b5b2b7016380e11 100644 (file)
@@ -35,7 +35,6 @@
 #include "gps-bluetooth-bluez-marshal.h"
 #include "gps.h"
 #include "settings.h"
-#include "ui-common.h"
 #include "gps-conn.h"
 
 /**
index 0b01186669f45b33beb941963dfe73e954cf2943..dc1ee384bcf0fb8d80142e7b8527f72949a2a302 100644 (file)
--- a/src/gps.h
+++ b/src/gps.h
@@ -28,7 +28,6 @@
 #include <bluetooth/rfcomm.h>
 #endif
 
-#include "path.h"
 #include "utils.h"
 #include "mapper-types.h"
 #include "gpsdata.h"
diff --git a/src/gpx.c b/src/gpx.c
deleted file mode 100644 (file)
index d42b2a9..0000000
--- a/src/gpx.c
+++ /dev/null
@@ -1,602 +0,0 @@
-/*
- * This file is part of mapper
- *
- * Copyright (C) 2006-2007 John Costigan.
- *
- * POI and GPS-Info code originally written by Cezary Jackiewicz.
- *
- * Default map data provided by http://www.openstreetmap.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-#include <stddef.h>
-#include <locale.h>
-#include <math.h>
-#include <errno.h>
-#include <sys/wait.h>
-#include <glib/gstdio.h>
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <fcntl.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <curl/multi.h>
-#include <gconf/gconf-client.h>
-#include <libxml/parser.h>
-
-#include <libintl.h>
-#include <locale.h>
-
-#include <sqlite3.h>
-
-#include "ui-common.h"
-#include "path.h"
-#include "utils.h"
-#include "mapper-types.h"
-#include "latlon.h"
-#include "gpx.h"
-#include "dialogs.h"
-#include "gtkmap.h"
-
-#define XML_DATE_FORMAT "%FT%T"
-
-#define WRITE_STRING(string) { \
-    GnomeVFSResult vfs_result; \
-    GnomeVFSFileSize size; \
-    if(GNOME_VFS_OK != (vfs_result = gnome_vfs_write(handle, (string), strlen((string)), &size))) \
-    { \
-        gchar buffer[BUFFER_SIZE]; \
-        g_snprintf(buffer, sizeof(buffer), \
-                "%s:\n%s\n%s", _("Error while writing to file"), _("File is incomplete."), \
-                gnome_vfs_result_to_string(vfs_result)); \
-        popup_error(_window, buffer); \
-        return FALSE; \
-    } \
-}
-
-/** This enum defines the states of the SAX parsing state machine. */
-typedef enum {
-       START=1,
-       INSIDE_GPX=100,
-       INSIDE_METADATA,
-       INSIDE_PATH,
-       INSIDE_PATH_SEGMENT,
-       INSIDE_PATH_POINT,
-       INSIDE_PATH_POINT_ELE,
-       INSIDE_PATH_POINT_TIME,
-       INSIDE_PATH_POINT_DESC,
-       INSIDE_PATH_POINT_NAME,
-       FINISH=5000,
-       UNKNOWN=6666,
-       ERROR=9999,
-} SaxState;
-
-/** Data used during the SAX parsing operation. */
-typedef struct _SaxData SaxData;
-struct _SaxData {
-       Path path;
-       SaxState state;
-       SaxState prev_state;
-       guint unknown_depth;
-       gboolean at_least_one_trkpt;
-       GString *chars;
-};
-
-static gchar XML_TZONE[7];
-
-void 
-gpx_init(void)
-{
-time_t time1;
-struct tm time2;
-time1 = time(NULL);
-localtime_r(&time1, &time2);
-g_snprintf(XML_TZONE, sizeof(XML_TZONE), "%+03ld:%02ld", (time2.tm_gmtoff / 60 / 60), (time2.tm_gmtoff / 60) % 60);
-}
-
-gboolean 
-gpx_write(Path *path, GnomeVFSHandle *handle)
-{
-Point *curr = NULL;
-WayPoint *wcurr = NULL;
-gboolean trkseg_break = FALSE;
-gchar buffer[80];
-time_t gpx_time;
-gpx_time = time(NULL);
-
-/* Find first non-zero point. */
-for (curr = path->head - 1, wcurr = path->whead; curr++ != path->tail;) {
-       if (curr->unity)
-               break;
-       else if (wcurr && curr == wcurr->point)
-               wcurr++;
-}
-
-/* Write the header. */
-WRITE_STRING("<?xml version=\"1.0\"?>\n"
-       "<gpx version=\"1.0\" creator=\"mapper\" xmlns=\"http://www.topografix.com/GPX/1/0\">\n");
-
-/* Write any metadata */
-WRITE_STRING("<metadata>\n");
-
-WRITE_STRING("<time>");
-strftime(buffer, sizeof(buffer), XML_DATE_FORMAT, localtime(&gpx_time));
-WRITE_STRING(buffer);
-WRITE_STRING(XML_TZONE);
-WRITE_STRING("</time>\n");
-
-WRITE_STRING("</metadata>\n");
-
-/* Write track(s) and waypoint(s) */
-WRITE_STRING("<trk>\n<trkseg>\n");
-
-/* Curr points to first non-zero point. */
-for (curr--; curr++ != path->tail;) {
-       gdouble lat, lon;
-       if (curr->unity) {
-               gboolean first_sub = TRUE;
-               if (trkseg_break) {
-                       /* First trkpt of the segment - write trkseg header. */
-                       WRITE_STRING("</trkseg>\n<trkseg>\n");
-                       trkseg_break = FALSE;
-               }
-               unit2latlon(curr->unitx, curr->unity, &lat, &lon);
-               WRITE_STRING("<trkpt lat=\"");
-               g_ascii_formatd(buffer, sizeof(buffer), "%.06f", lat);
-               WRITE_STRING(buffer);
-               WRITE_STRING("\" lon=\"");
-               g_ascii_formatd(buffer, sizeof(buffer), "%.06f", lon);
-               WRITE_STRING(buffer);
-               WRITE_STRING("\"");
-
-               /* write the elevation */
-               if (!isnan(curr->altitude)) {
-                       if (first_sub) {
-                               WRITE_STRING(">\n");
-                               first_sub = FALSE;
-                       }
-                       WRITE_STRING("<ele>");
-                       g_ascii_formatd(buffer, sizeof(buffer), "%.2f", curr->altitude);
-                       WRITE_STRING(buffer);
-                       WRITE_STRING("</ele>\n");
-               }
-
-               /* write the time */
-               if (curr->time) {
-                       if (first_sub) {
-                               WRITE_STRING(">\n");
-                               first_sub = FALSE;
-                       }
-                       WRITE_STRING("<time>");
-                       strftime(buffer, sizeof(buffer), XML_DATE_FORMAT, localtime(&curr->time));
-                       WRITE_STRING(buffer);
-                       WRITE_STRING(XML_TZONE);
-                       WRITE_STRING("</time>\n");
-               }
-
-               if (wcurr && curr == wcurr->point) {
-                       gchar *desc;
-                       if (first_sub) {
-                               WRITE_STRING(">\n");
-                               first_sub = FALSE;
-                       }
-                       if (wcurr->desc) {
-                               desc=g_markup_printf_escaped("<desc>%s</desc>\n", wcurr->desc);
-                               WRITE_STRING(desc);
-                               g_free(desc);
-                       }
-                       wcurr++;
-               }
-               if (first_sub) {
-                       WRITE_STRING("/>\n");
-               } else {
-                       WRITE_STRING("</trkpt>\n");
-               }
-       } else
-               trkseg_break = TRUE;
-}
-
-/* Write the footer. */
-WRITE_STRING("</trkseg>\n</trk>\n</gpx>\n");
-
-return TRUE;
-}
-
-/**
- * Handle a start tag in the parsing of a GPX file.
- */
-#define MACRO_SET_UNKNOWN(utag) { \
-    data->prev_state = data->state; \
-    data->state = UNKNOWN; \
-    data->unknown_depth = 1; \
-       g_debug("GPX: unknown tag [%s]", (gchar *)utag); }
-
-static void
-gpx_start_element(SaxData *data, const xmlChar *name, const xmlChar **attrs)
-{
-switch (data->state) {
-case ERROR:
-break;
-case START:
-       if (!strcmp((gchar *) name, "gpx"))
-               data->state = INSIDE_GPX;
-       else
-               MACRO_SET_UNKNOWN(name);
-break;
-case INSIDE_GPX:
-       if (!strcmp((gchar *) name, "trk"))
-               data->state = INSIDE_PATH;
-       else if (!strcmp((gchar *) name, "metadata"))
-               data->state = INSIDE_METADATA;
-       else
-               MACRO_SET_UNKNOWN(name);
-break;
-case INSIDE_METADATA:
-break;
-case INSIDE_PATH:
-       if (!strcmp((gchar *) name, "trkseg")) {
-               data->state = INSIDE_PATH_SEGMENT;
-               data->at_least_one_trkpt = FALSE;
-       } else
-               MACRO_SET_UNKNOWN(name);
-break;
-case INSIDE_PATH_SEGMENT:
-       if (!strcmp((gchar *) name, "trkpt")) {
-               const xmlChar **curr_attr;
-               gchar *error_check;
-               gdouble lat = 0.f, lon = 0.f;
-               gboolean has_lat, has_lon;
-               has_lat = FALSE;
-               has_lon = FALSE;
-               for (curr_attr = attrs; *curr_attr != NULL;) {
-                       const gchar *attr_name = *curr_attr++;
-                       const gchar *attr_val = *curr_attr++;
-                       if (!strcmp(attr_name, "lat")) {
-                               lat = g_ascii_strtod(attr_val, &error_check);
-                               if (error_check != attr_val)
-                                       has_lat = TRUE;
-                       } else if (!strcmp(attr_name, "lon")) {
-                               lon = g_ascii_strtod(attr_val, &error_check);
-                               if (error_check != attr_val)
-                                       has_lon = TRUE;
-                       }
-               }
-               if (has_lat && has_lon) {
-                       MACRO_PATH_INCREMENT_TAIL(data->path);
-                       latlon2unit(lat, lon, &data->path.tail->unitx, &data->path.tail->unity);
-                       data->path.tail->time = 0;
-                       data->path.tail->altitude = NAN;
-                       data->state = INSIDE_PATH_POINT;
-               } else
-                       data->state = ERROR;
-       } else
-               MACRO_SET_UNKNOWN(name);
-break;
-case INSIDE_PATH_POINT:
-       if (!strcmp((gchar *) name, "time"))
-               data->state = INSIDE_PATH_POINT_TIME;
-       else if (!strcmp((gchar *) name, "ele"))
-               data->state = INSIDE_PATH_POINT_ELE;
-       else if (!strcmp((gchar *) name, "desc"))
-               data->state = INSIDE_PATH_POINT_DESC;
-       else if (!strcmp((gchar *) name, "name"))
-               data->state = INSIDE_PATH_POINT_NAME;
-       else
-               MACRO_SET_UNKNOWN(name);
-break;
-case UNKNOWN:
-       data->unknown_depth++;
-break;
-default: ;
-}
-
-}
-
-/**
- * Handle an end tag in the parsing of a GPX file.
- */
-static void 
-gpx_end_element(SaxData * data, const xmlChar * name)
-{
-switch (data->state) {
-case ERROR:
-
-break;
-case START:
-       data->state = ERROR;
-break;
-case INSIDE_GPX:
-       if (!strcmp((gchar *) name, "gpx"))
-               data->state = FINISH;
-       else
-               data->state = ERROR;
-break;
-case INSIDE_METADATA:
-       if (!strcmp((gchar *) name, "metadata"))
-               data->state = INSIDE_GPX;
-break;
-case INSIDE_PATH:
-       if (!strcmp((gchar *) name, "trk"))
-               data->state = INSIDE_GPX;
-       else
-               data->state = ERROR;
-break;
-case INSIDE_PATH_SEGMENT:
-       if (!strcmp((gchar *) name, "trkseg")) {
-               if (data->at_least_one_trkpt) {
-                       MACRO_PATH_INCREMENT_TAIL(data->path);
-                       *data->path.tail = _point_null;
-               }
-               data->state = INSIDE_PATH;
-       } else
-               data->state = ERROR;
-break;
-case INSIDE_PATH_POINT:
-       if (!strcmp((gchar *) name, "trkpt")) {
-               data->state = INSIDE_PATH_SEGMENT;
-               data->at_least_one_trkpt = TRUE;
-       } else
-               data->state = ERROR;
-break;
-case INSIDE_PATH_POINT_ELE:
-       if (!strcmp((gchar *) name, "ele")) {
-               gchar *error_check;
-               data->path.tail->altitude = g_ascii_strtod(data->chars->str, &error_check);
-               if (error_check == data->chars->str)
-                       data->path.tail->altitude = NAN;
-               data->state = INSIDE_PATH_POINT;
-               g_string_free(data->chars, TRUE);
-               data->chars = g_string_new("");
-       } else
-               data->state = ERROR;
-break;
-case INSIDE_PATH_POINT_TIME:
-       if (!strcmp((gchar *) name, "time")) {
-               struct tm time;
-               gchar *ptr;
-
-               if (NULL == (ptr = strptime(data->chars->str, XML_DATE_FORMAT, &time)))
-                       /* Failed to parse dateTime format. */
-                       data->state = ERROR;
-               else {
-                       /* Parse was successful. Now we have to parse timezone.
-                        * From here on, if there is an error, I just assume local
-                        * timezone.  Yes, this is not proper XML, but I don't
-                        * care. */
-                       gchar *error_check;
-
-                       /* First, set time in "local" time zone. */
-                       data->path.tail->time = (mktime(&time));
-
-                       /* Now, skip inconsequential characters */
-                       while (*ptr && *ptr != 'Z' && *ptr != '-' && *ptr != '+')
-                               ptr++;
-
-                       /* Check if we ran to the end of the string. */
-                       if (*ptr) {
-                               /* Next character is either 'Z', '-', or '+' */
-                               if (*ptr == 'Z')
-                                       /* Zulu (UTC) time. Undo the local time zone's offset. */
-                                       data->path.tail->time += time.tm_gmtoff;
-                               else {
-                                       /* Not Zulu (UTC). Must parse hours and minutes. */
-                                       gint offhours = strtol(ptr, &error_check, 10);
-                                       if (error_check != ptr && *(ptr = error_check) == ':') {
-                                               /* Parse of hours worked. Check minutes. */
-                                               gint offmins = strtol(ptr + 1, &error_check, 10);
-                                               if (error_check != (ptr + 1)) {
-                                                       /* Parse of minutes worked. Calculate. */
-                                                       data->path.tail->time += (time.tm_gmtoff - (offhours * 60 * 60 + offmins * 60));
-                                               }
-                                       }
-                               }
-                       }
-                       /* Successfully parsed dateTime. */
-                       data->state = INSIDE_PATH_POINT;
-               }
-
-               g_string_free(data->chars, TRUE);
-               data->chars = g_string_new("");
-       } else
-               data->state = ERROR;
-break;
-case INSIDE_PATH_POINT_DESC:
-       /* only parse description for routes */
-       if (!strcmp((gchar *) name, "desc")) {
-               MACRO_PATH_INCREMENT_WTAIL(data->path);
-               data->path.wtail->point = data->path.tail;
-               data->path.wtail->desc = g_string_free(data->chars, FALSE);
-               data->chars = g_string_new("");
-               data->state = INSIDE_PATH_POINT;
-       } else
-               data->state = ERROR;
-break;
-case INSIDE_PATH_POINT_NAME:
-               /* Just ignore these for now */
-               g_string_free(data->chars, FALSE);
-               data->chars = g_string_new("");
-               data->state = INSIDE_PATH_POINT;
-break;
-case UNKNOWN:
-       if (!--data->unknown_depth)
-               data->state = data->prev_state;
-       else
-               data->state = ERROR;
-break;
-default: ;
-}
-
-}
-
-/**
- * Handle char data in the parsing of a GPX file.
- */
-static void 
-gpx_chars(SaxData *data, const xmlChar *ch, int len)
-{
-guint i;
-
-switch (data->state) {
-case ERROR:
-case UNKNOWN:
-       break;
-case INSIDE_PATH_POINT_ELE:
-case INSIDE_PATH_POINT_TIME:
-case INSIDE_PATH_POINT_DESC:
-case INSIDE_PATH_POINT_NAME:
-       for (i = 0; i < len; i++)
-               data->chars = g_string_append_c(data->chars, ch[i]);
-       /* g_debug("GPXC: %s", data->chars->str); */
-       break;
-default:
-break;
-}
-
-}
-
-/**
- * Handle an entity in the parsing of a GPX file.  We don't do anything
- * special here.
- */
-static xmlEntityPtr 
-gpx_get_entity(SaxData *data, const xmlChar *name)
-{
-return xmlGetPredefinedEntity(name);
-}
-
-/**
- * Handle an error in the parsing of a GPX file.
- */
-static void 
-gpx_error(SaxData *data, const gchar *msg, ...)
-{
-va_list args;
-
-va_start(args, msg);
-g_logv("GPX", G_LOG_LEVEL_WARNING, msg, args);
-va_end(args);
-
-data->state = ERROR;
-}
-
-/**
- * Parse a buffer of GPX data.
- *
- * XXX: Add support for parsing directly from file if the file is local.
- *
- */
-gboolean
-gpx_parse(Path *path, gchar *buffer, gint size, gpx_path_policy policy)
-{
-SaxData data;
-xmlSAXHandler sax_handler;
-
-MACRO_PATH_INIT(data.path);
-data.state = START;
-data.chars = g_string_new("");
-
-memset(&sax_handler, 0, sizeof(sax_handler));
-sax_handler.characters = (charactersSAXFunc) gpx_chars;
-sax_handler.startElement = (startElementSAXFunc) gpx_start_element;
-sax_handler.endElement = (endElementSAXFunc) gpx_end_element;
-sax_handler.entityDecl = (entityDeclSAXFunc) gpx_get_entity;
-sax_handler.warning = (warningSAXFunc) gpx_error;
-sax_handler.error = (errorSAXFunc) gpx_error;
-sax_handler.fatalError = (fatalErrorSAXFunc) gpx_error;
-
-xmlSAXUserParseMemory(&sax_handler, &data, buffer, size);
-
-g_string_free(data.chars, TRUE);
-
-if (data.state != FINISH) {
-       g_warning("GPX: Parser stopped in error state %d", data.state);
-       return FALSE;
-}
-
-switch (policy) {
-case GPX_PATH_APPEND:
-case GPX_PATH_PREPEND:
-       {
-       Point *src_first;
-       Path *src, *dest;
-
-       if (policy==GPX_PATH_APPEND) {
-               /* Append to current path. Make sure last path point is zero. */
-               if (path->tail->unity != 0) {
-                       MACRO_PATH_INCREMENT_TAIL((*path));
-                       *path->tail = _point_null;
-               }
-               src = &data.path;
-               dest = path;
-       } else {
-               /* Prepend to current route. */
-               src = path;
-               dest = &data.path;
-       }
-
-       /* Find src_first non-zero point. */
-       for (src_first = src->head - 1; src_first++ != src->tail;)
-               if (src_first->unity)
-                       break;
-
-       /* Append route points from src to dest. */
-       if (src->tail >= src_first) {
-               WayPoint *curr;
-               guint num_dest_points = dest->tail - dest->head + 1;
-               guint num_src_points = src->tail - src_first + 1;
-
-               /* Adjust dest->tail to be able to fit src route data
-                * plus room for more route data. */
-               path_resize(dest, num_dest_points + num_src_points);
-
-               memcpy(dest->tail + 1, src_first, num_src_points * sizeof(Point));
-
-               dest->tail += num_src_points;
-
-               /* Append waypoints from src to dest->. */
-               path_wresize(dest, (dest->wtail - dest->whead) + (src->wtail - src->whead) + 2);
-               for (curr = src->whead - 1; curr++ != src->wtail;) {
-                       (++(dest->wtail))->point = dest->head + num_dest_points + (curr->point - src_first);
-                       dest->wtail->desc = curr->desc;
-               }
-       }
-
-       /* Kill old route - don't use MACRO_PATH_FREE(), because that
-        * would free the string desc's that we just moved to data.route. */
-       g_free(src->head);
-       g_free(src->whead);
-       if (policy==GPX_PATH_PREPEND)
-               (*path) = *dest;
-       }
-break;
-case GPX_PATH_NEW:
-       /* Overwrite with data.route. */
-       MACRO_PATH_FREE((*path));
-       (*path) = data.path;
-       path_resize(path, path->tail - path->head + 1);
-       path_wresize(path, path->wtail - path->whead + 1);
-break;
-default:
-       g_assert_not_reached();
-break;
-}
-
-return TRUE;
-}
diff --git a/src/gpx.h b/src/gpx.h
deleted file mode 100644 (file)
index d117b9d..0000000
--- a/src/gpx.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _GPX_H
-#define _GPX_H
-
-#include <glib.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include "path.h"
-
-typedef enum {
-       GPX_PATH_PREPEND=-1,
-       GPX_PATH_NEW=0,
-       GPX_PATH_APPEND=1,
-} gpx_path_policy;
-
-void gpx_init(void);
-gboolean gpx_write(Path *path, GnomeVFSHandle *handle);
-gboolean gpx_parse(Path *to_replace, gchar *buffer, gint size, gpx_path_policy policy);
-
-#endif
index 2f07badd833e5fd337b7842cb895d1d7f78ffe22..8601d0e7475674a1125b2aa89e4a8c017c0e391a 100644 (file)
@@ -53,7 +53,6 @@
 #include "ui-common.h"
 #include "settings.h"
 #include "latlon.h"
-#include "gpx.h"
 #include "map-download.h"
 #include "iap.h"
 #include "map-repo.h"
index c4a613cd0ccc79239569a6dea3b0aaa866e92117..51848933460ab0356a27b992e07b535ddb0f8e1d 100644 (file)
@@ -81,7 +81,6 @@
 #include "poi.h"
 #include "cb.h"
 #include "speak.h"
-#include "gpx.h"
 #include "config-gconf.h"
 #include "dialogs.h"
 
@@ -360,7 +359,6 @@ switch (mis) {
                _gps->update_info=gps_info_update;
 
                timezone_init();
-               gpx_init();
                variables_init();
                latlon_init();
                _track=path_new(PATH_TYPE_TRACK, 0);
index 6afe2d1d3a1764e5f3e36693382853e8ee182127..9b1686bd7af6a50519fa672c1733788bc29fd108 100644 (file)
@@ -520,7 +520,7 @@ if (!model)
 gtk_tree_model_get(model, &iter, ITEM_LAT, &lat, -1);
 gtk_tree_model_get(model, &iter, ITEM_LON, &lon, -1);
 
-gtk_map_set_center_latlon(_map, &lat, &lon);
+gtk_map_set_center_latlon(_map, lat, lon);
 
 return TRUE;
 }
index 7613ef04742e605a39c3d59c37e9c59ada97ab3d..2bb930ed3d6821aa1bbf1b1c41ccc6e17ed03205 100644 (file)
--- a/src/poi.c
+++ b/src/poi.c
@@ -20,7 +20,6 @@
 #include "utils.h"
 #include "poi.h"
 #include "gps.h"
-#include "map.h"
 #include "mapper-types.h"
 #include "settings.h"
 #include "db.h"
index ab15bbbb4f1fdfdf4be3df0cd2bc1e05b60a6ba3..6886f7aafe0a06962b201142545ee8162e543f55 100644 (file)
 #include "ui-common.h"
 #include "settings.h"
 #include "mapper-types.h"
-#include "map.h"
 #include "file.h"
 #include "latlon.h"
-#include "map.h"
 #include "map-download.h"
 #include "iap.h"
-#include "gpx.h"
 #include "help.h"
 
 #define DISTANCE_SQUARED(a, b) \
@@ -192,7 +189,7 @@ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle))) {
 
                p=path_find_last_point(oti->path);
                if (p) {
-                       unit2latlon(p->unitx, p->unity, lat, lon);
+                       unit2latlon(p->unitx, p->unity, &lat, &lon);
                        g_ascii_formatd(strlat, 32, "%.06f", lat);
                        g_ascii_formatd(strlon, 32, "%.06f", lon);
                        g_snprintf(buffer, sizeof(buffer), "%s, %s", strlat, strlon);
index 37ef52cb43581b95de1f04df4199ddab5b84bfd7..63ea3dc47d714ef496df7a5e48ae59d02b11bfca 100644 (file)
@@ -21,7 +21,6 @@
 #include "utils.h"
 #include "poi.h"
 #include "gps.h"
-#include "map.h"
 #include "mapper-types.h"
 #include "latlon.h"
 #include "ui-common.h"
@@ -61,17 +60,18 @@ struct _GpsDialogInfo {
 void 
 update_gcs(void)
 {
+#if 0
 gint i;
 
 for (i=0; i < COLORABLE_ENUM_COUNT; i++) {
-       gdk_color_alloc(gtk_widget_get_colormap(_map_widget),&_color[i]);
+       gdk_color_alloc(gtk_widget_get_colormap(_map_widget), &_color[i]);
        if (_gc[i])
                g_object_unref(_gc[i]);
-       _gc[i]=gdk_gc_new(map_pixmap_get());
+       _gc[i]=gdk_gc_new(gtk_map_pixmap_get());
        gdk_gc_set_foreground(_gc[i], &_color[i]);
        gdk_gc_set_line_attributes(_gc[i], _draw_width, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND);
 }
-
+#endif
 }
 
 static gboolean
@@ -678,7 +678,7 @@ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table=gtk_table_new(2, 3, FALSE
 gtk_table_attach(GTK_TABLE(table), label=gtk_label_new(_("Show POI below zoom")), 0, 1, 2, 3, GTK_FILL, 0, 2, 4);
 gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
 gtk_table_attach(GTK_TABLE(table), label=gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 2, 4);
-gtk_container_add(GTK_CONTAINER(label), num_poi_zoom=hildon_number_editor_new(0, MAX_ZOOM));
+gtk_container_add(GTK_CONTAINER(label), num_poi_zoom=hildon_number_editor_new(0, 7));
 
 /* Initialize fields. */
 hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(num_poi_zoom), _poi_zoom);
index b9c69c0cb3e49bcda736daa4df1569b53f707633..49d5abc33ecbaceb27caebbbb36121b2391cece8 100644 (file)
@@ -14,7 +14,6 @@
 #include "track.h"
 #include "latlon.h"
 #include "path.h"
-#include "gpx.h"
 
 /* Add sensitivity */
 static gint sensitivity=3;
index 4a0b55df98dd034a9db0286c2422a2a427387f23..7bf5a5e18383dd558424b053844bdf999b9e8dcd 100644 (file)
@@ -16,6 +16,7 @@
 #include <gtk/gtk.h>
 #include <fcntl.h>
 
+#include "gtkmap.h"
 #include "gps.h"
 #include "mapper-types.h"
 #include "ui-maemo.h"
@@ -127,6 +128,17 @@ Path *_track;
 
 AutoRouteDownloadData _autoroute_data;
 
+gint _show_tracks;
+gboolean _show_scale;
+gboolean _show_velvec;
+gboolean _show_poi;
+
+guint _lead_ratio;
+guint _center_ratio;
+guint _draw_width;
+gint _zoom;
+GtkMapCenterMode _center_mode;
+
 void mapper_ui_init(void);
 gboolean window_present();
 
index 53a647120964fcc6b4f1764ecbaa4ddca474bdd9..77d3914ba90e878defb26046302979e435fd43be 100644 (file)
@@ -37,7 +37,6 @@
 #include <curl/multi.h>
 #include <gconf/gconf-client.h>
 
-#include "path.h"
 #include "mapper-types.h"
 #include "gpsdata.h"