Ignore:
Timestamp:
2017-09-13T23:24:50+02:00 (7 years ago)
Author:
bastiK
Message:

see #15229 - use Config.getPref() wherever possible

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

Legend:

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

    r12841 r12846  
    77import java.util.Objects;
    88
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1110import org.openstreetmap.josm.data.osm.Relation;
     
    1716import org.openstreetmap.josm.gui.mappaint.Environment;
    1817import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
     18import org.openstreetmap.josm.spi.preferences.Config;
    1919import org.openstreetmap.josm.tools.CheckParameterUtil;
    2020import org.openstreetmap.josm.tools.HiDPISupport;
     
    9090            );
    9191
    92             fillImage.alpha = Utils.clamp(Main.pref.getInt("mappaint.fill-image-alpha", 255), 0, 255);
     92            fillImage.alpha = Utils.clamp(Config.getPref().getInt("mappaint.fill-image-alpha", 255), 0, 255);
    9393            Integer pAlpha = Utils.colorFloat2int(c.get(FILL_OPACITY, null, float.class));
    9494            if (pAlpha != null) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java

    r12841 r12846  
    1212import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitive;
     14import org.openstreetmap.josm.spi.preferences.Config;
    1415import org.openstreetmap.josm.tools.LanguageInfo;
    1516
     
    233234         */
    234235        public final void initNameTagsFromPreferences() {
    235             if (Main.pref == null) {
     236            if (Config.getPref() == null) {
    236237                this.nameTags = new ArrayList<>(Arrays.asList(DEFAULT_NAME_TAGS));
    237238                this.nameComplementTags = new ArrayList<>(Arrays.asList(DEFAULT_NAME_COMPLEMENT_TAGS));
    238239            } else {
    239240                this.nameTags = new ArrayList<>(
    240                         Main.pref.getList("mappaint.nameOrder", Arrays.asList(DEFAULT_NAME_TAGS))
     241                        Config.getPref().getList("mappaint.nameOrder", Arrays.asList(DEFAULT_NAME_TAGS))
    241242                );
    242243                this.nameComplementTags = new ArrayList<>(
    243                         Main.pref.getList("mappaint.nameComplementOrder", Arrays.asList(DEFAULT_NAME_COMPLEMENT_TAGS))
     244                        Config.getPref().getList("mappaint.nameComplementOrder", Arrays.asList(DEFAULT_NAME_COMPLEMENT_TAGS))
    244245                );
    245246            }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java

    r12841 r12846  
    1010import java.util.stream.IntStream;
    1111
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.data.osm.Node;
    1413import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2524import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.BoxProvider;
    2625import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.SimpleBoxProvider;
     26import org.openstreetmap.josm.spi.preferences.Config;
    2727import org.openstreetmap.josm.tools.CheckParameterUtil;
    2828import org.openstreetmap.josm.tools.Logging;
     
    196196        mapImage.offsetY = Math.round(offsetYF);
    197197
    198         mapImage.alpha = Utils.clamp(Main.pref.getInt("mappaint.icon-image-alpha", 255), 0, 255);
     198        mapImage.alpha = Utils.clamp(Config.getPref().getInt("mappaint.icon-image-alpha", 255), 0, 255);
    199199        Integer pAlpha = Utils.colorFloat2int(c.get(keys[ICON_OPACITY_IDX], null, float.class));
    200200        if (pAlpha != null) {
     
    356356            // This is only executed once, so no performance concerns.
    357357            // However, it would be better, if the settings could be changed at runtime.
    358             int size = max(
    359                     Main.pref.getInt("mappaint.node.selected-size", 5),
    360                     Main.pref.getInt("mappaint.node.unselected-size", 3),
    361                     Main.pref.getInt("mappaint.node.connection-size", 5),
    362                     Main.pref.getInt("mappaint.node.tagged-size", 3)
     358            int size = max(Config.getPref().getInt("mappaint.node.selected-size", 5),
     359                    Config.getPref().getInt("mappaint.node.unselected-size", 3),
     360                    Config.getPref().getInt("mappaint.node.connection-size", 5),
     361                    Config.getPref().getInt("mappaint.node.tagged-size", 3)
    363362            );
    364363            return new SimpleBoxProvider(new Rectangle(-size/2, -size/2, size, size));
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/StyleElement.java

    r12841 r12846  
    77import java.util.Objects;
    88
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1110import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
     
    1514import org.openstreetmap.josm.gui.mappaint.StyleKeys;
    1615import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction.RelativeFloat;
     16import org.openstreetmap.josm.spi.preferences.Config;
    1717
    1818/**
     
    148148                s = defaultFontSize;
    149149                if (s == null) {
    150                     defaultFontSize = s = (float) Main.pref.getInt("mappaint.fontsize", 8);
     150                    defaultFontSize = s = (float) Config.getPref().getInt("mappaint.fontsize", 8);
    151151                }
    152152            }
     
    161161                n = defaultFontName;
    162162                if (n == null) {
    163                     defaultFontName = n = Main.pref.get("mappaint.font", "Droid Sans");
     163                    defaultFontName = n = Config.getPref().get("mappaint.font", "Droid Sans");
    164164                }
    165165            }
Note: See TracChangeset for help on using the changeset viewer.