]> git.street.me.uk Git - andy/viking.git/blobdiff - src/vikwindow.c
Give all action entries with an icon a tooltip.
[andy/viking.git] / src / vikwindow.c
index bf76c996f51d799a7376baa6da2791c587844073..547df1af96b6740b5bbe0524b61a6167d8ef7839 100644 (file)
@@ -29,6 +29,7 @@
 #include "background.h"
 #include "acquire.h"
 #include "datasources.h"
+#include "geojson.h"
 #include "vikgoto.h"
 #include "dems.h"
 #include "mapcache.h"
@@ -41,6 +42,7 @@
 #include "garminsymbols.h"
 #include "vikmapslayer.h"
 #include "geonamessearch.h"
+#include "vikutils.h"
 
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
@@ -95,6 +97,7 @@ static gboolean delete_event( VikWindow *vw );
 
 static gboolean key_press_event( VikWindow *vw, GdkEventKey *event, gpointer data );
 
+static void center_changed_cb ( VikWindow *vw );
 static void window_configure_event ( VikWindow *vw );
 static void draw_sync ( VikWindow *vw );
 static void draw_redraw ( VikWindow *vw );
@@ -153,6 +156,7 @@ static gboolean window_save ( VikWindow *vw );
 
 struct _VikWindow {
   GtkWindow gtkwindow;
+  GtkWidget *hpaned;
   VikViewport *viking_vvp;
   VikLayersPanel *viking_vlp;
   VikStatusbar *viking_vs;
@@ -172,6 +176,8 @@ struct _VikWindow {
 
   gboolean pan_move;
   gint pan_x, pan_y;
+  gint delayed_pan_x, delayed_pan_y; // Temporary storage
+  gboolean single_click_pending;
 
   guint draw_image_width, draw_image_height;
   gboolean draw_image_save_as_png;
@@ -243,6 +249,14 @@ VikStatusbar * vik_window_get_statusbar ( VikWindow *vw )
   return vw->viking_vs;
 }
 
+/**
+ *  Returns the 'project' filename
+ */
+const gchar *vik_window_get_filename (VikWindow *vw)
+{
+  return vw->filename;
+}
+
 typedef struct {
   VikStatusbar *vs;
   vik_statusbar_type_t vs_type;
@@ -396,7 +410,7 @@ static int determine_location_thread ( VikWindow *vw, gpointer threaddata )
     }
 
     vik_viewport_set_zoom ( vw->viking_vvp, zoom );
-    vik_viewport_set_center_latlon ( vw->viking_vvp, &ll );
+    vik_viewport_set_center_latlon ( vw->viking_vvp, &ll, FALSE );
 
     gchar *message = g_strdup_printf ( _("Location found: %s"), name );
     vik_window_statusbar_update ( vw, message, VIK_STATUSBAR_INFO );
@@ -429,7 +443,7 @@ void vik_window_new_window_finish ( VikWindow *vw )
 
   // Maybe add a default map layer
   if ( a_vik_get_add_default_map_layer () ) {
-    VikMapsLayer *vml = VIK_MAPS_LAYER ( vik_layer_create(VIK_LAYER_MAPS, vw->viking_vvp, NULL, FALSE) );
+    VikMapsLayer *vml = VIK_MAPS_LAYER ( vik_layer_create(VIK_LAYER_MAPS, vw->viking_vvp, FALSE) );
     vik_layer_rename ( VIK_LAYER(vml), _("Default Map") );
     vik_aggregate_layer_add_layer ( vik_layers_panel_get_top_layer(vw->viking_vlp), VIK_LAYER(vml), TRUE );
 
@@ -678,14 +692,15 @@ static void drag_data_received_cb ( GtkWidget *widget,
 #define VIK_SETTINGS_WIN_FULLSCREEN "window_fullscreen"
 #define VIK_SETTINGS_WIN_WIDTH "window_width"
 #define VIK_SETTINGS_WIN_HEIGHT "window_height"
+#define VIK_SETTINGS_WIN_PANE_POSITION "window_horizontal_pane_position"
 #define VIK_SETTINGS_WIN_SAVE_IMAGE_WIDTH "window_save_image_width"
 #define VIK_SETTINGS_WIN_SAVE_IMAGE_HEIGHT "window_save_image_height"
 #define VIK_SETTINGS_WIN_SAVE_IMAGE_PNG "window_save_image_as_png"
+#define VIK_SETTINGS_WIN_COPY_CENTRE_FULL_FORMAT "window_copy_centre_full_format"
 
 static void vik_window_init ( VikWindow *vw )
 {
   GtkWidget *main_vbox;
-  GtkWidget *hpaned;
 
   vw->action_group = NULL;
 
@@ -711,6 +726,7 @@ static void vik_window_init ( VikWindow *vw )
  
   vw->pan_move = FALSE; 
   vw->pan_x = vw->pan_y = -1;
+  vw->single_click_pending = FALSE;
 
   gint draw_image_width;
   if ( a_settings_get_integer ( VIK_SETTINGS_WIN_SAVE_IMAGE_WIDTH, &draw_image_width ) )
@@ -746,6 +762,9 @@ static void vik_window_init ( VikWindow *vw )
 
   g_signal_connect (G_OBJECT (vw), "delete_event", G_CALLBACK (delete_event), NULL);
 
+  // Own signals
+  g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "updated_center", G_CALLBACK(center_changed_cb), vw);
+  // Signals from GTK
   g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "expose_event", G_CALLBACK(draw_sync), vw);
   g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "configure_event", G_CALLBACK(window_configure_event), vw);
   gtk_widget_add_events ( GTK_WIDGET(vw->viking_vvp), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK );
@@ -753,17 +772,22 @@ static void vik_window_init ( VikWindow *vw )
   g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "button_press_event", G_CALLBACK(draw_click), vw);
   g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "button_release_event", G_CALLBACK(draw_release), vw);
   g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "motion_notify_event", G_CALLBACK(draw_mouse_motion), vw);
+
   g_signal_connect_swapped (G_OBJECT(vw->viking_vlp), "update", G_CALLBACK(draw_update), vw);
+  g_signal_connect_swapped (G_OBJECT(vw->viking_vlp), "delete_layer", G_CALLBACK(vik_window_clear_highlight), vw);
 
   // Allow key presses to be processed anywhere
   g_signal_connect_swapped (G_OBJECT (vw), "key_press_event", G_CALLBACK (key_press_event), vw);
 
-  hpaned = gtk_hpaned_new ();
-  gtk_paned_pack1 ( GTK_PANED(hpaned), GTK_WIDGET (vw->viking_vlp), FALSE, FALSE );
-  gtk_paned_pack2 ( GTK_PANED(hpaned), GTK_WIDGET (vw->viking_vvp), TRUE, TRUE );
+  // Set initial button sensitivity
+  center_changed_cb ( vw );
+
+  vw->hpaned = gtk_hpaned_new ();
+  gtk_paned_pack1 ( GTK_PANED(vw->hpaned), GTK_WIDGET (vw->viking_vlp), FALSE, FALSE );
+  gtk_paned_pack2 ( GTK_PANED(vw->hpaned), GTK_WIDGET (vw->viking_vvp), TRUE, TRUE );
 
   /* This packs the button into the window (a gtk container). */
-  gtk_box_pack_start (GTK_BOX(main_vbox), hpaned, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX(main_vbox), vw->hpaned, TRUE, TRUE, 0);
 
   gtk_box_pack_end (GTK_BOX(main_vbox), GTK_WIDGET(vw->viking_vs), FALSE, TRUE, 0);
 
