Index: trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 2888)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 2889)
@@ -3,4 +3,6 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.io.File;
+import java.io.InputStream;
 import java.io.IOException;
 import java.util.Collection;
@@ -23,4 +25,5 @@
     private static ElemStyles styles = new ElemStyles();
     private static Collection<String> iconDirs;
+    private static File zipIcons;
 
     public static ElemStyles getStyles()
@@ -46,5 +49,5 @@
             }
         }
-        ImageIcon i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, name);
+        ImageIcon i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, name, zipIcons);
         if(i == null)
         {
@@ -87,5 +90,12 @@
                 xmlReader.setErrorHandler(handler);
                 MirroredInputStream in = new MirroredInputStream(a[1]);
-                xmlReader.parse(new InputSource(in));
+                InputStream zip = in.getZipEntry("xml","style");
+                if(zip != null)
+                {
+                    zipIcons = in.getFile();
+                    xmlReader.parse(new InputSource(zip));
+                }
+                else
+                    xmlReader.parse(new InputSource(in));
             } catch(IOException e) {
                 System.err.println(tr("Warning: failed to load Mappaint styles from ''{0}''. Exception was: {1}", a[1], e.toString()));
@@ -97,4 +107,5 @@
         }
         iconDirs = null;
+        zipIcons = null;
     }
 }
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 2888)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 2889)
@@ -12,5 +12,7 @@
 import java.awt.event.ActionEvent;
 import java.io.BufferedReader;
+import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
@@ -18,4 +20,5 @@
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -72,4 +75,5 @@
     public String locale_name;
     public final static String OPTIONAL_TOOLTIP_TEXT = "Optional tooltip text";
+    private static File zipIcons = null;
 
     public static abstract class Item {
@@ -550,5 +554,5 @@
     public void setIcon(String iconName) {
         Collection<String> s = Main.pref.getCollection("taggingpreset.icon.sources", null);
-        ImageIcon icon = ImageProvider.getIfAvailable(s, "presets", null, iconName);
+        ImageIcon icon = ImageProvider.getIfAvailable(s, "presets", null, iconName, zipIcons);
         if (icon == null)
         {
@@ -636,12 +640,15 @@
             try {
                 MirroredInputStream s = new MirroredInputStream(source);
+                InputStream zip = s.getZipEntry("xml","preset");
+                if(zip != null)
+                    zipIcons = s.getFile();
                 InputStreamReader r;
                 try
                 {
-                    r = new InputStreamReader(s, "UTF-8");
+                    r = new InputStreamReader(zip == null ? s : zip, "UTF-8");
                 }
                 catch (UnsupportedEncodingException e)
                 {
-                    r = new InputStreamReader(s);
+                    r = new InputStreamReader(zip == null ? s: zip);
                 }
                 allPresets.addAll(TaggingPreset.readAll(new BufferedReader(r)));
@@ -663,4 +670,5 @@
                 );
             }
+            zipIcons = null;
         }
         return allPresets;
Index: trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java	(revision 2888)
+++ trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java	(revision 2889)
@@ -13,4 +13,7 @@
 import java.net.URL;
 import java.net.URLConnection;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 
 import org.openstreetmap.josm.Main;
@@ -62,4 +65,37 @@
             throw new IOException();
         fs = new FileInputStream(file);
+    }
+
+    public InputStream getZipEntry(String extension, String namepart)
+    {
+        InputStream res = null;
+        try {
+            if(file != null && (file.getName().endsWith(".zip")
+            || file.getName().endsWith(".ZIP")))
+            {
+                ZipFile zipFile = new ZipFile(file);
+                ZipEntry resentry = null;
+                Enumeration entries = zipFile.entries();
+                while(entries.hasMoreElements()) {
+                    ZipEntry entry = (ZipEntry)entries.nextElement();
+                    if(entry.getName().endsWith("."+extension)) {
+                        /* choose any file with correct extension. When more than
+                        one file, prefer the one which matches namepart */
+                        if(resentry == null || entry.getName().indexOf(namepart) >= 0) {
+                            resentry = entry;
+                        }
+                    }
+                }
+                if(resentry != null) {
+                    res = zipFile.getInputStream(resentry);
+                }
+                else {
+                    zipFile.close();
+                }
+            }
+        } catch (Exception e) {
+            System.err.println(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", file.getName(), e.toString()));
+        }
+        return res;
     }
 
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 2888)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 2889)
@@ -17,4 +17,5 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
+import java.io.InputStream;
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -26,4 +27,6 @@
 import java.util.List;
 import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 
 import javax.swing.Icon;
@@ -88,4 +91,8 @@
      */
     public static ImageIcon getIfAvailable(Collection<String> dirs, String id, String subdir, String name) {
+        return getIfAvailable(dirs, id, subdir, name, null);
+    }
+
+    public static ImageIcon getIfAvailable(Collection<String> dirs, String id, String subdir, String name, File archive) {
         if (name == null)
             return null;
@@ -116,8 +123,34 @@
         if (dirs != null && dirs.size() > 0) {
             cache_name = "id:" + id + ":" + full_name;
+            if(archive != null)
+                cache_name += ":" + archive.getName();
         }
 
         Image img = cache.get(cache_name);
         if (img == null) {
+            if(archive != null)
+            {
+                try
+                {
+                    ZipFile zipFile = new ZipFile(archive);
+                    ZipEntry entry = zipFile.getEntry(full_name);
+                    if(entry != null)
+                    {
+                        int size = (int)entry.getSize();
+                        int offs = 0;
+                        byte[] buf = new byte[size];
+                        InputStream is = zipFile.getInputStream(entry);
+                        while(size > 0)
+                        {
+                            int l = is.read(buf, offs, size);
+                            offs += l;
+                            size -= l;
+                        }
+                        img = Toolkit.getDefaultToolkit().createImage(buf);
+                    }
+                } catch (Exception e) {
+                    System.err.println(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", archive.getName(), e.toString()));
+                }
+            }
             // getImageUrl() does a ton of "stat()" calls and gets expensive
             // and redundant when you have a whole ton of objects. So,
@@ -125,8 +158,11 @@
             // and don't bother to create a URL unless we're actually
             // creating the image.
-            URL path = getImageUrl(full_name, dirs);
-            if (path == null)
-                return null;
-            img = Toolkit.getDefaultToolkit().createImage(path);
+            if(img == null)
+            {
+                URL path = getImageUrl(full_name, dirs);
+                if (path == null)
+                    return null;
+                img = Toolkit.getDefaultToolkit().createImage(path);
+            }
             cache.put(cache_name, img);
         }
