X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/f2f2f7bf756f928fa8c45a1e3eee11a670828cd8..80471a6a905e00bf80ad04fa2061f88ea81f15cb:/src/vikgeoreflayer.c diff --git a/src/vikgeoreflayer.c b/src/vikgeoreflayer.c index 94cdaee9..5a95f314 100644 --- a/src/vikgeoreflayer.c +++ b/src/vikgeoreflayer.c @@ -24,10 +24,10 @@ #endif #include "viking.h" -#include "vikgeoreflayer_pixmap.h" -#include -#include +#include +#include #include +#include #include "icons/icons.h" @@ -65,16 +65,16 @@ static gboolean georef_layer_zoom_press ( VikGeorefLayer *vgl, GdkEventButton *e static VikToolInterface georef_tools[] = { { N_("Georef Move Map"), (VikToolConstructorFunc) georef_layer_move_create, NULL, NULL, NULL, (VikToolMouseFunc) georef_layer_move_press, NULL, (VikToolMouseFunc) georef_layer_move_release, - (VikToolKeyFunc) NULL, GDK_CURSOR_IS_PIXMAP, &cursor_geomove }, + (VikToolKeyFunc) NULL, GDK_CURSOR_IS_PIXMAP, &cursor_geomove_pixbuf }, { N_("Georef Zoom Tool"), (VikToolConstructorFunc) georef_layer_zoom_create, NULL, NULL, NULL, (VikToolMouseFunc) georef_layer_zoom_press, NULL, NULL, - (VikToolKeyFunc) NULL, GDK_CURSOR_IS_PIXMAP, &cursor_geozoom }, + (VikToolKeyFunc) NULL, GDK_CURSOR_IS_PIXMAP, &cursor_geozoom_pixbuf }, }; VikLayerInterface vik_georef_layer_interface = { "GeoRef Map", - &georeflayer_pixbuf, /*icon */ + &vikgeoreflayer_pixbuf, /*icon */ georef_tools, sizeof(georef_tools) / sizeof(VikToolInterface), @@ -293,11 +293,12 @@ static gboolean world_file_read_line ( gchar *buffer, gint size, FILE *f, GtkWid a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(widget), _("Unexpected end of file reading World file.") ); g_free ( buffer ); fclose ( f ); + f = NULL; return FALSE; } if ( use_value ) { - gdouble val = strtod ( buffer, NULL ); + gdouble val = g_strtod ( buffer, NULL ); gtk_spin_button_set_value ( GTK_SPIN_BUTTON(widget), val > 0 ? val : -val ); } return TRUE; @@ -305,11 +306,16 @@ static gboolean world_file_read_line ( gchar *buffer, gint size, FILE *f, GtkWid static void georef_layer_dialog_load ( GtkWidget *pass_along[4] ) { - GtkWidget *file_selector = gtk_file_selection_new (_("Choose World file")); - - if ( gtk_dialog_run ( GTK_DIALOG ( file_selector ) ) == GTK_RESPONSE_OK ) + GtkWidget *file_selector = gtk_file_chooser_dialog_new (_("Choose World file"), + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + + if ( gtk_dialog_run ( GTK_DIALOG ( file_selector ) ) == GTK_RESPONSE_ACCEPT ) { - FILE *f = fopen ( gtk_file_selection_get_filename ( GTK_FILE_SELECTION(file_selector) ), "r" ); + FILE *f = g_fopen ( gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER(file_selector) ), "r" ); gtk_widget_destroy ( file_selector ); if ( !f ) { @@ -325,6 +331,7 @@ static void georef_layer_dialog_load ( GtkWidget *pass_along[4] ) { g_free ( buffer ); fclose ( f ); + f = NULL; } } } @@ -344,11 +351,16 @@ We need a static void georef_layer_export_params ( gpointer *pass_along[2] ) { VikGeorefLayer *vgl = VIK_GEOREF_LAYER(pass_along[0]); - GtkWidget *file_selector = gtk_file_selection_new (_("Choose World file")); - - if ( gtk_dialog_run ( GTK_DIALOG ( file_selector ) ) == GTK_RESPONSE_OK ) + GtkWidget *file_selector = gtk_file_chooser_dialog_new (_("Choose World file"), + NULL, + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + if ( gtk_dialog_run ( GTK_DIALOG ( file_selector ) ) == GTK_RESPONSE_ACCEPT ) { - FILE *f = fopen ( gtk_file_selection_get_filename ( GTK_FILE_SELECTION(file_selector) ), "w" ); + FILE *f = g_fopen ( gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER(file_selector) ), "w" ); + gtk_widget_destroy ( file_selector ); if ( !f ) { @@ -359,6 +371,7 @@ static void georef_layer_export_params ( gpointer *pass_along[2] ) { fprintf ( f, "%f\n%f\n%f\n%f\n%f\n%f\n", vgl->mpp_easting, vgl->mpp_northing, 0.0, 0.0, vgl->corner.easting, vgl->corner.northing ); fclose ( f ); + f = NULL; } } else