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


Ignore:
Timestamp:
2009-01-11T12:00:48+01:00 (16 years ago)
Author:
stoecker
Message:

moved style name into style file

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

Legend:

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

    r1222 r1241  
    7373            if (qName.equals("rule"))
    7474                inRule=true;
     75            else if (qName.equals("rules"))
     76            {
     77                if(styleName == null)
     78                {
     79                    String n = atts.getValue("name");
     80                    if(n == null) n = "standard";
     81                    styleName = n;
     82                }
     83            }
    7584            else if (qName.equals("scale_max"))
    7685                inScaleMax = true;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r1233 r1241  
    5050    public static void readFromPreferences() {
    5151        String[] a = null;
    52        
     52
    5353        /* don't prefix icon path, as it should be generic */
    5454        String internalicon = "resource://images/styles/standard/;resource://images/styles/";
    55         String internalfile = "standard=resource://styles/standard/elemstyles.xml";
     55        String internalfile = "resource://styles/standard/elemstyles.xml";
    5656
    5757        iconDirs = Main.pref.get("mappaint.icon.sources");
     
    7070                    a = fileset.split("=", 2);
    7171                else
    72                     a = new String[] {"standard", fileset};
     72                    a = new String[] {null, fileset};
    7373                XMLReader xmlReader = XMLReaderFactory.createXMLReader();
    7474                ElemStyleHandler handler = new ElemStyleHandler(a[0]);
  • trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java

    r1221 r1241  
    1111import java.awt.event.ActionEvent;
    1212import java.awt.event.ActionListener;
     13import java.util.regex.Matcher;
     14import java.util.regex.Pattern;
    1315import java.util.ArrayList;
    1416import java.util.Collections;
     
    6769        // fill model with colors:
    6870        List<String> colorKeyList = new ArrayList<String>();
     71        List<String> colorKeyList_mappaint = new ArrayList<String>();
    6972        for(String key : colorMap.keySet()) {
    70             colorKeyList.add(key);
     73            if(key.startsWith("mappaint."))
     74                colorKeyList_mappaint.add(key);
     75            else
     76                colorKeyList.add(key);
    7177        }
    7278        Collections.sort(colorKeyList);
     79        Collections.sort(colorKeyList_mappaint);
     80        colorKeyList.addAll(colorKeyList_mappaint);
    7381        for (String key : colorKeyList) {
    7482            Vector<Object> row = new Vector<Object>(2);
     
    117125                    return l;
    118126                }
    119                 return oldColorsRenderer.getTableCellRendererComponent(t,tr(o.toString()),selected,focus,row,column);
     127                return oldColorsRenderer.getTableCellRendererComponent(t,getName(o.toString()),selected,focus,row,column);
     128            }
     129            private String getName(String o)
     130            {
     131                try
     132                {
     133                    Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o);
     134                    m.matches();
     135                    return tr("Paint style {0}: {1}", m.group(1), m.group(2));
     136                }
     137                catch (Exception e) {}
     138                return tr(o);
    120139            }
    121140        });
Note: See TracChangeset for help on using the changeset viewer.