Index: trunk/src/org/openstreetmap/josm/data/projection/UTM.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/projection/UTM.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/data/projection/UTM.java	(revision 1743)
@@ -91,4 +91,8 @@
     {
         return Math.toRadians(-183.0 + (zone * 6.0));
+    }
+    private double UTMCentralMeridianDeg(int zone)
+    {
+        return -183.0 + (zone * 6.0);
     }
 
@@ -324,15 +328,20 @@
 
     public EastNorth latlon2eastNorth(LatLon p) {
-        EastNorth a = MapLatLonToXY(Math.toRadians(p.lat()), Math.toRadians(p.lon()), UTMCentralMeridian(33));
+        EastNorth a = MapLatLonToXY(Math.toRadians(p.lat()), Math.toRadians(p.lon()), UTMCentralMeridian(getzone()));
         return new EastNorth(a.east() * UTMScaleFactor + 3500000.0, a.north() * UTMScaleFactor);
     }
 
     public LatLon eastNorth2latlon(EastNorth p) {
-        return MapXYToLatLon((p.east()-3500000.0)/UTMScaleFactor, p.north()/UTMScaleFactor, UTMCentralMeridian(33));
+        return MapXYToLatLon((p.east()-3500000.0)/UTMScaleFactor, p.north()/UTMScaleFactor, UTMCentralMeridian(getzone()));
+    }
+
+    @Override public String toString() {
+        return tr("UTM Zone {0}", getzone());
     }
 
     /* TODO - support all UTM's not only zone 33 */
-    @Override public String toString() {
-        return tr("UTM Zone {0}", 33);
+    public int getzone()
+    {
+      return 33;
     }
 
@@ -354,6 +363,6 @@
     {
         return new Bounds(
-        new LatLon(-90.0, 14.0),
-        new LatLon(90.0, 22.0));
+        new LatLon(-85.0, UTMCentralMeridianDeg(getzone())-5.0),
+        new LatLon(85.0, UTMCentralMeridianDeg(getzone())+5.0));
     }
 }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java	(revision 1743)
@@ -1,3 +1,9 @@
 package org.openstreetmap.josm.gui.mappaint;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.OsmUtils;
 
 abstract public class ElemStyle
@@ -9,4 +15,5 @@
     public int priority;
     public String code;
+    Collection<Rule> rules = null;
 
     public Boolean equals(ElemStyle s)
@@ -14,4 +21,18 @@
         return s != null && s.code.equals(code);
     }
+    public boolean check(Map<String, String> keys)
+    {
+        if(rules == null)
+            return true;
+        for(Rule r : rules)
+        {
+            String k = keys.get(r.key);
+            String bv = OsmUtils.getNamedOsmBoolean(r.boolValue);
+            if(k == null || (r.value != null && !k.equals(r.value))
+            || (bv != null && !bv.equals(OsmUtils.getNamedOsmBoolean(k))))
+                return false;
+        }
+        return true;
+    }
 }
 
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java	(revision 1743)
@@ -2,4 +2,6 @@
 
 import java.awt.Color;
+import java.util.Collection;
+import java.util.LinkedList;
 
 import javax.swing.ImageIcon;
