]> git.street.me.uk Git - andy/viking.git/blobdiff - src/vikwindow.c
Remove dependencies to gob2
[andy/viking.git] / src / vikwindow.c
index 012fda638773c3a9a827b5a8e854a38617ae4cec..2863e0f82825fa8b4e44711c1997cd5b5f945f4b 100644 (file)
 #include "googlesearch.h"
 #include "dems.h"
 #include "print.h"
 #include "googlesearch.h"
 #include "dems.h"
 #include "print.h"
+#include "preferences.h"
+#include "icons/icons.h"
 
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
 #include <ctype.h>
 
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
 #include <ctype.h>
+#include <glib.h>
+#include <glib/gstdio.h>
 #include <glib/gprintf.h>
 #include <glib/gi18n.h>
 #include <glib/gprintf.h>
 #include <glib/gi18n.h>
-#ifdef WINDOWS
-/* TODO IMPORTANT: mkdir for windows header? is it called 'mkdir' */
-#define make_dir(dir) mkdir(dir)
-#else
-#include <sys/types.h>
-#include <sys/stat.h>
-#define make_dir(dir) mkdir(dir,0777)
-#endif
 
 #define VIKING_WINDOW_WIDTH      1000
 #define VIKING_WINDOW_HEIGHT     800
 
 #define VIKING_WINDOW_WIDTH      1000
 #define VIKING_WINDOW_HEIGHT     800
@@ -107,8 +103,9 @@ static toolbox_tools_t* toolbox_create(VikWindow *vw);
 static void toolbox_add_tool(toolbox_tools_t *vt, VikToolInterface *vti, gint layer_type );
 static int toolbox_get_tool(toolbox_tools_t *vt, const gchar *tool_name);
 static void toolbox_activate(toolbox_tools_t *vt, const gchar *tool_name);
 static void toolbox_add_tool(toolbox_tools_t *vt, VikToolInterface *vti, gint layer_type );
 static int toolbox_get_tool(toolbox_tools_t *vt, const gchar *tool_name);
 static void toolbox_activate(toolbox_tools_t *vt, const gchar *tool_name);
+static const GdkCursor *toolbox_get_cursor(toolbox_tools_t *vt, const gchar *tool_name);
 static void toolbox_click (toolbox_tools_t *vt, GdkEventButton *event);
 static void toolbox_click (toolbox_tools_t *vt, GdkEventButton *event);
-static void toolbox_move (toolbox_tools_t *vt, GdkEventButton *event);
+static void toolbox_move (toolbox_tools_t *vt, GdkEventMotion *event);
 static void toolbox_release (toolbox_tools_t *vt, GdkEventButton *event);
 
 
 static void toolbox_release (toolbox_tools_t *vt, GdkEventButton *event);
 
 
@@ -161,7 +158,8 @@ struct _VikWindow {
 };
 
 enum {
 };
 
 enum {
- TOOL_ZOOM = 0,
+ TOOL_PAN = 0,
+ TOOL_ZOOM,
  TOOL_RULER,
  TOOL_LAYER,
  NUMBER_OF_TOOLS
  TOOL_RULER,
  TOOL_LAYER,
  NUMBER_OF_TOOLS
@@ -175,10 +173,7 @@ enum {
 
 static guint window_signals[VW_LAST_SIGNAL] = { 0 };
 
 
 static guint window_signals[VW_LAST_SIGNAL] = { 0 };
 
-static gchar *tool_names[NUMBER_OF_TOOLS] = { N_("Zoom"), N_("Ruler"), N_("Pan") };
-
-GdkCursor *vw_cursor_zoom = NULL;
-GdkCursor *vw_cursor_ruler = NULL;
+static gchar *tool_names[NUMBER_OF_TOOLS] = { N_("Pan"), N_("Zoom"), N_("Ruler") };
 
 GType vik_window_get_type (void)
 {
 
 GType vik_window_get_type (void)
 {
@@ -272,7 +267,7 @@ static void window_init ( VikWindow *vw )
   window_create_ui(vw);
   window_set_filename (vw, NULL);
   
   window_create_ui(vw);
   window_set_filename (vw, NULL);
   
-  toolbox_activate(vw->vt, "Zoom");
+  toolbox_activate(vw->vt, "Pan");
 
   vw->filename = NULL;
   vw->item_factory = NULL;
 
   vw->filename = NULL;
   vw->item_factory = NULL;
@@ -280,7 +275,6 @@ static void window_init ( VikWindow *vw )
   vw->modified = FALSE;
   vw->only_updating_coord_mode_ui = FALSE;
   
   vw->modified = FALSE;
   vw->only_updating_coord_mode_ui = FALSE;
   
-
   vw->pan_x = vw->pan_y = -1;
   vw->draw_image_width = DRAW_IMAGE_DEFAULT_WIDTH;
   vw->draw_image_height = DRAW_IMAGE_DEFAULT_HEIGHT;
   vw->pan_x = vw->pan_y = -1;
   vw->draw_image_width = DRAW_IMAGE_DEFAULT_WIDTH;
   vw->draw_image_height = DRAW_IMAGE_DEFAULT_HEIGHT;
@@ -311,8 +305,8 @@ static void window_init ( VikWindow *vw )
   gtk_window_set_default_size ( GTK_WINDOW(vw), VIKING_WINDOW_WIDTH, VIKING_WINDOW_HEIGHT);
 
   hpaned = gtk_hpaned_new ();
   gtk_window_set_default_size ( GTK_WINDOW(vw), VIKING_WINDOW_WIDTH, VIKING_WINDOW_HEIGHT);
 
   hpaned = gtk_hpaned_new ();
-  gtk_paned_add1 ( GTK_PANED(hpaned), GTK_WIDGET (vw->viking_vlp) );
-  gtk_paned_add2 ( GTK_PANED(hpaned), GTK_WIDGET (vw->viking_vvp) );
+  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 );
 
   /* This packs the button into the window (a gtk container). */
   gtk_box_pack_start (GTK_BOX(main_vbox), hpaned, TRUE, TRUE, 0);
 
   /* This packs the button into the window (a gtk container). */
   gtk_box_pack_start (GTK_BOX(main_vbox), hpaned, TRUE, TRUE, 0);
@@ -402,13 +396,23 @@ static void draw_status ( VikWindow *vw )
 void vik_window_set_redraw_trigger(VikLayer *vl)
 {
   VikWindow *vw = VIK_WINDOW(VIK_GTK_WINDOW_FROM_LAYER(vl));
 void vik_window_set_redraw_trigger(VikLayer *vl)
 {
   VikWindow *vw = VIK_WINDOW(VIK_GTK_WINDOW_FROM_LAYER(vl));
-  vw->trigger = vl;
+  if (NULL != vw)
+    vw->trigger = vl;
 }
 
 static void window_configure_event ( VikWindow *vw )
 {
 }
 
 static void window_configure_event ( VikWindow *vw )
 {
+  static int first = 1;
   draw_redraw ( vw );
   draw_redraw ( vw );
-  gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, vw_cursor_zoom );
+  if (first) {
+    // This is a hack to set the cursor corresponding to the first tool
+    // FIXME find the correct way to initialize both tool and its cursor
+    const GdkCursor *cursor = NULL;
+    first = 0;
+    cursor = toolbox_get_cursor(vw->vt, "Pan");
+    /* We set cursor, even if it is NULL: it resets to default */
+    gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, cursor );
+  }
 }
 
 static void draw_redraw ( VikWindow *vw )
 }
 
 static void draw_redraw ( VikWindow *vw )
@@ -451,6 +455,13 @@ static gboolean draw_buf(gpointer data)
 
 /* Mouse event handlers ************************************************************************/
 
 
 /* Mouse event handlers ************************************************************************/
 
+static void vik_window_pan_click (VikWindow *vw, GdkEventButton *event)
+{
+  /* set panning origin */
+  vw->pan_x = (gint) event->x;
+  vw->pan_y = (gint) event->y;
+}
+
 static void draw_click (VikWindow *vw, GdkEventButton *event)
 {
   gtk_widget_grab_focus ( GTK_WIDGET(vw->viking_vvp) );
 static void draw_click (VikWindow *vw, GdkEventButton *event)
 {
   gtk_widget_grab_focus ( GTK_WIDGET(vw->viking_vvp) );
@@ -459,30 +470,38 @@ static void draw_click (VikWindow *vw, GdkEventButton *event)
    * for panning and zooming; tools only get left/right/movement 
    */
   if ( event->button == 2) {
    * for panning and zooming; tools only get left/right/movement 
    */
   if ( event->button == 2) {
-    /* set panning origin */
-    vw->pan_x = (gint) event->x;
-    vw->pan_y = (gint) event->y;
+    vik_window_pan_click ( vw, event );
   } 
   else {
     toolbox_click(vw->vt, event);
   }
 }
 
   } 
   else {
     toolbox_click(vw->vt, event);
   }
 }
 
+static void vik_window_pan_move (VikWindow *vw, GdkEventMotion *event)
+{
+  if ( vw->pan_x != -1 ) {
+    vik_viewport_pan_sync ( vw->viking_vvp, event->x - vw->pan_x, event->y - vw->pan_y );
+  }
+}
+
 static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event)
 {
   static VikCoord coord;
   static struct UTM utm;
   static struct LatLon ll;
 static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event)
 {
   static VikCoord coord;
   static struct UTM utm;
   static struct LatLon ll;
-  static char pointer_buf[36];
+  #define BUFFER_SIZE 50
+  static char pointer_buf[BUFFER_SIZE];
+  gchar *lat = NULL, *lon = NULL;
   gint16 alt;
   gdouble zoom;
   VikDemInterpol interpol_method;
 
   gint16 alt;
   gdouble zoom;
   VikDemInterpol interpol_method;
 
-  toolbox_move(vw->vt, (GdkEventButton *)event);
+  toolbox_move(vw->vt, event);
 
   vik_viewport_screen_to_coord ( vw->viking_vvp, event->x, event->y, &coord );
   vik_coord_to_utm ( &coord, &utm );
   a_coords_utm_to_latlon ( &utm, &ll );
 
   vik_viewport_screen_to_coord ( vw->viking_vvp, event->x, event->y, &coord );
   vik_coord_to_utm ( &coord, &utm );
   a_coords_utm_to_latlon ( &utm, &ll );
+  a_coords_latlon_to_string ( &ll, &lat, &lon );
   /* Change interpolate method according to scale */
   zoom = vik_viewport_get_zoom(vw->viking_vvp);
   if (zoom > 2.0)
   /* Change interpolate method according to scale */
   zoom = vik_viewport_get_zoom(vw->viking_vvp);
   if (zoom > 2.0)
@@ -492,14 +511,27 @@ static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event)
   else
     interpol_method = VIK_DEM_INTERPOL_BEST;
   if ((alt = a_dems_get_elev_by_coord(&coord, interpol_method)) != VIK_DEM_INVALID_ELEVATION)
   else
     interpol_method = VIK_DEM_INTERPOL_BEST;
   if ((alt = a_dems_get_elev_by_coord(&coord, interpol_method)) != VIK_DEM_INVALID_ELEVATION)
