*
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "viking.h"
-#include "vikgeoreflayer_pixmap.h"
-#include <stdlib.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+#include <glib/gi18n.h>
#include <string.h>
#include "icons/icons.h"
static gboolean georef_layer_zoom_press ( VikGeorefLayer *vgl, GdkEventButton *event, VikViewport *vvp );
static VikToolInterface georef_tools[] = {
- { "Georef Move Map", (VikToolConstructorFunc) georef_layer_move_create, NULL, NULL, NULL,
+ { 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, &cursor_geomove },
+ (VikToolKeyFunc) NULL, GDK_CURSOR_IS_PIXMAP, &cursor_geomove_pixbuf },
- { "Georef Zoom Tool", (VikToolConstructorFunc) georef_layer_zoom_create, NULL, NULL, NULL,
+ { N_("Georef Zoom Tool"), (VikToolConstructorFunc) georef_layer_zoom_create, NULL, NULL, NULL,
(VikToolMouseFunc) georef_layer_zoom_press, NULL, NULL,
- (VikToolKeyFunc) NULL, &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),
if (gx)
{
- g_warning ( "Couldn't open image file: %s", gx->message );
+ g_warning ( _("Couldn't open image file: %s"), gx->message );
g_error_free ( gx );
}
else
{
if (!fgets ( buffer, 1024, f ))
{
- a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(widget), "Unexpected end of file reading World file." );
+ 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;
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 )
{
- a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(pass_along[0]), "The World file you requested could not be opened for reading." );
+ a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(pass_along[0]), _("The World file you requested could not be opened for reading.") );
return;
}
else
{
g_free ( buffer );
fclose ( f );
+ f = NULL;
}
}
}
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 )
{
- a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(pass_along[0]), "The file you requested could not be opened for writing." );
+ a_dialog_error_msg ( VIK_GTK_WINDOW_FROM_WIDGET(pass_along[0]), _("The file you requested could not be opened for writing.") );
return;
}
else
{
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
/* returns TRUE if OK was pressed. */
static gboolean georef_layer_dialog ( VikGeorefLayer **vgl, gpointer vp, GtkWindow *w )
{
- GtkWidget *dialog = gtk_dialog_new_with_buttons ("Layer Properties",
+ GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Layer Properties"),
w,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL,
gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), table, TRUE, TRUE, 0 );
wfp_hbox = gtk_hbox_new ( FALSE, 0 );
- wfp_label = gtk_label_new ( "World File Parameters:" );
- wfp_button = gtk_button_new_with_label ( "Load From File..." );
+ wfp_label = gtk_label_new ( _("World File Parameters:") );
+ wfp_button = gtk_button_new_with_label ( _("Load From File...") );
gtk_box_pack_start ( GTK_BOX(wfp_hbox), wfp_label, TRUE, TRUE, 0 );
gtk_box_pack_start ( GTK_BOX(wfp_hbox), wfp_button, FALSE, FALSE, 3 );
- ce_label = gtk_label_new ( "Corner pixel easting:" );
+ ce_label = gtk_label_new ( _("Corner pixel easting:") );
ce_spin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( 4, 0.0, 1500000.0, 1, 5, 5 ), 1, 4 );
- cn_label = gtk_label_new ( "Corner pixel northing:" );
+ cn_label = gtk_label_new ( _("Corner pixel northing:") );
cn_spin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( 4, 0.0, 9000000.0, 1, 5, 5 ), 1, 4 );
- xlabel = gtk_label_new ( "X (easting) scale (mpp): ");
- ylabel = gtk_label_new ( "Y (northing) scale (mpp): ");
+ xlabel = gtk_label_new ( _("X (easting) scale (mpp): "));
+ ylabel = gtk_label_new ( _("Y (northing) scale (mpp): "));
xspin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( 4, VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM, 1, 5, 5 ), 1, 8 );
yspin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( 4, VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM, 1, 5, 5 ), 1, 8 );
- imagelabel = gtk_label_new ( "Map Image:" );
+ imagelabel = gtk_label_new ( _("Map Image:") );
imageentry = vik_file_entry_new ();
if (*vgl)
gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item );
gtk_widget_show ( item );
- item = gtk_menu_item_new_with_label ( "Zoom to Fit Map" );
+ item = gtk_menu_item_new_with_label ( _("Zoom to Fit Map") );
g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(georef_layer_zoom_to_fit), pass_along );
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show ( item );
- item = gtk_menu_item_new_with_label ( "Goto Map Center" );
+ item = gtk_menu_item_new_with_label ( _("Goto Map Center") );
g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(georef_layer_goto_center), pass_along );
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show ( item );
- item = gtk_menu_item_new_with_label ( "Export to World File" );
+ item = gtk_menu_item_new_with_label ( _("Export to World File") );
g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(georef_layer_export_params), pass_along );
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show ( item );