Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 1239)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 1240)
@@ -47,5 +47,5 @@
     protected Stroke currentStroke = null;
     protected Font orderFont;
-    protected ElemStyles styles;
+    protected ElemStyles.StyleSet styles;
     protected double circum;
     protected String regionalNameOrder[];
@@ -78,7 +78,8 @@
         // check, if the node is visible at all
         Point p = nc.getPoint(n.eastNorth);
-        if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
-
-        IconElemStyle nodeStyle = (IconElemStyle)styles.get(n);
+        if ((!selectedCall && n.selected) || (p.x < 0) || (p.y < 0)
+        || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
+
+        IconElemStyle nodeStyle = styles != null ? (IconElemStyle)styles.get(n) : null;
         if (nodeStyle != null && isZoomOk(nodeStyle))
             drawNode(n, nodeStyle.icon, nodeStyle.annotate, n.selected);
@@ -96,5 +97,5 @@
      */
     public void visit(Way w) {
-        if(w.nodes.size() < 2)
+        if(w.nodes.size() < 2 && (!selectedCall && w.selected))
             return;
 
@@ -104,5 +105,5 @@
             return;
 
-        ElemStyle wayStyle = styles.get(w);
+        ElemStyle wayStyle = styles != null ? styles.get(w) : null;
 
         if(!isZoomOk(wayStyle))
@@ -322,5 +323,6 @@
                 /* nodes drawn on second call */
                 if(!(m.member instanceof Node))
-                    drawSelected(m.member, styles.get(m.member), true, true);
+                    drawSelected(m.member, styles != null ? styles.get(m.member)
+                    : null, true, true);
                 alreadyDrawn.add(m.member);
             }
@@ -368,5 +370,5 @@
                     && m.member instanceof Node)
                     {
-                        drawSelected(m.member, styles.get(m.member), true, true);
+                        drawSelected(m.member, styles != null ? styles.get(m.member) : null, true, true);
                         alreadyDrawn.add(m.member);
                     }
@@ -420,5 +422,5 @@
                             outer.add(w);
                         else if(r.selected)
-                            drawSelected(m.member, styles.get(m.member), true, true);
+                            drawSelected(m.member, styles != null ? styles.get(m.member) : null, true, true);
                     }
                 }
@@ -432,8 +434,8 @@
         }
 
-        ElemStyle wayStyle = styles.get(r);
+        ElemStyle wayStyle = styles != null ? styles.get(r) : null;
         /* find one wayStyle, prefer the style from Relation or take the first
         one of outer rings */
-        if(wayStyle == null || !(wayStyle instanceof AreaElemStyle))
+        if(styles != null && (wayStyle == null || !(wayStyle instanceof AreaElemStyle)))
         {
             for (Way w : outer)
@@ -779,5 +781,4 @@
     }
 
