Ignore:
Timestamp:
2017-10-08T14:04:12+02:00 (7 years ago)
Author:
bastiK
Message:

see #15410 - better display of mappaint colors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r12943 r12944  
    9696
    9797    private static final String COLOR_PREFIX = "color.";
     98    private static final Pattern COLOR_LAYER_PATTERN = Pattern.compile("layer (.+)");
     99    private static final Pattern COLOR_MAPPAINT_PATTERN = Pattern.compile("mappaint\\.(.+?)\\.(.+)");
    98100
    99101    private static final String[] OBSOLETE_PREF_KEYS = {
     
    978980    /* only for preferences */
    979981    public synchronized String getColorName(String o) {
    980         Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o);
    981         if (m.matches()) {
    982             return tr("Paint style {0}: {1}", tr(I18n.escape(m.group(1))), tr(I18n.escape(m.group(2))));
    983         }
    984         m = Pattern.compile("layer (.+)").matcher(o);
     982        Matcher m = COLOR_LAYER_PATTERN.matcher(o);
    985983        if (m.matches()) {
    986984            return tr("Layer: {0}", tr(I18n.escape(m.group(1))));
    987985        }
    988986        String fullKey = COLOR_PREFIX + o;
    989         return colornames.containsKey(fullKey) ? tr(I18n.escape(colornames.get(fullKey))) : fullKey;
     987        if (colornames.containsKey(fullKey)) {
     988            String name = colornames.get(fullKey);
     989            Matcher m2 = COLOR_MAPPAINT_PATTERN.matcher(name);
     990            if (m2.matches()) {
     991                return tr("Paint style {0}: {1}", tr(I18n.escape(m2.group(1))), tr(I18n.escape(m2.group(2))));
     992            } else {
     993                return tr(I18n.escape(colornames.get(fullKey)));
     994            }
     995        } else {
     996            return fullKey;
     997        }
    990998    }
    991999
Note: See TracChangeset for help on using the changeset viewer.