@@ -806,6 +830,12 @@ static void vik_window_init ( VikWindow *vw )
         gtk_check_menu_item_set_active ( GTK_CHECK_MENU_ITEM(check_box), TRUE );
       }
     }
+
+    gint position = -1; // Let GTK determine default positioning
+    if ( !a_settings_get_integer ( VIK_SETTINGS_WIN_PANE_POSITION, &position ) ) {
+      position = -1;
+    }
+    gtk_paned_set_position ( GTK_PANED(vw->hpaned), position );
   }
 
   gtk_window_set_default_size ( GTK_WINDOW(vw), width, height );
@@ -877,9 +907,21 @@ static gboolean key_press_event( VikWindow *vw, GdkEventKey *event, gpointer dat
        map_download = TRUE;
        map_download_only_new = FALSE;
   }
+  // Standard Ctrl+KP+ / Ctrl+KP- to zoom in/out respectively
+  else if ( event->keyval == GDK_KEY_KP_Add && (event->state & modifiers) == GDK_CONTROL_MASK ) {
+    vik_viewport_zoom_in ( vw->viking_vvp );
+    draw_update(vw);
+    return TRUE; // handled keypress
+  }
+  else if ( event->keyval == GDK_KEY_KP_Subtract && (event->state & modifiers) == GDK_CONTROL_MASK ) {
+    vik_viewport_zoom_out ( vw->viking_vvp );
+    draw_update(vw);
+    return TRUE; // handled keypress
+  }
 
   if ( map_download ) {
     simple_map_update ( vw, map_download_only_new );
+    return TRUE; // handled keypress
   }
 
   VikLayer *vl = vik_layers_panel_get_selected ( vw->viking_vlp );
@@ -960,6 +1002,8 @@ static gboolean delete_event( VikWindow *vw )
         a_settings_set_integer ( VIK_SETTINGS_WIN_WIDTH, width );
         a_settings_set_integer ( VIK_SETTINGS_WIN_HEIGHT, height );
       }
+
+      a_settings_set_integer ( VIK_SETTINGS_WIN_PANE_POSITION, gtk_paned_get_position (GTK_PANED(vw->hpaned)) );
     }
 
     a_settings_set_integer ( VIK_SETTINGS_WIN_SAVE_IMAGE_WIDTH, vw->draw_image_width );
@@ -1059,7 +1103,21 @@ static void draw_redraw ( VikWindow *vw )
 
   /* actually draw */
   vik_viewport_clear ( vw->viking_vvp);
+  // Main layer drawing
   vik_layers_panel_draw_all ( vw->viking_vlp );
+  // Draw highlight (possibly again but ensures it is on top - especially for when tracks overlap)
+  if ( vik_viewport_get_draw_highlight (vw->viking_vvp) ) {
+    if ( vw->containing_vtl && (vw->selected_tracks || vw->selected_waypoints ) ) {
+      vik_trw_layer_draw_highlight_items ( vw->containing_vtl, vw->selected_tracks, vw->selected_waypoints, vw->viking_vvp );
+    }
+    else if ( vw->containing_vtl && (vw->selected_track || vw->selected_waypoint) ) {
+      vik_trw_layer_draw_highlight_item ( vw->containing_vtl, vw->selected_track, vw->selected_waypoint, vw->viking_vvp );
+    }
+    else if ( vw->selected_vtl ) {
+      vik_trw_layer_draw_highlight ( vw->selected_vtl, vw->viking_vvp );
+    }
+  }
+  // Other viewport decoration items on top if they are enabled/in use
   vik_viewport_draw_scale ( vw->viking_vvp );
   vik_viewport_draw_copyright ( vw->viking_vvp );
   vik_viewport_draw_centermark ( vw->viking_vvp );
@@ -1122,11 +1180,34 @@ static void vik_window_pan_move (VikWindow *vw, GdkEventMotion *event)
   }
 }
 
+/**
+ * get_location_strings:
+ *
+ * Utility function to get positional strings for the given location
+ * lat and lon strings will get allocated and so need to be freed after use
+ */
+static void get_location_strings ( VikWindow *vw, struct UTM utm, gchar **lat, gchar **lon )
+{
+  if ( vik_viewport_get_drawmode ( vw->viking_vvp ) == VIK_VIEWPORT_DRAWMODE_UTM ) {
+    // Reuse lat for the first part (Zone + N or S, and lon for the second part (easting and northing) of a UTM format:
+    //  ZONE[N|S] EASTING NORTHING
+    *lat = g_malloc(4*sizeof(gchar));
+    // NB zone is stored in a char but is an actual number
+    g_snprintf (*lat, 4, "%d%c", utm.zone, utm.letter);
+    *lon = g_malloc(16*sizeof(gchar));
+    g_snprintf (*lon, 16, "%d %d", (gint)utm.easting, (gint)utm.northing);
+  }
+  else {
+    struct LatLon ll;
+    a_coords_utm_to_latlon ( &utm, &ll );
+    a_coords_latlon_to_string ( &ll, lat, lon );
+  }
+}
+
 static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event)
 {
   static VikCoord coord;
   static struct UTM utm;
-  static struct LatLon ll;
   #define BUFFER_SIZE 50
   static char pointer_buf[BUFFER_SIZE];
   gchar *lat = NULL, *lon = NULL;
@@ -1146,19 +1227,7 @@ static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event)
   vik_viewport_screen_to_coord ( vw->viking_vvp, event->x, event->y, &coord );
   vik_coord_to_utm ( &coord, &utm );
 
-  if ( vik_viewport_get_drawmode ( vw->viking_vvp ) == VIK_VIEWPORT_DRAWMODE_UTM ) {
-    // Reuse lat for the first part (Zone + N or S, and lon for the second part (easting and northing) of a UTM format:
-    //  ZONE[N|S] EASTING NORTHING
-    lat = g_malloc(4*sizeof(gchar));
-    // NB zone is stored in a char but is an actual number
-    g_snprintf (lat, 4, "%d%c", utm.zone, utm.letter);
-    lon = g_malloc(16*sizeof(gchar));
-    g_snprintf (lon, 16, "%d %d", (gint)utm.easting, (gint)utm.northing);
-  }
-  else {
-    a_coords_utm_to_latlon ( &utm, &ll );
-    a_coords_latlon_to_string ( &ll, &lat, &lon );
-  }
+  get_location_strings ( vw, utm, &lat, &lon );
 
   /* Change interpolate method according to scale */
   zoom = vik_viewport_get_zoom(vw->viking_vvp);
@@ -1191,16 +1260,62 @@ static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event)
   /* gdk_event_request_motions ( event ); */
 }
 
