Changeset 11542 in josm for trunk


Ignore:
Timestamp:
2017-02-07T22:00:43+01:00 (2 years ago)
Author:
stoecker
Message:

null colors never worked in preferences and don't make much sense

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r11462 r11542  
    4343import org.openstreetmap.josm.data.osm.Way;
    4444import org.openstreetmap.josm.data.osm.WaySegment;
    45 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
    4645import org.openstreetmap.josm.data.preferences.ColorProperty;
    4746import org.openstreetmap.josm.gui.MainMenu;
     
    305304        initialMoveDelay = Main.pref.getInteger("edit.initial-move-delay", 200);
    306305        initialMoveThreshold = Main.pref.getInteger("extrude.initial-move-threshold", 1);
    307         mainColor = new ColorProperty(marktr("Extrude: main line"), (Color) null).get();
    308         if (mainColor == null) mainColor = PaintColors.SELECTED.get();
     306        mainColor = new ColorProperty(marktr("Extrude: main line"), Color.RED).get();
    309307        helperColor = new ColorProperty(marktr("Extrude: helper line"), Color.ORANGE).get();
    310308        helperStrokeDash = GuiHelper.getCustomizedStroke(Main.pref.get("extrude.stroke.helper-line", "1 4"));
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java

    r11381 r11542  
    3636import org.openstreetmap.josm.data.osm.Way;
    3737import org.openstreetmap.josm.data.osm.WaySegment;
    38 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
    3938import org.openstreetmap.josm.data.preferences.CachingProperty;
    4039import org.openstreetmap.josm.data.preferences.ColorProperty;
     
    155154    @Override
    156155    protected void readPreferences() {
    157         guideColor = new ColorProperty(marktr("improve way accuracy helper line"), (Color) null).get();
    158         if (guideColor == null)
    159             guideColor = PaintColors.HIGHLIGHT.get();
     156        guideColor = new ColorProperty(marktr("improve way accuracy helper line"), Color.RED).get();
    160157    }
    161158
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r11144 r11542  
    3333import org.openstreetmap.josm.data.osm.Way;
    3434import org.openstreetmap.josm.data.osm.WaySegment;
    35 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
    3635import org.openstreetmap.josm.data.preferences.AbstractToStringProperty;
    3736import org.openstreetmap.josm.data.preferences.BooleanProperty;
     
    106105    private static final CachingProperty<Double> SNAP_DISTANCE_CHINESE  = new DoubleProperty(prefKey("snap-distance-chinese"), 1).cached();
    107106    private static final CachingProperty<Double> SNAP_DISTANCE_NAUTICAL = new DoubleProperty(prefKey("snap-distance-nautical"), 0.1).cached();
    108     private static final CachingProperty<Color> MAIN_COLOR = new ColorProperty(marktr("make parallel helper line"), (Color) null).cached();
     107    private static final CachingProperty<Color> MAIN_COLOR = new ColorProperty(marktr("make parallel helper line"), Color.RED).cached();
    109108
    110109    private static final CachingProperty<Map<Modifier, Boolean>> SNAP_MODIFIER_COMBO
     
    461460
    462461            Color mainColor = MAIN_COLOR.get();
    463             if (mainColor == null) {
    464                 mainColor = PaintColors.SELECTED.get();
    465             }
    466 
    467462            // FIXME: should clip the line (gets insanely slow when zoomed in on a very long line
    468463            g.setStroke(REF_LINE_STROKE.get());
  • trunk/src/org/openstreetmap/josm/data/preferences/ColorProperty.java

    r10922 r11542  
    55import java.util.Locale;
    66
     7import org.openstreetmap.josm.tools.CheckParameterUtil;
    78import org.openstreetmap.josm.tools.ColorHelper;
    89
     
    2122     */
    2223    public ColorProperty(String colName, String defaultValue) {
    23         this(colName, defaultValue == null ? null : ColorHelper.html2color(defaultValue));
     24        this(colName, ColorHelper.html2color(defaultValue));
    2425    }
    2526
     
    3132    public ColorProperty(String colName, Color defaultValue) {
    3233        super(getColorKey(colName), defaultValue);
     34        CheckParameterUtil.ensureParameterNotNull(defaultValue, "defaultValue");
    3335        this.name = colName;
    3436        getPreferences().registerColor(getColorKey(colName), colName);
Note: See TracChangeset for help on using the changeset viewer.