Index: /applications/editors/josm/plugins/infomode/build.xml
===================================================================
--- /applications/editors/josm/plugins/infomode/build.xml	(revision 26396)
+++ /applications/editors/josm/plugins/infomode/build.xml	(revision 26397)
@@ -30,5 +30,5 @@
 <project name="InfoMode" default="dist" basedir=".">
     <!-- enter the SVN commit message -->
-    <property name="commit.message" value="InfoMode initial commit"/>
+    <property name="commit.message" value="InfoMode : link and velocity works, shift=highlight track"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     <property name="plugin.main.version" value="4201"/>
Index: /applications/editors/josm/plugins/infomode/src/org/openstreetmap/josm/plugins/infomode/InfoMode.java
===================================================================
--- /applications/editors/josm/plugins/infomode/src/org/openstreetmap/josm/plugins/infomode/InfoMode.java	(revision 26396)
+++ /applications/editors/josm/plugins/infomode/src/org/openstreetmap/josm/plugins/infomode/InfoMode.java	(revision 26397)
@@ -11,4 +11,5 @@
 
 import java.awt.AWTEvent;
+import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Point;
@@ -20,4 +21,6 @@
 import java.awt.Cursor;
 import java.awt.Graphics2D;
+import java.awt.Shape;
+import java.awt.Stroke;
 import java.awt.Toolkit;
 import java.awt.event.AWTEventListener;
@@ -68,12 +71,8 @@
     @Override
     public void enterMode() {
-        System.out.println("entering mode");
         if (!isEnabled()) return;
         super.enterMode();
-        System.out.println("enter mode");
-        
         
         mv = Main.map.mapView;
-        
         Main.map.mapView.addMouseListener(this);
         Main.map.mapView.addMouseMotionListener(this);
@@ -91,5 +90,4 @@
     public void exitMode() {
         super.exitMode();
-        System.out.println("exit mode");
         Main.map.mapView.removeMouseListener(this);
         Main.map.mapView.removeMouseMotionListener(this);
@@ -123,12 +121,15 @@
             GpxLayer gpxL = (GpxLayer )l;
             
-            double minDist=1e9,d,len=0;
+            double minDist=1e9,d;
             WayPoint wp=null,oldWp=null,prevWp=null;
             GpxTrack trk=null;
+            double maxD = mv.getDist100Pixel()/3;
             for (GpxTrack track : gpxL.data.tracks) {
                 for (GpxTrackSegment seg : track.getSegments()) {
+                    oldWp=null;// next segment will have new previous point
                     for (WayPoint S : seg.getWayPoints()) {
                         d = S.getEastNorth().distance(pos);
-                        if (d<minDist && d<100) {
+                        
+                        if (d<minDist && d<maxD) {
                             minDist = d;
                             prevWp=oldWp;
@@ -136,5 +137,5 @@
                             trk=track;
                             }
-                        oldWp=wp;
+                        oldWp=S;
                     }
                 }
@@ -145,19 +146,36 @@
                 g.setColor(Color.RED);
                 g.fillOval(p.x-10, p.y-10, 20, 20); // mark selected point
+                if (shift) { // highlight track
+                    g.setColor(new Color(255,30,0,128));
+                    Stroke oldStroke = g.getStroke();
+                    g.setStroke( new BasicStroke(10) );
+                    for (GpxTrackSegment seg : trk.getSegments()) {
+                    Point oldP=null,curP=null;// next segment will have new previous point
+                        for (WayPoint S : seg.getWayPoints()) {
+                            curP = mv.getPoint(S.getEastNorth());
+                            if (oldP!=null) g.drawLine(oldP.x, oldP.y, curP.x, curP.y);
+                            oldP = curP;
+                        }
+                    }
+                    g.setStroke(oldStroke);
+                }
+                Point s=mv.getLocationOnScreen();
+                int pcx = s.x+p.x-40;
+                int pcy = s.y+p.y+30;
+                if (shift) {pcx+=40; pcy-=30;}
                 
                 if (wp!=wpOld) {
-                if (oldPopup!=null) oldPopup.hide();
-                double vel=-1;
-                if (prevWp!=null && wp.time!=prevWp.time) {
-                    vel=wp.getCoor().greatCircleDistance(prevWp.getCoor())/
-                            (wp.time-prevWp.time)*3.6;
-                }
-                infoPanel.setData(wp,trk,vel,gpxL.data.tracks);
-                Point s=mv.getLocationOnScreen();
-                Popup pp=PopupFactory.getSharedInstance().getPopup(mv, infoPanel, 
-                        s.x+p.x+10, s.y+p.y+10);
-                pp.show();
-                wpOld=wp;
-                oldPopup=pp;
+                    if (oldPopup!=null) oldPopup.hide();
+                    double vel=-1;
+                    if (prevWp!=null && wp.time!=prevWp.time) {
+                        vel=wp.getCoor().greatCircleDistance(prevWp.getCoor())/
+                                (wp.time-prevWp.time)*3.6;
+                    }
+                    infoPanel.setData(wp,trk,vel,gpxL.data.tracks);
+                    Popup pp=PopupFactory.getSharedInstance().getPopup(mv, infoPanel, 
+                            pcx, pcy);
+                    pp.show();
+                    wpOld=wp;
+                    oldPopup=pp;
                 }
             }
@@ -267,7 +285,3 @@
         }
     }
-
-    
-
-    
 }