+/**
+ * Action the single click after a small timeout
+ * If a double click has occurred then this will do nothing
+ */
+static gboolean vik_window_pan_timeout (VikWindow *vw)
+{
+  if ( ! vw->single_click_pending ) {
+    // Double click happened, so don't do anything
+    return FALSE;
+  }
+
+  /* set panning origin */
+  vw->pan_move = FALSE;
+  vw->single_click_pending = FALSE;
+  vik_viewport_set_center_screen ( vw->viking_vvp, vw->delayed_pan_x, vw->delayed_pan_y );
+  draw_update ( vw );
+
+  // Really turn off the pan moving!!
+  vw->pan_x = vw->pan_y = -1;
+  return FALSE;
+}
+
 static void vik_window_pan_release ( VikWindow *vw, GdkEventButton *event )
 {
-  if ( vw->pan_move == FALSE )
-    vik_viewport_set_center_screen ( vw->viking_vvp, vw->pan_x, vw->pan_y );
-  else
+  gboolean do_draw = TRUE;
+
+  if ( vw->pan_move == FALSE ) {
+    vw->single_click_pending = !vw->single_click_pending;
+
+    if ( vw->single_click_pending ) {
+      // Store offset to use
+      vw->delayed_pan_x = vw->pan_x;
+      vw->delayed_pan_y = vw->pan_y;
+      // Get double click time
+      GtkSettings *gs = gtk_widget_get_settings ( GTK_WIDGET(vw) );
+      GValue dct = { 0 }; // = G_VALUE_INIT; // GLIB 2.30+ only
+      g_value_init ( &dct, G_TYPE_INT );
+      g_object_get_property ( G_OBJECT(gs), "gtk-double-click-time", &dct );
+      // Give chance for a double click to occur
+      gint timer = g_value_get_int ( &dct ) + 50;
+      g_timeout_add ( timer, (GSourceFunc)vik_window_pan_timeout, vw );
+      do_draw = FALSE;
+    }
+    else {
+      vik_viewport_set_center_screen ( vw->viking_vvp, vw->pan_x, vw->pan_y );
+    }
+  }
+  else {
      vik_viewport_set_center_screen ( vw->viking_vvp, vik_viewport_get_width(vw->viking_vvp)/2 - event->x + vw->pan_x,
                                       vik_viewport_get_height(vw->viking_vvp)/2 - event->y + vw->pan_y );
+  }
+
   vw->pan_move = FALSE;
   vw->pan_x = vw->pan_y = -1;
-  draw_update ( vw );
+  if ( do_draw )
+    draw_update ( vw );
 }
 
 static void draw_release ( VikWindow *vw, GdkEventButton *event )
@@ -1353,20 +1468,29 @@ static void draw_ruler(VikViewport *vvp, GdkDrawable *d, GdkGC *gc, gint x1, gin
     switch (dist_units) {
     case VIK_UNITS_DISTANCE_KILOMETRES:
       if (distance >= 1000 && distance < 100000) {
-       g_sprintf(str, "%3.2f km", distance/1000.0);
+        g_sprintf(str, "%3.2f km", distance/1000.0);
       } else if (distance < 1000) {
-       g_sprintf(str, "%d m", (int)distance);
+        g_sprintf(str, "%d m", (int)distance);
       } else {
-       g_sprintf(str, "%d km", (int)distance/1000);
+        g_sprintf(str, "%d km", (int)distance/1000);
       }
       break;
     case VIK_UNITS_DISTANCE_MILES:
       if (distance >= VIK_MILES_TO_METERS(1) && distance < VIK_MILES_TO_METERS(100)) {
-       g_sprintf(str, "%3.2f miles", VIK_METERS_TO_MILES(distance));
+        g_sprintf(str, "%3.2f miles", VIK_METERS_TO_MILES(distance));
       } else if (distance < VIK_MILES_TO_METERS(1)) {
-       g_sprintf(str, "%d yards", (int)(distance*1.0936133));
+        g_sprintf(str, "%d yards", (int)(distance*1.0936133));
+      } else {
+        g_sprintf(str, "%d miles", (int)VIK_METERS_TO_MILES(distance));
+      }
+      break;
+    case VIK_UNITS_DISTANCE_NAUTICAL_MILES:
+      if (distance >= VIK_NAUTICAL_MILES_TO_METERS(1) && distance < VIK_NAUTICAL_MILES_TO_METERS(100)) {
+        g_sprintf(str, "%3.2f NM", VIK_METERS_TO_NAUTICAL_MILES(distance));
+      } else if (distance < VIK_NAUTICAL_MILES_TO_METERS(1)) {
+        g_sprintf(str, "%d yards", (int)(distance*1.0936133));
       } else {
-       g_sprintf(str, "%d miles", (int)VIK_METERS_TO_MILES(distance));
+        g_sprintf(str, "%d NM", (int)VIK_METERS_TO_NAUTICAL_MILES(distance));
       }
       break;
     default:
@@ -1453,14 +1577,17 @@ static VikLayerToolFuncStatus ruler_click (VikLayer *vl, GdkEventButton *event,
       vik_units_distance_t dist_units = a_vik_get_units_distance ();
       switch (dist_units) {
       case VIK_UNITS_DISTANCE_KILOMETRES:
-       temp = g_strdup_printf ( "%s %s DIFF %f meters", lat, lon, vik_coord_diff( &coord, &(s->oldcoord) ) );
-       break;
+        temp = g_strdup_printf ( "%s %s DIFF %f meters", lat, lon, vik_coord_diff( &coord, &(s->oldcoord) ) );
+        break;
       case VIK_UNITS_DISTANCE_MILES:
-       temp = g_strdup_printf ( "%s %s DIFF %f miles", lat, lon, VIK_METERS_TO_MILES(vik_coord_diff( &coord, &(s->oldcoord) )) );
-       break;
+        temp = g_strdup_printf ( "%s %s DIFF %f miles", lat, lon, VIK_METERS_TO_MILES(vik_coord_diff( &coord, &(s->oldcoord) )) );
+        break;
+      case VIK_UNITS_DISTANCE_NAUTICAL_MILES:
+        temp = g_strdup_printf ( "%s %s DIFF %f NM", lat, lon, VIK_METERS_TO_NAUTICAL_MILES(vik_coord_diff( &coord, &(s->oldcoord) )) );
+        break;
       default:
-       temp = g_strdup_printf ("Just to keep the compiler happy");
-       g_critical("Houston, we've had a problem. distance=%d", dist_units);
+        temp = g_strdup_printf ("Just to keep the compiler happy");
+        g_critical("Houston, we've had a problem. distance=%d", dist_units);
       }
 
       s->has_oldcoord = FALSE;
@@ -1530,6 +1657,9 @@ static VikLayerToolFuncStatus ruler_move (VikLayer *vl, GdkEventMotion *event, r
     case VIK_UNITS_DISTANCE_MILES:
       temp = g_strdup_printf ( "%s %s DIFF %f miles", lat, lon, VIK_METERS_TO_MILES (vik_coord_diff( &coord, &(s->oldcoord) )) );
       break;
+    case VIK_UNITS_DISTANCE_NAUTICAL_MILES:
+      temp = g_strdup_printf ( "%s %s DIFF %f NM", lat, lon, VIK_METERS_TO_NAUTICAL_MILES (vik_coord_diff( &coord, &(s->oldcoord) )) );
+      break;
     default:
       temp = g_strdup_printf ("Just to keep the compiler happy");
       g_critical("Houston, we've had a problem. distance=%d", dist_units);
@@ -1574,7 +1704,8 @@ static VikToolInterface ruler_tool =
     (VikToolKeyFunc) ruler_key_press,
     FALSE,
     GDK_CURSOR_IS_PIXMAP,
-    &cursor_ruler_pixbuf };
+    &cursor_ruler_pixbuf,
+    NULL };
 /*** end ruler code ********************************************************/
 
 
@@ -1738,6 +1869,9 @@ static VikLayerToolFuncStatus zoomtool_move (VikLayer *vl, GdkEventMotion *event
       draw_buf_done = FALSE;
     }
   }
+  else
+    zts->bounds_active = FALSE;
+
   return VIK_LAYER_TOOL_ACK;
 }
 
