]> git.street.me.uk Git - andy/viking.git/blobdiff - src/viktrwlayer.c
Update libjpeg utilities from exif command line tool to version 0.6.21
[andy/viking.git] / src / viktrwlayer.c
index 67afed4a2c5ac27c7f325e4eb9e2d3edd9aa6d75..7eeae31ca31ac9485e13c2e2942121de733909a1 100644 (file)
@@ -263,8 +263,6 @@ static void trw_layer_free_track_gcs ( VikTrwLayer *vtl );
 static void trw_layer_draw_track_cb ( const gpointer id, VikTrack *track, struct DrawingParams *dp );
 static void trw_layer_draw_waypoint ( const gpointer id, VikWaypoint *wp, struct DrawingParams *dp );
 
-static void trw_layer_calculate_bounds_waypoints ( VikTrwLayer *vtl );
-
 static void goto_coord ( gpointer *vlp, gpointer vvp, gpointer vl, const VikCoord *coord );
 static void trw_layer_goto_track_startpoint ( gpointer pass_along[6] );
 static void trw_layer_goto_track_endpoint ( gpointer pass_along[6] );
@@ -3313,9 +3311,20 @@ static void trw_layer_geotagging_track ( gpointer pass_along[6] )
   vtl->has_verified_thumbnails = FALSE;
 
   trw_layer_geotag_dialog ( VIK_GTK_WINDOW_FROM_LAYER(vtl),
-                           vtl,
-                           track,
-                           track->name );
+                            vtl,
+                            NULL,
+                            track );
+}
+
+static void trw_layer_geotagging_waypoint ( gpointer pass_along[6] )
+{
+  VikTrwLayer *vtl = VIK_TRW_LAYER(pass_along[0]);
+  VikWaypoint *wpt = g_hash_table_lookup ( VIK_TRW_LAYER(pass_along[0])->waypoints, pass_along[3] );
+
+  trw_layer_geotag_dialog ( VIK_GTK_WINDOW_FROM_LAYER(vtl),
+                            vtl,
+                            wpt,
+                            NULL );
 }
 
 static void trw_layer_geotagging ( gpointer lav[2] )
@@ -3325,9 +3334,9 @@ static void trw_layer_geotagging ( gpointer lav[2] )
   vtl->has_verified_thumbnails = FALSE;
 
   trw_layer_geotag_dialog ( VIK_GTK_WINDOW_FROM_LAYER(vtl),
-                           vtl,
-                           NULL,
-                           NULL);
+                            vtl,
+                            NULL,
+                            NULL );
 }
 #endif
 
@@ -4651,7 +4660,7 @@ static void trw_layer_delete_item ( gpointer pass_along[6] )
 /**
  *  Rename waypoint and maintain corresponding name of waypoint in the treeview
  */
-static void trw_layer_waypoint_rename ( VikTrwLayer *vtl, VikWaypoint *wp, const gchar *new_name )
+void trw_layer_waypoint_rename ( VikTrwLayer *vtl, VikWaypoint *wp, const gchar *new_name )
 {
   vik_waypoint_set_name ( wp, new_name );
 
@@ -4673,6 +4682,28 @@ static void trw_layer_waypoint_rename ( VikTrwLayer *vtl, VikWaypoint *wp, const
   }
 }
 
+/**
+ *  Maintain icon of waypoint in the treeview
+ */
+void trw_layer_waypoint_reset_icon ( VikTrwLayer *vtl, VikWaypoint *wp )
+{
+  // update the treeview
+  wpu_udata udataU;
+  udataU.wp   = wp;
+  udataU.uuid = NULL;
+
+  // Need key of it for treeview update
+  gpointer *wpf = g_hash_table_find ( vtl->waypoints, (GHRFunc) trw_layer_waypoint_find_uuid, &udataU );
+
+  if ( wpf && udataU.uuid ) {
+    GtkTreeIter *it = g_hash_table_lookup ( vtl->waypoints_iters, udataU.uuid );
+
+    if ( it ) {
+      vik_treeview_item_set_icon ( VIK_LAYER(vtl)->vt, it, get_wp_sym_small (wp->symbol) );
+    }
+  }
+}
+
 static void trw_layer_properties_item ( gpointer pass_along[7] )
 {
   VikTrwLayer *vtl = VIK_TRW_LAYER(pass_along[0]);
@@ -7245,18 +7276,15 @@ static gboolean trw_layer_sublayer_add_menu_items ( VikTrwLayer *l, GtkMenu *men
 
     if ( subtype == VIK_TRW_LAYER_SUBLAYER_WAYPOINT )
     {
-      gboolean separator_created = FALSE;
+      // Always create separator as now there is always at least the transform menu option
+      item = gtk_menu_item_new ();
+      gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item );
+      gtk_widget_show ( item );
 
       /* could be a right-click using the tool */
       if ( vlp != NULL ) {
-       item = gtk_menu_item_new ();
-       gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item );
-       gtk_widget_show ( item );
-
-       separator_created = TRUE;
-
         item = gtk_image_menu_item_new_with_mnemonic ( _("_Goto") );
-       gtk_image_menu_item_set_image ( (GtkImageMenuItem*)item, gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU) );
+        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(trw_layer_goto_waypoint), pass_along );
         gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item );
         gtk_widget_show ( item );
@@ -7266,30 +7294,22 @@ static gboolean trw_layer_sublayer_add_menu_items ( VikTrwLayer *l, GtkMenu *men
 
       if ( wp && wp->name ) {
         if ( is_valid_geocache_name ( wp->name ) ) {
-
-          if ( !separator_created ) {
-            item = gtk_menu_item_new ();
-            gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item );
-            gtk_widget_show ( item );
-            separator_created = TRUE;
-          }
-
           item = gtk_menu_item_new_with_mnemonic ( _("_Visit Geocache Webpage") );
           g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_waypoint_gc_webpage), pass_along );
           gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item );
           gtk_widget_show ( item );
         }
+#ifdef VIK_CONFIG_GEOTAG
+        item = gtk_menu_item_new_with_mnemonic ( _("Geotag _Images...") );
+        g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_geotagging_waypoint), pass_along );
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+        gtk_widget_set_tooltip_text (item, _("Geotag multiple images against this waypoint"));
+        gtk_widget_show ( item );
+#endif
       }
 
       if ( wp && wp->image )
       {
-       if ( !separator_created ) {
-         item = gtk_menu_item_new ();
-         gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item );
-         gtk_widget_show ( item );
-         separator_created = TRUE;
-       }
-
        // Set up image paramater
        pass_along[5] = wp->image;
 
@@ -7330,7 +7350,6 @@ static gboolean trw_layer_sublayer_add_menu_items ( VikTrwLayer *l, GtkMenu *men
           gtk_widget_show ( item );
         }
       }
-
     }
   }
 
@@ -9834,7 +9853,7 @@ static void trw_layer_track_alloc_colors ( VikTrwLayer *vtl )
  * (Re)Calculate the bounds of the waypoints in this layer,
  * This should be called whenever waypoints are changed
  */
-static void trw_layer_calculate_bounds_waypoints ( VikTrwLayer *vtl )
+void trw_layer_calculate_bounds_waypoints ( VikTrwLayer *vtl )
 {
   struct LatLon topleft = { 0.0, 0.0 };
   struct LatLon bottomright = { 0.0, 0.0 };