Changeset 3886 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2011-02-10T12:15:36+01:00 (13 years ago)
Author:
bastiK
Message:

mappaint: find images relative to the source file

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r3876 r3886  
    7777                dirs.add(a[1]);
    7878            }
     79        }
     80        String sourceDir = ref.source.getLocalSourceDir();
     81        if (sourceDir != null) {
     82            dirs.add(sourceDir);
    7983        }
    8084        ImageIcon i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, ref.iconName, ref.source.zipIcons, sanitize);
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java

    r3863 r3886  
    22package org.openstreetmap.josm.gui.preferences;
    33
     4import java.io.File;
    45import java.util.regex.Matcher;
    56import java.util.regex.Pattern;
     
    122123        return true;
    123124    }
     125
     126    public String getLocalSourceDir() {
     127        if (!isLocal())
     128            return null;
     129        File f = new File(url);
     130        File dir = f.getParentFile();
     131        if (dir == null)
     132            return null;
     133        return dir.getPath();
     134    }
    124135}
Note: See TracChangeset for help on using the changeset viewer.