@@ -1745,11 +1879,11 @@ static VikLayerToolFuncStatus zoomtool_release (VikLayer *vl, GdkEventButton *ev
 {
   guint modifiers = event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK);
 
-  zts->bounds_active = FALSE;
-
   // Ensure haven't just released on the exact same position
   //  i.e. probably haven't moved the mouse at all
-  if ( modifiers == GDK_SHIFT_MASK && !( ( event->x == zts->start_x ) && ( event->y == zts->start_y )) ) {
+  if ( zts->bounds_active && modifiers == GDK_SHIFT_MASK &&
+     ( event->x < zts->start_x-5 || event->x > zts->start_x+5 ) &&
+     ( event->y < zts->start_y-5 || event->y > zts->start_y+5 ) ) {
 
     VikCoord coord1, coord2;
     vik_viewport_screen_to_coord ( zts->vw->viking_vvp, zts->start_x, zts->start_y, &coord1);
@@ -1766,7 +1900,7 @@ static VikLayerToolFuncStatus zoomtool_release (VikLayer *vl, GdkEventButton *ev
 
     VikCoord new_center;
     vik_coord_load_from_latlon ( &new_center, vik_viewport_get_coord_mode ( zts->vw->viking_vvp ), &average );
-    vik_viewport_set_center_coord ( zts->vw->viking_vvp, &new_center );
+    vik_viewport_set_center_coord ( zts->vw->viking_vvp, &new_center, FALSE );
 
     /* Convert into definite 'smallest' and 'largest' positions */
     struct LatLon minmin;
@@ -1804,9 +1938,30 @@ static VikLayerToolFuncStatus zoomtool_release (VikLayer *vl, GdkEventButton *ev
       zoom = zoom * 2;
       vik_viewport_set_zoom ( zts->vw->viking_vvp, zoom );
     }
-
-    draw_update ( zts->vw );
   }
+  else {
+     // When pressing shift and clicking for zoom, then jump three levels
+     if ( modifiers == GDK_SHIFT_MASK ) {
+       // Zoom in/out by three if possible
+       vik_viewport_set_center_screen ( zts->vw->viking_vvp, event->x, event->y );
+       if ( event->button == 1 ) {
+          vik_viewport_zoom_in ( zts->vw->viking_vvp );
+          vik_viewport_zoom_in ( zts->vw->viking_vvp );
+          vik_viewport_zoom_in ( zts->vw->viking_vvp );
+       }
+       else if ( event->button == 3 ) {
+          vik_viewport_zoom_out ( zts->vw->viking_vvp );
+          vik_viewport_zoom_out ( zts->vw->viking_vvp );
+          vik_viewport_zoom_out ( zts->vw->viking_vvp );
+       }
+     }
+  }
+
+  draw_update ( zts->vw );
+
+  // Reset
+  zts->bounds_active = FALSE;
+
   return VIK_LAYER_TOOL_ACK;
 }
 
@@ -1822,7 +1977,8 @@ static VikToolInterface zoom_tool =
     NULL,
     FALSE,
     GDK_CURSOR_IS_PIXMAP,
-    &cursor_zoom_pixbuf };
+    &cursor_zoom_pixbuf,
+    NULL };
 /*** end zoom code ********************************************************/
 
 /********************************************************************************
@@ -1833,12 +1989,31 @@ static gpointer pantool_create (VikWindow *vw, VikViewport *vvp)
   return vw;
 }
 
+// NB Double clicking means this gets called THREE times!!!
 static VikLayerToolFuncStatus pantool_click (VikLayer *vl, GdkEventButton *event, VikWindow *vw)
 {
   vw->modified = TRUE;
-  if ( event->button == 1 )
-    vik_window_pan_click ( vw, event );
-  draw_update ( vw );
+
+  if ( event->type == GDK_2BUTTON_PRESS ) {
+    // Zoom in / out on double click
+    // No need to change the center as that has already occurred in the first click of a double click occurrence
+    if ( event->button == 1 ) {
+      guint modifier = event->state & GDK_SHIFT_MASK;
+      if ( modifier )
+        vik_viewport_zoom_out ( vw->viking_vvp );
+      else
+        vik_viewport_zoom_in ( vw->viking_vvp );
+    }
+    else if ( event->button == 3 )
+      vik_viewport_zoom_out ( vw->viking_vvp );
+
+    draw_update ( vw );
+  }
+  else
+    // Standard pan click
+    if ( event->button == 1 )
+      vik_window_pan_click ( vw, event );
+
   return VIK_LAYER_TOOL_ACK;
 }
 
@@ -1866,7 +2041,9 @@ static VikToolInterface pan_tool =
     (VikToolMouseFunc) pantool_release,
     NULL,
     FALSE,
-    GDK_FLEUR };
+    GDK_FLEUR,
+    NULL,
+    NULL };
 /*** end pan code ********************************************************/
 
 /********************************************************************************
@@ -2076,10 +2253,52 @@ static void draw_goto_cb ( GtkAction *a, VikWindow *vw )
     return;
   }
 
-  vik_viewport_set_center_coord ( vw->viking_vvp, &new_center );
+  vik_viewport_set_center_coord ( vw->viking_vvp, &new_center, TRUE );
   draw_update ( vw );
 }
 
+/**
+ * center_changed_cb:
+ */
+static void center_changed_cb ( VikWindow *vw )
+{
+// ATM Keep back always available, so when we pan - we can jump to the last requested position
+/*
+  GtkAction* action_back = gtk_action_group_get_action ( vw->action_group, "GoBack" );
+  if ( action_back ) {
+    gtk_action_set_sensitive ( action_back, vik_viewport_back_available(vw->viking_vvp) );
+  }
+*/
+  GtkAction* action_forward = gtk_action_group_get_action ( vw->action_group, "GoForward" );
+  if ( action_forward ) {
+    gtk_action_set_sensitive ( action_forward, vik_viewport_forward_available(vw->viking_vvp) );
+  }
+}
+
+/**
+ * draw_goto_back_and_forth:
+ */
+static void draw_goto_back_and_forth ( GtkAction *a, VikWindow *vw )
+{
+  gboolean changed = FALSE;
+  if (!strcmp(gtk_action_get_name(a), "GoBack")) {
+    changed = vik_viewport_go_back ( vw->viking_vvp );
+  }
+  else if (!strcmp(gtk_action_get_name(a), "GoForward")) {
+    changed = vik_viewport_go_forward ( vw->viking_vvp );
+  }
+  else {
+    return;
+  }
+
+  // Recheck buttons sensitivities, as the center changed signal is not sent on back/forward changes
+  //  (otherwise we would get stuck in an infinite loop!)
+  center_changed_cb ( vw );
+
+  if ( changed )
+    draw_update ( vw );
+}
+
 /**
  * Refresh maps displayed
  */
@@ -2153,6 +2372,23 @@ static void help_about_cb ( GtkAction *a, VikWindow *vw )
   a_dialog_about(GTK_WINDOW(vw));
 }
 
+static void help_cache_info_cb ( GtkAction *a, VikWindow *vw )
+{
+  // NB: No i18n as this is just for debug
+  gint byte_size = a_mapcache_get_size();
+  gchar *msg_sz = NULL;
+  gchar *msg = NULL;
+#if GLIB_CHECK_VERSION(2,30,0)
+  msg_sz = g_format_size_full ( byte_size, G_FORMAT_SIZE_LONG_FORMAT );
+#else
+  msg_sz = g_format_size_for_display ( byte_size );
+#endif
+  msg = g_strdup_printf ( "Map Cache size is %s with %d items", msg_sz, a_mapcache_get_count());
+  a_dialog_info_msg_extra ( GTK_WINDOW(vw), "%s", msg );
+  g_free ( msg_sz );
+  g_free ( msg );
+}
+
 static void menu_delete_layer_cb ( GtkAction *a, VikWindow *vw )
 {
   if ( vik_layers_panel_get_selected ( vw->viking_vlp ) )
@@ -2358,15 +2594,14 @@ static void menu_tool_cb ( GtkAction *old, GtkAction *a, VikWindow *vw )
     vw->current_tool = TOOL_SELECT;
   }
   else {
-    /* TODO: only enable tools from active layer */
     VikLayerTypeEnum layer_id;
     for (layer_id=0; layer_id<VIK_LAYER_NUM_TYPES; layer_id++) {
       for ( tool_id = 0; tool_id < vik_layer_get_interface(layer_id)->tools_count; tool_id++ ) {
-       if (!strcmp(vik_layer_get_interface(layer_id)->tools[tool_id].radioActionEntry.name, gtk_action_get_name(a))) {
+        if (!strcmp(vik_layer_get_interface(layer_id)->tools[tool_id].radioActionEntry.name, gtk_action_get_name(a))) {
            vw->current_tool = TOOL_LAYER;
            vw->tool_layer_id = layer_id;
            vw->tool_tool_id = tool_id;
-       }
+        }
       }
     }
   }
