# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: src/org/openstreetmap/josm/gui/layer/markerlayer/ButtonMarker.java
--- src/org/openstreetmap/josm/gui/layer/markerlayer/ButtonMarker.java Base (BASE)
+++ src/org/openstreetmap/josm/gui/layer/markerlayer/ButtonMarker.java Locally Modified (Based On LOCAL)
@@ -25,7 +25,7 @@
     private Rectangle buttonRectangle;
 
     public ButtonMarker(LatLon ll, String buttonImage, MarkerLayer parentLayer, double time, double offset) {
-        super(ll, null, buttonImage, parentLayer, time, offset);
+        super(ll, "", buttonImage, parentLayer, time, offset);
         buttonRectangle = new Rectangle(0, 0, symbol.getIconWidth(), symbol.getIconHeight());
     }
 
@@ -61,8 +61,10 @@
         Rectangle r = new Rectangle(buttonRectangle);
         r.grow((inset.top+inset.bottom)/2, (inset.left+inset.right)/2);
         b.paintBorder(mv, g, r.x, r.y, r.width, r.height);
-        if ((text != null) && showTextOrIcon && Main.pref.getBoolean("marker.buttonlabels", true)) {
-            g.drawString(text, screen.x+4, screen.y+2);
+
+        String labelText = getText();
+        if ((labelText != null) && showTextOrIcon && Main.pref.getBoolean("marker.buttonlabels", true)) {
+            g.drawString(labelText, screen.x+4, screen.y+2);
         }
     }
 }
Index: src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
--- src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java Base (BASE)
+++ src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java Locally Modified (Based On LOCAL)
@@ -9,8 +9,10 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.LinkedList;
 
+import java.util.Map;
 import javax.swing.Icon;
 
 import org.openstreetmap.josm.data.coor.CachedLatLon;
@@ -19,7 +21,7 @@
 import org.openstreetmap.josm.data.gpx.GpxData;
 import org.openstreetmap.josm.data.gpx.GpxLink;
 import org.openstreetmap.josm.data.gpx.WayPoint;