@@ -20,7 +22,6 @@
 
     class RuleElem {
-        String key;
-        String value;
-        String boolValue;
+        Rule rule = new Rule();
+        Collection<Rule> rules;
         long scaleMax;
         long scaleMin;
@@ -31,8 +32,9 @@
         public void init()
         {
-            key = value = boolValue = null;
+            rules = null;
             scaleMax = 1000000000;
             scaleMin = 0;
             line.init();
+            rule.init();
             linemod.init();
             area.init();
@@ -71,5 +73,5 @@
 
     private void error(String message) {
-        System.out.println(styleName + " (" + rule.key + "=" + rule.value + "): " + message);
+        System.out.println(styleName + " (" + rule.rule.key + "=" + rule.rule.value + "): " + message);
     }
 
@@ -148,15 +150,26 @@
             {
                 inCondition=true;
+                Rule r = rule.rule;
+                if(r.key != null)
+                {
+                    if(rule.rules == null)
+                        rule.rules = new LinkedList<Rule>();
+                    r = new Rule();
+                    r.init();
+                    rule.rules.add(r);
+                }
                 for (int count=0; count<atts.getLength(); count++)
                 {
                     if(atts.getQName(count).equals("k"))
-                        rule.key = atts.getValue(count);
+                        r.key = atts.getValue(count);
                     else if(atts.getQName(count).equals("v"))
-                        rule.value = atts.getValue(count);
+                        r.value = atts.getValue(count);
                     else if(atts.getQName(count).equals("b"))
-                        rule.boolValue = atts.getValue(count);
+                        r.boolValue = atts.getValue(count);
                     else
                         error("The element \"" + qName + "\" has unknown attribute \"" + atts.getQName(count) + "\"!");
                 }
+                if(r.key == null)
+                    error("The condition has no key!");
             }
             else if (qName.equals("line"))
@@ -216,15 +229,27 @@
         {
             if(hadLine)
-                styles.add(styleName, rule.key, rule.value, rule.boolValue,
+            {
+                rule.line.rules = rule.rules;
+                styles.add(styleName, rule.rule,
                 new LineElemStyle(rule.line, rule.scaleMax, rule.scaleMin));
+            }
             if(hadLineMod)
-                styles.addModifier(styleName, rule.key, rule.value, rule.boolValue,
+            {
+                rule.linemod.rules = rule.rules;
+                styles.addModifier(styleName, rule.rule,
                 new LineElemStyle(rule.linemod, rule.scaleMax, rule.scaleMin));
+            }
             if(hadIcon)
-                styles.add(styleName, rule.key, rule.value, rule.boolValue,
+            {
+                rule.icon.rules = rule.rules;
+                styles.add(styleName, rule.rule,
                 new IconElemStyle(rule.icon, rule.scaleMax, rule.scaleMin));
+            }
             if(hadArea)
-                styles.add(styleName, rule.key, rule.value, rule.boolValue,
+            {
+                rule.area.rules = rule.rules;
+                styles.add(styleName, rule.rule,
                 new AreaElemStyle(rule.area, rule.scaleMax, rule.scaleMin));
+            }
             inRule = false;
             hadLine = hadLineMod = hadIcon = hadArea = false;
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 1743)
@@ -39,15 +39,15 @@
                 if((style = icons.get("n" + key + "=" + val)) != null)
                 {
-                    if(ret == null || style.priority > ret.priority)
+                    if((ret == null || style.priority > ret.priority) && style.check(keys))
                         ret = style;
                 }
                 if((style = icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null)
                 {
-                    if(ret == null || style.priority > ret.priority)
+                    if((ret == null || style.priority > ret.priority) && style.check(keys))
                         ret = style;
                 }
                 if((style = icons.get("x" + key)) != null)
                 {
-                    if(ret == null || style.priority > ret.priority)
+                    if((ret == null || style.priority > ret.priority) && style.check(keys))
                         ret = style;
                 }
@@ -70,34 +70,40 @@
                 String idx = "n" + key + "=" + val;
                 if((styleArea = areas.get(idx)) != null && (retArea == null
-                || styleArea.priority > retArea.priority) && (!noclosed || !styleArea.closed))
+                || styleArea.priority > retArea.priority) && (!noclosed
+                || !styleArea.closed) && styleArea.check(keys))
                     retArea = styleArea;
-                if((styleLine = lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority))
+                if((styleLine = lines.get(idx)) != null && (retLine == null
+                || styleLine.priority > retLine.priority) && styleLine.check(keys))
                 {
                     retLine = styleLine;
                     linestring = idx;
                 }
-                if((styleLine = modifiers.get(idx)) != null)
+                if((styleLine = modifiers.get(idx)) != null && styleLine.check(keys))
                     over.put(idx, styleLine);
                 idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val);
                 if((styleArea = areas.get(idx)) != null && (retArea == null
-                || styleArea.priority > retArea.priority) && (!noclosed || !styleArea.closed))
+                || styleArea.priority > retArea.priority) && (!noclosed
+                || !styleArea.closed) && styleArea.check(keys))
                     retArea = styleArea;
-                if((styleLine = lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority))
+                if((styleLine = lines.get(idx)) != null && (retLine == null
+                || styleLine.priority > retLine.priority) && styleLine.check(keys))
                 {
                     retLine = styleLine;
                     linestring = idx;
                 }
-                if((styleLine = modifiers.get(idx)) != null)
+                if((styleLine = modifiers.get(idx)) != null && styleLine.check(keys))
                     over.put(idx, styleLine);
                 idx = "x" + key;
                 if((styleArea = areas.get(idx)) != null && (retArea == null
-                || styleArea.priority > retArea.priority) && (!noclosed || !styleArea.closed))
+                || styleArea.priority > retArea.priority) && (!noclosed
+                || !styleArea.closed) && styleArea.check(keys))
                     retArea = styleArea;
-                if((styleLine = lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority))
+                if((styleLine = lines.get(idx)) != null && (retLine == null
+                || styleLine.priority > retLine.priority) && styleLine.check(keys))
                 {
                     retLine = styleLine;
                     linestring = idx;
                 }
-                if((styleLine = modifiers.get(idx)) != null)
+                if((styleLine = modifiers.get(idx)) != null && styleLine.check(keys))
                     over.put(idx, styleLine);
             }
