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


Ignore:
Timestamp:
2014-05-02T00:34:56+02:00 (10 years ago)
Author:
bastiK
Message:

see #9691 - include mapcss version of the default style as an option in the map style dialog
not default yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java

    r7005 r7041  
    214214        private boolean insertNewDefaults(List<SourceEntry> list) {
    215215            boolean changed = false;
     216           
     217            boolean addedMapcssStyle = false; // Migration code can be removed ~ Nov. 2014
    216218
    217219            Collection<String> knownDefaults = new TreeSet<>(Main.pref.getCollection("mappaint.style.known-defaults"));
     
    231233                    insertionIdx++;
    232234                    changed = true;
     235                    /* Migration code can be removed ~ Nov. 2014 */
     236                    if (Utils.equal(def.url, "resource://styles/standard/elemstyles.mapcss")) {
     237                        addedMapcssStyle = true;
     238                    }
    233239                } else {
    234240                    if (i >= insertionIdx) {
     
    243249            Main.pref.putCollection("mappaint.style.known-defaults", knownDefaults);
    244250
     251            /* Migration code can be removed ~ Nov. 2014 */
     252            if (addedMapcssStyle) {
     253                // change title of the XML entry
     254                // only do this once. If the user changes it afterward, do not touch
     255                if (!Main.pref.getBoolean("mappaint.style.migration.changedXmlName", false)) {
     256                    SourceEntry josmXml = Utils.find(list, new Predicate<SourceEntry>() {
     257                        @Override
     258                        public boolean evaluate(SourceEntry se) {
     259                            return Utils.equal(se.url, "resource://styles/standard/elemstyles.xml");
     260                        }
     261                    });
     262                    if (josmXml != null) {
     263                        josmXml.title = tr("JOSM default (XML; old version)");
     264                    }
     265                    Main.pref.put("mappaint.style.migration.changedXmlName", true);
     266                }
     267            }
     268           
    245269            return changed;
    246270        }
     
    248272        @Override
    249273        public Collection<ExtendedSourceEntry> getDefault() {
    250             ExtendedSourceEntry defJOSM = new ExtendedSourceEntry("elemstyles.xml", "resource://styles/standard/elemstyles.xml");
    251             defJOSM.active = true;
    252             defJOSM.name = "standard";
    253             defJOSM.title = tr("JOSM Internal Style");
    254             defJOSM.description = tr("Internal style to be used as base for runtime switchable overlay styles");
     274            ExtendedSourceEntry defJosmXml = new ExtendedSourceEntry("elemstyles.xml", "resource://styles/standard/elemstyles.xml");
     275            defJosmXml.active = true;
     276            defJosmXml.name = "standard";
     277            defJosmXml.title = tr("JOSM default (XML; old version)");
     278            defJosmXml.description = tr("Internal style to be used as base for runtime switchable overlay styles");
     279            ExtendedSourceEntry defJosmMapcss = new ExtendedSourceEntry("elemstyles.mapcss", "resource://styles/standard/elemstyles.mapcss");
     280            defJosmMapcss.active = false;
     281            defJosmMapcss.name = "standard";
     282            defJosmMapcss.title = tr("JOSM default (MapCSS)");
     283            defJosmMapcss.description = tr("Internal style to be used as base for runtime switchable overlay styles");
    255284            ExtendedSourceEntry defPL2 = new ExtendedSourceEntry("potlatch2.mapcss", "resource://styles/standard/potlatch2.mapcss");
    256285            defPL2.active = false;
     
    259288            defPL2.description = tr("the main Potlatch 2 style");
    260289
    261             return Arrays.asList(new ExtendedSourceEntry[] { defJOSM, defPL2 });
     290            return Arrays.asList(new ExtendedSourceEntry[] { defJosmXml, defJosmMapcss, defPL2 });
    262291        }
    263292
Note: See TracChangeset for help on using the changeset viewer.