-    g_snprintf ( pointer_buf, 36, _("Cursor: %f %f %dm"), ll.lat, ll.lon, alt );
+    g_snprintf ( pointer_buf, BUFFER_SIZE, _("%s %s %dm"), lat, lon, alt );
   else
   else
-    g_snprintf ( pointer_buf, 36, _("Cursor: %f %f"), ll.lat, ll.lon );
+    g_snprintf ( pointer_buf, BUFFER_SIZE, _("%s %s"), lat, lon );
+  g_free (lat);
+  lat = NULL;
+  g_free (lon);
+  lon = NULL;
   vik_statusbar_set_message ( vw->viking_vs, 4, pointer_buf );
 
   vik_statusbar_set_message ( vw->viking_vs, 4, pointer_buf );
 
-  if ( vw->pan_x != -1 ) {
-    vik_viewport_pan_sync ( vw->viking_vvp, event->x - vw->pan_x, event->y - vw->pan_y );
-  }
+  vik_window_pan_move ( vw, event );
+}
+
+static void vik_window_pan_release ( VikWindow *vw, GdkEventButton *event )
+{
+  if ( ABS(vw->pan_x - event->x) <= 1 && ABS(vw->pan_y - event->y) <= 1 )
+    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 );
+  draw_update ( vw );
+  vw->pan_x = vw->pan_y = -1;
 }
 
 static void draw_release ( VikWindow *vw, GdkEventButton *event )
 }
 
 static void draw_release ( VikWindow *vw, GdkEventButton *event )
