]> git.itanic.dy.fi Git - maemo-mapper/commitdiff
* Changed the "set_view_center" method name to "set_view_position" for
authorgnuite <gnuite@gmail.com>
Tue, 27 Nov 2007 02:10:14 +0000 (02:10 +0000)
committergnuite <gnuite@gmail.com>
Tue, 27 Nov 2007 02:10:14 +0000 (02:10 +0000)
    clarity.
  * Added two new signals to the DBUS interface: view_position_changed and
    view_dimensions_changed.
  * Fixed a bug in POI lat/lon handling (closes #1695).

git-svn-id: svn+ssh://garage/var/lib/gforge/svnroot/maemo-mapper/trunk@134 6c538b50-5814-0410-93ad-8bdf4c0149d1

13 files changed:
src/data.c
src/data.h
src/dbus-ifc.c
src/dbus-ifc.h
src/defines.h
src/display.c
src/display.h
src/gps.c
src/input.c
src/main.c
src/maps.c
src/path.c
src/poi.c

index 05bf6db98e785bcc32d38fb1d2281ca9099a1b77..aa34b8fe1c2670b8774eabe832758b024a7441a0 100644 (file)
@@ -121,10 +121,10 @@ GdkRectangle _redraw_wait_bounds = { 0, 0, 0, 0};
 
 
 /** CACHED SCREEN INFORMATION THAT IS DEPENDENT ON THE CURRENT VIEW. */
-gint _screen_width_pixels = 0;
-gint _screen_height_pixels = 0;
-gint _screen_halfwidth_pixels = 0;
-gint _screen_halfheight_pixels = 0;
+gint _view_width_pixels = 0;
+gint _view_height_pixels = 0;
+gint _view_halfwidth_pixels = 0;
+gint _view_halfheight_pixels = 0;
 
 /** The current track and route. */
 Path _track;
@@ -142,6 +142,7 @@ GtkWidget *_waypoint_banner = NULL;
 GtkWidget *_download_banner = NULL;
 
 /** DOWNLOAD PROGRESS. */
+gboolean _conic_is_connected = FALSE;
 GMutex *_mapdb_mutex = NULL;
 GMutex *_mouse_mutex = NULL;
 volatile gint _num_downloads = 0;
index 3659d37b02ee2f15915b82859f2c375933d8c1dd..92ffbcf4b378e6f1bd0f7501e920b033a1a2b3c8 100644 (file)
@@ -100,10 +100,10 @@ extern GdkRectangle _redraw_wait_bounds;
 
 
 /** CACHED SCREEN INFORMATION THAT IS DEPENDENT ON THE CURRENT VIEW. */
-extern gint _screen_width_pixels;
-extern gint _screen_height_pixels;
-extern gint _screen_halfwidth_pixels;
-extern gint _screen_halfheight_pixels;
+extern gint _view_width_pixels;
+extern gint _view_height_pixels;
+extern gint _view_halfwidth_pixels;
+extern gint _view_halfheight_pixels;
 
 
 /** The current track and route. */
@@ -122,6 +122,7 @@ extern GtkWidget *_waypoint_banner;
 extern GtkWidget *_download_banner;
 
 /** DOWNLOAD PROGRESS. */
+extern gboolean _conic_is_connected;
 extern GMutex *_mapdb_mutex;
 extern GMutex *_mouse_mutex;
 extern volatile gint _num_downloads;
index 87a08f753cad4ed5cf42d7f9d8f4c2ee45b2860e..2a171641eaf6015e52f8a8aaed853c103bf67ca4 100644 (file)
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <libosso.h>
 #include <glib.h>
+#include "dbus/dbus.h"
 
 #define DBUS_API_SUBJECT_TO_CHANGE
 
 #include "display.h"
 #include "dbus-ifc.h"
 
+/***********************
+ * BELOW: DBUS METHODS *
+ ***********************/
+
 static gint
 dbus_ifc_cb_default(const gchar *interface, const gchar *method,
         GArray *args, gpointer data, osso_rpc_t *retval)
@@ -56,17 +61,22 @@ dbus_ifc_cb_default(const gchar *interface, const gchar *method,
 }
 
 static gboolean
-dbus_ifc_set_view_center_idle(SetViewCenterArgs *args)
+dbus_ifc_set_view_position_idle(SetViewPositionArgs *args)
 {
     Point center;
-    printf("%s(%f, %f, %d)\n", __PRETTY_FUNCTION__,
-            args->lat, args->lon, args->zoom);
+    printf("%s(%f, %f, %d, %f)\n", __PRETTY_FUNCTION__, args->new_lat,
+            args->new_lon, args->new_zoom, args->new_viewing_angle);
 
-    latlon2unit(args->lat, args->lon, center.unitx, center.unity);
+    if(!_mouse_is_down)
+    {
+        if(_center_mode > 0)
+            gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
+                        _menu_view_ac_none_item), TRUE);
 
-    map_center_unit_full(center, args->zoom,
-            _center_mode > 0 && _center_rotate
-            ? _gps.heading : _next_map_rotate_angle);
+        latlon2unit(args->new_lat, args->new_lon, center.unitx, center.unity);
+
+        map_center_unit_full(center, args->new_zoom, args->new_viewing_angle);
+    }
 
     g_free(args);
 
