Changeset 7227 in josm


Ignore:
Timestamp:
2014-06-09T14:05:46+02:00 (10 years ago)
Author:
akks
Message:

show advanced preferences of A and W modes before enrtering them

Location:
trunk/src/org/openstreetmap/josm/actions/mapmode
Files:
2 edited

Legend:

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

    r7217 r7227  
    114114    private static final BasicStroke BASIC_STROKE = new BasicStroke(1);
    115115
     116    private static int snapToIntersectionThreshold;
     117
    116118    public DrawAction(MapFrame mapFrame) {
    117119        super(tr("Draw"), "node/autonode", tr("Draw nodes"),
     
    129131        cursorJoinNode = ImageProvider.getCursor("crosshair", "joinnode");
    130132        cursorJoinWay = ImageProvider.getCursor("crosshair", "joinway");
     133
     134        readPreferences();
     135        snapHelper.init();
    131136    }
    132137
     
    201206            return;
    202207        super.enterMode();
    203 
    204         rubberLineColor = Main.pref.getColor(marktr("helper line"), null);
    205         if (rubberLineColor == null) rubberLineColor = PaintColors.SELECTED.get();
    206 
    207         rubberLineStroke = GuiHelper.getCustomizedStroke(Main.pref.get("draw.stroke.helper-line","3"));
    208         drawHelperLine = Main.pref.getBoolean("draw.helper-line", true);
    209         drawTargetHighlight = Main.pref.getBoolean("draw.target-highlight", true);
     208        readPreferences();
    210209
    211210        // determine if selection is suitable to continue drawing. If it
     
    232231        // would like to but haven't got mouse position yet:
    233232        // computeHelperLine(false, false, false);
     233    }
     234
     235    private void readPreferences() {
     236        rubberLineColor = Main.pref.getColor(marktr("helper line"), null);
     237        if (rubberLineColor == null) rubberLineColor = PaintColors.SELECTED.get();
     238
     239        rubberLineStroke = GuiHelper.getCustomizedStroke(Main.pref.get("draw.stroke.helper-line","3"));
     240        drawHelperLine = Main.pref.getBoolean("draw.helper-line", true);
     241        drawTargetHighlight = Main.pref.getBoolean("draw.target-highlight", true);
     242        snapToIntersectionThreshold = Main.pref.getInteger("edit.snap-intersection-threshold",10);
    234243    }
    235244
     
    9941003                    B.north() + q * (A.north() - B.north()));
    9951004
    996             int snapToIntersectionThreshold
    997             = Main.pref.getInteger("edit.snap-intersection-threshold",10);
    9981005
    9991006            // only adjust to intersection if within snapToIntersectionThreshold pixel of mouse click; otherwise
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java

    r7217 r7227  
    105105                "add_node_lock");
    106106        cursorImproveLock = ImageProvider.getCursor("crosshair", "lock");
    107 
     107        readPreferences();
    108108    }
    109109
     
    117117        }
    118118        super.enterMode();
    119 
     119        readPreferences();
     120
     121        mv = Main.map.mapView;
     122        mousePos = null;
     123        oldModeHelpText = "";
     124
     125        if (getCurrentDataSet() == null) {
     126            return;
     127        }
     128
     129        updateStateByCurrentSelection();
     130
     131        Main.map.mapView.addMouseListener(this);
     132        Main.map.mapView.addMouseMotionListener(this);
     133        Main.map.mapView.addTemporaryLayer(this);
     134        DataSet.addSelectionListener(this);
     135
     136        Main.map.keyDetector.addModifierListener(this);
     137    }
     138
     139    private void readPreferences() {
    120140        guideColor = Main.pref.getColor(marktr("improve way accuracy helper line"), null);
    121141        if (guideColor == null) guideColor = PaintColors.HIGHLIGHT.get();
     
    126146        deleteNodeStroke = GuiHelper.getCustomizedStroke(Main.pref.get("improvewayaccuracy.stroke.delete-node", "1"));
    127147        dotSize = Main.pref.getInteger("improvewayaccuracy.dot-size",6);
    128 
    129         mv = Main.map.mapView;
    130         mousePos = null;
    131         oldModeHelpText = "";
    132 
    133         if (getCurrentDataSet() == null) {
    134             return;
    135         }
    136 
    137         updateStateByCurrentSelection();
    138 
    139         Main.map.mapView.addMouseListener(this);
    140         Main.map.mapView.addMouseMotionListener(this);
    141         Main.map.mapView.addTemporaryLayer(this);
    142         DataSet.addSelectionListener(this);
    143 
    144         Main.map.keyDetector.addModifierListener(this);
    145148    }
    146149
Note: See TracChangeset for help on using the changeset viewer.