@@ -2475,6 +2710,7 @@ static void setup_recent_files (VikWindow *self)
   menu = gtk_recent_chooser_menu_new_for_manager (manager);
   gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu), GTK_RECENT_SORT_MRU);
   gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter);
+  gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (menu), a_vik_get_recent_number_files() );
 
   menu_item = gtk_ui_manager_get_widget (self->uim, "/ui/MainMenu/File/OpenRecentFile");
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), menu);
@@ -2483,7 +2719,10 @@ static void setup_recent_files (VikWindow *self)
                     G_CALLBACK (on_activate_recent_item), (gpointer) self);
 }
 
-static void update_recently_used_document(const gchar *filename)
+/*
+ *
+ */
+static void update_recently_used_document (VikWindow *vw, const gchar *filename)
 {
   /* Update Recently Used Document framework */
   GtkRecentManager *manager = gtk_recent_manager_get_default();
@@ -2504,7 +2743,9 @@ static void update_recently_used_document(const gchar *filename)
   recent_data->is_private     = FALSE;
   if (!gtk_recent_manager_add_full (manager, uri, recent_data))
   {
-    g_warning (_("Unable to add '%s' to the list of recently used documents"), uri);
+    gchar *msg = g_strdup_printf (_("Unable to add '%s' to the list of recently used documents"), uri);
+    vik_statusbar_set_message ( vw->viking_vs, VIK_STATUSBAR_INFO, msg );
+    g_free ( msg );
   }
 
   g_free (uri);
@@ -2537,6 +2778,14 @@ void vik_window_clear_busy_cursor ( VikWindow *vw )
 void vik_window_open_file ( VikWindow *vw, const gchar *filename, gboolean change_filename )
 {
   vik_window_set_busy_cursor ( vw );
+
+  // Enable the *new* filename to be accessible by the Layers codez
+  gchar *original_filename = g_strdup ( vw->filename );
+  g_free ( vw->filename );
+  vw->filename = g_strdup ( filename );
+  gboolean success = FALSE;
+  gboolean restore_original_filename = FALSE;
+
   vw->loaded_type = a_file_load ( vik_layers_panel_get_top_layer(vw->viking_vlp), vw->viking_vvp, filename );
   switch ( vw->loaded_type )
   {
@@ -2563,6 +2812,7 @@ void vik_window_open_file ( VikWindow *vw, const gchar *filename, gboolean chang
       // No break, carry on to show any data
     case LOAD_TYPE_VIK_SUCCESS:
     {
+      restore_original_filename = TRUE; // NB Will actually get inverted by the 'success' component below
       GtkWidget *mode_button;
       /* Update UI */
       if ( change_filename )
@@ -2586,13 +2836,22 @@ void vik_window_open_file ( VikWindow *vw, const gchar *filename, gboolean chang
       g_assert ( mode_button );
       gtk_check_menu_item_set_active ( GTK_CHECK_MENU_ITEM(mode_button),vik_viewport_get_draw_highlight (vw->viking_vvp) );
     }
+      // NB No break, carry on to redraw
     //case LOAD_TYPE_OTHER_SUCCESS:
     default:
-      update_recently_used_document(filename);
+      success = TRUE;
+      // When LOAD_TYPE_OTHER_SUCCESS *only*, this will maintain the existing Viking project
+      restore_original_filename = ! restore_original_filename;
+      update_recently_used_document (vw, filename);
       draw_update ( vw );
       break;
   }
 
+  if ( ! success || restore_original_filename )
+    // Load didn't work or want to keep as the existing Viking project, keep using the original name
+    window_set_filename ( vw, original_filename );
+  g_free ( original_filename );
+
   vik_window_clear_busy_cursor ( vw );
 }
 
@@ -2645,6 +2904,11 @@ static void load_file ( GtkAction *a, VikWindow *vw )
     gtk_file_filter_add_pattern ( filter, "*.gpx" ); // No MIME type available
     gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(vw->open_dia), filter);
 
+    filter = gtk_file_filter_new ();
+    gtk_file_filter_set_name ( filter, _("JPG") );
+    gtk_file_filter_add_mime_type ( filter, "image/jpeg");
+    gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(vw->open_dia), filter);
+
     filter = gtk_file_filter_new ();
     gtk_file_filter_set_name( filter, _("Viking") );
     gtk_file_filter_add_pattern ( filter, "*.vik" );
@@ -2747,7 +3011,7 @@ static gboolean save_file_as ( GtkAction *a, VikWindow *vw )
   }
   // Auto append / replace extension with '.vik' to the suggested file name as it's going to be a Viking File
   gchar* auto_save_name = g_strdup ( window_get_filename ( vw ) );
-  if ( ! check_file_ext ( auto_save_name, ".vik" ) )
+  if ( ! a_file_check_ext ( auto_save_name, ".vik" ) )
     auto_save_name = g_strconcat ( auto_save_name, ".vik", NULL );
 
   gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(vw->save_dia), auto_save_name);
@@ -2775,7 +3039,7 @@ static gboolean window_save ( VikWindow *vw )
 
   if ( a_file_save ( vik_layers_panel_get_top_layer ( vw->viking_vlp ), vw->viking_vvp, vw->filename ) )
   {
-    update_recently_used_document ( vw->filename );
+    update_recently_used_document ( vw, vw->filename );
   }
   else
   {
@@ -2914,6 +3178,10 @@ static void export_to_kml ( GtkAction *a, VikWindow *vw )
   export_to_common ( vw, FILE_TYPE_KML, ".kml" );
 }
 
+#if !GLIB_CHECK_VERSION(2,26,0)
+typedef struct stat GStatBuf;
+#endif
+
 static void file_properties_cb ( GtkAction *a, VikWindow *vw )
 {
   gchar *message = NULL;
@@ -2924,19 +3192,15 @@ static void file_properties_cb ( GtkAction *a, VikWindow *vw )
       if ( g_stat ( vw->filename, &stat_buf ) == 0 ) {
         gchar time_buf[64];
         strftime ( time_buf, sizeof(time_buf), "%c", gmtime((const time_t *)&stat_buf.st_mtime) );
-       gchar *size = NULL;
-       gint byte_size = stat_buf.st_size;
-       // See http://en.wikipedia.org/wiki/Megabyte (and Kilobyte)
-       //  hence using 1000 rather than 1024
-       //  so get output as per 'ls' or the Gtk file open dialog
-       if ( byte_size < 1000 )
-         size = g_strdup_printf ( _("%d bytes"), byte_size );
-       else if ( byte_size < 1000*1000 )
-         size = g_strdup_printf ( _("%3.1f kB"), (gdouble)byte_size / 1000 );
-       else
-         size = g_strdup_printf ( _("%3.1f MB"), (gdouble)byte_size / (1000*1000) );
-        message = g_strdup_printf ( _("%s\n\n%s\n\n%s"), vw->filename, time_buf, size );
-       g_free (size);
+        gchar *size = NULL;
+        gint byte_size = stat_buf.st_size;
+#if GLIB_CHECK_VERSION(2,30,0)
+        size = g_format_size_full ( byte_size, G_FORMAT_SIZE_DEFAULT );
+#else
+        size = g_format_size_for_display ( byte_size );
+#endif
+        message = g_strdup_printf ( "%s\n\n%s\n\n%s", vw->filename, time_buf, size );
+        g_free (size);
       }
     }
     else
