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 );
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;
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;
}
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 );
// 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) );
- vik_maps_layer_pretend_licence_shown ( vml );
+ 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 );
while ( cur_file ) {
// Only open a new window if a viking file
gchar *file_name = cur_file->data;
- if (vw != NULL && check_file_magic_vik ( file_name ) ) {
+ if (vw != NULL && vw->filename && check_file_magic_vik ( file_name ) ) {
VikWindow *newvw = vik_window_new_window ();
if (newvw)
vik_window_open_file ( newvw, file_name, TRUE );
gint entry_runner = 0;
gchar *entry = entries[entry_runner];
while (entry) {
- if ( g_strcmp0 ( entry, "" ) )
- filenames = g_slist_append ( filenames, entry );
+ if ( g_strcmp0 ( entry, "" ) ) {
+ // Drag+Drop gives URIs. And so in particular, %20 in place of spaces in filenames
+ // thus need to convert the text into a plain string
+ gchar *filename = g_filename_from_uri ( entry, NULL, NULL );
+ if ( filename )
+ filenames = g_slist_append ( filenames, filename );
+ }
entry_runner++;
entry = entries[entry_runner];
}
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 ) )
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 );
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);
+ // Set initial button sensitivity
+ center_changed_cb ( 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 );
/* 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 );
/* 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 = G_VALUE_INIT;
+ 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 )
(VikToolKeyFunc) ruler_key_press,
FALSE,
GDK_CURSOR_IS_PIXMAP,
- &cursor_ruler_pixbuf };
+ &cursor_ruler_pixbuf,
+ NULL };
/*** end ruler code ********************************************************/
draw_buf_done = FALSE;
}
}
+ else
+ zts->bounds_active = FALSE;
+
return VIK_LAYER_TOOL_ACK;
}
{
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);
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;
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;
}
NULL,
FALSE,
GDK_CURSOR_IS_PIXMAP,
- &cursor_zoom_pixbuf };
+ &cursor_zoom_pixbuf,
+ NULL };
/*** end zoom code ********************************************************/
/********************************************************************************
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;
}
(VikToolMouseFunc) pantool_release,
NULL,
FALSE,
- GDK_FLEUR };
+ GDK_FLEUR,
+ NULL,
+ NULL };
/*** end pan code ********************************************************/
/********************************************************************************
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
*/
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;
- }
+ }
}
}
}
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);
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 )
{
// 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 )
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:
+ 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(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 );
}
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" );
}
// 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);
// Show some progress
if ( this_success ) {
export_count++;
- gchar *message = g_strconcat ( _("Exporting to file: "), fn, NULL );
+ gchar *message = g_strdup_printf ( _("Exporting to file: %s"), fn );
vik_statusbar_set_message ( vw->viking_vs, VIK_STATUSBAR_INFO, message );
while ( gtk_events_pending() )
gtk_main_iteration ();
return;
}
- GtkWidget *dialog = gtk_dialog_new_with_buttons ( _("Export to directory"),
+ GtkWidget *dialog = gtk_file_chooser_dialog_new ( _("Export to directory"),
GTK_WINDOW(vw),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_CANCEL,
GTK_RESPONSE_REJECT,
GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT,
NULL );
-
- GtkWidget *gw = gtk_file_chooser_widget_new ( GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
- gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), gw, TRUE, TRUE, 0 );
-
- // try to make it a nice size - otherwise seems to default to something impractically small
- gtk_window_set_default_size ( GTK_WINDOW(dialog), 600, 300 );
+ gtk_window_set_transient_for ( GTK_WINDOW(dialog), GTK_WINDOW(vw) );
+ gtk_window_set_destroy_with_parent ( GTK_WINDOW(dialog), TRUE );
+ gtk_window_set_modal ( GTK_WINDOW(dialog), TRUE );
gtk_widget_show_all ( dialog );
if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) {
- gchar *dir = gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER(gw) );
+ gchar *dir = gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER(dialog) );
gtk_widget_destroy ( dialog );
if ( dir ) {
if ( !export_to ( vw, gl, vft, dir, extension ) )
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;
}
#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 );
+}
+
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);
}
NULL,
NULL,
NULL,
+ NULL,
},
};
VikLayerParam pref_lon[] = {
NULL,
NULL,
NULL,
+ NULL,
},
};
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 );
}
}
- 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 );
png_radio = gtk_radio_button_new_with_label ( NULL, _("Save as PNG") );
jpeg_radio = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(png_radio), _("Save as JPEG") );
+ gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), png_radio, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), jpeg_radio, FALSE, FALSE, 0);
+
if ( ! vw->draw_image_save_as_png )
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(jpeg_radio), TRUE );
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), win_warning_label, FALSE, FALSE, 0);
#endif
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), current_window_button, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), png_radio, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), jpeg_radio, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), zoom_label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), zoom_combo, FALSE, FALSE, 0);
#ifdef VIK_CONFIG_GEOTAG
{ "AcquireGeotag", NULL, N_("From Geotagged _Images..."), NULL, N_("Create waypoints from geotagged images"), (GCallback)acquire_from_geotag },
#endif
+ { "AcquireURL", NULL, N_("From _URL..."), NULL, N_("Get a file from a URL"), (GCallback)acquire_from_url },
#ifdef VIK_CONFIG_GEONAMES
{ "AcquireWikipedia", NULL, N_("From _Wikipedia Waypoints"), NULL, N_("Create waypoints from Wikipedia items in the current view"), (GCallback)acquire_from_wikipedia },
#endif
{ "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 },
gtk_action_group_add_radio_actions (action_group, mode_entries, G_N_ELEMENTS (mode_entries), 4, (GCallback)window_change_coord_mode_cb, 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>",
action.callback = (GCallback)menu_addlayer_cb;
gtk_action_group_add_actions(action_group, &action, 1, window);
+ g_free ( (gchar*)action.label );
+
if ( vik_layer_get_interface(i)->tools_count ) {
gtk_ui_manager_add_ui(uim, mid, "/ui/MainMenu/Tools/", vik_layer_get_interface(i)->name, NULL, GTK_UI_MANAGER_SEPARATOR, FALSE);
gtk_ui_manager_add_ui(uim, mid, "/ui/MainToolbar/ToolItems/", vik_layer_get_interface(i)->name, NULL, GTK_UI_MANAGER_SEPARATOR, FALSE);
}
GtkActionEntry action_dl;
+ gchar *layername = g_strdup_printf ( "Layer%s", vik_layer_get_interface(i)->fixed_layer_name );
gtk_ui_manager_add_ui(uim, mid, "/ui/MainMenu/Edit/LayerDefaults",
vik_layer_get_interface(i)->name,
- g_strdup_printf("Layer%s", vik_layer_get_interface(i)->fixed_layer_name),
+ layername,
GTK_UI_MANAGER_MENUITEM, FALSE);
+ g_free (layername);
// For default layers use action names of the form 'Layer<LayerName>'
// This is to avoid clashing with just the layer name used above for the tool actions
action_dl.tooltip = NULL;
action_dl.callback = (GCallback)layer_defaults_cb;
gtk_action_group_add_actions(action_group, &action_dl, 1, window);
+ g_free ( (gchar*)action_dl.name );
+ g_free ( (gchar*)action_dl.label );
}
g_object_unref (icon_factory);