Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 989)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 990)
@@ -134,4 +134,6 @@
 			if (tmpWidth > width) width = tmpWidth;
 		}
+		if(w.selected)
+			color = selectedColor;
 
 		Node lastN;
@@ -146,5 +148,8 @@
 					{
 						if(lastN != null)
-							drawSeg(lastN, n, s.color != null ? s.color : color, false, s.getWidth(width), s.dashed);
+						{
+							drawSeg(lastN, n, s.color != null  && !w.selected ? s.color : color,
+							false, s.getWidth(width), s.dashed);
+						}
 						lastN = n;
 					}
@@ -157,5 +162,5 @@
 		{
 			if(lastN != null)
-				drawSeg(lastN, n, w.selected ? selectedColor : color, showDirection, width, dashed);
+				drawSeg(lastN, n, color, showDirection, width, dashed);
 			lastN = n;
 		}
@@ -171,5 +176,8 @@
 					{
 						if(lastN != null)
-							drawSeg(lastN, n, s.color != null ? s.color : color, false, s.getWidth(width), s.dashed);
+						{
+							drawSeg(lastN, n, s.color != null && !w.selected ? s.color : color,
+							false, s.getWidth(width), s.dashed);
+						}
 						lastN = n;
 					}
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java	(revision 989)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java	(revision 990)
@@ -51,9 +51,9 @@
 		String colorString;
 		if(i < 0) // name only
-			colorString = Main.pref.get("color.mappaint."+colString);
+			colorString = Main.pref.get("color.mappaint."+styleName+"."+colString);
 		else if(i == 0) // value only
 			colorString = colString;
 		else // value and name
-			colorString = Main.pref.get("color.mappaint."+colString.substring(0,i), colString.substring(i));
+			colorString = Main.pref.get("color.mappaint."+styleName+"."+colString.substring(0,i), colString.substring(i));
 		return ColorHelper.html2color(colorString);
 	}
@@ -108,5 +108,5 @@
 			else if (qName.equals("linemod"))
 			{
-				hadLineMod = inLine = true;
+				hadLineMod = inLineMod = true;
 				for (int count=0; count<atts.getLength(); count++)
 				{
@@ -116,30 +116,30 @@
 						if(val.startsWith("+"))
 						{
-							rule.line.width = Integer.parseInt(val.substring(1));
-							rule.line.widthMode = LineElemStyle.WidthMode.OFFSET;
+							rule.linemod.width = Integer.parseInt(val.substring(1));
+							rule.linemod.widthMode = LineElemStyle.WidthMode.OFFSET;
 						}
 						else if(val.startsWith("-"))
 						{
-							rule.line.width = Integer.parseInt(val);
-							rule.line.widthMode = LineElemStyle.WidthMode.OFFSET;
+							rule.linemod.width = Integer.parseInt(val);
+							rule.linemod.widthMode = LineElemStyle.WidthMode.OFFSET;
 						}
 						else if(val.endsWith("%"))
 						{
-							rule.line.width = Integer.parseInt(val.substring(0, val.length()-1));
-							rule.line.widthMode = LineElemStyle.WidthMode.PERCENT;
+							rule.linemod.width = Integer.parseInt(val.substring(0, val.length()-1));
+							rule.linemod.widthMode = LineElemStyle.WidthMode.PERCENT;
 						}
 						else
-							rule.line.width = Integer.parseInt(val);
+							rule.linemod.width = Integer.parseInt(val);
 					}
 					else if (atts.getQName(count).equals("colour"))
-						rule.line.color=convertColor(atts.getValue(count));
+						rule.linemod.color=convertColor(atts.getValue(count));
 					else if (atts.getQName(count).equals("realwidth"))
-						rule.line.realWidth=Integer.parseInt(atts.getValue(count));
+						rule.linemod.realWidth=Integer.parseInt(atts.getValue(count));
 					else if (atts.getQName(count).equals("dashed"))
-						rule.line.dashed=Boolean.parseBoolean(atts.getValue(count));
-					else if(atts.getQName(count).equals("priority"))
-						rule.line.priority = Integer.parseInt(atts.getValue(count));
+						rule.linemod.dashed=Boolean.parseBoolean(atts.getValue(count));
+					else if(atts.getQName(count).equals("priority"))
+						rule.linemod.priority = Integer.parseInt(atts.getValue(count));
 					else if(atts.getQName(count).equals("mode"))
-						rule.line.over = !atts.getValue(count).equals("under");
+						rule.linemod.over = !atts.getValue(count).equals("under");
 				}
 			}