Index: /applications/editors/josm/plugins/infomode/src/org/openstreetmap/josm/plugins/infomode/InfoPanel.java
===================================================================
--- /applications/editors/josm/plugins/infomode/src/org/openstreetmap/josm/plugins/infomode/InfoPanel.java	(revision 26397)
+++ /applications/editors/josm/plugins/infomode/src/org/openstreetmap/josm/plugins/infomode/InfoPanel.java	(revision 26397)
@@ -0,0 +1,123 @@
+package org.openstreetmap.josm.plugins.infomode;
+
+import java.awt.Color;
+import java.awt.event.MouseEvent;
+import java.util.HashSet;
+import java.util.Set;
+import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseListener;
+import java.text.DateFormat;
+import java.util.Collection;
+import java.util.Locale;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.gpx.GpxTrack;
+import org.openstreetmap.josm.data.gpx.WayPoint;
+import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.OpenBrowser;
+import org.openstreetmap.josm.tools.UrlLabel;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+class InfoPanel extends JPanel {
+    
+    private Collection<GpxTrack> tracks;
+    private GpxTrack trk;
+    private DateFormat df;
+
+    private JLabel label1=new JLabel();
+    private JLabel label2=new JLabel();
+    private JLabel label3=new JLabel();
+    private JLabel label4=new JLabel();
+    private JLabel label5=new JLabel();
+    private JLabel label6=new JLabel();
+    private JButton but1 = new JButton(tr("Hide this"));
+    private JButton but2 = new JButton(tr("Hide this&older"));
+    
+    public InfoPanel() {
+        super(new GridBagLayout());
+        df = DateFormat.getDateTimeInstance(DateFormat.DEFAULT,DateFormat.DEFAULT, Locale.getDefault()); 
+        setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+        add(label1, GBC.eol().insets(10,0,0,0));
+        add(label2, GBC.eol().insets(10,0,0,0));
+        add(label3, GBC.eol().insets(10,0,0,0));
+        add(label4, GBC.eol().insets(10,0,0,0));
+        add(label5, GBC.eol().insets(10,0,0,0));
+        add(label6, GBC.eol().insets(10,0,0,0));
+        add(but1, GBC.std().insets(10,5,0,0));
+        add(but2, GBC.eop().insets(10,5,0,0));
+        // lightweight hyperlink
+        label6.addMouseListener(new MouseListener() {
+            @Override
+            public void mouseClicked(MouseEvent e) { OpenBrowser.displayUrl(label6.getText());  }
+            public void mousePressed(MouseEvent e) { }
+            public void mouseReleased(MouseEvent e) { }
+            public void mouseEntered(MouseEvent e) { }
+            public void mouseExited(MouseEvent e) { }
+        });
+        but1.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                if (tracks!=null) tracks.remove(trk);
+                Main.map.mapView.repaint();
+            }
+        });
+        but2.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+            if (tracks==null) return;
+            Set<GpxTrack> toRemove = new HashSet<GpxTrack>();
+            
+            double tm=-1;
+            for (GpxTrackSegment seg : trk.getSegments()) {
+                    for (WayPoint S : seg.getWayPoints()) {
+                        if (S.time>tm) {tm=S.time;}
+                    }
+                }
+            
+            for (GpxTrack track : tracks) {
+                boolean f=true;
+                sg: for (GpxTrackSegment seg : track.getSegments()) {
+                    for (WayPoint S : seg.getWayPoints()) {
+                        if (S.time>tm) {f=false; break sg;}
+                    }
+                }
+                if (f) toRemove.add(track);
+            }
+            tracks.removeAll(toRemove);
+            Main.map.mapView.repaint();
+            }
+        });
+        
+
+    }
+
+    void setData(WayPoint wp, GpxTrack trk, double vel, Collection<GpxTrack> tracks) {
+        this.tracks=tracks;
+        this.trk=trk;
+        if (wp.time==0.0)  label1.setText(tr("No timestamp"));
+        else label1.setText(df.format(wp.getTime()));
+        if (vel>0) label2.setText(String.format("%.1f "+tr("km/h"), vel));
+              else label2.setText(null);
+        String s = (String) trk.getAttributes().get("name");
+        if (s!=null) label3.setText(tr("Track name: ")+s); 
+                else label3.setText(null);
+        s = (String) trk.getAttributes().get("desc");
+        label4.setText(s);
+        s = (String) wp.attr.get("ele");
+        String s1="";
+        try {s1 = String.format("H=%3.1f   ", Double.parseDouble(s));} catch (Exception e) { }
+        s1=s1+"L="+(int)trk.length();
+        label5.setText(s1);
+        if (trk.getAttributes().containsKey("url")) {
+           label6.setText(trk.getAttributes().get("url").toString());
+        }
+    }
+    
+}