-import org.openstreetmap.josm.data.preferences.StringProperty;
+import org.openstreetmap.josm.data.preferences.IntegerProperty;
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -60,6 +62,7 @@
  */
 public class Marker implements ActionListener {
     public final String text;
+    public final Map<String,String> textMap = new HashMap<String,String>();
     public final Icon symbol;
     public final MarkerLayer parentLayer;
     public double time; /* absolute time of marker since epoch */
@@ -95,7 +98,8 @@
      */
     public static LinkedList<MarkerProducers> markerProducers = new LinkedList<MarkerProducers>();
 
-    private static final StringProperty PROP_NAME_DESC = new StringProperty( "draw.gpx.layer.wpt", "nameordesc" );
+    private static final IntegerProperty PROP_LABEL = new IntegerProperty( "draw.rawgps.layer.wpt", 0 );
+    private static final String[] labelAttributes = new String[]{"name", "desc"};
 
     // Add one Maker specifying the default behaviour.
     static {
@@ -117,36 +121,13 @@
                     uri = new File(relativePath.getParentFile(), uri).toURI().toString();
                 }
 
-                String name_desc = "";
-                if (PROP_NAME_DESC.get() == null || "nameordesc".equals(PROP_NAME_DESC.get()))
-                {
-                    if (wpt.attr.containsKey("name")) {
-                        name_desc = wpt.getString("name");
-                    } else if (wpt.attr.containsKey("desc")) {
-                        name_desc = wpt.getString("desc");
+                Map<String,String> name_desc = new HashMap<String,String>();
+                for(String attribute:labelAttributes) {
+                    if (wpt.attr.containsKey(attribute)) {
+                        name_desc.put(attribute,wpt.getString(attribute));
                     }
-                } else if ("name".equals(PROP_NAME_DESC.get())) {
-                    if (wpt.attr.containsKey("name")) {
-                        name_desc = wpt.getString("name");
                     }
-                }
-                else if ("desc".equals(PROP_NAME_DESC.get())) {
-                    if (wpt.attr.containsKey("desc")) {
-                        name_desc = wpt.getString("desc");
-                    }
-                }
-                else if ("both".equals(PROP_NAME_DESC.get()) ) {
-                    if (wpt.attr.containsKey("name")) {
-                        name_desc = wpt.getString("name");
 
-                        if (wpt.attr.containsKey("desc")) {
-                            name_desc += " (" + wpt.getString("desc") + ")" ;
-                        }
-                    } else if (wpt.attr.containsKey("desc")) {
-                        name_desc = wpt.getString("desc");
-                    }
-                }
-
                 if (uri == null) {
                     String symbolName = wpt.getString("symbol");
                     if (symbolName == null) {
@@ -155,7 +136,7 @@
                     return new Marker(wpt.getCoor(), name_desc, symbolName, parentLayer, time, offset);
                 }
                 else if (uri.endsWith(".wav"))
-                    return AudioMarker.create(wpt.getCoor(), name_desc, uri, parentLayer, time, offset);
+                    return AudioMarker.create(wpt.getCoor(), getText(name_desc), uri, parentLayer, time, offset);
                 else if (uri.endsWith(".png") || uri.endsWith(".jpg") || uri.endsWith(".jpeg") || uri.endsWith(".gif"))
                     return ImageMarker.create(wpt.getCoor(), uri, parentLayer, time, offset);
                 else
@@ -175,13 +156,35 @@
 
     public Marker(LatLon ll, String text, String iconName, MarkerLayer parentLayer, double time, double offset) {
         setCoor(ll);
+        if (text != null && text.length() == 0) {
+            this.text = null;
+        }
+        else {
         this.text = text;
+        }
         this.offset = offset;
         this.time = time;
         this.symbol = ImageProvider.getIfAvailable("markers",iconName);
         this.parentLayer = parentLayer;
     }
 
+    public Marker(LatLon ll, Map<String,String> textMap, String iconName, MarkerLayer parentLayer, double time, double offset) {
+        setCoor(ll);
+        if (textMap!=null) {
+            for(String txt:textMap.keySet()) {
+                String tmpText = textMap.get(txt);
+                if (tmpText!=null) {
+                    this.textMap.put(txt,tmpText);
+                }
+            }
+        }
+        this.text = null;
+        this.offset = offset;
+        this.time = time;
+        this.symbol = ImageProvider.getIfAvailable("markers",iconName);
+        this.parentLayer = parentLayer;
+    }
+
     /**
      * Checks whether the marker display area contains the given point.
      * Markers not interested in mouse clicks may always return false.
@@ -217,8 +220,9 @@
             g.drawLine(screen.x+2, screen.y-2, screen.x-2, screen.y+2);
         }
 
-        if ((text != null) && showTextOrIcon) {
-            g.drawString(text, screen.x+4, screen.y+2);
+        String labelText = getText();
+        if ((labelText != null) && showTextOrIcon) {
+            g.drawString(labelText, screen.x+4, screen.y+2);
         }
     }
 
@@ -253,7 +257,84 @@
      */
 
     public AudioMarker audioMarkerFromMarker(String uri) {
-        AudioMarker audioMarker = AudioMarker.create(getCoor(), this.text, uri, this.parentLayer, this.time, this.offset);
+        AudioMarker audioMarker = AudioMarker.create(getCoor(), this.getText(), uri, this.parentLayer, this.time, this.offset);
         return audioMarker;
     }
+
+    /**
+     * Returns the Text which should be displayed, depending on chosen preference
+     * @return Text
+     */
+    public String getText() {
+        if (this.text != null ) {
+            return this.text;
 }
+        else {
+            return getText(this.textMap);
+        }
+    }
+
+    /**
+     * Returns the Text which should be displayed, depending on chosen preference.
+     * The possible attributes are read from textMap.
+     *
+     * @param textMap A map with available texts/attributes
+     * @return Text
+     */
+    private static String getText(Map<String,String> textMap) {
+        String text = "";
+
+        if (textMap != null && !textMap.isEmpty()) {
+            switch(PROP_LABEL.get())
+            {
+                // name
+                case 1:
+                {
+                    if (textMap.containsKey("name")) {
+                        text = textMap.get("name");
+                    }
+                    break;
+                }
+
+                // desc
+                case 2:
+                {
+                    if (textMap.containsKey("desc")) {
+                        text = textMap.get("desc");
+                    }
+                    break;
+                }
+
+                // auto
+                case 0:
+                // both
+                case 3:
+                {
+                    if (textMap.containsKey("name")) {
+                        text = textMap.get("name");
+
+                        if (textMap.containsKey("desc")) {
+                            if (PROP_LABEL.get() != 0 || !text.equals(textMap.get("desc"))) {
+                                text += " - " + textMap.get("desc");
+                            }
+                        }
+                    }
+                    else if (textMap.containsKey("desc")) {
+                        text = textMap.get("desc");
+                    }
+                    break;
+                }
+
+                // none
+                case 4:
+                default:
+                {
+                    text = "";
+                    break;
+                }
+            }
+        }
+
+        return text;
+    }
+}
Index: src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java
--- src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java Base (BASE)
+++ src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java Locally Modified (Based On LOCAL)
@@ -58,6 +58,7 @@
     private JCheckBox inactive = new JCheckBox(tr("Draw inactive layers in other color"));
     private JCheckBox useAntialiasing = new JCheckBox(tr("Smooth map graphics (antialiasing)"));
     private JCheckBox makeAutoMarkers = new JCheckBox(tr("Create markers when reading GPX."));
+    private JComboBox waypointLabel = new JComboBox(new String[] {tr("Auto"), tr("Name"), tr("Desc"), tr("Both"), tr("None")});
 
     public void addGui(PreferenceTabbedPane gui) {
         gui.display.setPreferredSize(new Dimension(400,600));
@@ -203,6 +204,14 @@
         panel.add(colorTypeVelocityTune, GBC.eop().insets(5,0,0,5));
         panel.add(colorTypeDilution, GBC.eol().insets(40,0,0,0));
 
+        // waypointLabel
+        panel.add(Box.createVerticalGlue(), GBC.eol().insets(0, 20, 0, 0));
+
+        waypointLabel.setSelectedIndex(Main.pref.getInteger("draw.rawgps.layer.wpt", 0 ));
+        colorTypeDilution.setToolTipText(tr("Allows to change the labelling of track waypoints."));
+        panel.add(new JLabel(tr("Waypoint labelling")), GBC.std().insets(20,0,0,0));
+        panel.add(waypointLabel, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
+
         panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH));
         JScrollPane scrollpane = new JScrollPane(panel);
         scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
@@ -305,6 +314,10 @@
         } }
         else { vn = 0; }
         Main.pref.putInteger("mappaint.node.virtual-size", vn);
+        if (Main.pref.getInteger("draw.rawgps.layer.wpt",-1) != waypointLabel.getSelectedIndex()) {
+            Main.pref.putInteger( "draw.rawgps.layer.wpt", waypointLabel.getSelectedIndex());
+            Main.map.repaint();
+        }
         return false;
     }
 }