@@ -177,38 +183,28 @@
     }
 
-    private String getKey(String k, String v, String b)
-    {
-        if(v != null)
-            return "n" + k + "=" + v;
-        else if(b != null)
-            return "b" + k  + "=" + OsmUtils.getNamedOsmBoolean(b);
-        else
-            return "x" + k;
-    }
-
-    public void add(String name, String k, String v, String b, LineElemStyle style)
-    {
-        String key = getKey(k,v,b);
+    public void add(String name, Rule r, LineElemStyle style)
+    {
+        String key = r.getKey();
         style.code = key;
         getStyleSet(name, true).lines.put(key, style);
     }
 
-    public void addModifier(String name, String k, String v, String b, LineElemStyle style)
-    {
-        String key = getKey(k,v,b);
+    public void addModifier(String name, Rule r, LineElemStyle style)
+    {
+        String key = r.getKey();
         style.code = key;
         getStyleSet(name, true).modifiers.put(key, style);
     }
 
-    public void add(String name, String k, String v, String b, AreaElemStyle style)
-    {
-        String key = getKey(k,v,b);
+    public void add(String name, Rule r, AreaElemStyle style)
+    {
+        String key = r.getKey();
         style.code = key;
         getStyleSet(name, true).areas.put(key, style);
     }
 
-    public void add(String name, String k, String v, String b, IconElemStyle style)
-    {
-        String key = getKey(k,v,b);
+    public void add(String name, Rule r, IconElemStyle style)
+    {
+        String key = r.getKey();
         style.code = key;
         getStyleSet(name, true).icons.put(key, style);
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 1743)
@@ -1,4 +1,6 @@
 package org.openstreetmap.josm.gui.mappaint;
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
@@ -17,5 +19,5 @@
 
     private static ElemStyles styles = new ElemStyles();
-    private static String iconDirs;
+    private static Collection<String> iconDirs;
 
     public static ElemStyles getStyles()
@@ -27,5 +29,5 @@
     {
         List<String> dirs = new LinkedList<String>();
-        for(String fileset : iconDirs.split(";"))
+        for(String fileset : iconDirs)
         {
             String[] a;
@@ -49,20 +51,26 @@
 
     public static void readFromPreferences() {
-        String[] a = null;
+        iconDirs = Main.pref.getCollection("mappaint.icon.sources", Collections.<String>emptySet());
+        if(Main.pref.getBoolean("mappaint.icon.enable-defaults", true))
+        {
+            LinkedList<String> f = new LinkedList<String>(iconDirs);
+            /* don't prefix icon path, as it should be generic */
+            f.add("resource://images/styles/standard/");
+            f.add("resource://images/styles/");
+            iconDirs = f;
+        }
 
-        /* don't prefix icon path, as it should be generic */
-        String internalicon = "resource://images/styles/standard/;resource://images/styles/";
-        String internalfile = "resource://styles/standard/elemstyles.xml";
+        Collection<String> files = Main.pref.getCollection("mappaint.style.sources", Collections.<String>emptySet());
+        if(Main.pref.getBoolean("mappaint.style.enable-defaults", true))
+        {
+            LinkedList<String> f = new LinkedList<String>();
+            f.add("resource://styles/standard/elemstyles.xml");
+            f.addAll(files);
+            files = f;
+        }
 
-        iconDirs = Main.pref.get("mappaint.icon.sources");
-        if(Main.pref.getBoolean("mappaint.icon.enable-defaults", true))
-            iconDirs = iconDirs == null || iconDirs.length() == 0 ? internalicon : iconDirs + ";" + internalicon;
-
-        String file = Main.pref.get("mappaint.style.sources");
-        if(Main.pref.getBoolean("mappaint.style.enable-defaults", true))
-            file = (file == null || file.length() == 0) ? internalfile : internalfile + ";" + file;
-
-        for(String fileset : file.split(";"))
+        for(String fileset : files)
         {
+            String[] a = null;
             try
             {
@@ -81,4 +89,5 @@
                 System.out.println("Mappaint-Style \"" + a[0] + "\" file \"" + a[1] + "\"");
                 System.out.println("Mappaint-Style problems: " + e);
+                e.printStackTrace();
             }
         }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/Rule.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/Rule.java	(revision 1743)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/Rule.java	(revision 1743)
@@ -0,0 +1,28 @@
+package org.openstreetmap.josm.gui.mappaint;
+
+import org.openstreetmap.josm.data.osm.OsmUtils;
+
+public class Rule
+{
+    String key;
+    String value;
+    String boolValue;
+
+    public String getKey()
+    {
+        if(value != null)
+            return "n" + key + "=" + value;
+        else if(boolValue != null)
+            return "b" + key  + "=" + OsmUtils.getNamedOsmBoolean(boolValue);
+        else
+            return "x" + key;
+    }
+    public void init()
+    {
+      key = value = boolValue = null;
+    }
+
+}
+
+
+
Index: trunk/src/org/openstreetmap/josm/gui/preferences/MapPaintPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/MapPaintPreference.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/MapPaintPreference.java	(revision 1743)
@@ -2,7 +2,24 @@
 package org.openstreetmap.josm.gui.preferences;
 
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.GridBagLayout;
+
+import javax.swing.BorderFactory;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.GBC;
 
 public class MapPaintPreference implements PreferenceSetting {
+    private StyleSources sources;
+    private JCheckBox enableIconDefault;
+    private JCheckBox enableDefault;
+    private JComboBox styleCombo = new JComboBox();
 
     public static class Factory implements PreferenceSettingFactory {
@@ -13,9 +30,44 @@
 
     public void addGui(final PreferenceDialog gui) {
-        // this is intended for a future configuration panel for mappaint!
+        enableDefault = new JCheckBox(tr("Enable built-in defaults"),
+                Main.pref.getBoolean("mappaint.style.enable-defaults", true));
+        enableIconDefault = new JCheckBox(tr("Enable built-in icon defaults"),
+                Main.pref.getBoolean("mappaint.icon.enable-defaults", true));
+
+        styleCombo.addItem("standard");
+
+        String style = Main.pref.get("mappaint.style", "standard");
+        styleCombo.setEditable(true);
+        for (int i = 0; i < styleCombo.getItemCount(); ++i) {
+            if (styleCombo.getItemAt(i).getClass().getName().equals(style)) {
+                styleCombo.setSelectedIndex(i);
+                break;
+            }
+        }
+
+        JPanel panel = new JPanel(new GridBagLayout());
+        JScrollPane scrollpane = new JScrollPane(panel);
+        panel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
+        panel.add(enableDefault, GBC.std().insets(5,5,5,0));
+        panel.add(enableIconDefault, GBC.eol().insets(5,5,5,0));
+
+        panel.add(new JLabel(tr("Used style")), GBC.std().insets(5,5,0,5));
+        panel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL));
+        panel.add(styleCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,0,5,0));
+
+        sources = new StyleSources("mappaint.style.sources", "mappaint.icon.sources",
+        "http://josm.openstreetmap.de/styles", false, tr("Map Paint Styles"));
+        panel.add(sources, GBC.eol().fill(GBC.BOTH));
+        gui.mapcontent.addTab(tr("Map Paint Styles"), scrollpane);
     }
 
     public boolean ok() {
-        return false; // dummy
+        Boolean restart = Main.pref.put("mappaint.style.enable-defaults", enableDefault.getSelectedObjects() != null);
+        if(Main.pref.put("mappaint.icon.enable-defaults", enableIconDefault.getSelectedObjects() != null))
+          restart = true;
+        if(sources.finish())
+          restart = true;
+        Main.pref.put("mappaint.style", styleCombo.getEditor().getItem().toString());
+        return restart;
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 1743)
@@ -45,4 +45,5 @@
 
     public final javax.swing.JTabbedPane displaycontent = new javax.swing.JTabbedPane();
+    public final javax.swing.JTabbedPane mapcontent = new javax.swing.JTabbedPane();
 
     /**
@@ -118,4 +119,5 @@
 
         display.add(displaycontent, GBC.eol().fill(GBC.BOTH));
+        map.add(mapcontent, GBC.eol().fill(GBC.BOTH));
         for (Iterator<PreferenceSetting> it = settings.iterator(); it.hasNext();) {
             try {
@@ -150,9 +152,9 @@
         settingsFactory.add(new LafPreference.Factory());
         settingsFactory.add(new LanguagePreference.Factory());
-        settingsFactory.add(new MapPaintPreference.Factory());
         settingsFactory.add(new ServerAccessPreference.Factory());
         settingsFactory.add(new FilePreferences.Factory());
         settingsFactory.add(new ProxyPreferences.Factory());
         settingsFactory.add(new ProjectionPreference.Factory());
+        settingsFactory.add(new MapPaintPreference.Factory());
         settingsFactory.add(new TaggingPresetPreference.Factory());
         settingsFactory.add(new PluginPreference.Factory());
Index: trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java	(revision 1743)
@@ -8,6 +8,8 @@
 
 import javax.swing.BorderFactory;
+import javax.swing.Box;
 import javax.swing.JComboBox;
 import javax.swing.JLabel;
+import javax.swing.JScrollPane;
 import javax.swing.JPanel;
 
@@ -50,5 +52,5 @@
 
         JPanel projPanel = new JPanel();
-        projPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.gray), tr("Map Projection")));
+        projPanel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
         projPanel.setLayout(new GridBagLayout());
         projPanel.add(new JLabel(tr("Projection method")), GBC.std().insets(5,5,0,5));
@@ -58,5 +60,7 @@
         projPanel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL));
         projPanel.add(coordinatesCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,5,5,5));
-        gui.map.add(projPanel, GBC.eol().insets(0,0,0,10).fill(GBC.HORIZONTAL));
+        projPanel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH));
+        JScrollPane scrollpane = new JScrollPane(projPanel);
+        gui.mapcontent.addTab(tr("Map Projection"), scrollpane);
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/StyleSources.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/StyleSources.java	(revision 1743)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/StyleSources.java	(revision 1743)
@@ -0,0 +1,338 @@
+// License: GPL. Copyright 2007 by Immanuel Scholz and others
+package org.openstreetmap.josm.gui.preferences;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JScrollPane;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.io.MirroredInputStream;
+import org.openstreetmap.josm.tools.GBC;
+
+public class StyleSources extends JPanel {
+    private JList sourcesList;
+    private JList sourcesDefaults;
+    private JList iconsList = null;
+    private String pref;
+    private String iconpref;
+
+    public class SourceInfo {
+        String version;
+        String name;
+        String url;
+        String author;
+        String link;
+        String description;
+        String shortdescription;
+        public SourceInfo(String name, String url)
+        {
+            this.name = name;
+            this.url = url;
+            version = author = link = description = shortdescription = null;
+        }
+        public String getName()
+        {
+            return shortdescription == null ? name : shortdescription;
+        }
+        public String getTooltip()
+        {
+            String s = tr("Short Description: {0}", getName()) + "<br>" + tr("URL: {0}", url);
+            if(author != null) s += "<br>" + tr("Author: {0}", author);
+            if(link != null) s += "<br>" + tr("Webpage: {0}", link);
+            if(description != null) s += "<br>" + tr("Description: {0}", description);
+            if(version != null) s += "<br>" + tr("Version: {0}", version);
+            return "<html>" + s + "</html>";
+        }
+        public String toString()
+        {
+            return getName() + " (" + url + ")";
+        }
+    };
+
+    class MyCellRenderer extends JLabel implements ListCellRenderer {
+        public Component getListCellRendererComponent(JList list, Object value,
+        int index, boolean isSelected, boolean cellHasFocus)
+        {
+            String s = value.toString();
+            setText(s);
+            if (isSelected) {
+                setBackground(list.getSelectionBackground());
+                setForeground(list.getSelectionForeground());
+            }
+            else {
+                setBackground(list.getBackground());
+                setForeground(list.getForeground());
+            }
+            setEnabled(list.isEnabled());
+            setFont(list.getFont());
+            setOpaque(true);
+            setToolTipText(((SourceInfo)value).getTooltip());
+            return this;
+        }
+    }
+
+    public StyleSources(String pref, String iconpref, String url, boolean named, final String name)
+    {
+        sourcesList = new JList(new DefaultListModel());
+        sourcesDefaults = new JList(new DefaultListModel());
+        sourcesDefaults.setCellRenderer(new MyCellRenderer());
+        getDefaults(url);
+
+        this.pref = pref;
+        this.iconpref = iconpref;
+
+        Collection<String> sources = Main.pref.getCollection(pref, null);
+        if(sources != null)
+            for(String s : sources)
+                ((DefaultListModel)sourcesList.getModel()).addElement(s);
+
+        JButton iconadd = null;
+        JButton iconedit = null;
+        JButton icondelete = null;
+
+        if(iconpref != null)
+        {
+            iconsList = new JList(new DefaultListModel());
+            sources = Main.pref.getCollection(iconpref, null);
+            if(sources != null)
+                for(String s : sources)
+                    ((DefaultListModel)iconsList.getModel()).addElement(s);
+
+            iconadd = new JButton(tr("Add"));
+            iconadd.addActionListener(new ActionListener(){
+                public void actionPerformed(ActionEvent e) {
+                    String source = JOptionPane.showInputDialog(Main.parent, tr("Icon paths"));
+                    if (source != null)
+                        ((DefaultListModel)iconsList.getModel()).addElement(source);
+                }
+            });
+
+            iconedit = new JButton(tr("Edit"));
+            iconedit.addActionListener(new ActionListener(){
+                public void actionPerformed(ActionEvent e) {
+                    if (sourcesList.getSelectedIndex() == -1)
+                        JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit."));
+                    else {
+                        String source = JOptionPane.showInputDialog(Main.parent,
+                        tr("Icon paths"), iconsList.getSelectedValue());
+                        if (source != null)
+                            ((DefaultListModel)iconsList.getModel()).setElementAt(source, iconsList.getSelectedIndex());
+                    }
+                }
+            });
+
+            icondelete = new JButton(tr("Delete"));
+            icondelete.addActionListener(new ActionListener(){
+                public void actionPerformed(ActionEvent e) {
+                    if (iconsList.getSelectedIndex() == -1)
+                        JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."));
+                    else {
+                        ((DefaultListModel)iconsList.getModel()).remove(iconsList.getSelectedIndex());
+                    }
+                }
+            });
+        }
+
+        JButton add = new JButton(tr("Add"));
+        add.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                String source = JOptionPane.showInputDialog(Main.parent, name);
+                if (source != null)
+                    ((DefaultListModel)sourcesList.getModel()).addElement(source);
+            }
+        });
+
+        JButton edit = new JButton(tr("Edit"));
+        edit.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                if (sourcesList.getSelectedIndex() == -1)
+                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit."));
+                else {
+                    String source = JOptionPane.showInputDialog(Main.parent,
+                    name, sourcesList.getSelectedValue());
+                    if (source != null)
+                        ((DefaultListModel)sourcesList.getModel()).setElementAt(source, sourcesList.getSelectedIndex());
+                }
+            }
+        });
+
+        JButton delete = new JButton(tr("Delete"));
+        delete.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                if (sourcesList.getSelectedIndex() == -1)
+                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."));
+                else {
+                    ((DefaultListModel)sourcesList.getModel()).remove(sourcesList.getSelectedIndex());
+                }
+            }
+        });
+
+        JButton copy = new JButton(tr("Copy defaults"));
+        copy.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                if (sourcesDefaults.getSelectedIndex() == -1)
+                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to copy."));
+                else {
+                    ((DefaultListModel)sourcesList.getModel()).addElement(
+                    ((SourceInfo)sourcesDefaults.getSelectedValue()).url);
+                }
+            }
+        });
+
+        sourcesList.setToolTipText(tr("The XML source (URL or filename) for {0} definition files.", name));
+        add.setToolTipText(tr("Add a new XML source to the list."));
+        delete.setToolTipText(tr("Delete the selected source from the list."));
+
+        setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
+        setLayout(new GridBagLayout());
+        add(new JLabel(name), GBC.eol().insets(5,5,5,0));
+        add(new JScrollPane(sourcesList), GBC.eol().insets(5,0,5,0).fill(GBC.BOTH));
+        add(new JLabel(tr("Defaults (See tooltip for detailed information)")), GBC.eol().insets(5,5,5,0));
+        add(new JScrollPane(sourcesDefaults), GBC.eol().insets(5,0,5,0).fill(GBC.BOTH));
+        JPanel buttonPanel = new JPanel(new GridBagLayout());
+        add(buttonPanel, GBC.eol().insets(5,0,5,5).fill(GBC.HORIZONTAL));
+        buttonPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
+        buttonPanel.add(add, GBC.std().insets(0,5,0,0));
+        buttonPanel.add(edit, GBC.std().insets(5,5,5,0));
+        buttonPanel.add(delete, GBC.std().insets(0,5,5,0));
+        buttonPanel.add(copy, GBC.std().insets(0,5,0,0));
+        if(iconsList != null)
+        {
+            add(new JLabel(tr("Icon paths")), GBC.eol().insets(5,-5,5,0));
+            add(new JScrollPane(iconsList), GBC.eol().insets(5,0,5,0).fill(GBC.BOTH));
+            buttonPanel = new JPanel(new GridBagLayout());
+            add(buttonPanel, GBC.eol().insets(5,0,5,5).fill(GBC.HORIZONTAL));
+            buttonPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
+            buttonPanel.add(iconadd, GBC.std().insets(0,5,0,0));
+            buttonPanel.add(iconedit, GBC.std().insets(5,5,5,0));
+            buttonPanel.add(icondelete, GBC.std().insets(0,5,0,0));
+        }
+    }
+
+    public boolean finish() {
+        boolean changed = false;
+        int num = sourcesList.getModel().getSize();
+        if (num > 0)
+        {
+            ArrayList<String> l = new ArrayList<String>();
+            for (int i = 0; i < num; ++i)
+                l.add((String)sourcesList.getModel().getElementAt(i));
+            if(Main.pref.putCollection(pref, l))
+                changed = true;
+        }
+        else if(Main.pref.putCollection(pref, null))
+            changed = true;
+        if(iconsList != null)
+        {
+            num = iconsList.getModel().getSize();
+            if (num > 0)
+            {
+                ArrayList<String> l = new ArrayList<String>();
+                for (int i = 0; i < num; ++i)
+                    l.add((String)iconsList.getModel().getElementAt(i));
+                if(Main.pref.putCollection(iconpref, l))
+                    changed = true;
+            }
+            else if(Main.pref.putCollection(iconpref, null))
+                changed = true;
+        }
+        return changed;
+    }
+
+    public void getDefaults(String name)
+    {
+        String lang = Main.getLanguageCode()+"_";
+        try
+        {
+            MirroredInputStream stream = new MirroredInputStream(name);
+            InputStreamReader r;
+            try
+            {
+                r = new InputStreamReader(stream, "UTF-8");
+            }
+            catch (UnsupportedEncodingException e)
+            {
+                r = new InputStreamReader(stream);
+            }
+            BufferedReader reader = new BufferedReader(r);
+
+            String line;
+            SourceInfo last = null;
+
+            while((line = reader.readLine()) != null)
+            {
+                if(line.startsWith("\t"))
+                {
+                    Matcher m = Pattern.compile("^\t([^:]+): *(.+)$").matcher(line);
+                    m.matches();
+                    try
+                    {
+                        if(last != null)
+                        {
+                            String key = m.group(1);
+                            String value = m.group(2);
+                            if("author".equals(key) && last.author == null)
+                                last.author = value;
+                            else if("version".equals(key))
+                                last.version = value;
+                            else if("link".equals(key) && last.link == null)
+                                last.link = value;
+                            else if("description".equals(key) && last.description == null)
+                                last.description = value;
+                            else if("shortdescription".equals(key) && last.shortdescription == null)
+                                last.shortdescription = value;
+                            else if((lang+"author").equals(key))
+                                last.author = value;
+                            else if((lang+"link").equals(key))
+                                last.link = value;
+                            else if((lang+"description").equals(key))
+                                last.description = value;
+                            else if((lang+"shortdescription").equals(key))
+                                last.shortdescription = value;
+                        }
+                    }
+                    catch (IllegalStateException e)
+                    { e.printStackTrace(); }
+                }
+                else
+                {
+                    last = null;
+                    Matcher m = Pattern.compile("^(.+);(.+)$").matcher(line);
+                    m.matches();
+                    try
+                    {
+                        last = new SourceInfo(m.group(1),m.group(2));
+                        ((DefaultListModel)sourcesDefaults.getModel()).addElement(last);
+                    }
+                    catch (IllegalStateException e)
+                    { e.printStackTrace(); }
+                }
+            }
+        }
+        catch(Exception e)
+        { e.printStackTrace(); }
+    }
+}
Index: trunk/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java	(revision 1743)
@@ -4,25 +4,15 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
-import java.awt.Color;
 import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 
 import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.DefaultListModel;
-import javax.swing.JButton;
 import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JList;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
 import javax.swing.JPanel;
+import javax.swing.JSeparator;
 import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
 
 import org.openstreetmap.josm.Main;
@@ -41,11 +31,9 @@
 
     public static Collection<TaggingPreset> taggingPresets;
-    private JList taggingPresetSources;
+    private StyleSources sources;
     private JCheckBox sortMenu;
     private JCheckBox enableDefault;
 
     public void addGui(final PreferenceDialog gui) {
-
-        taggingPresetSources = new JList(new DefaultListModel());
         sortMenu = new JCheckBox(tr("Sort presets menu"),
                 Main.pref.getBoolean("taggingpreset.sortmenu", false));
@@ -53,77 +41,21 @@
                 Main.pref.getBoolean("taggingpreset.enable-defaults", true));
 
-        Collection<String> sources = Main.pref.getCollection("taggingpreset.sources", null);
-        if(sources != null)
-            for(String s : sources)
-                ((DefaultListModel)taggingPresetSources.getModel()).addElement(s);
-
-        JButton addAnno = new JButton(tr("Add"));
-        addAnno.addActionListener(new ActionListener(){
-            public void actionPerformed(ActionEvent e) {
-                String source = JOptionPane.showInputDialog(Main.parent, tr("Tagging preset source"));
-                if (source != null)
-                    ((DefaultListModel)taggingPresetSources.getModel()).addElement(source);
-            }
-        });
-
-        JButton editAnno = new JButton(tr("Edit"));
-        editAnno.addActionListener(new ActionListener(){
-            public void actionPerformed(ActionEvent e) {
-                if (taggingPresetSources.getSelectedIndex() == -1)
-                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit."));
-                else {
-                    String source = JOptionPane.showInputDialog(Main.parent, tr("Tagging preset source"), taggingPresetSources.getSelectedValue());
-                    if (source != null)
-                        ((DefaultListModel)taggingPresetSources.getModel()).setElementAt(source, taggingPresetSources.getSelectedIndex());
-                }
-            }
-        });
-
-        JButton deleteAnno = new JButton(tr("Delete"));
-        deleteAnno.addActionListener(new ActionListener(){
-            public void actionPerformed(ActionEvent e) {
-                if (taggingPresetSources.getSelectedIndex() == -1)
-                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."));
-                else {
-                    ((DefaultListModel)taggingPresetSources.getModel()).remove(taggingPresetSources.getSelectedIndex());
-                }
-            }
-        });
-        taggingPresetSources.setVisibleRowCount(3);
-
-        taggingPresetSources.setToolTipText(tr("The sources (URL or filename) of tagging preset definition files. See http://josm.openstreetmap.de/wiki/TaggingPresets for help."));
-        addAnno.setToolTipText(tr("Add a new tagging preset source to the list."));
-        deleteAnno.setToolTipText(tr("Delete the selected source from the list."));
-
-        JPanel tpPanel = new JPanel();
-        tpPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.gray), tr("Tagging Presets")));
-        tpPanel.setLayout(new GridBagLayout());
-        tpPanel.add(sortMenu, GBC.eol().insets(5,5,5,0));
-        tpPanel.add(enableDefault, GBC.eol().insets(5,5,5,0));
-        tpPanel.add(new JLabel(tr("Tagging preset sources")), GBC.eol().insets(5,5,5,0));
-        tpPanel.add(new JScrollPane(taggingPresetSources), GBC.eol().insets(5,0,5,0).fill(GBC.BOTH));
-        JPanel buttonPanel = new JPanel(new GridBagLayout());
-        tpPanel.add(buttonPanel, GBC.eol().insets(5,0,5,5).fill(GBC.HORIZONTAL));
-        buttonPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
-        buttonPanel.add(addAnno, GBC.std().insets(0,5,0,0));
-        buttonPanel.add(editAnno, GBC.std().insets(5,5,5,0));
-        buttonPanel.add(deleteAnno, GBC.std().insets(0,5,0,0));
-        gui.map.add(tpPanel, GBC.eol().fill(GBC.BOTH));
+        JPanel panel = new JPanel(new GridBagLayout());
+        JScrollPane scrollpane = new JScrollPane(panel);
+        panel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
+        panel.add(sortMenu, GBC.eol().insets(5,5,5,0));
+        panel.add(enableDefault, GBC.eol().insets(5,0,5,0));
+        sources = new StyleSources("taggingpreset.sources", "taggingpreset.icon.sources",
+        "http://josm.openstreetmap.de/presets", false, tr("Tagging Presets"));
+        panel.add(sources, GBC.eol().fill(GBC.BOTH));
+        gui.mapcontent.addTab(tr("Tagging Presets"), scrollpane);
     }
 
     public boolean ok() {
-        boolean restart;
-        Main.pref.put("taggingpreset.enable-defaults", enableDefault.getSelectedObjects() != null);
-        restart = Main.pref.put("taggingpreset.sortmenu", sortMenu.getSelectedObjects() != null);
-        int num = taggingPresetSources.getModel().getSize();
-        if (num > 0)
-        {
-            ArrayList<String> l = new ArrayList<String>();
-            for (int i = 0; i < num; ++i)
-                l.add((String)taggingPresetSources.getModel().getElementAt(i));
-            if(Main.pref.putCollection("taggingpreset.sources", l))
-                restart = true;
-        }
-        else if(Main.pref.putCollection("taggingpreset.sources", null))
+        boolean restart = Main.pref.put("taggingpreset.enable-defaults",
+        enableDefault.getSelectedObjects() != null);
+        if(Main.pref.put("taggingpreset.sortmenu", sortMenu.getSelectedObjects() != null))
+            restart = true;
+        if(sources.finish())
             restart = true;
         return restart;
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 1743)
@@ -465,5 +465,5 @@
      */
     public void setIcon(String iconName) {
-        Collection<String> s = Main.pref.getCollection("taggingpreset.iconpaths", null);
+        Collection<String> s = Main.pref.getCollection("taggingpreset.icon.sources", null);
         ImageIcon icon = ImageProvider.getIfAvailable(s, "presets", null, iconName);
         if (icon == null)
Index: trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java	(revision 1742)
+++ trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java	(revision 1743)
@@ -85,5 +85,6 @@
             destDirFile.mkdirs();
 
-        localPath = "mirror_" + new File(url.getPath()).getName();
+        String a = url.toString().replaceAll("[^A-Za-z0-9_.-]", "_");
+        localPath = "mirror_" + a;
         destDirFile = new File(destDir, localPath + ".tmp");
         BufferedOutputStream bos = null;