@@ -2950,64 +3214,70 @@ static void file_properties_cb ( GtkAction *a, VikWindow *vw )
   g_free ( message );
 }
 
+static void my_acquire ( VikWindow *vw, VikDataSourceInterface *datasource )
+{
+  vik_datasource_mode_t mode = datasource->mode;
+  if ( mode == VIK_DATASOURCE_AUTO_LAYER_MANAGEMENT )
+    mode = VIK_DATASOURCE_CREATENEWLAYER;
+  a_acquire ( vw, vw->viking_vlp, vw->viking_vvp, mode, datasource, NULL, NULL );
+}
+
 static void acquire_from_gps ( GtkAction *a, VikWindow *vw )
 {
-  // Via the file menu, acquiring from a GPS makes a new layer
-  //  this has always been the way (not entirely sure if this was the real intention!)
-  //  thus maintain the behaviour ATM.
-  // Hence explicit setting here (as the value may be changed elsewhere)
-  vik_datasource_gps_interface.mode = VIK_DATASOURCE_CREATENEWLAYER;
-  a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_gps_interface, NULL, NULL );
+  my_acquire ( vw, &vik_datasource_gps_interface );
 }
 
 static void acquire_from_file ( GtkAction *a, VikWindow *vw )
 {
-  a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_file_interface, NULL, NULL );
+  my_acquire ( vw, &vik_datasource_file_interface );
+}
+
+static void acquire_from_geojson ( GtkAction *a, VikWindow *vw )
+{
+  my_acquire ( vw, &vik_datasource_geojson_interface );
 }
 
 static void acquire_from_routing ( GtkAction *a, VikWindow *vw )
 {
-  a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_routing_interface, NULL, NULL );
+  my_acquire ( vw, &vik_datasource_routing_interface );
 }
 
 #ifdef VIK_CONFIG_OPENSTREETMAP
 static void acquire_from_osm ( GtkAction *a, VikWindow *vw )
 {
-  a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_osm_interface, NULL, NULL );
+  my_acquire ( vw, &vik_datasource_osm_interface );
 }
 
 static void acquire_from_my_osm ( GtkAction *a, VikWindow *vw )
 {
-  a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_osm_my_traces_interface, NULL, NULL );
+  my_acquire ( vw, &vik_datasource_osm_my_traces_interface );
 }
 #endif
 
 #ifdef VIK_CONFIG_GEOCACHES
 static void acquire_from_gc ( GtkAction *a, VikWindow *vw )
 {
-  a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_gc_interface, NULL, NULL );
+  my_acquire ( vw, &vik_datasource_gc_interface );
 }
 #endif
 
 #ifdef VIK_CONFIG_GEOTAG
 static void acquire_from_geotag ( GtkAction *a, VikWindow *vw )
 {
-  vik_datasource_geotag_interface.mode = VIK_DATASOURCE_CREATENEWLAYER;
-  a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_geotag_interface, NULL, NULL );
+  my_acquire ( vw, &vik_datasource_geotag_interface );
 }
 #endif
 
 #ifdef VIK_CONFIG_GEONAMES
 static void acquire_from_wikipedia ( GtkAction *a, VikWindow *vw )
 {
-  a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_wikipedia_interface, NULL, NULL );
+  my_acquire ( vw, &vik_datasource_wikipedia_interface );
 }
 #endif
 
 static void acquire_from_url ( GtkAction *a, VikWindow *vw )
 {
-  vik_datasource_url_interface.mode = VIK_DATASOURCE_CREATENEWLAYER;
-  a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_url_interface, NULL, NULL );
+  my_acquire ( vw, &vik_datasource_url_interface );
 }
 
 static void goto_default_location( GtkAction *a, VikWindow *vw)
@@ -3015,7 +3285,7 @@ static void goto_default_location( GtkAction *a, VikWindow *vw)
   struct LatLon ll;
   ll.lat = a_vik_get_default_lat();
   ll.lon = a_vik_get_default_long();
-  vik_viewport_set_center_latlon(vw->viking_vvp, &ll);
+  vik_viewport_set_center_latlon(vw->viking_vvp, &ll, TRUE);
   vik_layers_panel_emit_update(vw->viking_vlp);
 }
 
@@ -3031,6 +3301,38 @@ static void mapcache_flush_cb ( GtkAction *a, VikWindow *vw )
   a_mapcache_flush();
 }
 
+static void menu_copy_centre_cb ( GtkAction *a, VikWindow *vw )
+{
+  const VikCoord* coord;
+  struct UTM utm;
+  gchar *lat = NULL, *lon = NULL;
+
+  coord = vik_viewport_get_center ( vw->viking_vvp );
+  vik_coord_to_utm ( coord, &utm );
+
+  gboolean full_format = FALSE;
+  a_settings_get_boolean ( VIK_SETTINGS_WIN_COPY_CENTRE_FULL_FORMAT, &full_format );
+
+  if ( full_format )
+    // Bells & Whistles - may include degrees, minutes and second symbols
+    get_location_strings ( vw, utm, &lat, &lon );
+  else {
+    // Simple x.xx y.yy format
+    struct LatLon ll;
+    a_coords_utm_to_latlon ( &utm, &ll );
+    lat = g_strdup_printf ( "%.6f", ll.lat );
+    lon = g_strdup_printf ( "%.6f", ll.lon );
+  }
+
+  gchar *msg = g_strdup_printf ( "%s %s", lat, lon );
+  g_free (lat);
+  g_free (lon);
+
+  a_clipboard_copy ( VIK_CLIPBOARD_DATA_TEXT, 0, 0, 0, msg, NULL );
+
+  g_free ( msg );
+}
+
 static void layer_defaults_cb ( GtkAction *a, VikWindow *vw )
 {
   gchar **texts = g_strsplit ( gtk_action_get_name(a), "Layer", 0 );
@@ -3079,6 +3381,10 @@ static void preferences_cb ( GtkAction *a, VikWindow *vw )
     // Update all windows
     g_slist_foreach ( window_list, (GFunc) preferences_change_update, NULL );
   }
+
+  // Ensure TZ Lookup initialized
+  if ( a_vik_get_time_ref_frame() == VIK_TIME_REF_WORLD )
+    vu_setup_lat_lon_tz_lookup();
 }
 
 static void default_location_cb ( GtkAction *a, VikWindow *vw )
@@ -3097,6 +3403,7 @@ static void default_location_cb ( GtkAction *a, VikWindow *vw )
       NULL,
       NULL,
       NULL,
+      NULL,
     },
   };
   VikLayerParam pref_lon[] = {
@@ -3111,6 +3418,7 @@ static void default_location_cb ( GtkAction *a, VikWindow *vw )
       NULL,
       NULL,
       NULL,
+      NULL,
     },
   };
 