@@ -180,5 +180,5 @@
 			if(hadLineMod)
 				styles.addModifier(styleName, rule.key, rule.value, rule.boolValue,
-				new LineElemStyle(rule.line, rule.scaleMax, rule.scaleMin));
+				new LineElemStyle(rule.linemod, rule.scaleMax, rule.scaleMin));
 			if(hadIcon)
 				styles.add(styleName, rule.key, rule.value, rule.boolValue,
@@ -195,4 +195,6 @@
 		else if (inLine && qName.equals("line"))
 			inLine = false;
+		else if (inLineMod && qName.equals("linemod"))
+			inLineMod = false;
 		else if (inIcon && qName.equals("icon"))
 			inIcon = false;
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 989)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 990)
@@ -117,5 +117,6 @@
 		AreaElemStyle retArea = null;
 		LineElemStyle retLine = null;
-		List<LineElemStyle> over = new LinkedList<LineElemStyle>();
+		String linestring = null;
+		HashMap<String, LineElemStyle> over = new HashMap<String, LineElemStyle>();
 		Iterator<String> iterator = w.keys.keySet().iterator();
 		while(iterator.hasNext())
@@ -129,26 +130,37 @@
 				retArea = styleArea;
 			if((styleLine = ss.lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority))
+			{
 				retLine = styleLine;
+				linestring = idx;
+			}
 			if((styleLine = ss.modifiers.get(idx)) != null)
-				over.add(styleLine);
+				over.put(idx, styleLine);
 			idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val);
 			if((styleArea = ss.areas.get(idx)) != null && (retArea == null || styleArea.priority > retArea.priority))
 				retArea = styleArea;
 			if((styleLine = ss.lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority))
+			{
 				retLine = styleLine;
+				linestring = idx;
+			}
 			if((styleLine = ss.modifiers.get(idx)) != null)
-				over.add(styleLine);
+				over.put(idx, styleLine);
 			idx = "x" + key;
 			if((styleArea = ss.areas.get(idx)) != null && (retArea == null || styleArea.priority > retArea.priority))
 				retArea = styleArea;
 			if((styleLine = ss.lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority))
+			{
 				retLine = styleLine;
+				linestring = idx;
+			}
 			if((styleLine = ss.modifiers.get(idx)) != null)
-				over.add(styleLine);
+				over.put(idx, styleLine);
 		}
+		over.remove(linestring);
 		if(over.size() != 0 && retLine != null)
 		{
-			Collections.sort(over);
-			retLine = new LineElemStyle(retLine, over);
+			List<LineElemStyle> s = new LinkedList<LineElemStyle>(over.values());
+			Collections.sort(s);
+			retLine = new LineElemStyle(retLine, s);
 		}
 		if(retArea != null)
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java	(revision 989)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java	(revision 990)
@@ -2,6 +2,5 @@
 
 import java.awt.Color;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.Collection;
 
 public class LineElemStyle extends ElemStyle implements Comparable<LineElemStyle>
@@ -16,5 +15,5 @@
 	public WidthMode widthMode;
 
-	public List<LineElemStyle> overlays;
+	public Collection<LineElemStyle> overlays;
 
 	public LineElemStyle(LineElemStyle s, long maxScale, long minScale) {
@@ -31,5 +30,5 @@
 	}
 
-	public LineElemStyle(LineElemStyle s, List<LineElemStyle> overlays) {
+	public LineElemStyle(LineElemStyle s, Collection<LineElemStyle> overlays) {
 		this.width = s.width;
 		this.realWidth = s.realWidth;