-    // NW 111106 Overridden from SimplePaintVisitor in josm-1.4-nw1
     // Shows areas before non-areas
     public void visitAll(DataSet data, Boolean virtual) {
@@ -798,5 +799,5 @@
         fillAlpha = Math.min(255, Math.max(0, Integer.valueOf(Main.pref.getInteger("mappaint.fillalpha", 50))));
         circum = Main.map.mapView.getScale()*100*Main.proj.scaleFactor()*40041455; // circumference of the earth in meter
-        styles = MapPaintStyles.getStyles();
+        styles = MapPaintStyles.getStyles().getStyleSet();
         drawMultipolygon = Main.pref.getBoolean("mappaint.multipolygon",false);
         orderFont = new Font(Main.pref.get("mappaint.font","Helvetica"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8));
@@ -808,7 +809,4 @@
         selectedCall = false;
 
-        // update the style name, just in case the user changed it in the meantime
-        styles.updateStyleName();
-
         if(profiler)
         {
@@ -817,5 +815,5 @@
         }
 
-        if (fillAreas && styles.hasAreas()) {
+        if (fillAreas && styles != null && styles.hasAreas()) {
             Collection<Way> noAreaWays = new LinkedList<Way>();
 
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 1239)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 1240)
@@ -17,9 +17,9 @@
 public class ElemStyles
 {
-    private class StyleSet {
-        HashMap<String, IconElemStyle> icons;
-        HashMap<String, LineElemStyle> lines;
-        HashMap<String, AreaElemStyle> areas;
-        HashMap<String, LineElemStyle> modifiers;
+    public class StyleSet {
+        private HashMap<String, IconElemStyle> icons;
+        private HashMap<String, LineElemStyle> lines;
+        private HashMap<String, AreaElemStyle> areas;
+        private HashMap<String, LineElemStyle> modifiers;
         public StyleSet()
         {
@@ -29,17 +29,126 @@
             areas = new HashMap<String, AreaElemStyle>();
         }
-    }
+        private ElemStyle getNode(Map<String, String> keys)
+        {
+            IconElemStyle ret = null;
+            Iterator<String> iterator = keys.keySet().iterator();
+            while(iterator.hasNext())
+            {
+                String key = iterator.next();
+                String val = keys.get(key);
+                IconElemStyle style;
+                if((style = icons.get("n" + key + "=" + val)) != null)
+                {
+                    if(ret == null || style.priority > ret.priority)
+                        ret = style;
+                }
+                if((style = icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null)
+                {
+                    if(ret == null || style.priority > ret.priority)
+                        ret = style;
+                }
+                if((style = icons.get("x" + key)) != null)
+                {
+                    if(ret == null || style.priority > ret.priority)
+                        ret = style;
+                }
+            }
+            return ret;
+        }
+        private ElemStyle get(Map<String, String> keys)
+        {
+            AreaElemStyle retArea = null;
+            LineElemStyle retLine = null;
+            String linestring = null;
+            HashMap<String, LineElemStyle> over = new HashMap<String, LineElemStyle>();
+            Iterator<String> iterator = keys.keySet().iterator();
+            while(iterator.hasNext())
+            {
+                String key = iterator.next();
+                String val = keys.get(key);
+                AreaElemStyle styleArea;
+                LineElemStyle styleLine;
+                String idx = "n" + key + "=" + val;
+                if((styleArea = areas.get(idx)) != null && (retArea == null || styleArea.priority > retArea.priority))
+                    retArea = styleArea;
+                if((styleLine = lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority))
+                {
+                    retLine = styleLine;
+                    linestring = idx;
+                }
+                if((styleLine = modifiers.get(idx)) != null)
+                    over.put(idx, styleLine);
+                idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val);
+                if((styleArea = areas.get(idx)) != null && (retArea == null || styleArea.priority > retArea.priority))
+                    retArea = styleArea;
+                if((styleLine = lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority))
+                {
+                    retLine = styleLine;
+                    linestring = idx;
+                }
+                if((styleLine = modifiers.get(idx)) != null)
+                    over.put(idx, styleLine);
+                idx = "x" + key;
+                if((styleArea = areas.get(idx)) != null && (retArea == null || styleArea.priority > retArea.priority))
+                    retArea = styleArea;
+                if((styleLine = lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority))
+                {
+                    retLine = styleLine;
+                    linestring = idx;
+                }
+                if((styleLine = modifiers.get(idx)) != null)
+                    over.put(idx, styleLine);
+            }
+            over.remove(linestring);
+            if(over.size() != 0 && retLine != null)
+            {
+                List<LineElemStyle> s = new LinkedList<LineElemStyle>(over.values());
+                Collections.sort(s);
+                retLine = new LineElemStyle(retLine, s);
+            }
+            if(retArea != null)
+            {
+                if(retLine != null)
+                    return new AreaElemStyle(retArea, retLine);
+                else
+                    return retArea;
+            }
+            return retLine;
+        }
+
+        public ElemStyle get(OsmPrimitive osm)
+        {
+            return (osm.keys == null) ? null :
+            ((osm instanceof Node) ? getNode(osm.keys) : get(osm.keys));
+        }
+
+        public boolean isArea(OsmPrimitive o)
+        {
+            if(o.keys != null && !(o instanceof Node))
+            {
+                Iterator<String> iterator = o.keys.keySet().iterator();
+                while(iterator.hasNext())
+                {
+                    String key = iterator.next();
+                    String val = o.keys.get(key);
+                    if(areas.containsKey("n" + key + "=" + val)
+                    || areas.containsKey("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))
+                    || areas.containsKey("x" + key))
+                        return true;
+                }
+            }
+            return false;
+        }
+
+        public boolean hasAreas()
+        {
+            return areas.size() > 0;
+        }
+    }
+
     HashMap<String, StyleSet> styleSet;
-    String styleName;
-
     public ElemStyles()
     {
         styleSet = new HashMap<String, StyleSet>();
-        updateStyleName();
-    }
-
-    public void updateStyleName() {
-        // Main.pref.get() is slow when done thousands of times, do it once here and cache it
-        styleName = Main.pref.get("mappaint.style", "standard");
     }
 
@@ -85,5 +194,6 @@
     {
         if(name == null)
-            name = styleName;
+            name = Main.pref.get("mappaint.style", "standard");
+
         StyleSet s = styleSet.get(name);
         if(create && s == null)
@@ -95,126 +205,8 @@
     }
 
-    private ElemStyle getNode(Map<String, String> keys, StyleSet ss)
-    {
-        IconElemStyle ret = null;
-        Iterator<String> iterator = keys.keySet().iterator();
-        while(iterator.hasNext())
-        {
-            String key = iterator.next();
-            String val = keys.get(key);
-            IconElemStyle style;
-            if((style = ss.icons.get("n" + key + "=" + val)) != null)
-            {
-                if(ret == null || style.priority > ret.priority)
-                    ret = style;
-            }
-            if((style = ss.icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null)
-            {
-                if(ret == null || style.priority > ret.priority)
-                    ret = style;
-            }
-            if((style = ss.icons.get("x" + key)) != null)
-            {
-                if(ret == null || style.priority > ret.priority)
-                    ret = style;
-            }
-        }
-        return ret;
-    }
-
-    private ElemStyle get(Map<String, String> keys, StyleSet ss)
-    {
-        AreaElemStyle retArea = null;
-        LineElemStyle retLine = null;
-        String linestring = null;
-        HashMap<String, LineElemStyle> over = new HashMap<String, LineElemStyle>();
-        Iterator<String> iterator = keys.keySet().iterator();
-        while(iterator.hasNext())
-        {
-            String key = iterator.next();
-            String val = keys.get(key);
-            AreaElemStyle styleArea;
-            LineElemStyle styleLine;
-            String idx = "n" + key + "=" + 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.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.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.put(idx, styleLine);
-        }
-        over.remove(linestring);
-        if(over.size() != 0 && retLine != null)
-        {
-            List<LineElemStyle> s = new LinkedList<LineElemStyle>(over.values());
-            Collections.sort(s);
-            retLine = new LineElemStyle(retLine, s);
-        }
-        if(retArea != null)
-        {
-            if(retLine != null)
-                return new AreaElemStyle(retArea, retLine);
-            else
-                return retArea;
-        }
-        return retLine;
-    }
-
-    public ElemStyle get(OsmPrimitive osm)
-    {
-        StyleSet ss = getStyleSet(null, false);
-        return (ss == null || osm.keys == null) ? null :
-        ((osm instanceof Node) ? getNode(osm.keys, ss) : get(osm.keys, ss));
-    }
-
-    private boolean isArea(Map<String, String> keys, StyleSet ss)
-    {
-        Iterator<String> iterator = keys.keySet().iterator();
-        while(iterator.hasNext())
-        {
-            String key = iterator.next();
-            String val = keys.get(key);
-            if(ss.areas.containsKey("n" + key + "=" + val)
-            || ss.areas.containsKey("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))
-            || ss.areas.containsKey("x" + key))
-                return true;
-        }
-        return false;
-    }
-
-    public boolean isArea(OsmPrimitive o)
-    {
-        StyleSet ss = getStyleSet(null, false);
-        return (ss != null && o.keys != null && !(o instanceof Node))
-        ? isArea(o.keys, ss) : false;
-    }
-
-    public boolean hasAreas()
-    {
-        StyleSet ss = getStyleSet(null, false);
-        return ss != null && ss.areas.size() > 0;
+    /* called from class users, never return null */
+    public StyleSet getStyleSet()
+    {
+        return getStyleSet(null, false);
     }
 }