@@ -3273,7 +3581,7 @@ static void save_image_dir ( VikWindow *vw, const gchar *fn, guint w, guint h, g
         utm.northing -= ((gdouble)y - (((gdouble)tiles_h)+1)/2) * (h*zoom);
 
       /* move to correct place. */
-      vik_viewport_set_center_utm ( vw->viking_vvp, &utm );
+      vik_viewport_set_center_utm ( vw->viking_vvp, &utm, FALSE );
 
       draw_redraw ( vw );
 
@@ -3282,7 +3590,9 @@ static void save_image_dir ( VikWindow *vw, const gchar *fn, guint w, guint h, g
       gdk_pixbuf_save ( pixbuf_to_save, name_of_file, save_as_png ? "png" : "jpeg", &error, NULL );
       if (error)
       {
-        g_warning("Unable to write to file %s: %s", name_of_file, error->message );
+        gchar *msg = g_strdup_printf (_("Unable to write to file %s: %s"), name_of_file, error->message );
+        vik_statusbar_set_message ( vw->viking_vs, VIK_STATUSBAR_INFO, msg );
+        g_free ( msg );
         g_error_free (error);
       }
 
@@ -3290,7 +3600,7 @@ static void save_image_dir ( VikWindow *vw, const gchar *fn, guint w, guint h, g
     }
   }
 
-  vik_viewport_set_center_utm ( vw->viking_vvp, &utm_orig );
+  vik_viewport_set_center_utm ( vw->viking_vvp, &utm_orig, FALSE );
   vik_viewport_set_xmpp ( vw->viking_vvp, old_xmpp );
   vik_viewport_set_ympp ( vw->viking_vvp, old_ympp );
   vik_viewport_configure ( vw->viking_vvp );
@@ -3348,6 +3658,9 @@ static void draw_to_image_file_total_area_cb (GtkSpinButton *spinbutton, gpointe
   case VIK_UNITS_DISTANCE_MILES:
     label_text = g_strdup_printf ( _("Total area: %ldm x %ldm (%.3f sq. miles)"), (glong)w, (glong)h, (w*h/2589988.11));
     break;
+  case VIK_UNITS_DISTANCE_NAUTICAL_MILES:
+    label_text = g_strdup_printf ( _("Total area: %ldm x %ldm (%.3f sq. NM)"), (glong)w, (glong)h, (w*h/(1852.0*1852.0)));
+    break;
   default:
     label_text = g_strdup_printf ("Just to keep the compiler happy");
     g_critical("Houston, we've had a problem. distance=%d", dist_units);
@@ -3553,8 +3866,8 @@ static void draw_to_image_file ( VikWindow *vw, gboolean one_image_only )
     if ( !fn )
       return;
 
-    gint active = gtk_combo_box_get_active ( GTK_COMBO_BOX(zoom_combo) );
-    gdouble zoom = pow (2, active-2 );
+    gint active_z = gtk_combo_box_get_active ( GTK_COMBO_BOX(zoom_combo) );
+    gdouble zoom = pow (2, active_z-2 );
 
     if ( one_image_only )
       save_image_file ( vw, fn, 
@@ -3737,46 +4050,57 @@ static GtkActionEntry entries[] = {
   { "SaveAs",    GTK_STOCK_SAVE_AS,      N_("Save _As..."),                      NULL,  N_("Save the file under different name"),           (GCallback)save_file_as          },
   { "FileProperties", NULL,              N_("Properties..."),                    NULL,  N_("File Properties"),                              (GCallback)file_properties_cb },
   { "GenImg",    GTK_STOCK_CLEAR,        N_("_Generate Image File..."),          NULL,  N_("Save a snapshot of the workspace into a file"), (GCallback)draw_to_image_file_cb },
-  { "GenImgDir", GTK_STOCK_DND_MULTIPLE, N_("Generate _Directory of Images..."), NULL,  N_("FIXME:IMGDIR"),                                 (GCallback)draw_to_image_dir_cb  },
+  { "GenImgDir", GTK_STOCK_DND_MULTIPLE, N_("Generate _Directory of Images..."), NULL,  N_("Generate _Directory of Images"),                (GCallback)draw_to_image_dir_cb },
   { "Print",    GTK_STOCK_PRINT,        N_("_Print..."),          NULL,         N_("Print maps"), (GCallback)print_cb },
   { "Exit",      GTK_STOCK_QUIT,         N_("E_xit"),                         "<control>W", N_("Exit the program"),                             (GCallback)window_close          },
   { "SaveExit",  GTK_STOCK_QUIT,         N_("Save and Exit"),                 NULL, N_("Save and Exit the program"),                             (GCallback)save_file_and_exit          },
 
+  { "GoBack",    GTK_STOCK_GO_BACK,      N_("Go to the Pre_vious Location"),  NULL,         N_("Go to the previous location"),              (GCallback)draw_goto_back_and_forth },
+  { "GoForward", GTK_STOCK_GO_FORWARD,   N_("Go to the _Next Location"),      NULL,         N_("Go to the next location"),                  (GCallback)draw_goto_back_and_forth },
   { "GotoDefaultLocation", GTK_STOCK_HOME, N_("Go to the _Default Location"),  NULL,         N_("Go to the default location"),                     (GCallback)goto_default_location },
   { "GotoSearch", GTK_STOCK_JUMP_TO,     N_("Go to _Location..."),           NULL,         N_("Go to address/place using text search"),        (GCallback)goto_address       },
   { "GotoLL",    GTK_STOCK_JUMP_TO,      N_("_Go to Lat/Lon..."),           NULL,         N_("Go to arbitrary lat/lon coordinate"),         (GCallback)draw_goto_cb          },
   { "GotoUTM",   GTK_STOCK_JUMP_TO,      N_("Go to UTM..."),                  NULL,         N_("Go to arbitrary UTM coordinate"),               (GCallback)draw_goto_cb          },
   { "Refresh",   GTK_STOCK_REFRESH,      N_("_Refresh"),                      "F5",         N_("Refresh any maps displayed"),               (GCallback)draw_refresh_cb       },
-  { "SetHLColor",GTK_STOCK_SELECT_COLOR, N_("Set _Highlight Color..."),       NULL,         NULL,                                           (GCallback)set_highlight_color   },
-  { "SetBGColor",GTK_STOCK_SELECT_COLOR, N_("Set Bac_kground Color..."),      NULL,         NULL,                                           (GCallback)set_bg_color          },
-  { "ZoomIn",    GTK_STOCK_ZOOM_IN,      N_("Zoom _In"),                   "<control>plus", NULL,                                           (GCallback)draw_zoom_cb          },
-  { "ZoomOut",   GTK_STOCK_ZOOM_OUT,     N_("Zoom _Out"),                 "<control>minus", NULL,                                           (GCallback)draw_zoom_cb          },
-  { "ZoomTo",    GTK_STOCK_ZOOM_FIT,     N_("Zoom _To..."),               "<control>Z", NULL,                                           (GCallback)zoom_to_cb            },
+  { "SetHLColor",GTK_STOCK_SELECT_COLOR, N_("Set _Highlight Color..."),       NULL,         N_("Set Highlight Color"),                      (GCallback)set_highlight_color },
+  { "SetBGColor",GTK_STOCK_SELECT_COLOR, N_("Set Bac_kground Color..."),      NULL,         N_("Set Background Color"),                     (GCallback)set_bg_color },
+  { "ZoomIn",    GTK_STOCK_ZOOM_IN,      N_("Zoom _In"),                  "<control>plus",  N_("Zoom In"),                                  (GCallback)draw_zoom_cb },
+  { "ZoomOut",   GTK_STOCK_ZOOM_OUT,     N_("Zoom _Out"),                 "<control>minus", N_("Zoom Out"),                                 (GCallback)draw_zoom_cb },
+  { "ZoomTo",    GTK_STOCK_ZOOM_FIT,     N_("Zoom _To..."),               "<control>Z",     N_("Zoom To"),                                  (GCallback)zoom_to_cb },
   { "PanNorth",  NULL,                   N_("Pan _North"),                "<control>Up",    NULL,                                           (GCallback)draw_pan_cb },
   { "PanEast",   NULL,                   N_("Pan _East"),                 "<control>Right", NULL,                                           (GCallback)draw_pan_cb },
   { "PanSouth",  NULL,                   N_("Pan _South"),                "<control>Down",  NULL,                                           (GCallback)draw_pan_cb },
   { "PanWest",   NULL,                   N_("Pan _West"),                 "<control>Left",  NULL,                                           (GCallback)draw_pan_cb },
-  { "BGJobs",    GTK_STOCK_EXECUTE,      N_("Background _Jobs"),              NULL,         NULL,                                           (GCallback)a_background_show_window },
+  { "BGJobs",    GTK_STOCK_EXECUTE,      N_("Background _Jobs"),              NULL,         N_("Background Jobs"),                          (GCallback)a_background_show_window },
 
-  { "Cut",       GTK_STOCK_CUT,          N_("Cu_t"),                          NULL,         NULL,                                           (GCallback)menu_cut_layer_cb     },
-  { "Copy",      GTK_STOCK_COPY,         N_("_Copy"),                         NULL,         NULL,                                           (GCallback)menu_copy_layer_cb    },
-  { "Paste",     GTK_STOCK_PASTE,        N_("_Paste"),                        NULL,         NULL,                                           (GCallback)menu_paste_layer_cb   },
-  { "Delete",    GTK_STOCK_DELETE,       N_("_Delete"),                       NULL,         NULL,                                           (GCallback)menu_delete_layer_cb  },
+  { "Cut",       GTK_STOCK_CUT,          N_("Cu_t"),                          NULL,         N_("Cut selected layer"),                       (GCallback)menu_cut_layer_cb     },
+  { "Copy",      GTK_STOCK_COPY,         N_("_Copy"),                         NULL,         N_("Copy selected layer"),                      (GCallback)menu_copy_layer_cb    },
+  { "Paste",     GTK_STOCK_PASTE,        N_("_Paste"),                        NULL,         N_("Paste layer into selected container layer or otherwise above selected layer"), (GCallback)menu_paste_layer_cb },
+  { "Delete",    GTK_STOCK_DELETE,       N_("_Delete"),                       NULL,         N_("Remove selected layer"),                    (GCallback)menu_delete_layer_cb  },
   { "DeleteAll", NULL,                   N_("Delete All"),                    NULL,         NULL,                                           (GCallback)clear_cb              },
+  { "CopyCentre",NULL,                   N_("Copy Centre _Location"),     "<control>h",     NULL,                                           (GCallback)menu_copy_centre_cb   },
   { "MapCacheFlush",NULL,                N_("_Flush Map Cache"),              NULL,         NULL,                                           (GCallback)mapcache_flush_cb     },
   { "SetDefaultLocation", GTK_STOCK_GO_FORWARD, N_("_Set the Default Location"), NULL, N_("Set the Default Location to the current position"),(GCallback)default_location_cb },
-  { "Preferences",GTK_STOCK_PREFERENCES, N_("_Preferences"),                  NULL,         NULL,                                           (GCallback)preferences_cb              },
+  { "Preferences",GTK_STOCK_PREFERENCES, N_("_Preferences"),                  NULL,         N_("Program Preferences"),                      (GCallback)preferences_cb },
   { "LayerDefaults",GTK_STOCK_PROPERTIES, N_("_Layer Defaults"),             NULL,         NULL,                                           NULL },
-  { "Properties",GTK_STOCK_PROPERTIES,   N_("_Properties"),                   NULL,         NULL,                                           (GCallback)menu_properties_cb    },
+  { "Properties",GTK_STOCK_PROPERTIES,   N_("_Properties"),                   NULL,         N_("Layer Properties"),                         (GCallback)menu_properties_cb },
+
+  { "HelpEntry", GTK_STOCK_HELP,         N_("_Help"),                         "F1",         N_("Help"),                                     (GCallback)help_help_cb },
+  { "About",     GTK_STOCK_ABOUT,        N_("_About"),                        NULL,         N_("About"),                                    (GCallback)help_about_cb },
+};
 
-  { "HelpEntry", GTK_STOCK_HELP,         N_("_Help"),                         "F1",         NULL,                                           (GCallback)help_help_cb     },
-  { "About",     GTK_STOCK_ABOUT,        N_("_About"),                        NULL,         NULL,                                           (GCallback)help_about_cb    },
+static GtkActionEntry debug_entries[] = {
+  { "MapCacheInfo", NULL,                "_Map Cache Info",                   NULL,         NULL,                                           (GCallback)help_cache_info_cb    },
 };
 
 static GtkActionEntry entries_gpsbabel[] = {
   { "ExportKML", NULL,                   N_("_KML..."),                      NULL,         N_("Export as KML"),                                (GCallback)export_to_kml },
 };
 
+static GtkActionEntry entries_geojson[] = {
+  { "AcquireGeoJSON",   NULL,            N_("Import Geo_JSON File..."),   NULL,         N_("Import GeoJSON file"),                          (GCallback)acquire_from_geojson },
+};
+
 /* Radio items */
 /* FIXME use VIEWPORT_DRAWMODE values */
 static GtkRadioActionEntry mode_entries[] = {
@@ -3829,9 +4153,17 @@ static void window_create_ui( VikWindow *window )
   gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), window);
   gtk_action_group_add_toggle_actions (action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), window);
   gtk_action_group_add_radio_actions (action_group, mode_entries, G_N_ELEMENTS (mode_entries), 4, (GCallback)window_change_coord_mode_cb, window);
+  if ( vik_debug ) {
+    if ( gtk_ui_manager_add_ui_from_string ( uim,
+         "<ui><menubar name='MainMenu'><menu action='Help'><menuitem action='MapCacheInfo'/></menu></menubar></ui>",
+         -1, NULL ) ) {
+      gtk_action_group_add_actions (action_group, debug_entries, G_N_ELEMENTS (debug_entries), window);
+    }
+  }
+
 
   // Use this to see if GPSBabel is available:
-  if ( a_babel_device_list ) {
+  if ( a_babel_available () ) {
        // If going to add more entries then might be worth creating a menu_gpsbabel.xml.h file
        if ( gtk_ui_manager_add_ui_from_string ( uim,
          "<ui><menubar name='MainMenu'><menu action='File'><menu action='Export'><menuitem action='ExportKML'/></menu></menu></menubar></ui>",
@@ -3839,6 +4171,14 @@ static void window_create_ui( VikWindow *window )
       gtk_action_group_add_actions ( action_group, entries_gpsbabel, G_N_ELEMENTS (entries_gpsbabel), window );
   }
 
+  // GeoJSON import capability
+  if ( g_find_program_in_path ( a_geojson_program_import() ) ) {
+    if ( gtk_ui_manager_add_ui_from_string ( uim,
+         "<ui><menubar name='MainMenu'><menu action='File'><menu action='Acquire'><menuitem action='AcquireGeoJSON'/></menu></menu></menubar></ui>",
+         -1, &error ) )
+      gtk_action_group_add_actions ( action_group, entries_geojson, G_N_ELEMENTS (entries_geojson), window );
+  }
+
   icon_factory = gtk_icon_factory_new ();
   gtk_icon_factory_add_default (icon_factory);