X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/3c575a4a5723c467dd99719ef3810db4b98b9026..64d557a287f0e695856d6bc579293b399b8a07ea:/src/vikwindow.c?ds=sidebyside diff --git a/src/vikwindow.c b/src/vikwindow.c index d670251c..8f214574 100644 --- a/src/vikwindow.c +++ b/src/vikwindow.c @@ -27,18 +27,14 @@ #include "background.h" #include "acquire.h" #include "datasources.h" -#ifdef VIK_CONFIG_GOOGLE -#include "googlesearch.h" -#endif -#ifdef VIK_CONFIG_GEONAMES -#include "geonamessearch.h" -#endif +#include "vikgoto.h" #include "dems.h" #include "mapcache.h" #include "print.h" #include "preferences.h" #include "icons/icons.h" #include "vikexttools.h" +#include "garminsymbols.h" #ifdef HAVE_STDLIB_H #include @@ -54,6 +50,7 @@ #include #include #include +#include #define VIKING_WINDOW_WIDTH 1000 #define VIKING_WINDOW_HEIGHT 800 @@ -151,6 +148,7 @@ struct _VikWindow { GtkActionGroup *action_group; + gboolean pan_move; gint pan_x, pan_y; guint draw_image_width, draw_image_height; @@ -287,7 +285,8 @@ static void window_init ( VikWindow *vw ) vw->modified = FALSE; vw->only_updating_coord_mode_ui = FALSE; - + + vw->pan_move = FALSE; vw->pan_x = vw->pan_y = -1; vw->draw_image_width = DRAW_IMAGE_DEFAULT_WIDTH; vw->draw_image_height = DRAW_IMAGE_DEFAULT_HEIGHT; @@ -307,7 +306,7 @@ static void window_init ( VikWindow *vw ) 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_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK ); + 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 ); g_signal_connect_swapped (G_OBJECT(vw->viking_vvp), "scroll_event", G_CALLBACK(draw_scroll), 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); @@ -439,7 +438,7 @@ static void draw_redraw ( VikWindow *vw ) if ( ! new_trigger ) ; /* do nothing -- have to redraw everything. */ - else if ( (old_trigger != new_trigger) || !vik_coord_equals(&old_center, &vw->trigger_center) ) + else if ( (old_trigger != new_trigger) || !vik_coord_equals(&old_center, &vw->trigger_center) || (new_trigger->type == VIK_LAYER_AGGREGATE) ) vik_viewport_set_trigger ( vw->viking_vvp, new_trigger ); /* todo: set to half_drawn mode if new trigger is above old */ else vik_viewport_set_half_drawn ( vw->viking_vvp, TRUE ); @@ -472,6 +471,7 @@ static gboolean draw_buf(gpointer data) static void vik_window_pan_click (VikWindow *vw, GdkEventButton *event) { /* set panning origin */ + vw->pan_move = FALSE; vw->pan_x = (gint) event->x; vw->pan_y = (gint) event->y; } @@ -494,7 +494,12 @@ static void draw_click (VikWindow *vw, GdkEventButton *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 ); + 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_move = TRUE; + vw->pan_x = event->x; + vw->pan_y = event->y; } } @@ -510,6 +515,13 @@ static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event) gdouble zoom; VikDemInterpol interpol_method; + /* This is a hack, but work far the best, at least for single pointer systems. + * See http://bugzilla.gnome.org/show_bug.cgi?id=587714 for more. */ + gint x, y; + gdk_window_get_pointer (event->window, &x, &y, NULL); + event->x = x; + event->y = y; + toolbox_move(vw->vt, event); vik_viewport_screen_to_coord ( vw->viking_vvp, event->x, event->y, &coord ); @@ -535,11 +547,17 @@ static void draw_mouse_motion (VikWindow *vw, GdkEventMotion *event) vik_statusbar_set_message ( vw->viking_vs, 4, pointer_buf ); vik_window_pan_move ( vw, event ); + + /* This is recommended by the GTK+ documentation, but does not work properly. + * Use deprecated way until GTK+ gets a solution for correct motion hint handling: + * http://bugzilla.gnome.org/show_bug.cgi?id=587714 + */ + /* gdk_event_request_motions ( 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 ) + if ( vw->pan_move == FALSE ) 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, @@ -716,13 +734,30 @@ static void draw_ruler(VikViewport *vvp, GdkDrawable *d, GdkGC *gc, gint x1, gin gdk_draw_layout(d, gc, x1-5, y1-CR-3*CW-8, pl); /* draw label with distance */ - if (distance >= 1000 && distance < 100000) { - g_sprintf(str, "%3.2f km", distance/1000.0); - } else if (distance < 1000) { - g_sprintf(str, "%d m", (int)distance); - } else { - g_sprintf(str, "%d km", (int)distance/1000); + vik_units_distance_t dist_units = a_vik_get_units_distance (); + switch (dist_units) { + case VIK_UNITS_DISTANCE_KILOMETRES: + if (distance >= 1000 && distance < 100000) { + g_sprintf(str, "%3.2f km", distance/1000.0); + } else if (distance < 1000) { + g_sprintf(str, "%d m", (int)distance); + } else { + g_sprintf(str, "%d km", (int)distance/1000); + } + break; + case VIK_UNITS_DISTANCE_MILES: + if (distance >= 1600 && distance < 160000) { + g_sprintf(str, "%3.2f miles", distance/1600.0); + } else if (distance < 1600) { + g_sprintf(str, "%d yards", (int)(distance*1.0936133)); + } else { + g_sprintf(str, "%d miles", (int)distance/1600); + } + break; + default: + g_critical("Houston, we've had a problem. distance=%d", dist_units); } + pango_layout_set_text(pl, str, -1); pango_layout_get_pixel_size ( pl, &wd, &hd ); @@ -800,7 +835,19 @@ static VikLayerToolFuncStatus ruler_click (VikLayer *vl, GdkEventButton *event, vik_coord_to_latlon ( &coord, &ll ); a_coords_latlon_to_string ( &ll, &lat, &lon ); if ( s->has_oldcoord ) { - temp = g_strdup_printf ( "%s %s DIFF %f meters", lat, lon, vik_coord_diff( &coord, &(s->oldcoord) ) ); + 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; + case VIK_UNITS_DISTANCE_MILES: + temp = g_strdup_printf ( "%s %s DIFF %f miles", lat, lon, vik_coord_diff( &coord, &(s->oldcoord) )* 0.000621371192); + break; + default: + 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; } else { @@ -860,7 +907,18 @@ static VikLayerToolFuncStatus ruler_move (VikLayer *vl, GdkEventMotion *event, r draw_buf_done = FALSE; } 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_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; + case VIK_UNITS_DISTANCE_MILES: + temp = g_strdup_printf ( "%s %s DIFF %f miles", lat, lon, vik_coord_diff( &coord, &(s->oldcoord) )* 0.000621371192); + break; + default: + temp = g_strdup_printf ("Just to keep the compiler happy"); + g_critical("Houston, we've had a problem. distance=%d", dist_units); + } vik_statusbar_set_message ( vw->viking_vs, 3, temp ); g_free ( temp ); } @@ -1105,6 +1163,16 @@ static void menu_properties_cb ( GtkAction *a, VikWindow *vw ) a_dialog_info_msg ( GTK_WINDOW(vw), _("You must select a layer to show its properties.") ); } +static void help_help_cb ( GtkAction *a, VikWindow *vw ) +{ +#if GTK_CHECK_VERSION (2, 14, 0) + gchar *uri; + uri = g_strdup_printf("ghelp:%s", PACKAGE); + gtk_show_uri(NULL, uri, GDK_CURRENT_TIME, NULL); + g_free(uri); +#endif +} + static void help_about_cb ( GtkAction *a, VikWindow *vw ) { a_dialog_about(GTK_WINDOW(vw)); @@ -1331,6 +1399,82 @@ GtkWidget *vik_window_get_drawmode_button ( VikWindow *vw, VikViewportDrawMode m return mode_button; } +static void on_activate_recent_item (GtkRecentChooser *chooser, + VikWindow *self) +{ + gchar *filename; + + filename = gtk_recent_chooser_get_current_uri (chooser); + if (filename != NULL) + { + GFile *file = g_file_new_for_uri ( filename ); + gchar *path = g_file_get_path ( file ); + g_object_unref ( file ); + if ( self->filename ) + { + gchar *filenames[] = { path, NULL }; + g_signal_emit ( G_OBJECT(self), window_signals[VW_OPENWINDOW_SIGNAL], 0, filenames ); + } + else + vik_window_open_file ( self, path, TRUE ); + g_free ( path ); + } + + g_free (filename); +} + +static void setup_recent_files (VikWindow *self) +{ + GtkRecentManager *manager; + GtkRecentFilter *filter; + GtkWidget *menu, *menu_item; + + filter = gtk_recent_filter_new (); + /* gtk_recent_filter_add_application (filter, g_get_application_name()); */ + gtk_recent_filter_add_group(filter, "viking"); + + manager = gtk_recent_manager_get_default (); + 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); + + menu_item = gtk_ui_manager_get_widget (self->uim, "/ui/MainMenu/File/OpenRecentFile"); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), menu); + + g_signal_connect (G_OBJECT (menu), "item-activated", + G_CALLBACK (on_activate_recent_item), (gpointer) self); +} + +static void update_recently_used_document(const gchar *filename) +{ + /* Update Recently Used Document framework */ + GtkRecentManager *manager = gtk_recent_manager_get_default(); + GtkRecentData *recent_data = g_slice_new (GtkRecentData); + gchar *groups[] = {"viking", NULL}; + GFile *file = g_file_new_for_commandline_arg(filename); + gchar *uri = g_file_get_uri(file); + gchar *basename = g_path_get_basename(filename); + g_object_unref(file); + file = NULL; + + recent_data->display_name = basename; + recent_data->description = NULL; + recent_data->mime_type = "text/x-gps-data"; + recent_data->app_name = (gchar *) g_get_application_name (); + recent_data->app_exec = g_strjoin (" ", g_get_prgname (), "%f", NULL); + recent_data->groups = groups; + 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); + } + + g_free (uri); + g_free (basename); + g_free (recent_data->app_exec); + g_slice_free (GtkRecentData, recent_data); +} + void vik_window_open_file ( VikWindow *vw, const gchar *filename, gboolean change_filename ) { switch ( a_file_load ( vik_layers_panel_get_top_layer(vw->viking_vlp), vw->viking_vvp, filename ) ) @@ -1341,6 +1485,7 @@ void vik_window_open_file ( VikWindow *vw, const gchar *filename, gboolean chang case 1: { GtkWidget *mode_button; + /* Update UI */ if ( change_filename ) window_set_filename ( vw, filename ); mode_button = vik_window_get_drawmode_button ( vw, vik_viewport_get_drawmode ( vw->viking_vvp ) ); @@ -1358,7 +1503,9 @@ 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_centermark(vw->viking_vvp) ); } - default: draw_update ( vw ); + default: + update_recently_used_document(filename); + draw_update ( vw ); } } static void load_file ( GtkAction *a, VikWindow *vw ) @@ -1450,7 +1597,10 @@ static gboolean save_file_as ( GtkAction *a, VikWindow *vw ) 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 ); return TRUE; + } else { a_dialog_error_msg ( GTK_WINDOW(vw), _("The filename you requested could not be opened for writing.") ); @@ -1486,15 +1636,19 @@ static void acquire_from_gc ( GtkAction *a, VikWindow *vw ) } #endif -static void goto_address( GtkAction *a, VikWindow *vw) +static void goto_default_location( GtkAction *a, VikWindow *vw) { -#if defined(VIK_CONFIG_GOOGLE) && VIK_CONFIG_SEARCH==VIK_CONFIG_SEARCH_GOOGLE - a_google_search(vw, vw->viking_vlp, vw->viking_vvp); -#endif -#if defined(VIK_CONFIG_GEONAMES) && VIK_CONFIG_SEARCH==VIK_CONFIG_SEARCH_GEONAMES - a_geonames_search(vw, vw->viking_vlp, vw->viking_vvp); -#endif + 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_layers_panel_emit_update(vw->viking_vlp); +} + +static void goto_address( GtkAction *a, VikWindow *vw) +{ + a_vik_goto(vw, vw->viking_vlp, vw->viking_vvp); } static void mapcache_flush_cb ( GtkAction *a, VikWindow *vw ) @@ -1504,7 +1658,52 @@ static void mapcache_flush_cb ( GtkAction *a, VikWindow *vw ) static void preferences_cb ( GtkAction *a, VikWindow *vw ) { + gboolean wp_icon_size = a_vik_get_use_large_waypoint_icons(); + a_preferences_show_window ( GTK_WINDOW(vw) ); + + // Delete icon indexing 'cache' and so automatically regenerates with the new setting when changed + if (wp_icon_size != a_vik_get_use_large_waypoint_icons()) + clear_garmin_icon_syms (); + + draw_update ( vw ); +} + +static void default_location_cb ( GtkAction *a, VikWindow *vw ) +{ + /* Simplistic repeat of preference setting + Only the name & type are important for setting the preference via this 'external' way */ + VikLayerParam pref_lat[] = { + { VIKING_PREFERENCES_NAMESPACE "default_latitude", + VIK_LAYER_PARAM_DOUBLE, + VIK_LOCATION_LAT, + NULL, + VIK_LAYER_WIDGET_SPINBUTTON, + NULL, + NULL }, + }; + VikLayerParam pref_lon[] = { + { VIKING_PREFERENCES_NAMESPACE "default_longitude", + VIK_LAYER_PARAM_DOUBLE, + VIK_LOCATION_LONG, + NULL, + VIK_LAYER_WIDGET_SPINBUTTON, + NULL, + NULL }, + }; + + /* Get current center */ + struct LatLon ll; + vik_coord_to_latlon ( vik_viewport_get_center ( vw->viking_vvp ), &ll ); + + /* Apply to preferences */ + VikLayerParamData vlp_data; + vlp_data.d = ll.lat; + a_preferences_run_setparam (vlp_data, pref_lat); + vlp_data.d = ll.lon; + a_preferences_run_setparam (vlp_data, pref_lon); + /* Remember to save */ + a_preferences_save_to_file(); } static void clear_cb ( GtkAction *a, VikWindow *vw ) @@ -1680,7 +1879,19 @@ static void draw_to_image_file_total_area_cb (GtkSpinButton *spinbutton, gpointe w *= gtk_spin_button_get_value(GTK_SPIN_BUTTON(pass_along[4])); h *= gtk_spin_button_get_value(GTK_SPIN_BUTTON(pass_along[5])); } - label_text = g_strdup_printf ( _("Total area: %ldm x %ldm (%.3f sq. km)"), (glong)w, (glong)h, (w*h/1000000)); + vik_units_distance_t dist_units = a_vik_get_units_distance (); + switch (dist_units) { + case VIK_UNITS_DISTANCE_KILOMETRES: + label_text = g_strdup_printf ( _("Total area: %ldm x %ldm (%.3f sq. km)"), (glong)w, (glong)h, (w*h/1000000)); + break; + 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; + default: + label_text = g_strdup_printf ("Just to keep the compiler happy"); + g_critical("Houston, we've had a problem. distance=%d", dist_units); + } + gtk_label_set_text(GTK_LABEL(pass_along[6]), label_text); g_free ( label_text ); } @@ -1713,7 +1924,7 @@ static void draw_to_image_file ( VikWindow *vw, const gchar *fn, gboolean one_im zoom_label = gtk_label_new ( _("Zoom (meters per pixel):") ); /* TODO: separate xzoom and yzoom factors */ - zoom_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new ( vik_viewport_get_xmpp(vw->viking_vvp), VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM/2.0, 1, 100, 3 )), 16, 3); + zoom_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new ( vik_viewport_get_xmpp(vw->viking_vvp), VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM/2.0, 1, 100, 0 )), 16, 0); total_size_label = gtk_label_new ( NULL ); @@ -1946,18 +2157,19 @@ static GtkActionEntry entries[] = { { "Help", NULL, N_("_Help"), 0, 0, 0 }, { "New", GTK_STOCK_NEW, N_("_New"), "N", N_("New file"), (GCallback)newwindow_cb }, - { "Open", GTK_STOCK_OPEN, N_("_Open"), "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 }, + { "Open", GTK_STOCK_OPEN, N_("_Open..."), "O", N_("Open a file"), (GCallback)load_file }, + { "OpenRecentFile", NULL, N_("Open _Recent File"), NULL, NULL, (GCallback)NULL }, + { "Append", GTK_STOCK_ADD, N_("Append _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 }, + { "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 - { "AcquireGC", NULL, N_("Geo_caches"), NULL, N_("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 { "Save", GTK_STOCK_SAVE, N_("_Save"), "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 }, + { "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) { "Print", GTK_STOCK_PRINT, N_("_Print..."), NULL, N_("Print maps"), (GCallback)print_cb }, @@ -1966,13 +2178,14 @@ static GtkActionEntry entries[] = { { "Exit", GTK_STOCK_QUIT, N_("E_xit"), "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 }, - { "GotoSearch", GTK_STOCK_JUMP_TO, N_("Go To location"), NULL, N_("Go to address/place using text 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 }, + { "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 }, { "SetBGColor",GTK_STOCK_SELECT_COLOR, N_("Set Background Color..."), NULL, NULL, (GCallback)set_bg_color }, { "ZoomIn", GTK_STOCK_ZOOM_IN, N_("Zoom _In"), "plus", NULL, (GCallback)draw_zoom_cb }, { "ZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _Out"), "minus", NULL, (GCallback)draw_zoom_cb }, - { "ZoomTo", GTK_STOCK_ZOOM_FIT, N_("Zoom _To"), "Z", NULL, (GCallback)zoom_to_cb }, + { "ZoomTo", GTK_STOCK_ZOOM_FIT, N_("Zoom _To..."), "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 }, @@ -1983,6 +2196,14 @@ static GtkActionEntry entries[] = { { "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 }, + { "Zoom256", NULL, N_("256"), NULL, NULL, (GCallback)draw_zoom_cb }, + { "Zoom512", NULL, N_("512"), NULL, NULL, (GCallback)draw_zoom_cb }, + { "Zoom1024", NULL, N_("1024"), NULL, NULL, (GCallback)draw_zoom_cb }, + { "Zoom2048", NULL, N_("2048"), NULL, NULL, (GCallback)draw_zoom_cb }, + { "Zoom4096", NULL, N_("4096"), NULL, NULL, (GCallback)draw_zoom_cb }, + { "Zoom8192", NULL, N_("8192"), NULL, NULL, (GCallback)draw_zoom_cb }, + { "Zoom16384", NULL, N_("16384"), NULL, NULL, (GCallback)draw_zoom_cb }, + { "Zoom32768", NULL, N_("32768"), NULL, NULL, (GCallback)draw_zoom_cb }, { "PanNorth", NULL, N_("Pan North"), "Up", NULL, (GCallback)draw_pan_cb }, { "PanEast", NULL, N_("Pan East"), "Right", NULL, (GCallback)draw_pan_cb }, { "PanSouth", NULL, N_("Pan South"), "Down", NULL, (GCallback)draw_pan_cb }, @@ -1994,10 +2215,12 @@ static GtkActionEntry entries[] = { { "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 }, - { "MapCacheFlush",NULL, N_("Flush Map cache"), NULL, NULL, (GCallback)mapcache_flush_cb }, - { "Preferences",GTK_STOCK_PREFERENCES, N_("_Preferences..."), NULL, NULL, (GCallback)preferences_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 }, { "Properties",GTK_STOCK_PROPERTIES, N_("_Properties"), NULL, NULL, (GCallback)menu_properties_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 }, }; @@ -2015,10 +2238,10 @@ static GtkRadioActionEntry tool_entries[] = { }; static GtkToggleActionEntry toggle_entries[] = { - { "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 }, + { "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" @@ -2134,6 +2357,8 @@ static void window_create_ui( VikWindow *window ) accel_group = gtk_ui_manager_get_accel_group (uim); gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); gtk_ui_manager_ensure_update (uim); + + setup_recent_files(window); }