@@ -78,45 +88,54 @@ static gint
 dbus_ifc_handle_set_view_center(GArray *args, osso_rpc_t *retval)
 {
     printf("%s()\n", __PRETTY_FUNCTION__);
-    SetViewCenterArgs *svca = g_new(SetViewCenterArgs, 1);
+    SetViewPositionArgs *svca = g_new(SetViewPositionArgs, 1);
+
+    /* Argument 3: int: zoom.  Get this first because we might need it to
+     * calculate the next latitude and/or longitude. */
+    if(args->len >= 3
+            && g_array_index(args, osso_rpc_t, 2).type == DBUS_TYPE_INT32)
+    {
+        svca->new_zoom = CLAMP(g_array_index(args, osso_rpc_t, 2).value.i,
+                MIN_ZOOM, MAX_ZOOM);
+    }
+    else
+        svca->new_zoom = _next_zoom;
+
+    if(args->len < 2)
+    {
+        /* Latitude and/or Longitude are not defined.  Calculate next. */
+        Point new_center = map_calc_new_center(svca->new_zoom);
+        unit2latlon(new_center.unitx, new_center.unity, svca->new_lat, svca->new_lon);
+    }
 
     /* Argument 1: double: latitude. */
     if(args->len >= 1
         && g_array_index(args, osso_rpc_t, 0).type == DBUS_TYPE_DOUBLE)
     {
-        svca->lat = CLAMP(g_array_index(args, osso_rpc_t, 0).value.d,
+        svca->new_lat = CLAMP(g_array_index(args, osso_rpc_t, 0).value.d,
                 -90.0, 90.0);
     }
-    else
-    {
-        gdouble tmp;
-        unit2latlon(_center.unitx, _center.unity, svca->lat, tmp);
-    }
 
     /* Argument 2: double: longitude. */
     if(args->len >= 2
             && g_array_index(args, osso_rpc_t, 1).type == DBUS_TYPE_DOUBLE)
     {
-        svca->lon = CLAMP(g_array_index(args, osso_rpc_t, 1).value.d,
+        svca->new_lon = CLAMP(g_array_index(args, osso_rpc_t, 1).value.d,
                 -180.0, 180.0);
     }
-    else
-    {
-        gdouble tmp;
-        unit2latlon(_center.unitx, _center.unity, tmp, svca->lon);
-    }
 
-    /* Argument 2 (optional): int: zoom. */
-    if(args->len >= 3
-            && g_array_index(args, osso_rpc_t, 2).type == DBUS_TYPE_INT32)
+    /* Argument 4: double: viewing angle. */
+    if(args->len >= 4
+            && g_array_index(args, osso_rpc_t, 3).type == DBUS_TYPE_DOUBLE)
     {
-        svca->zoom = CLAMP(g_array_index(args, osso_rpc_t, 2).value.i,
-                MIN_ZOOM, MAX_ZOOM);
+        svca->new_viewing_angle
+            = (gint)(g_array_index(args, osso_rpc_t, 2).value.d + 0.5) % 360;
     }
     else
-        svca->zoom = _zoom;
+        svca->new_viewing_angle = _center_mode > 0 && _center_rotate
+            ? _gps.heading : _next_map_rotate_angle;
 
-    g_idle_add((GSourceFunc)dbus_ifc_set_view_center_idle, svca);
+    g_idle_add((GSourceFunc)dbus_ifc_set_view_position_idle, svca);
     retval->type = DBUS_TYPE_INVALID;
 
     vprintf("%s(): return OSSO_OK\n", __PRETTY_FUNCTION__);
@@ -130,13 +149,136 @@ dbus_ifc_controller(const gchar *interface, const gchar *method,
     printf("%s(%s)\n", __PRETTY_FUNCTION__, method);
 
     /* Method: set_view_center */
-    if(!strcmp(method, MM_DBUS_METHOD_SET_VIEW_CENTER))
+    if(!strcmp(method, MM_DBUS_METHOD_SET_VIEW_POSITION))
         return dbus_ifc_handle_set_view_center(args, retval);
 
     vprintf("%s(): return OSSO_ERROR\n", __PRETTY_FUNCTION__);
     return OSSO_ERROR;
 }
 
+/***********************
+ * ABOVE: DBUS METHODS *
+ ***********************/
+
+
+/***********************
+ * BELOW: DBUS SIGNALS *
+ ***********************/
+
+static gboolean
+dbus_ifc_view_position_changed_idle(ViewPositionChangedArgs *args)
+{
+    DBusConnection *bus = NULL;
+    DBusError error;
+    DBusMessage *message = NULL;
+    printf("%s(%f, %f, %d, %f)\n", __PRETTY_FUNCTION__, args->new_lat,
+            args->new_lon, args->new_zoom, args->new_viewing_angle);
+
+    dbus_error_init(&error);
+
+    if(NULL == (bus = dbus_bus_get(DBUS_BUS_SESSION, &error))
+            || NULL == (message = dbus_message_new_signal(MM_DBUS_PATH,
+                    MM_DBUS_INTERFACE, MM_DBUS_SIGNAL_VIEW_POSITION_CHANGED))
+            || !dbus_message_append_args(message,
+                DBUS_TYPE_DOUBLE, &args->new_lat,
+                DBUS_TYPE_DOUBLE, &args->new_lon,
+                DBUS_TYPE_INT32, &args->new_zoom,
+                DBUS_TYPE_DOUBLE, &args->new_viewing_angle,
+                DBUS_TYPE_INVALID)
+            || !dbus_connection_send(bus, message, NULL))
+    {
+        g_printerr("Error sending view_position_changed signal: %s: %s\n",
+                (dbus_error_is_set(&error)
+                 ? error.name : "<no error message>"),
+                (dbus_error_is_set(&error)
+                 ? error.message : ""));
+    }
+
+    if(message)
+        dbus_message_unref(message);
+    if(bus)
+        dbus_connection_unref(bus);
+
+    vprintf("%s(): return FALSE\n", __PRETTY_FUNCTION__);
+    return FALSE;
+}
+
+void
+dbus_ifc_fire_view_position_changed(
+        Point new_center, gint new_zoom, gdouble new_viewing_angle)
+{
+    ViewPositionChangedArgs *args;
+    printf("%s(%d, %d, %d, %f)\n", __PRETTY_FUNCTION__, new_center.unitx,
+            new_center.unity, new_zoom, new_viewing_angle);
+
+    args = g_new(ViewPositionChangedArgs, 1);
+    unit2latlon(new_center.unitx, new_center.unity,
+            args->new_lat, args->new_lon);
+    args->new_zoom = new_zoom;
+    args->new_viewing_angle = new_viewing_angle;
+
+    g_idle_add((GSourceFunc)dbus_ifc_view_position_changed_idle, args);
+
+    vprintf("%s(): return\n", __PRETTY_FUNCTION__);
+}
+
+static gboolean
+dbus_ifc_view_dimensions_changed_idle(ViewDimensionsChangedArgs *args)
+{
+    DBusConnection *bus = NULL;
+    DBusError error;
+    DBusMessage *message = NULL;
+    printf("%s(%d, %d)\n", __PRETTY_FUNCTION__,
+            args->new_view_width_pixels, args->new_view_height_pixels);
+
+    dbus_error_init(&error);
+
+    if(NULL == (bus = dbus_bus_get(DBUS_BUS_SESSION, &error))
+            || NULL == (message = dbus_message_new_signal(MM_DBUS_PATH,
+                    MM_DBUS_INTERFACE, MM_DBUS_SIGNAL_VIEW_DIMENSIONS_CHANGED))
+            || !dbus_message_append_args(message,
+                DBUS_TYPE_INT32, &args->new_view_width_pixels,
+                DBUS_TYPE_INT32, &args->new_view_height_pixels,
+                DBUS_TYPE_INVALID)
+            || !dbus_connection_send(bus, message, NULL))
+    {
+        g_printerr("Error sending view_dimensions_changed signal: %s: %s\n",
+                (dbus_error_is_set(&error)
+                 ? error.name : "<no error message>"),
+                (dbus_error_is_set(&error)
+                 ? error.message : ""));
+    }
+
+    if(message)
+        dbus_message_unref(message);
+    if(bus)
+        dbus_connection_unref(bus);
+
+    vprintf("%s(): return FALSE\n", __PRETTY_FUNCTION__);
+    return FALSE;
+}
+
+void
+dbus_ifc_fire_view_dimensions_changed(
+        gint new_view_width_pixels, gint new_view_height_pixels)
+{
+    ViewDimensionsChangedArgs *args;
+    printf("%s(%d, %d)\n", __PRETTY_FUNCTION__,
+            new_view_width_pixels, new_view_height_pixels);
+
+    args = g_new(ViewDimensionsChangedArgs, 1);
+    args->new_view_width_pixels = new_view_width_pixels;
+    args->new_view_height_pixels = new_view_height_pixels;
+
+    g_idle_add((GSourceFunc)dbus_ifc_view_dimensions_changed_idle, args);
+
+    vprintf("%s(): return\n", __PRETTY_FUNCTION__);
+}
+
+/***********************
+ * ABOVE: DBUS SIGNALS *
+ ***********************/
+
 void
 dbus_ifc_init()
 {
index 29cdb798f19f6075fcb6bca6906e9c4f0d779e22..95e27ecd92f50f05a2f6d271bb5050f489a80b52 100644 (file)
 #define MM_DBUS_PATH "/com/gnuite/maemo_mapper"
 #define MM_DBUS_INTERFACE "com.gnuite.maemo_mapper"
 
-#define MM_DBUS_METHOD_SET_VIEW_CENTER "set_view_center"
-typedef struct _SetViewCenterArgs SetViewCenterArgs;
-struct _SetViewCenterArgs
+/**
+ * Sets the view center (including zoom and viewing angle).  All of the
+ * fields are optional, although (due to the requirements of DBUS), if you
+ * specify one value, you must specify all the values preceding it.  I.e. if
+ * you specify new_viewing_angle, you must specify all the fields.
+ *
+ * A screen refresh is performed regardless of whether or not any of the
+ * fields are specified or different from previous values.  Thus, you can
+ * force a refresh of the screen simply by calling this method with no
+ * arguments.
+ *
+ * This method has no effect if the user is currently tap-and-holding or
+ * dragging on the screen.
+ *
+ * Note that, if this method causes the refresh of the screen, then
+ * Auto-Center will always become disabled.
+ */
+#define MM_DBUS_METHOD_SET_VIEW_POSITION "set_view_center"
+typedef struct _SetViewPositionArgs SetViewPositionArgs;
+struct _SetViewPositionArgs
 {
-    gdouble lat;
-    gdouble lon;
-    gint zoom; /* Optional - omit to keep zoom the same. */
+    gdouble new_lat;
+    gdouble new_lon;
+    gint new_zoom;
+    gdouble new_viewing_angle; /* i.e. rotation */
 };
 
+/**
+ * Occurs whenever the view center (including zoom and viewing angle)
+ * changes.  This signal is not necessarily fired when the screen size is
+ * changed.  Not all of the given information may necessarily have changed,
+ * but at least one is guaranteed to have changed.
+ */
+#define MM_DBUS_SIGNAL_VIEW_POSITION_CHANGED "view_position_changed"
+typedef struct _ViewPositionChangedArgs ViewPositionChangedArgs;
+struct _ViewPositionChangedArgs
+{
+    gdouble new_lat;
+    gdouble new_lon;
+    gint new_zoom;
+    gdouble new_viewing_angle; /* i.e. rotation */
+};
+void dbus_ifc_fire_view_position_changed(
+        Point new_center, gint new_zoom, gdouble new_viewing_angle);
+
+/**
+ * Occurs whenever the dimensions (width and height) of the map change.  The
+ * dimensions do not include any sidebars (like the GPS info panel).  If the
+ * GPS info panel is hidden or unhidden, this event will be fired.
+ */
+#define MM_DBUS_SIGNAL_VIEW_DIMENSIONS_CHANGED "view_dimensions_changed"
+typedef struct _ViewDimensionsChangedArgs ViewDimensionsChangedArgs;
+struct _ViewDimensionsChangedArgs
+{
+    gint new_view_width_pixels;
+    gint new_view_height_pixels;
+};
+void dbus_ifc_fire_view_dimensions_changed(
+        gint new_view_width_pixels, gint new_view_height_pixels);
+
+
 void dbus_ifc_init(void);
 
 #endif /* ifndef MAEMO_MAPPER_GPS_H */
index e93cfd9e7b532a29fec65f0482b68a2013a576c0..fc599e150ebfdc4b6be4db014579e67738d88fc3 100644 (file)
@@ -92,8 +92,8 @@
     gdk_pixbuf_rotate_vector(&fdevx, &fdevy, (MATRIX), \
             (gint)((UNITX) - (CENTER).unitx), \
             (gint)((UNITY) - (CENTER).unity)); \
-    (BUFX) = unit2pixel((gint)(fdevx)) + _screen_halfwidth_pixels; \
-    (BUFY) = unit2pixel((gint)(fdevy)) + _screen_halfheight_pixels; \
+    (BUFX) = unit2pixel((gint)(fdevx)) + _view_halfwidth_pixels; \
+    (BUFY) = unit2pixel((gint)(fdevy)) + _view_halfheight_pixels; \
 }
 
 #define unit2buf(UNITX, UNITY, BUFX, BUFY) \
     gdk_pixbuf_rotate_vector(&fdevx, &fdevy, MATRIX, \
             (gint)((PIXELX) - unit2zpixel((CENTER).unitx, (ZOOM))), \
             (gint)((PIXELY) - unit2zpixel((CENTER).unity, (ZOOM)))); \
-    (BUFX) = fdevx + _screen_halfwidth_pixels; \
-    (BUFY) = fdevy + _screen_halfheight_pixels; \
+    (BUFX) = fdevx + _view_halfwidth_pixels; \
+    (BUFY) = fdevy + _view_halfheight_pixels; \
 }
 
 #define pixel2buf(PIXELX, PIXELY, BUFX, BUFY) \
 #define buf2unit_full(BUFX, BUFY, UNITX, UNITY, CENTER, MATRIX) { \
     gfloat funitx, funity; \
     gdk_pixbuf_rotate_vector(&funitx, &funity, MATRIX, \
-            pixel2unit((gint)((BUFX) - _screen_halfwidth_pixels)), \
-            pixel2unit((gint)((BUFY) - _screen_halfheight_pixels))); \
+            pixel2unit((gint)((BUFX) - _view_halfwidth_pixels)), \
+            pixel2unit((gint)((BUFY) - _view_halfheight_pixels))); \
     (UNITX) = (CENTER).unitx + (gint)funitx; \
     (UNITY) = (CENTER).unity + (gint)funity; \
 }
 #define buf2pixel_full(BUFX, BUFY, PIXELX, PIXELY, CENTER, MATRIX) { \
     gfloat fpixelx, fpixely; \
     gdk_pixbuf_rotate_vector(&fpixelx, &fpixely, MATRIX, \
-            (gint)(BUFX) - _screen_halfwidth_pixels, \
-            (gint)(BUFY) - _screen_halfheight_pixels); \
+            (gint)(BUFX) - _view_halfwidth_pixels, \
+            (gint)(BUFY) - _view_halfheight_pixels); \
     (PIXELX) = unit2pixel((CENTER).unitx) + (gint)fpixelx; \
     (PIXELY) = unit2pixel((CENTER).unity) + (gint)fpixely; \
 }
     gtk_widget_queue_draw_area( \
             _map_widget, \
             0, 0, \
-            _screen_width_pixels, \
-            _screen_height_pixels)
+            _view_width_pixels, \
+            _view_height_pixels)
 
 /* Render all on-map metadata an annotations, including POI and paths. */
 #define MACRO_MAP_RENDER_DATA() { \
             if(!_fullscreen) \
                 break; \
         case UNBLANK_WHEN_MOVING: \