@@ -507,13 +539,7 @@ static void draw_release ( VikWindow *vw, GdkEventButton *event )
   gtk_widget_grab_focus ( GTK_WIDGET(vw->viking_vvp) );
 
   if ( event->button == 2 ) {  /* move / pan */
   gtk_widget_grab_focus ( GTK_WIDGET(vw->viking_vvp) );
 
   if ( event->button == 2 ) {  /* move / pan */
-    if ( ABS(vw->pan_x - event->x) <= 1 && ABS(vw->pan_y - event->y) <= 1 )
-        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 );
-      draw_update ( vw );
-      vw->pan_x = vw->pan_y = -1;
+    vik_window_pan_release(vw, event);
   }
   else {
     toolbox_release(vw->vt, event);
   }
   else {
     toolbox_release(vw->vt, event);
@@ -764,14 +790,16 @@ static VikLayerToolFuncStatus ruler_click (VikLayer *vl, GdkEventButton *event,
   VikCoord coord;
   gchar *temp;
   if ( event->button == 1 ) {
   VikCoord coord;
   gchar *temp;
   if ( event->button == 1 ) {
+    gchar *lat=NULL, *lon=NULL;
     vik_viewport_screen_to_coord ( s->vvp, (gint) event->x, (gint) event->y, &coord );
     vik_coord_to_latlon ( &coord, &ll );
     vik_viewport_screen_to_coord ( s->vvp, (gint) event->x, (gint) event->y, &coord );
     vik_coord_to_latlon ( &coord, &ll );
+    a_coords_latlon_to_string ( &ll, &lat, &lon );
     if ( s->has_oldcoord ) {
     if ( s->has_oldcoord ) {
-      temp = g_strdup_printf ( "%f %f DIFF %f meters", ll.lat, ll.lon, vik_coord_diff( &coord, &(s->oldcoord) ) );
+      temp = g_strdup_printf ( "%s %s DIFF %f meters", lat, lon, vik_coord_diff( &coord, &(s->oldcoord) ) );
       s->has_oldcoord = FALSE;
     }
     else {
       s->has_oldcoord = FALSE;
     }
     else {
-      temp = g_strdup_printf ( "%f %f", ll.lat, ll.lon );
+      temp = g_strdup_printf ( "%s %s", lat, lon );
       s->has_oldcoord = TRUE;
     }
 
       s->has_oldcoord = TRUE;
     }
 
@@ -787,7 +815,7 @@ static VikLayerToolFuncStatus ruler_click (VikLayer *vl, GdkEventButton *event,
   return VIK_LAYER_TOOL_ACK;
 }
 
   return VIK_LAYER_TOOL_ACK;
 }
 
-static VikLayerToolFuncStatus ruler_move (VikLayer *vl, GdkEventButton *event, ruler_tool_state_t *s)
+static VikLayerToolFuncStatus ruler_move (VikLayer *vl, GdkEventMotion *event, ruler_tool_state_t *s)
 {
   VikViewport *vvp = s->vvp;
   VikWindow *vw = s->vw;
 {
   VikViewport *vvp = s->vvp;
   VikWindow *vw = s->vw;
@@ -799,6 +827,7 @@ static VikLayerToolFuncStatus ruler_move (VikLayer *vl, GdkEventButton *event, r
   if ( s->has_oldcoord ) {
     int oldx, oldy, w1, h1, w2, h2;
     static GdkPixmap *buf = NULL;
   if ( s->has_oldcoord ) {
     int oldx, oldy, w1, h1, w2, h2;
     static GdkPixmap *buf = NULL;
+    gchar *lat=NULL, *lon=NULL;
     w1 = vik_viewport_get_width(vvp); 
     h1 = vik_viewport_get_height(vvp);
     if (!buf) {
     w1 = vik_viewport_get_width(vvp); 
     h1 = vik_viewport_get_height(vvp);
     if (!buf) {
@@ -825,8 +854,8 @@ static VikLayerToolFuncStatus ruler_move (VikLayer *vl, GdkEventButton *event, r
       g_idle_add_full (G_PRIORITY_HIGH_IDLE + 10, draw_buf, pass_along, NULL);
       draw_buf_done = FALSE;
     }
       g_idle_add_full (G_PRIORITY_HIGH_IDLE + 10, draw_buf, pass_along, NULL);
       draw_buf_done = FALSE;
     }
-
-    temp = g_strdup_printf ( "%f %f DIFF %f meters", ll.lat, ll.lon, vik_coord_diff( &coord, &(s->oldcoord) ) );
+    a_coords_latlon_to_string(&ll, &lat, &lon);
+    temp = g_strdup_printf ( "%s %s DIFF %f meters", lat, lon, vik_coord_diff( &coord, &(s->oldcoord) ) );
     vik_statusbar_set_message ( vw->viking_vs, 3, temp );
     g_free ( temp );
   }
     vik_statusbar_set_message ( vw->viking_vs, 3, temp );
     g_free ( temp );
   }
@@ -850,8 +879,11 @@ static VikToolInterface ruler_tool =
     (VikToolActivationFunc) NULL,
     (VikToolActivationFunc) ruler_deactivate, 
     (VikToolMouseFunc) ruler_click, 
     (VikToolActivationFunc) NULL,
     (VikToolActivationFunc) ruler_deactivate, 
     (VikToolMouseFunc) ruler_click, 
-    (VikToolMouseFunc) ruler_move, 
-    (VikToolMouseFunc) ruler_release };
+    (VikToolMouseMoveFunc) ruler_move, 
+    (VikToolMouseFunc) ruler_release,
+    NULL,
+    GDK_CURSOR_IS_PIXMAP,
+    &cursor_ruler_pixbuf };
 /*** end ruler code ********************************************************/
 
 
 /*** end ruler code ********************************************************/
 
 
@@ -876,7 +908,7 @@ static VikLayerToolFuncStatus zoomtool_click (VikLayer *vl, GdkEventButton *even
   return VIK_LAYER_TOOL_ACK;
 }
 
   return VIK_LAYER_TOOL_ACK;
 }
 
-static VikLayerToolFuncStatus zoomtool_move (VikLayer *vl, GdkEventButton *event, VikViewport *vvp)
+static VikLayerToolFuncStatus zoomtool_move (VikLayer *vl, GdkEventMotion *event, VikViewport *vvp)
 {
   return VIK_LAYER_TOOL_ACK;
 }
 {
   return VIK_LAYER_TOOL_ACK;
 }
@@ -893,9 +925,55 @@ static VikToolInterface zoom_tool =
     (VikToolActivationFunc) NULL,
     (VikToolActivationFunc) NULL,
     (VikToolMouseFunc) zoomtool_click, 
     (VikToolActivationFunc) NULL,
     (VikToolActivationFunc) NULL,
     (VikToolMouseFunc) zoomtool_click, 
-    (VikToolMouseFunc) zoomtool_move,
-    (VikToolMouseFunc) zoomtool_release };
-/*** end ruler code ********************************************************/
+    (VikToolMouseMoveFunc) zoomtool_move,
+    (VikToolMouseFunc) zoomtool_release,
+    NULL,
+    GDK_CURSOR_IS_PIXMAP,
+    &cursor_zoom_pixbuf };
+/*** end zoom code ********************************************************/
+
+/********************************************************************************
+ ** Pan tool code
+ ********************************************************************************/
+static gpointer pantool_create (VikWindow *vw, VikViewport *vvp)
+{
+  return vw;
+}
+
+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 );
+  return VIK_LAYER_TOOL_ACK;
+}
+
+static VikLayerToolFuncStatus pantool_move (VikLayer *vl, GdkEventMotion *event, VikWindow *vw)
+{
+  vik_window_pan_move ( vw, event );
+  return VIK_LAYER_TOOL_ACK;
+}
+
+static VikLayerToolFuncStatus pantool_release (VikLayer *vl, GdkEventButton *event, VikWindow *vw)
+{
+  if ( event->button == 1 )
+    vik_window_pan_release ( vw, event );
+  return VIK_LAYER_TOOL_ACK;
+}
+
+static VikToolInterface pan_tool = 
+  { "Pan", 
+    (VikToolConstructorFunc) pantool_create,
+    (VikToolDestructorFunc) NULL,
+    (VikToolActivationFunc) NULL,
+    (VikToolActivationFunc) NULL,
+    (VikToolMouseFunc) pantool_click, 
+    (VikToolMouseMoveFunc) pantool_move,
+    (VikToolMouseFunc) pantool_release,
+    NULL,
+    GDK_FLEUR };
+/*** end pan code ********************************************************/
 
 static void draw_pan_cb ( GtkAction *a, VikWindow *vw )
 {
 
 static void draw_pan_cb ( GtkAction *a, VikWindow *vw )
 {
@@ -911,6 +989,16 @@ static void draw_pan_cb ( GtkAction *a, VikWindow *vw )
   draw_update ( vw );
 }
 
   draw_update ( vw );
 }
 
+static void full_screen_cb ( GtkAction *a, VikWindow *vw )
+{
+  GtkWidget *check_box = gtk_ui_manager_get_widget ( vw->uim, "/ui/MainMenu/View/FullScreen" );
+  g_assert(check_box);
+  gboolean state = gtk_check_menu_item_get_active ( GTK_CHECK_MENU_ITEM(check_box));
+  if ( state )
+    gtk_window_fullscreen ( GTK_WINDOW(vw) );
+  else
+    gtk_window_unfullscreen ( GTK_WINDOW(vw) );
+}
 
 static void draw_zoom_cb ( GtkAction *a, VikWindow *vw )
 {
 
 static void draw_zoom_cb ( GtkAction *a, VikWindow *vw )
 {
@@ -965,7 +1053,7 @@ void draw_goto_cb ( GtkAction *a, VikWindow *vw )
      return;
   }
   else {
      return;
   }
   else {
-    g_critical("Houston we have a problem\n");
+    g_critical("Houston, we've had a problem.");
     return;
   }
 
     return;
   }
 
@@ -1028,6 +1116,17 @@ static void menu_delete_layer_cb ( GtkAction *a, VikWindow *vw )
     a_dialog_info_msg ( GTK_WINDOW(vw), _("You must select a layer to delete.") );
 }
 
     a_dialog_info_msg ( GTK_WINDOW(vw), _("You must select a layer to delete.") );
 }
 
