]> git.street.me.uk Git - andy/viking.git/blobdiff - src/vikgeoreflayer.c
Enable setting the icon on a viktreeview item.
[andy/viking.git] / src / vikgeoreflayer.c
index e1447e8f6524b4152e4263c4c36b02f13238a568..906d5433db067e37ab319ebcf2d2f84e5d905a5d 100644 (file)
@@ -65,18 +65,27 @@ static gboolean georef_layer_move_press ( VikGeorefLayer *vgl, GdkEventButton *e
 static gpointer georef_layer_zoom_create ( VikWindow *vw, VikViewport *vvp);
 static gboolean georef_layer_zoom_press ( VikGeorefLayer *vgl, GdkEventButton *event, VikViewport *vvp );
 
+// See comment in viktrwlayer.c for advice on values used
 static VikToolInterface georef_tools[] = {
-  { N_("Georef Move Map"), (VikToolConstructorFunc) georef_layer_move_create, NULL, NULL, NULL,
+  { { "GeorefMoveMap", "vik-icon-Georef Move Map",  N_("_Georef Move Map"), NULL,  N_("Georef Move Map"), 0 },
+    (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_pixbuf },
+    (VikToolKeyFunc) NULL,
+    FALSE,
+    GDK_CURSOR_IS_PIXMAP, &cursor_geomove_pixbuf },
 
-  { N_("Georef Zoom Tool"), (VikToolConstructorFunc) georef_layer_zoom_create, NULL, NULL, NULL,
+  { { "GeorefZoomTool", "vik-icon-Georef Zoom Tool",  N_("Georef Z_oom Tool"), NULL,  N_("Georef Zoom Tool"), 0 },
+    (VikToolConstructorFunc) georef_layer_zoom_create, NULL, NULL, NULL,
     (VikToolMouseFunc) georef_layer_zoom_press, NULL, NULL,
-    (VikToolKeyFunc) NULL, GDK_CURSOR_IS_PIXMAP, &cursor_geozoom_pixbuf },
+    (VikToolKeyFunc) NULL,
+    FALSE,
+    GDK_CURSOR_IS_PIXMAP, &cursor_geozoom_pixbuf },
 };
 
 VikLayerInterface vik_georef_layer_interface = {
   "GeoRef Map",
+  N_("GeoRef Map"),
+  NULL,
   &vikgeoreflayer_pixbuf, /*icon */
 
   georef_tools,
@@ -108,6 +117,7 @@ VikLayerInterface vik_georef_layer_interface = {
   (VikLayerFuncSublayerToggleVisible)   NULL,
   (VikLayerFuncSublayerTooltip)         NULL,
   (VikLayerFuncLayerTooltip)            georef_layer_tooltip,
+  (VikLayerFuncLayerSelected)           NULL,
 
   (VikLayerFuncMarshall)               georef_layer_marshall,
   (VikLayerFuncUnmarshall)             georef_layer_unmarshall,
@@ -119,10 +129,16 @@ VikLayerInterface vik_georef_layer_interface = {
   (VikLayerFuncWriteFileData)           NULL,
 
   (VikLayerFuncDeleteItem)              NULL,
+  (VikLayerFuncCutItem)                 NULL,
   (VikLayerFuncCopyItem)                NULL,
   (VikLayerFuncPasteItem)               NULL,
   (VikLayerFuncFreeCopiedItem)          NULL,
   (VikLayerFuncDragDropRequest)                NULL,
+
+  (VikLayerFuncSelectClick)             NULL,
+  (VikLayerFuncSelectMove)              NULL,
+  (VikLayerFuncSelectRelease)           NULL,
+  (VikLayerFuncSelectedViewportMenu)    NULL,
 };
 
 struct _VikGeorefLayer {
@@ -177,7 +193,7 @@ static void georef_layer_marshall( VikGeorefLayer *vgl, guint8 **data, gint *len
 
 static VikGeorefLayer *georef_layer_unmarshall( guint8 *data, gint len, VikViewport *vvp )
 {
-  VikGeorefLayer *rv = georef_layer_new ( vvp );
+  VikGeorefLayer *rv = georef_layer_new ();
   vik_layer_unmarshall_params ( VIK_LAYER(rv), data, len, vvp );
   if (rv->image) {
     georef_layer_load_image ( rv );
@@ -215,7 +231,7 @@ static VikLayerParamData georef_layer_get_param ( VikGeorefLayer *vgl, guint16 i
 VikGeorefLayer *georef_layer_new ( )
 {
   VikGeorefLayer *vgl = VIK_GEOREF_LAYER ( g_object_new ( VIK_GEOREF_LAYER_TYPE, NULL ) );
-  vik_layer_init ( VIK_LAYER(vgl), VIK_LAYER_GEOREF );
+  vik_layer_set_type ( VIK_LAYER(vgl), VIK_LAYER_GEOREF );
 
   vgl->image = NULL;
   vgl->pixbuf = NULL;
@@ -588,17 +604,21 @@ static void georef_layer_add_menu_items ( VikGeorefLayer *vgl, GtkMenu *menu, gp
   gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item );
   gtk_widget_show ( item );
 
-  item = gtk_menu_item_new_with_mnemonic ( _("_Zoom to Fit Map") );
+  /* Now with icons */
+  item = gtk_image_menu_item_new_with_mnemonic ( _("_Zoom to Fit Map") );
+  gtk_image_menu_item_set_image ( (GtkImageMenuItem*)item, gtk_image_new_from_stock (GTK_STOCK_ZOOM_FIT, GTK_ICON_SIZE_MENU) );
   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_mnemonic ( _("_Goto Map Center") );
+  item = gtk_image_menu_item_new_with_mnemonic ( _("_Goto Map Center") );
+  gtk_image_menu_item_set_image ( (GtkImageMenuItem*)item, gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU) );
   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_mnemonic ( _("_Export to World File") );
+  item = gtk_image_menu_item_new_with_mnemonic ( _("_Export to World File") );
+  gtk_image_menu_item_set_image ( (GtkImageMenuItem*)item, gtk_image_new_from_stock (GTK_STOCK_HARDDISK, GTK_ICON_SIZE_MENU) );
   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 );
@@ -619,7 +639,7 @@ static gboolean georef_layer_move_release ( VikGeorefLayer *vgl, GdkEventButton
   {
     vgl->corner.easting += (event->x - vgl->click_x) * vik_viewport_get_xmpp (vvp);
     vgl->corner.northing -= (event->y - vgl->click_y) * vik_viewport_get_ympp (vvp);
-    vik_layer_emit_update ( VIK_LAYER(vgl) );
+    vik_layer_emit_update ( VIK_LAYER(vgl), FALSE );
     return TRUE;
   }
   return FALSE; /* I didn't move anything on this layer! */
@@ -652,7 +672,7 @@ static gboolean georef_layer_zoom_press ( VikGeorefLayer *vgl, GdkEventButton *e
   }
   vik_viewport_set_xmpp ( vvp, vgl->mpp_easting );
   vik_viewport_set_ympp ( vvp, vgl->mpp_northing );
-  vik_layer_emit_update ( VIK_LAYER(vgl) );
+  vik_layer_emit_update ( VIK_LAYER(vgl), FALSE );
   return TRUE;
 }