-            if(!MOVING) \
+            if(!(MOVING)) \
                 break; \
         case UNBLANK_WITH_GPS: \
             printf("Unblanking screen...\n"); \
index 1836590276e724b27e2f2f6a128d9d9520311fd6..a8cf699ca9f43953a7293ef3b48fad205fc1ffd7 100644 (file)
@@ -37,6 +37,7 @@
 #include "data.h"
 #include "defines.h"
 
+#include "dbus-ifc.h"
 #include "display.h"
 #include "gdk-pixbuf-rotate.h"
 #include "gps.h"
@@ -904,8 +905,8 @@ map_render_segment(GdkGC *gc_norm, GdkGC *gc_alt,
     {
         gint x2, y2;
         unit2buf(unitx2, unity2, x2, y2);
-        if(((unsigned)(x2+_draw_width) <= _screen_width_pixels+2*_draw_width)
-         &&((unsigned)(y2+_draw_width) <= _screen_height_pixels+2*_draw_width))
+        if(((unsigned)(x2+_draw_width) <= _view_width_pixels+2*_draw_width)
+         &&((unsigned)(y2+_draw_width) <= _view_height_pixels+2*_draw_width))
         {
             gdk_draw_arc(_map_pixmap, gc_alt,
                     FALSE, /* FALSE: not filled. */
@@ -921,8 +922,8 @@ map_render_segment(GdkGC *gc_norm, GdkGC *gc_alt,
     {
         gint x1, y1;
         unit2buf(unitx1, unity1, x1, y1);
-        if(((unsigned)(x1+_draw_width) <= _screen_width_pixels+2*_draw_width)
-         &&((unsigned)(y1+_draw_width) <= _screen_height_pixels+2*_draw_width))
+        if(((unsigned)(x1+_draw_width) <= _view_width_pixels+2*_draw_width)
+         &&((unsigned)(y1+_draw_width) <= _view_height_pixels+2*_draw_width))
         {
             gdk_draw_arc(_map_pixmap, gc_alt,
                     FALSE, /* FALSE: not filled. */
@@ -940,9 +941,9 @@ map_render_segment(GdkGC *gc_norm, GdkGC *gc_alt,
         unit2buf(unitx1, unity1, x1, y1);
         unit2buf(unitx2, unity2, x2, y2);
         /* Make sure this line could possibly be visible. */
-        if(!((x1 > _screen_width_pixels && x2 > _screen_width_pixels)
+        if(!((x1 > _view_width_pixels && x2 > _view_width_pixels)
                 || (x1 < 0 && x2 < 0)
-                || (y1 > _screen_height_pixels && y2 > _screen_height_pixels)
+                || (y1 > _view_height_pixels && y2 > _view_height_pixels)
                 || (y1 < 0 && y2 < 0)))
             gdk_draw_line(_map_pixmap, gc_norm, x1, y1, x2, y2);
     }
@@ -1178,7 +1179,7 @@ map_force_redraw()
             _map_pixbuf,
             0, 0,
             0, 0,
-            _screen_width_pixels, _screen_height_pixels,
+            _view_width_pixels, _view_height_pixels,
             GDK_RGB_DITHER_NONE, 0, 0);
 
     MACRO_MAP_RENDER_DATA();
@@ -1187,7 +1188,7 @@ map_force_redraw()
     vprintf("%s(): return\n", __PRETTY_FUNCTION__);
 }
 
-static Point
+Point
 map_calc_new_center(gint zoom)
 {
     Point new_center;
@@ -1198,9 +1199,9 @@ map_calc_new_center(gint zoom)
         case CENTER_LEAD:
         {
             gfloat tmp = deg2rad(_gps.heading);
-            gfloat screen_pixels = _screen_width_pixels
-                + (((gint)_screen_height_pixels
-                            - (gint)_screen_width_pixels)
+            gfloat screen_pixels = _view_width_pixels
+                + (((gint)_view_height_pixels
+                            - (gint)_view_width_pixels)
                         * fabsf(cosf(deg2rad(
                                 ROTATE_DIR_ENUM_DEGREES[_rotate_dir] -
                                 (_center_rotate ? 0
@@ -1253,8 +1254,8 @@ map_center_unit_full(Point new_center,
         mrt->old_offsetx = _map_offset_devx;
         mrt->old_offsety = _map_offset_devy;
         mrt->new_center = _next_center = new_center;
-        mrt->screen_width_pixels = _screen_width_pixels;
-        mrt->screen_height_pixels = _screen_height_pixels;
+        mrt->screen_width_pixels = _view_width_pixels;
+        mrt->screen_height_pixels = _view_height_pixels;
         mrt->zoom = _next_zoom = zoom;
         mrt->rotate_angle = _next_map_rotate_angle = rotate_angle;
 
@@ -1365,10 +1366,10 @@ map_refresh_mark(gboolean force_redraw)
             new_center_devx, new_center_devy);
     if(force_redraw || (_center_mode > 0
                 && (UNITS_CONVERT[_units] * _gps.speed) >= _ac_min_speed &&
-    (((unsigned)(new_center_devx - (_screen_width_pixels * _center_ratio / 20))
-                > ((10 - _center_ratio) * _screen_width_pixels / 10))
- || ((unsigned)(new_center_devy - (_screen_height_pixels * _center_ratio / 20))
-                > ((10 - _center_ratio) * _screen_height_pixels / 10))
+    (((unsigned)(new_center_devx - (_view_width_pixels * _center_ratio / 20))
+                > ((10 - _center_ratio) * _view_width_pixels / 10))
+ || ((unsigned)(new_center_devy - (_view_height_pixels * _center_ratio / 20))
+                > ((10 - _center_ratio) * _view_height_pixels / 10))
             || (_center_rotate &&
               abs(_next_map_rotate_angle - _gps.heading)
                   > (4*(10-_rotate_sens))))))
@@ -1522,15 +1523,25 @@ map_replace_pixbuf_idle(MapRenderTask *mrt)
     printf("%s()\n", __PRETTY_FUNCTION__);
 
     if(!_mouse_is_down
-            && mrt->screen_width_pixels == _screen_width_pixels
-            && mrt->screen_height_pixels == _screen_height_pixels)
+            && mrt->screen_width_pixels == _view_width_pixels
+            && mrt->screen_height_pixels == _view_height_pixels)
     {
         g_object_unref(_map_pixbuf);
         _map_pixbuf = mrt->pixbuf;
+
+        if(_center.unitx != mrt->new_center.unitx
+                || _center.unity != mrt->new_center.unity
+                || _zoom != mrt->zoom
+                || _map_rotate_angle != mrt->rotate_angle)
+        {
+            dbus_ifc_fire_view_position_changed(
+                    mrt->new_center, mrt->zoom, mrt->rotate_angle);
+        }
+
         _center = mrt->new_center;
         _zoom = mrt->zoom;
-
         _map_rotate_angle = mrt->rotate_angle;
+
         gdk_pixbuf_rotate_matrix_fill_for_rotation(
                 _map_rotate_matrix,
                 deg2rad(ROTATE_DIR_ENUM_DEGREES[_rotate_dir]
@@ -1541,6 +1552,7 @@ map_replace_pixbuf_idle(MapRenderTask *mrt)
                     - ROTATE_DIR_ENUM_DEGREES[_rotate_dir]));
 
         g_slice_free(MapRenderTask, mrt);
+
         --_redraw_count;
 
         _map_offset_devx = 0;
@@ -1548,6 +1560,7 @@ map_replace_pixbuf_idle(MapRenderTask *mrt)
 
         map_set_mark();
         map_force_redraw();
+
     }
     else
     {
@@ -1664,14 +1677,14 @@ thread_render_map(MapRenderTask *mrt)
 
             /* Skip this tile under the following conditions:
              * devx < -tile_rothalf_pixels
-             * devx > _screen_width_pixels + tile_rothalf_pixels
+             * devx > _view_width_pixels + tile_rothalf_pixels
              * devy < -tile_rothalf_pixels
-             * devy > _screen_height_pixels + tile_rothalf_pixels
+             * devy > _view_height_pixels + tile_rothalf_pixels
              */
             if(((unsigned)(devx + tile_rothalf_pixels))
-                    < (_screen_width_pixels + (2 * tile_rothalf_pixels))
+                    < (_view_width_pixels + (2 * tile_rothalf_pixels))
                 && ((unsigned)(devy + tile_rothalf_pixels))
-                    < (_screen_height_pixels + (2 * tile_rothalf_pixels)))
+                    < (_view_height_pixels + (2 * tile_rothalf_pixels)))
             {
                 tile_dev[2 * (y * num_tilex + x)] = devx;
                 tile_dev[2 * (y * num_tilex + x) + 1] = devy;
@@ -1843,7 +1856,7 @@ thread_render_map(MapRenderTask *mrt)
 gboolean
 map_cb_configure(GtkWidget *widget, GdkEventConfigure *event)
 {
-    gint old_screen_width_pixels, old_screen_height_pixels;
+    gint old_view_width_pixels, old_view_height_pixels;
     GdkPixbuf *old_map_pixbuf;
     printf("%s(%d, %d)\n", __PRETTY_FUNCTION__,
             _map_widget->allocation.width, _map_widget->allocation.height);
@@ -1853,32 +1866,32 @@ map_cb_configure(GtkWidget *widget, GdkEventConfigure *event)
         /* Special case - first allocation - not persistent. */
         return TRUE;
 
-    old_screen_width_pixels = _screen_width_pixels;
-    old_screen_height_pixels = _screen_height_pixels;
-    _screen_width_pixels = _map_widget->allocation.width;
-    _screen_height_pixels = _map_widget->allocation.height;
-    _screen_halfwidth_pixels = _screen_width_pixels / 2;
-    _screen_halfheight_pixels = _screen_height_pixels / 2;
+    old_view_width_pixels = _view_width_pixels;
+    old_view_height_pixels = _view_height_pixels;
+    _view_width_pixels = _map_widget->allocation.width;
+    _view_height_pixels = _map_widget->allocation.height;
+    _view_halfwidth_pixels = _view_width_pixels / 2;
+    _view_halfheight_pixels = _view_height_pixels / 2;
 
     g_object_unref(_map_pixmap);
     _map_pixmap = gdk_pixmap_new(
                 _map_widget->window,
-                _screen_width_pixels, _screen_height_pixels,
+                _view_width_pixels, _view_height_pixels,
                 -1); /* -1: use bit depth of widget->window. */
 
     old_map_pixbuf = _map_pixbuf;
     _map_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
-            _screen_width_pixels, _screen_height_pixels);
+            _view_width_pixels, _view_height_pixels);
 
     {
-        gint oldnew_diffx = (gint)(_screen_width_pixels
-                - old_screen_width_pixels) / 2;
-        gint oldnew_diffy = (gint)(_screen_height_pixels
-                - old_screen_height_pixels) / 2;
+        gint oldnew_diffx = (gint)(_view_width_pixels
+                - old_view_width_pixels) / 2;
+        gint oldnew_diffy = (gint)(_view_height_pixels
+                - old_view_height_pixels) / 2;
         gdk_pixbuf_copy_area(old_map_pixbuf,
                 MAX(0, -oldnew_diffx), MAX(0, -oldnew_diffy),
-                MIN(_screen_width_pixels, old_screen_width_pixels),
-                MIN(_screen_height_pixels, old_screen_height_pixels),
+                MIN(_view_width_pixels, old_view_width_pixels),
+                MIN(_view_height_pixels, old_view_height_pixels),
                 _map_pixbuf,
                 MAX(0, oldnew_diffx), MAX(0, oldnew_diffy));
     }
@@ -1886,11 +1899,11 @@ map_cb_configure(GtkWidget *widget, GdkEventConfigure *event)
     g_object_unref(old_map_pixbuf);
 
     /* Set _scale_rect. */
-    _scale_rect.x = (_screen_width_pixels - SCALE_WIDTH) / 2;
+    _scale_rect.x = (_view_width_pixels - SCALE_WIDTH) / 2;
     _scale_rect.width = SCALE_WIDTH;
     pango_layout_set_text(_scale_layout, "0", -1);
     pango_layout_get_pixel_size(_scale_layout, NULL, &_scale_rect.height);
-    _scale_rect.y = _screen_height_pixels - _scale_rect.height - 1;
+    _scale_rect.y = _view_height_pixels - _scale_rect.height - 1;
 
     /* Set _zoom rect. */
     pango_layout_set_text(_zoom_layout, "00", -1);
@@ -1900,15 +1913,19 @@ map_cb_configure(GtkWidget *widget, GdkEventConfigure *event)
     pango_layout_set_width(_zoom_layout, _zoom_rect.width);
     pango_layout_context_changed(_zoom_layout);
     _zoom_rect.x = _scale_rect.x - _zoom_rect.width;
-    _zoom_rect.y = _screen_height_pixels - _zoom_rect.height - 1;
+    _zoom_rect.y = _view_height_pixels - _zoom_rect.height - 1;
 
     /* Set _comprose_rect. */
-    _comprose_rect.x = _screen_width_pixels - 25 - _comprose_rect.width;
-    _comprose_rect.y = _screen_height_pixels - 25 - _comprose_rect.height;
+    _comprose_rect.x = _view_width_pixels - 25 - _comprose_rect.width;
+    _comprose_rect.y = _view_height_pixels - 25 - _comprose_rect.height;
 
     map_set_mark();
     map_force_redraw();
 
+    /* Fire the screen_dimensions_changed DBUS signal. */
+    dbus_ifc_fire_view_dimensions_changed(
+            _view_width_pixels, _view_height_pixels);
+
     /* If Auto-Center is set to Lead, then recalc center. */
     if(_center_mode == CENTER_LEAD)
         map_center_unit(map_calc_new_center(_next_zoom));
@@ -2115,13 +2132,13 @@ map_cb_expose(GtkWidget *widget, GdkEventExpose *event)
 
     /* Draw the mark. */
     if((((unsigned)(_mark_bufx1 + _draw_width)
-                <= _screen_width_pixels+2*_draw_width)
+                <= _view_width_pixels+2*_draw_width)
              &&((unsigned)(_mark_bufy1 + _draw_width)
-                 <= _screen_height_pixels+2*_draw_width))
+                 <= _view_height_pixels+2*_draw_width))
         || (((unsigned)(_mark_bufx2 + _draw_width)
-                 <= _screen_width_pixels+2*_draw_width)
+                 <= _view_width_pixels+2*_draw_width)
              &&((unsigned)(_mark_bufy2 + _draw_width)
-                 <= _screen_height_pixels+2*_draw_width)))
+                 <= _view_height_pixels+2*_draw_width)))
     {
         gdk_draw_arc(
                 _map_widget->window,
index ee621ac87ab47e8c85e1dd931b18a45f8258d98f..b2f8b5d1b9b04b4c970c7a2f4921409600d920c3 100644 (file)
@@ -56,6 +56,7 @@ void map_center_unit_full(Point new_center, gint zoom, gint rotate_angle);
 void map_center_unit(Point new_center);
 void map_rotate(gint rotate_angle);
 void map_center_zoom(gint zoom);
+Point map_calc_new_center(gint zoom);
 
 gboolean map_download_refresh_idle(MapUpdateTask *mut);
 void map_set_zoom(gint new_zoom);
index 521e8e29163355361d0330e4c9c96b8db9390201..47abd9f81e8855c04cb20608803194098cfd0ba7 100644 (file)
--- a/src/gps.c
+++ b/src/gps.c
@@ -413,14 +413,14 @@ gps_parse_gsv(gchar *sentence)
                 BOUND(fraction, 0.0, 1.0);
                 hildon_banner_set_fraction(
                         HILDON_BANNER(_fix_banner), fraction);
+
+                /* Keep awake while they watch the progress bar. */
+                UNBLANK_SCREEN(TRUE, FALSE);
             }
             running_total = 0;
             num_sats_used = 0;
         }
         satcnt = 0;
-
-        /* Keep awake while they watch the progress bar. */
-        UNBLANK_SCREEN(TRUE, FALSE);
     }
 
     vprintf("%s(): return\n", __PRETTY_FUNCTION__);
index 0ffb0c92d4d725b066817992a4e882b32690affd..d825ed28169a1750d0495ae3b1957ef3788c5d66 100644 (file)
@@ -579,7 +579,7 @@ map_cb_button_release(GtkWidget *widget, GdkEventButton *event)
 
         _mouse_is_dragging = FALSE;
 
-        screen2unit(_screen_halfwidth_pixels, _screen_halfheight_pixels,
+        screen2unit(_view_halfwidth_pixels, _view_halfheight_pixels,
                 clkpt.unitx, clkpt.unity);
 
         if(_center_mode > 0)
index 6565d2f7853dceaf207ff51708828b0520754a37..0adc966ccf03c4b9833bbff2b9a75f9e2d5308f3 100644 (file)
@@ -61,7 +61,6 @@ static HildonProgram *_program = NULL;
 
 static ConIcConnection *_conic_conn = NULL;
 static gboolean _conic_is_connecting = FALSE;
-static volatile gboolean _conic_is_connected = FALSE;
 static gboolean _conic_conn_failed = FALSE;
 static GMutex *_conic_connection_mutex = NULL;
 static GCond *_conic_connection_cond = NULL;
@@ -81,9 +80,7 @@ conic_conn_event(ConIcConnection *connection, ConIcConnectionEvent *event)
         /* We're connected. */
         _conic_conn_failed = FALSE;
         if(_download_banner != NULL)
-        {
             gtk_widget_show(_download_banner);
-        }
     }
     else
     {
@@ -91,9 +88,7 @@ conic_conn_event(ConIcConnection *connection, ConIcConnectionEvent *event)
         /* Mark as a failed connection, if we had been trying to connect. */
         _conic_conn_failed = _conic_is_connecting;
         if(_download_banner != NULL)
-        {
             gtk_widget_hide(_download_banner);
-        }
     }
 
     _conic_is_connecting = FALSE; /* No longer trying to connect. */
@@ -605,7 +600,7 @@ main(gint argc, gchar *argv[])
         DBusGConnection *bus;
         DBusGProxy *proxy;
         
-        bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+        bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
         if(!bus || error)
         {
             g_printerr("Error: %s\n", error->message);
@@ -641,7 +636,8 @@ main(gint argc, gchar *argv[])
                 g_printerr("Failed to parse string as integer: %s\n", argv[3]);
                 return 3;
             }
-            if(!dbus_g_proxy_call(proxy, MM_DBUS_METHOD_SET_VIEW_CENTER,&error,
+            if(!dbus_g_proxy_call(proxy, MM_DBUS_METHOD_SET_VIEW_POSITION,
+                        &error,
                         G_TYPE_DOUBLE, lat, G_TYPE_DOUBLE, lon,
                         G_TYPE_INT, zoom, G_TYPE_INVALID,
                         G_TYPE_INVALID)
@@ -654,7 +650,8 @@ main(gint argc, gchar *argv[])
         else
         {
             /* Not specifying a zoom. */
-            if(!dbus_g_proxy_call(proxy, MM_DBUS_METHOD_SET_VIEW_CENTER, &error,
+            if(!dbus_g_proxy_call(proxy, MM_DBUS_METHOD_SET_VIEW_POSITION,
+                        &error,
                         G_TYPE_DOUBLE, lat, G_TYPE_DOUBLE, lon, G_TYPE_INVALID,
                         G_TYPE_INVALID)
                     || error)
index 597863b5fb230c3da69e402e941f65c394426615..fdbe2864fd84744a9f780b5c4076f30bdcaa523e 100644 (file)
@@ -893,8 +893,14 @@ static gboolean
 mapdb_initiate_update_banner_idle()
 {
     if(!_download_banner && _num_downloads != _curr_download)
+    {
         _download_banner = hildon_banner_show_progress(
                 _window, NULL, _("Processing Maps"));
+        /* If we're not connected, then hide the banner immediately.  It will
+         * be unhidden if/when we're connected. */
+        if(!_conic_is_connected)
+            gtk_widget_hide(_download_banner);
+    }
     return FALSE;
 }
 
@@ -2449,10 +2455,10 @@ mapman_dialog()
 
     /* Initialize to the bounds of the screen. */
     unit2latlon(
-            _center.unitx - pixel2unit(MAX(_screen_width_pixels,
-                    _screen_height_pixels) / 2),
-            _center.unity - pixel2unit(MAX(_screen_width_pixels,
-                    _screen_height_pixels) / 2), lat, lon);
+            _center.unitx - pixel2unit(MAX(_view_width_pixels,
+                    _view_height_pixels) / 2),
+            _center.unity - pixel2unit(MAX(_view_width_pixels,
+                    _view_height_pixels) / 2), lat, lon);
     BOUND(lat, -90.f, 90.f);
     BOUND(lon, -180.f, 180.f);
     lat_format(lat, buffer);
@@ -2461,10 +2467,10 @@ mapman_dialog()
     gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_topleft_lon), buffer);
 
     unit2latlon(
-            _center.unitx + pixel2unit(MAX(_screen_width_pixels,
-                    _screen_height_pixels) / 2),
-            _center.unity + pixel2unit(MAX(_screen_width_pixels,
-                    _screen_height_pixels) / 2), lat, lon);
+            _center.unitx + pixel2unit(MAX(_view_width_pixels,
+                    _view_height_pixels) / 2),
+            _center.unity + pixel2unit(MAX(_view_width_pixels,
+                    _view_height_pixels) / 2), lat, lon);
     BOUND(lat, -90.f, 90.f);
     BOUND(lon, -180.f, 180.f);
     lat_format(lat, buffer);
index c1cab78f20ae3ba0c0b0b31c6666c45d86cf6d40..bca3a00852d9bb83f3e057e402c036523ea0c4d7 100644 (file)
@@ -752,8 +752,8 @@ track_add(time_t time, gboolean newly_fixed)
 
         announce_thres_unsquared = (20+_gps.speed) * _announce_notice_ratio*32;
 
-        if(!_track.tail->unity || (_pos.unitx - _track.tail->unitx)
-                || (_pos.unity - _track.tail->unity))
+        if(!_track.tail->unity || (_pos.unitx != _track.tail->unitx)
+                || (_pos.unity != _track.tail->unity))
         {
             ret = TRUE;
             /* Update the nearest-waypoint data. */
@@ -1013,7 +1013,7 @@ track_insert_break(gboolean temporary)
         /** Instead of calling map_render_paths(), we'll just add the waypoint
          * ourselves. */
         /* Make sure this circle will be visible. */
-        if((x1 < _screen_width_pixels) && (y1 < _screen_height_pixels))
+        if((x1 < _view_width_pixels) && (y1 < _view_height_pixels))
             gdk_draw_arc(_map_pixmap, _gc[COLORABLE_TRACK_BREAK],
                     FALSE, /* FALSE: not filled. */
                     x1 - _draw_width,
index 3d1b1b7c1ac9ec1442e85e7783412454e58c7941..7344fd37b15ea3d1dee3d7eeb4667fb7b62fa443 100644 (file)
--- a/src/poi.c
+++ b/src/poi.c
@@ -392,8 +392,8 @@ select_poi(gint unitx, gint unity, PoiInfo *poi, gboolean quick)
                                G_TYPE_BOOLEAN,/* Selected */
                                G_TYPE_INT,    /* POI ID */
                                G_TYPE_INT,    /* Category ID */
-                               G_TYPE_FLOAT,  /* Latitude */
-                               G_TYPE_FLOAT,  /* Longitude */
+                               G_TYPE_DOUBLE,  /* Latitude */
+                               G_TYPE_DOUBLE,  /* Longitude */
                                G_TYPE_STRING, /* Lat/Lon */
                                G_TYPE_FLOAT,  /* Bearing */
                                G_TYPE_FLOAT,  /* Distance */
@@ -2152,8 +2152,8 @@ poi_list_dialog(GtkWidget *parent, gint unitx, gint unity, GList *poi_list)
                                    G_TYPE_BOOLEAN,/* Selected */
                                    G_TYPE_INT,    /* POI ID */
                                    G_TYPE_INT,    /* Category ID */
-                                   G_TYPE_FLOAT,  /* Latitude */
-                                   G_TYPE_FLOAT,  /* Longitude */
+                                   G_TYPE_DOUBLE, /* Latitude */
+                                   G_TYPE_DOUBLE, /* Longitude */
                                    G_TYPE_STRING, /* Lat/Lon */
                                    G_TYPE_FLOAT,  /* Bearing */
                                    G_TYPE_FLOAT,  /* Distance */
@@ -3098,9 +3098,9 @@ map_render_poi()
 
     if(_poi_db && _poi_zoom > _zoom)
     {
-        gint diag_offset = pixel2unit(MAX(_screen_width_pixels,
-                    _screen_height_pixels) / 2);
-        buf2unit(0, _screen_height_pixels, unitx, unity);
+        gint diag_offset = pixel2unit(MAX(_view_width_pixels,
+                    _view_height_pixels) / 2);
+        buf2unit(0, _view_height_pixels, unitx, unity);
         unitx = _center.unitx - diag_offset;
         unity = _center.unity + diag_offset;
         unit2latlon(unitx, unity, lat1, lon1);