+static void view_side_panel_cb ( GtkAction *a, VikWindow *vw )
+{
+  GtkWidget *check_box = gtk_ui_manager_get_widget ( vw->uim, "/ui/MainMenu/View/ViewSidePanel" );
+  g_assert(check_box);
+  gboolean state = gtk_check_menu_item_get_active ( GTK_CHECK_MENU_ITEM(check_box));
+  if ( state )
+    gtk_widget_show(GTK_WIDGET(vw->viking_vlp));
+  else
+    gtk_widget_hide(GTK_WIDGET(vw->viking_vlp));
+}
+
 /***************************************
  ** tool management routines
  **
 /***************************************
  ** tool management routines
  **
@@ -1098,6 +1197,24 @@ static void toolbox_activate(toolbox_tools_t *vt, const gchar *tool_name)
   vt->active_tool = tool;
 }
 
   vt->active_tool = tool;
 }
 
+static const GdkCursor *toolbox_get_cursor(toolbox_tools_t *vt, const gchar *tool_name)
+{
+  int tool = toolbox_get_tool(vt, tool_name);
+  toolbox_tool_t *t = &vt->tools[tool];
+  if (t->ti.cursor == NULL) {
+    if (t->ti.cursor_type == GDK_CURSOR_IS_PIXMAP && t->ti.cursor_data != NULL) {
+      GError *cursor_load_err = NULL;
+      GdkPixbuf *cursor_pixbuf = gdk_pixbuf_from_pixdata (t->ti.cursor_data, FALSE, &cursor_load_err);
+      /* TODO: settable offeset */
+      t->ti.cursor = gdk_cursor_new_from_pixbuf ( gdk_display_get_default(), cursor_pixbuf, 3, 3 );
+      g_object_unref ( G_OBJECT(cursor_pixbuf) );
+    } else {
+      t->ti.cursor = gdk_cursor_new ( t->ti.cursor_type );
+    }
+  }
+  return t->ti.cursor;
+}
+
 static void toolbox_click (toolbox_tools_t *vt, GdkEventButton *event)
 {
   VikLayer *vl = vik_layers_panel_get_selected ( vt->vw->viking_vlp );
 static void toolbox_click (toolbox_tools_t *vt, GdkEventButton *event)
 {
   VikLayer *vl = vik_layers_panel_get_selected ( vt->vw->viking_vlp );
@@ -1108,7 +1225,7 @@ static void toolbox_click (toolbox_tools_t *vt, GdkEventButton *event)
   }
 }
 
   }
 }
 
-static void toolbox_move (toolbox_tools_t *vt, GdkEventButton *event)
+static void toolbox_move (toolbox_tools_t *vt, GdkEventMotion *event)
 {
   VikLayer *vl = vik_layers_panel_get_selected ( vt->vw->viking_vlp );
   if (vt->active_tool != -1 && vt->tools[vt->active_tool].ti.move) {
 {
   VikLayer *vl = vik_layers_panel_get_selected ( vt->vw->viking_vlp );
   if (vt->active_tool != -1 && vt->tools[vt->active_tool].ti.move) {
@@ -1140,16 +1257,22 @@ static void menu_tool_cb ( GtkAction *old, GtkAction *a, VikWindow *vw )
 {
   /* White Magic, my friends ... White Magic... */
   int layer_id, tool_id;
 {
   /* White Magic, my friends ... White Magic... */
   int layer_id, tool_id;
+  const GdkCursor *cursor = NULL;
 
   toolbox_activate(vw->vt, gtk_action_get_name(a));
 
 
   toolbox_activate(vw->vt, gtk_action_get_name(a));
 
-  if (!strcmp(gtk_action_get_name(a), "Zoom")) {
+  cursor = toolbox_get_cursor(vw->vt, gtk_action_get_name(a));
+  /* We set cursor, even if it is NULL: it resets to default */
+  gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, cursor );
+
+  if (!strcmp(gtk_action_get_name(a), "Pan")) {
+    vw->current_tool = TOOL_PAN;
+  } 
+  else if (!strcmp(gtk_action_get_name(a), "Zoom")) {
     vw->current_tool = TOOL_ZOOM;
     vw->current_tool = TOOL_ZOOM;
-    gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, vw_cursor_zoom );
   } 
   else if (!strcmp(gtk_action_get_name(a), "Ruler")) {
     vw->current_tool = TOOL_RULER;
   } 
   else if (!strcmp(gtk_action_get_name(a), "Ruler")) {
     vw->current_tool = TOOL_RULER;
-    gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, vw_cursor_ruler );
   }
   else {
     /* TODO: only enable tools from active layer */
   }
   else {
     /* TODO: only enable tools from active layer */
@@ -1159,7 +1282,6 @@ static void menu_tool_cb ( GtkAction *old, GtkAction *a, VikWindow *vw )
            vw->current_tool = TOOL_LAYER;
            vw->tool_layer_id = layer_id;
            vw->tool_tool_id = tool_id;
            vw->current_tool = TOOL_LAYER;
            vw->tool_layer_id = layer_id;
            vw->tool_tool_id = tool_id;
-           gdk_window_set_cursor ( GTK_WIDGET(vw->viking_vvp)->window, vik_layer_get_tool_cursor ( layer_id, tool_id ) );
        }
       }
     }
        }
       }
     }
@@ -1193,11 +1315,11 @@ GtkWidget *vik_window_get_drawmode_button ( VikWindow *vw, VikViewportDrawMode m
   GtkWidget *mode_button;
   gchar *buttonname;
   switch ( mode ) {
   GtkWidget *mode_button;
   gchar *buttonname;
   switch ( mode ) {
-    case VIK_VIEWPORT_DRAWMODE_UTM: buttonname = "/ui/MainMenu/View/ModeUTM"; break;
+#ifdef VIK_CONFIG_EXPEDIA
     case VIK_VIEWPORT_DRAWMODE_EXPEDIA: buttonname = "/ui/MainMenu/View/ModeExpedia"; break;
     case VIK_VIEWPORT_DRAWMODE_EXPEDIA: buttonname = "/ui/MainMenu/View/ModeExpedia"; break;
-    case VIK_VIEWPORT_DRAWMODE_GOOGLE: buttonname = "/ui/MainMenu/View/ModeGoogle"; break;
+#endif
     case VIK_VIEWPORT_DRAWMODE_MERCATOR: buttonname = "/ui/MainMenu/View/ModeMercator"; break;
     case VIK_VIEWPORT_DRAWMODE_MERCATOR: buttonname = "/ui/MainMenu/View/ModeMercator"; break;
-    default: buttonname = "/ui/MainMenu/View/ModeKH";
+    default: buttonname = "/ui/MainMenu/View/ModeUTM";
   }
   mode_button = gtk_ui_manager_get_widget ( vw->uim, buttonname );
   g_assert ( mode_button );
   }
   mode_button = gtk_ui_manager_get_widget ( vw->uim, buttonname );
   g_assert ( mode_button );
@@ -1236,6 +1358,8 @@ void vik_window_open_file ( VikWindow *vw, const gchar *filename, gboolean chang
 }
 static void load_file ( GtkAction *a, VikWindow *vw )
 {
 }
 static void load_file ( GtkAction *a, VikWindow *vw )
 {
+  GSList *files = NULL;
+  GSList *cur_file = NULL;
   gboolean newwindow;
   if (!strcmp(gtk_action_get_name(a), "Open")) {
     newwindow = TRUE;
   gboolean newwindow;
   if (!strcmp(gtk_action_get_name(a), "Open")) {
     newwindow = TRUE;
@@ -1244,18 +1368,23 @@ static void load_file ( GtkAction *a, VikWindow *vw )
     newwindow = FALSE;
   } 
   else {
     newwindow = FALSE;
   } 
   else {
-    g_critical("Houston we got a problem\n");
+    g_critical("Houston, we've had a problem.");
     return;
   }
     
   if ( ! vw->open_dia )
   {
     return;
   }
     
   if ( ! vw->open_dia )
   {
-    vw->open_dia = gtk_file_selection_new ( _("Please select a GPS data file to open. ") );
-    gtk_file_selection_set_select_multiple ( GTK_FILE_SELECTION(vw->open_dia), TRUE );
+    vw->open_dia = gtk_file_chooser_dialog_new (_("Please select a GPS data file to open. "),
+                                     GTK_WINDOW(vw),
+                                     GTK_FILE_CHOOSER_ACTION_OPEN,
+                                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                     GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                                     NULL);
+    gtk_file_chooser_set_select_multiple ( GTK_FILE_CHOOSER(vw->open_dia), TRUE );
     gtk_window_set_transient_for ( GTK_WINDOW(vw->open_dia), GTK_WINDOW(vw) );
     gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->open_dia), TRUE );
   }
     gtk_window_set_transient_for ( GTK_WINDOW(vw->open_dia), GTK_WINDOW(vw) );
     gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->open_dia), TRUE );
   }
