Changeset 790 in josm for trunk/src


Ignore:
Timestamp:
2008-08-16T00:12:09+02:00 (16 years ago)
Author:
stoecker
Message:

some cleanup in mappaint and presets

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

Legend:

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

    r735 r790  
    8787                                for (int count=0; count<atts.getLength(); count++) {
    8888                                        if (atts.getQName(count).equals("src")) {
    89                                                 String imageFile = MapPaintStyles.getStyleDir()+"icons/"+atts.getValue(count);
     89                                                String imageFile = MapPaintStyles.getImageDir()+atts.getValue(count);
    9090                                                File f = new File(imageFile);
    9191                                                if (f.exists()) {
     
    9494                                                } else {
    9595                                                        try {
    96                                                                 URL path = getClass().getResource("/styles/standard/icons/"+atts.getValue(count));
     96                                                                URL path = getClass().getResource(MapPaintStyles.getImageDir()+atts.getValue(count));
    9797                                                                if (path == null) {
    9898                                                                        /* icon not found, using default */
    9999                                                                        System.out.println("Mappaint: Icon " + atts.getValue(count) + " not found, using default icon");
    100                                                                         path = getClass().getResource("/styles/standard/icons/misc/no_icon.png");
     100                                                                        path = getClass().getResource(MapPaintStyles.getImageDir()+"misc/no_icon.png");
    101101                                                                        curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
    102102                                                                } else {
     
    105105                                                        }
    106106                                                        catch (Exception e){
    107                                                                 URL path = getClass().getResource("/styles/standard/icons/amenity.png");
     107                                                                URL path = getClass().getResource(MapPaintStyles.getImageDir()+"incomming/amenity.png");
    108108                                                                curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
    109109                                                        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r736 r790  
    1717
    1818        public static String styleDir;
     19        public static String imageDir;
    1920        private static HashMap<String, ElemStyle> styles = new HashMap<String, ElemStyle>();
    2021       
     
    2223                return styleDir;
    2324        }
     25        public static String getImageDir(){
     26                return imageDir;
     27        }
    2428
    2529        public static void readFromPreferences() {
    2630
    2731                String styleName = Main.pref.get("mappaint.style", "standard");
    28                 styleDir = Main.pref.getPreferencesDir()+"plugins/mappaint/"+styleName+"/"; //some day we will support different icon directories over options
     32                styleDir = Main.pref.get("mappaint.styledir", Main.pref.getPreferencesDir()+"plugins/mappaint/"+styleName+"/");
    2933                String elemStylesFile = getStyleDir()+"elemstyles.xml";
     34                imageDir = styleDir+"icons/";
    3035
    3136//              System.out.println("mappaint: Using style: " + styleName);
     
    5762                        if (elemStylesPath != null)
    5863                        {
     64                                imageDir = "/images/styles/standard/";
    5965                                try
    6066                                {
Note: See TracChangeset for help on using the changeset viewer.