-  if ( gtk_dialog_run ( GTK_DIALOG(vw->open_dia) ) == GTK_RESPONSE_OK )
+  if ( gtk_dialog_run ( GTK_DIALOG(vw->open_dia) ) == GTK_RESPONSE_ACCEPT )
   {
     gtk_widget_hide ( vw->open_dia );
 #ifdef VIKING_PROMPT_IF_MODIFIED
   {
     gtk_widget_hide ( vw->open_dia );
 #ifdef VIKING_PROMPT_IF_MODIFIED
@@ -1263,14 +1392,19 @@ static void load_file ( GtkAction *a, VikWindow *vw )
 #else
     if ( vw->filename && newwindow )
 #endif
 #else
     if ( vw->filename && newwindow )
 #endif
-      g_signal_emit ( G_OBJECT(vw), window_signals[VW_OPENWINDOW_SIGNAL], 0, gtk_file_selection_get_selections (GTK_FILE_SELECTION(vw->open_dia) ) );
+      g_signal_emit ( G_OBJECT(vw), window_signals[VW_OPENWINDOW_SIGNAL], 0, gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER(vw->open_dia) ) );
     else {
     else {
-      gchar **files = gtk_file_selection_get_selections (GTK_FILE_SELECTION(vw->open_dia) );
-      gboolean change_fn = newwindow && (!files[1]); /* only change fn if one file */
-      while ( *files ) {
-        vik_window_open_file ( vw, *files, change_fn );
-        files++;
+      files = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER(vw->open_dia) );
+      gboolean change_fn = newwindow && (g_slist_length(files)==1); /* only change fn if one file */
+      
+      cur_file = files;
+      while ( cur_file ) {
+        gchar *file_name = cur_file->data;
+        vik_window_open_file ( vw, file_name, change_fn );
+        g_free (file_name);
+        cur_file = g_slist_next (cur_file);
       }
       }
+      g_slist_free (files);
     }
   }
   else
     }
   }
   else
@@ -1283,15 +1417,20 @@ static gboolean save_file_as ( GtkAction *a, VikWindow *vw )
   const gchar *fn;
   if ( ! vw->save_dia )
   {
   const gchar *fn;
   if ( ! vw->save_dia )
   {
-    vw->save_dia = gtk_file_selection_new ( _("Save as Viking File.") );
+    vw->save_dia = gtk_file_chooser_dialog_new (_("Save as Viking File."),
+                                     GTK_WINDOW(vw),
+                                     GTK_FILE_CHOOSER_ACTION_SAVE,
+                                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                     GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+                                     NULL);
     gtk_window_set_transient_for ( GTK_WINDOW(vw->save_dia), GTK_WINDOW(vw) );
     gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->save_dia), TRUE );
   }
 
     gtk_window_set_transient_for ( GTK_WINDOW(vw->save_dia), GTK_WINDOW(vw) );
     gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->save_dia), TRUE );
   }
 
-  while ( gtk_dialog_run ( GTK_DIALOG(vw->save_dia) ) == GTK_RESPONSE_OK )
+  while ( gtk_dialog_run ( GTK_DIALOG(vw->save_dia) ) == GTK_RESPONSE_ACCEPT )
   {
   {
-    fn = gtk_file_selection_get_filename (GTK_FILE_SELECTION(vw->save_dia) );
-    if ( access ( fn, F_OK ) != 0 || a_dialog_overwrite ( GTK_WINDOW(vw->save_dia), _("The file \"%s\" exists, do you wish to overwrite it?"), a_file_basename ( fn ) ) )
+    fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(vw->save_dia) );
+    if ( g_file_test ( fn, G_FILE_TEST_EXISTS ) == FALSE || a_dialog_overwrite ( GTK_WINDOW(vw->save_dia), _("The file \"%s\" exists, do you wish to overwrite it?"), a_file_basename ( fn ) ) )
     {
       window_set_filename ( vw, fn );
       rv = window_save ( vw );
     {
       window_set_filename ( vw, fn );
       rv = window_save ( vw );
@@ -1347,6 +1486,11 @@ static void goto_address( GtkAction *a, VikWindow *vw)
   a_google_search(vw, vw->viking_vlp, vw->viking_vvp);
 }
 
   a_google_search(vw, vw->viking_vlp, vw->viking_vvp);
 }
 
+static void preferences_cb ( GtkAction *a, VikWindow *vw )
+{
+  a_preferences_show_window ( GTK_WINDOW(vw) );
+}
+
 static void clear_cb ( GtkAction *a, VikWindow *vw )
 {
   vik_layers_panel_clear ( vw->viking_vlp );
 static void clear_cb ( GtkAction *a, VikWindow *vw )
 {
   vik_layers_panel_clear ( vw->viking_vlp );
@@ -1439,7 +1583,7 @@ static void save_image_dir ( VikWindow *vw, const gchar *fn, guint w, guint h, g
 
   g_assert ( vik_viewport_get_coord_mode ( vw->viking_vvp ) == VIK_COORD_UTM );
 
 
   g_assert ( vik_viewport_get_coord_mode ( vw->viking_vvp ) == VIK_COORD_UTM );
 
-  make_dir(fn);
+  g_mkdir(fn,0777);
 
   utm_orig = *((const struct UTM *)vik_viewport_get_center ( vw->viking_vvp ));
 
 
   utm_orig = *((const struct UTM *)vik_viewport_get_center ( vw->viking_vvp ));
 
@@ -1641,15 +1785,20 @@ static void draw_to_image_file_cb ( GtkAction *a, VikWindow *vw )
 {
   const gchar *fn;
   if (!vw->save_img_dia) {
 {
   const gchar *fn;
   if (!vw->save_img_dia) {
-    vw->save_img_dia = gtk_file_selection_new ( _("Save Image") );
+    vw->save_img_dia = gtk_file_chooser_dialog_new (_("Save Image"),
+                                     GTK_WINDOW(vw),
+                                     GTK_FILE_CHOOSER_ACTION_SAVE,
+                                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                     GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+                                     NULL);
     gtk_window_set_transient_for ( GTK_WINDOW(vw->save_img_dia), GTK_WINDOW(vw) );
     gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->save_img_dia), TRUE );
   }
 
     gtk_window_set_transient_for ( GTK_WINDOW(vw->save_img_dia), GTK_WINDOW(vw) );
     gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->save_img_dia), TRUE );
   }
 
-  while ( gtk_dialog_run ( GTK_DIALOG(vw->save_img_dia) ) == GTK_RESPONSE_OK )
+  while ( gtk_dialog_run ( GTK_DIALOG(vw->save_img_dia) ) == GTK_RESPONSE_ACCEPT )
   {
   {
-    fn = gtk_file_selection_get_filename (GTK_FILE_SELECTION(vw->save_img_dia) );
-    if ( access ( fn, F_OK ) != 0 || a_dialog_overwrite ( GTK_WINDOW(vw->save_img_dia), _("The file \"%s\" exists, do you wish to overwrite it?"), a_file_basename ( fn ) ) )
+    fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(vw->save_img_dia) );
+    if ( g_file_test ( fn, G_FILE_TEST_EXISTS ) == FALSE || a_dialog_overwrite ( GTK_WINDOW(vw->save_img_dia), _("The file \"%s\" exists, do you wish to overwrite it?"), a_file_basename ( fn ) ) )
     {
       draw_to_image_file ( vw, fn, TRUE );
       break;
     {
       draw_to_image_file ( vw, fn, TRUE );
       break;
@@ -1660,21 +1809,27 @@ static void draw_to_image_file_cb ( GtkAction *a, VikWindow *vw )
 
 static void draw_to_image_dir_cb ( GtkAction *a, VikWindow *vw )
 {
 
 static void draw_to_image_dir_cb ( GtkAction *a, VikWindow *vw )
 {
-  const gchar *fn;
+  gchar *fn = NULL;
+  
   if (!vw->save_img_dir_dia) {
   if (!vw->save_img_dir_dia) {
-    vw->save_img_dir_dia = gtk_file_selection_new ( _("Choose a name for a new directory to hold images"));
+    vw->save_img_dir_dia = gtk_file_chooser_dialog_new (_("Choose a directory to hold images"),
+                                     GTK_WINDOW(vw),
+                                     GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+                                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                     GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+                                     NULL);
     gtk_window_set_transient_for ( GTK_WINDOW(vw->save_img_dir_dia), GTK_WINDOW(vw) );
     gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->save_img_dir_dia), TRUE );
   }
     gtk_window_set_transient_for ( GTK_WINDOW(vw->save_img_dir_dia), GTK_WINDOW(vw) );
     gtk_window_set_destroy_with_parent ( GTK_WINDOW(vw->save_img_dir_dia), TRUE );
   }
-
-  while ( gtk_dialog_run ( GTK_DIALOG(vw->save_img_dir_dia) ) == GTK_RESPONSE_OK )
+  
+  while ( gtk_dialog_run ( GTK_DIALOG(vw->save_img_dir_dia) ) == GTK_RESPONSE_ACCEPT )
   {
   {
-    fn = gtk_file_selection_get_filename (GTK_FILE_SELECTION(vw->save_img_dir_dia) );
-    if ( access ( fn, F_OK ) == 0 )
-      a_dialog_info_msg_extra ( GTK_WINDOW(vw->save_img_dir_dia), _("The file %s exists. Please choose a name for a new directory to hold images in that does not exist."), a_file_basename(fn) );
-    else
+    fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(vw->save_img_dir_dia) );
+    if ( fn )
     {
       draw_to_image_file ( vw, fn, FALSE );
     {
       draw_to_image_file ( vw, fn, FALSE );
+      g_free(fn);
+      fn = NULL;
       break;
     }
   }
       break;
     }
   }
@@ -1698,17 +1853,11 @@ static void window_change_coord_mode_cb ( GtkAction *old_a, GtkAction *a, VikWin
   else if (!strcmp(gtk_action_get_name(a), "ModeExpedia")) {
     drawmode = VIK_VIEWPORT_DRAWMODE_EXPEDIA;
   }
   else if (!strcmp(gtk_action_get_name(a), "ModeExpedia")) {
     drawmode = VIK_VIEWPORT_DRAWMODE_EXPEDIA;
   }
-  else if (!strcmp(gtk_action_get_name(a), "ModeGoogle")) {
-    drawmode = VIK_VIEWPORT_DRAWMODE_GOOGLE;
-  }
-  else if (!strcmp(gtk_action_get_name(a), "ModeKH")) {
-    drawmode = VIK_VIEWPORT_DRAWMODE_KH;
-  }
   else if (!strcmp(gtk_action_get_name(a), "ModeMercator")) {
     drawmode = VIK_VIEWPORT_DRAWMODE_MERCATOR;
   }
   else {
   else if (!strcmp(gtk_action_get_name(a), "ModeMercator")) {
     drawmode = VIK_VIEWPORT_DRAWMODE_MERCATOR;
   }
   else {
-    g_critical("Houston, we got a problem!\n");
+    g_critical("Houston, we've had a problem.");
     return;
   }
 
     return;
   }
 
@@ -1770,86 +1919,88 @@ static void set_bg_color ( GtkAction *a, VikWindow *vw )
  ***********************************************************************************************/
 
 static GtkActionEntry entries[] = {
  ***********************************************************************************************/
 
 static GtkActionEntry entries[] = {
-  { "File", NULL, "_File", 0, 0, 0 },
-  { "Edit", NULL, "_Edit", 0, 0, 0 },
-  { "View", NULL, "_View", 0, 0, 0 },
-  { "SetZoom", NULL, "_Zoom", 0, 0, 0 },
-  { "SetPan", NULL, "_Pan", 0, 0, 0 },
-  { "Layers", NULL, "_Layers", 0, 0, 0 },
-  { "Tools", NULL, "_Tools", 0, 0, 0 },
-  { "Help", NULL, "_Help", 0, 0, 0 },
-
-  { "New",       GTK_STOCK_NEW,          "_New",                          "<control>N", "New file",                                     (GCallback)newwindow_cb          },
-  { "Open",      GTK_STOCK_OPEN,         "_Open",                         "<control>O", "Open a file",                                  (GCallback)load_file             },
-  { "Append",    GTK_STOCK_ADD,          "A_ppend File",                  NULL,         "Append data from a different file",            (GCallback)load_file             },
-  { "Acquire", NULL, "A_cquire", 0, 0, 0 },
-  { "AcquireGPS",   NULL,                "From _GPS",                    NULL,         "Transfer data from a GPS device",              (GCallback)acquire_from_gps      },
-  { "AcquireGoogle",   NULL,             "Google _Directions",           NULL,         "Get driving directions from Google",           (GCallback)acquire_from_google   },
+  { "File", NULL, N_("_File"), 0, 0, 0 },
+  { "Edit", NULL, N_("_Edit"), 0, 0, 0 },
+  { "View", NULL, N_("_View"), 0, 0, 0 },
+  { "SetZoom", NULL, N_("_Zoom"), 0, 0, 0 },
+  { "SetPan", NULL, N_("_Pan"), 0, 0, 0 },
+  { "Layers", NULL, N_("_Layers"), 0, 0, 0 },
+  { "Tools", NULL, N_("_Tools"), 0, 0, 0 },
+  { "Help", NULL, N_("_Help"), 0, 0, 0 },
+
+  { "New",       GTK_STOCK_NEW,          N_("_New"),                          "<control>N", N_("New file"),                                     (GCallback)newwindow_cb          },
+  { "Open",      GTK_STOCK_OPEN,         N_("_Open"),                         "<control>O", N_("Open a file"),                                  (GCallback)load_file             },
+  { "Append",    GTK_STOCK_ADD,          N_("A_ppend File"),                  NULL,         N_("Append data from a different file"),            (GCallback)load_file             },
+  { "Acquire", NULL, N_("A_cquire"), 0, 0, 0 },
+  { "AcquireGPS",   NULL,                N_("From _GPS"),                NULL,         N_("Transfer data from a GPS device"),              (GCallback)acquire_from_gps      },
+  { "AcquireGoogle",   NULL,             N_("Google _Directions"),       NULL,         N_("Get driving directions from Google"),           (GCallback)acquire_from_google   },
 #ifdef VIK_CONFIG_GEOCACHES
 #ifdef VIK_CONFIG_GEOCACHES
-  { "AcquireGC",   NULL,                 "Geo_caches",                   NULL,         "Get Geocaches from geocaching.com",            (GCallback)acquire_from_gc       },
+  { "AcquireGC",   NULL,                 N_("Geo_caches"),               NULL,         N_("Get Geocaches from geocaching.com"),            (GCallback)acquire_from_gc       },
 #endif
 #endif
-  { "Save",      GTK_STOCK_SAVE,         "_Save",                         "<control>S", "Save the file",                                (GCallback)save_file             },
-  { "SaveAs",    GTK_STOCK_SAVE_AS,      "Save _As",                      NULL,         "Save the file under different name",           (GCallback)save_file_as          },
-  { "GenImg",    GTK_STOCK_CLEAR,        "_Generate Image File",          NULL,         "Save a snapshot of the workspace into a file", (GCallback)draw_to_image_file_cb },
-  { "GenImgDir", GTK_STOCK_DND_MULTIPLE, "Generate _Directory of Images", NULL,         "FIXME:IMGDIR",                                 (GCallback)draw_to_image_dir_cb  },
+  { "Save",      GTK_STOCK_SAVE,         N_("_Save"),                         "<control>S", N_("Save the file"),                                (GCallback)save_file             },
+  { "SaveAs",    GTK_STOCK_SAVE_AS,      N_("Save _As"),                      NULL,         N_("Save the file under different name"),           (GCallback)save_file_as          },
+  { "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  },
 
 #if GTK_CHECK_VERSION(2,10,0)
 
 #if GTK_CHECK_VERSION(2,10,0)
-  { "Print",    GTK_STOCK_PRINT,        "_Print...",          NULL,         "Print maps", (GCallback)print_cb },
+  { "Print",    GTK_STOCK_PRINT,        N_("_Print..."),          NULL,         N_("Print maps"), (GCallback)print_cb },
 #endif
 
 #endif
 
-  { "Exit",      GTK_STOCK_QUIT,         "E_xit",                         "<control>W", "Exit the program",                             (GCallback)window_close          },
-  { "SaveExit",  GTK_STOCK_QUIT,         "Save and Exit",                 NULL, "Save and Exit the program",                             (GCallback)save_file_and_exit          },
-
-  { "GoogleMapsSearch",   GTK_STOCK_GO_FORWARD,                 "Go To Google Maps location",                    NULL,         "Go to address/place using Google Maps search",            (GCallback)goto_address       },
-  { "GotoLL",    GTK_STOCK_QUIT,         "_Go to Lat\\/Lon...",           NULL,         "Go to arbitrary lat\\/lon coordinate",         (GCallback)draw_goto_cb          },
-  { "GotoUTM",   GTK_STOCK_QUIT,         "Go to UTM...",                  NULL,         "Go to arbitrary UTM coordinate",               (GCallback)draw_goto_cb          },
-  { "SetBGColor",GTK_STOCK_SELECT_COLOR, "Set Background Color...",       NULL,         NULL,                                           (GCallback)set_bg_color          },
-  { "ZoomIn",    GTK_STOCK_ZOOM_IN,      "Zoom _In",                   "<control>plus", NULL,                                           (GCallback)draw_zoom_cb          },
-  { "ZoomOut",   GTK_STOCK_ZOOM_OUT,     "Zoom _Out",                 "<control>minus", NULL,                                           (GCallback)draw_zoom_cb          },
-  { "ZoomTo",    GTK_STOCK_ZOOM_FIT,     "Zoom _To",               "<control><shift>Z", NULL,                                           (GCallback)zoom_to_cb            },
-  { "Zoom0.25",  NULL,                   "0.25",                          NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
-  { "Zoom0.5",   NULL,                   "0.5",                           NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
-  { "Zoom1",     NULL,                   "1",                             NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
-  { "Zoom2",     NULL,                   "2",                             NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
-  { "Zoom4",     NULL,                   "4",                             NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
-  { "Zoom8",     NULL,                   "8",                             NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
-  { "Zoom16",    NULL,                   "16",                            NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
-  { "Zoom32",    NULL,                   "32",                            NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
-  { "Zoom64",    NULL,                   "64",                            NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
-  { "Zoom128",   NULL,                   "128",                           NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
-  { "PanNorth",  NULL,                   "Pan North",                  "<control>Up", NULL,                                           (GCallback)draw_pan_cb },
-  { "PanEast",  NULL,                    "Pan East",                   "<control>Right", NULL,                                           (GCallback)draw_pan_cb },
-  { "PanSouth",  NULL,                   "Pan South",                  "<control>Down", NULL,                                           (GCallback)draw_pan_cb },
-  { "PanWest",  NULL,                    "Pan West",                   "<control>Left", NULL,                                           (GCallback)draw_pan_cb },
-  { "BGJobs",    GTK_STOCK_EXECUTE,      "Background _Jobs",              NULL,         NULL,                                           (GCallback)a_background_show_window },
-
-  { "Cut",       GTK_STOCK_CUT,          "Cu_t",                          NULL,         NULL,                                           (GCallback)menu_cut_layer_cb     },
-  { "Copy",      GTK_STOCK_COPY,         "_Copy",                         NULL,         NULL,                                           (GCallback)menu_copy_layer_cb    },
-  { "Paste",     GTK_STOCK_PASTE,        "_Paste",                        NULL,         NULL,                                           (GCallback)menu_paste_layer_cb   },
-  { "Delete",    GTK_STOCK_DELETE,       "_Delete",                       NULL,         NULL,                                           (GCallback)menu_delete_layer_cb  },
-  { "DeleteAll", NULL,                   "Delete All",                    NULL,         NULL,                                           (GCallback)clear_cb              },
-  { "Properties",GTK_STOCK_PROPERTIES,   "_Properties",                   NULL,         NULL,                                           (GCallback)menu_properties_cb    },
-
-  { "About",     GTK_STOCK_ABOUT,        "_About",                        NULL,         NULL,                                           (GCallback)help_about_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          },
+
+  { "GoogleMapsSearch",   GTK_STOCK_JUMP_TO,                 N_("Go To Google Maps location"),                   NULL,         N_("Go to address/place using Google Maps search"),            (GCallback)goto_address       },
+  { "GotoLL",    GTK_STOCK_QUIT,         N_("_Go to Lat\\/Lon..."),           NULL,         N_("Go to arbitrary lat\\/lon coordinate"),         (GCallback)draw_goto_cb          },
+  { "GotoUTM",   GTK_STOCK_QUIT,         N_("Go to UTM..."),                  NULL,         N_("Go to arbitrary UTM coordinate"),               (GCallback)draw_goto_cb          },
+  { "SetBGColor",GTK_STOCK_SELECT_COLOR, N_("Set Background 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><shift>Z", NULL,                                           (GCallback)zoom_to_cb            },
+  { "Zoom0.25",  NULL,                   N_("0.25"),                          NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
+  { "Zoom0.5",   NULL,                   N_("0.5"),                           NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
+  { "Zoom1",     NULL,                   N_("1"),                             NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
+  { "Zoom2",     NULL,                   N_("2"),                             NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
+  { "Zoom4",     NULL,                   N_("4"),                             NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
+  { "Zoom8",     NULL,                   N_("8"),                             NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
+  { "Zoom16",    NULL,                   N_("16"),                            NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
+  { "Zoom32",    NULL,                   N_("32"),                            NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
+  { "Zoom64",    NULL,                   N_("64"),                            NULL,         NULL,                                           (GCallback)draw_zoom_cb          },
+  { "Zoom128",   NULL,                   N_("128"),                           NULL,         NULL,                                           (GCallback)draw_zoom_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 },
+
+  { "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  },
+  { "DeleteAll", NULL,                   N_("Delete All"),                    NULL,         NULL,                                           (GCallback)clear_cb              },
+  { "Preferences",GTK_STOCK_PREFERENCES, N_("_Preferences..."),                    NULL,         NULL,                                           (GCallback)preferences_cb              },
+  { "Properties",GTK_STOCK_PROPERTIES,   N_("_Properties"),                   NULL,         NULL,                                           (GCallback)menu_properties_cb    },
+
+  { "About",     GTK_STOCK_ABOUT,        N_("_About"),                        NULL,         NULL,                                           (GCallback)help_about_cb    },
 };
 
 /* Radio items */
 static GtkRadioActionEntry mode_entries[] = {
 };
 
 /* Radio items */
 static GtkRadioActionEntry mode_entries[] = {
-  { "ModeUTM",         NULL,         "_UTM Mode",               "<control>u", NULL, 0 },
-  { "ModeExpedia",     NULL,         "_Expedia Mode",           "<control>e", NULL, 1 },
-  { "ModeGoogle",      NULL,         "_Old Google Mode",        "<control>o", NULL, 2 },
-  { "ModeKH",          NULL,         "Old _KH Mode",            "<control>k", NULL, 3 },
-  { "ModeMercator",    NULL,         "_Google Mode",            "<control>g", NULL, 4 }
+  { "ModeUTM",         NULL,         N_("_UTM Mode"),               "<control>u", NULL, 0 },
+  { "ModeExpedia",     NULL,         N_("_Expedia Mode"),           "<control>e", NULL, 1 },
+  { "ModeMercator",    NULL,         N_("_Mercator Mode"),            "<control>g", NULL, 4 }
 };
 
 static GtkRadioActionEntry tool_entries[] = {
 };
 
 static GtkRadioActionEntry tool_entries[] = {
-  { "Zoom",      "vik-icon-zoom",        "_Zoom",                         "<control><shift>Z", "Zoom Tool",  0 },
-  { "Ruler",     "vik-icon-ruler",       "_Ruler",                        "<control><shift>R", "Ruler Tool", 1 }
+  { "Pan",      "vik-icon-pan",        N_("_Pan"),                         "<control><shift>P", N_("Pan Tool"),  0 },
+  { "Zoom",      "vik-icon-zoom",        N_("_Zoom"),                         "<control><shift>Z", N_("Zoom Tool"),  1 },
+  { "Ruler",     "vik-icon-ruler",       N_("_Ruler"),                        "<control><shift>R", N_("Ruler Tool"), 2 }
 };
 
 static GtkToggleActionEntry toggle_entries[] = {
 };
 
 static GtkToggleActionEntry toggle_entries[] = {
-  { "ShowScale", NULL,                   "Show Scale",                    NULL,         NULL,                                           (GCallback)set_draw_scale, TRUE   },
-  { "ShowCenterMark", NULL,                   "Show Center Mark",                    NULL,         NULL,                                           (GCallback)set_draw_centermark, TRUE   },
+  { "ShowScale", NULL,                   N_("Show Scale"),                    NULL,         N_("Show Scale"),                                           (GCallback)set_draw_scale, TRUE   },
+  { "ShowCenterMark", NULL,                   N_("Show Center Mark"),                    NULL,         N_("Show Center Mark"),                                           (GCallback)set_draw_centermark, TRUE   },
+  { "FullScreen",    GTK_STOCK_FULLSCREEN,      N_("Full Screen"),                   "F11", N_("Activate full screen mode"),                                           (GCallback)full_screen_cb, FALSE },
+  { "ViewSidePanel", GTK_STOCK_INDEX,   N_("Show Side Panel"),                   "F9",         N_("Show Side Panel"),                                           (GCallback)view_side_panel_cb, TRUE    },
 };
 
 #include "menu.xml.h"
 };
 
 #include "menu.xml.h"
@@ -1870,6 +2021,7 @@ static void window_create_ui( VikWindow *window )
 
   toolbox_add_tool(window->vt, &ruler_tool, TOOL_LAYER_TYPE_NONE);
   toolbox_add_tool(window->vt, &zoom_tool, TOOL_LAYER_TYPE_NONE);
 
   toolbox_add_tool(window->vt, &ruler_tool, TOOL_LAYER_TYPE_NONE);
   toolbox_add_tool(window->vt, &zoom_tool, TOOL_LAYER_TYPE_NONE);
+  toolbox_add_tool(window->vt, &pan_tool, TOOL_LAYER_TYPE_NONE);
 
   error = NULL;
   if (!(mid = gtk_ui_manager_add_ui_from_string (uim, menu_xml, -1, &error))) {
 
   error = NULL;
   if (!(mid = gtk_ui_manager_add_ui_from_string (uim, menu_xml, -1, &error))) {
@@ -1878,6 +2030,7 @@ static void window_create_ui( VikWindow *window )
   }
 
   action_group = gtk_action_group_new ("MenuActions");
   }
 
   action_group = gtk_action_group_new ("MenuActions");
+  gtk_action_group_set_translation_domain(action_group, PACKAGE_NAME);
   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);
   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);
@@ -1967,24 +2120,25 @@ static void window_create_ui( VikWindow *window )
 
 
 
 
 
 
-#include "icons/icons.h"
 static struct { 
   const GdkPixdata *data;
   gchar *stock_id;
 } stock_icons[] = {
 static struct { 
   const GdkPixdata *data;
   gchar *stock_id;
 } stock_icons[] = {
-  { &addtr_18,         "Create Track"      },
-  { &begintr_18,       "Begin Track"      },
-  { &edtr_18,          "Edit Trackpoint"   },
-  { &addwp_18,         "Create Waypoint"   },
-  { &edwp_18,          "Edit Waypoint"     },
-  { &iscissors_18,     "Magic Scissors"   },
-  { &zoom_18,          "vik-icon-zoom"     },
-  { &ruler_18,         "vik-icon-ruler"    },
-  { &geozoom_18,       "Georef Zoom Tool"  },
-  { &geomove_18,       "Georef Move Map"   },
-  { &mapdl_18,         "Maps Download"     },
-  { &demdl_18,         "DEM Download/Import"     },
-  { &showpic_18,       "Show Picture"      },
+  { &begintr_18_pixbuf,                "Begin Track"      },
+  { &iscissors_18_pixbuf,      "Magic Scissors"   },
+  { &mover_22_pixbuf,          "vik-icon-pan"     },
+  { &demdl_18_pixbuf,          "DEM Download/Import"     },
+  { &showpic_18_pixbuf,                "Show Picture"      },
+  { &addtr_18_pixbuf,          "Create Track"      },
+  { &edtr_18_pixbuf,           "Edit Trackpoint"   },
+  { &addwp_18_pixbuf,          "Create Waypoint"   },
+  { &edwp_18_pixbuf,           "Edit Waypoint"     },
+  { &zoom_18_pixbuf,           "vik-icon-zoom"     },
+  { &ruler_18_pixbuf,          "vik-icon-ruler"    },
+  { &geozoom_18_pixbuf,                "Georef Zoom Tool"  },
+  { &geomove_18_pixbuf,                "Georef Move Map"   },
+  { &mapdl_18_pixbuf,          "Maps Download"     },
+  { &showpic_18_pixbuf,                "Show Picture"      },
 };
  
 static gint n_stock_icons = G_N_ELEMENTS (stock_icons);
 };
  
 static gint n_stock_icons = G_N_ELEMENTS (stock_icons);
@@ -2003,24 +2157,3 @@ register_vik_icons (GtkIconFactory *icon_factory)
   }
 }
 
   }
 }
 
-void vik_window_cursors_init()
-{
-  GdkPixbuf *cursor_pixbuf;
-  GError *cursor_load_err;
-
-  cursor_pixbuf = gdk_pixbuf_from_pixdata (&cursor_zoom, FALSE, &cursor_load_err);
-  vw_cursor_zoom = gdk_cursor_new_from_pixbuf ( gdk_display_get_default(), cursor_pixbuf, 6, 6 );
-
-  g_object_unref ( G_OBJECT(cursor_pixbuf) );
-
-  cursor_pixbuf = gdk_pixbuf_from_pixdata (&cursor_ruler, FALSE, &cursor_load_err);
-  vw_cursor_ruler = gdk_cursor_new_from_pixbuf ( gdk_display_get_default(), cursor_pixbuf, 6, 6 );
-
-  g_object_unref ( G_OBJECT(cursor_pixbuf) );
-}
-
-void vik_window_cursors_uninit()
-{
-  gdk_cursor_unref ( vw_cursor_zoom );
-  gdk_cursor_unref ( vw_cursor_ruler );
-}