Index: /trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java	(revision 3599)
+++ /trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java	(revision 3600)
@@ -36,4 +36,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.osm.WaySegment;
+import org.openstreetmap.josm.data.preferences.IntegerProperty;
 import org.openstreetmap.josm.data.projection.Projection;
 import org.openstreetmap.josm.gui.help.Helpful;
@@ -55,4 +56,6 @@
         void zoomChanged();
     }
+
+    public static final IntegerProperty PROP_SNAP_DISTANCE = new IntegerProperty("mappaint.node.snap-distance", 10);
 
     /**
@@ -461,5 +464,5 @@
      * neither does the result *order*.
      * It solely depends on the distance to point p.
-     * 
+     *
      * @return a sorted map with the keys representing the distance of
      *      their associated nodes to point p.
@@ -471,8 +474,8 @@
 
         if (ds != null) {
-            double dist, snapDistanceSq = Main.pref.getInteger("mappaint.node.snap-distance", 10);
+            double dist, snapDistanceSq = PROP_SNAP_DISTANCE.get();
             snapDistanceSq *= snapDistanceSq;
 
-            for (Node n : ds.searchNodes(getBBox(p, Main.pref.getInteger("mappaint.node.snap-distance", 10)))) {
+            for (Node n : ds.searchNodes(getBBox(p, PROP_SNAP_DISTANCE.get()))) {
                 if (predicate.evaluate(n)
                         && (dist = getPoint2D(n).distanceSq(p)) < snapDistanceSq)
@@ -497,5 +500,5 @@
      * neither does the result *order*.
      * It solely depends on the distance to point p.
-     * 
+     *
      * @return All nodes nearest to point p that are in a belt from
      *      dist(nearest) to dist(nearest)+4px around p and
@@ -544,9 +547,9 @@
      * neither does the result *order*.
      * It solely depends on the distance to point p.
-     * 
+     *
      * @return All nodes nearest to point p that are in a belt from
      *      dist(nearest) to dist(nearest)+4px around p.
      * @see #getNearestNodes(Point, Collection, Predicate)
-     * 
+     *
      * @param p the point for which to search the nearest segment.
      * @param predicate the returned objects have to fulfill certain properties.
@@ -558,19 +561,19 @@
     /**
      * The *result* depends on the current map selection state.
-     * 
+     *
      * If more than one node within node.snap-distance pixels is found,
      * the nearest node selected is returned.
-     * 
+     *
      * If no such node is found, the nearest new/id=0 node within
      * about the same distance as the true nearest node is returned.
-     * 
+     *
      * If no such node is found either, the true nearest
      * node to p is returned.
-     * 
+     *
      * Finally, if a node is not found at all, return null.
-     * 
+     *
      * @return A node within snap-distance to point p,
      *      that is chosen by the algorithm described.
-     * 
+     *
      * @param p the screen point
      * @param predicate this parameter imposes a condition on the returned object, e.g.
@@ -616,5 +619,5 @@
      * neither does the result *order*.
      * It solely depends on the distance to point p.
-     * 
+     *
      * @return a sorted map with the keys representing the perpendicular
      *      distance of their associated way segments to point p.
@@ -685,8 +688,8 @@
      * Segments within 10px of p are searched and sorted by their distance to @param p,
      * then, within groups of equally distant segments, prefer those that are selected.
-     * 
+     *
      * @return all segments within 10px of p that are not in ignore,
      *          sorted by their perpendicular distance.
-     * 
+     *
      * @param p the point for which to search the nearest segments.
      * @param ignore a collection of segments which are not to be returned.
@@ -716,5 +719,5 @@
     /**
      * The result *order* depends on the current map selection state.
-     * 
+     *
      * @return all segments within 10px of p, sorted by their perpendicular distance.
      * @see #getNearestWaySegments(Point, Collection, Predicate)
@@ -729,5 +732,5 @@
     /**
      * The *result* depends on the current map selection state.
-     * 
+     *
      * @return The nearest way segment to point p,
      *      prefer a nearest, selected way segment, if found.
@@ -761,8 +764,8 @@
      * neither does the result *order*.
      * It solely depends on the perpendicular distance to point p.
-     * 
+     *
      * @return all nearest ways to the screen point given that are not in ignore.
      * @see #getNearestWaySegments(Point, Collection, Predicate)
-     * 
+     *
      * @param p the point for which to search the nearest ways.
      * @param ignore a collection of ways which are not to be returned.
@@ -792,8 +795,8 @@
      * neither does the result *order*.
      * It solely depends on the perpendicular distance to point p.
-     * 
+     *
      * @return all nearest ways to the screen point given.
      * @see #getNearestWays(Point, Collection, Predicate)
-     * 
+     *
      * @param p the point for which to search the nearest ways.
      * @param predicate the returned object has to fulfill certain properties.
@@ -827,17 +830,17 @@
      * neither does the result *order*.
      * It solely depends on the distance to point p.
-     * 
+     *
      * First, nodes will be searched. If there are nodes within BBox found,
      * return a collection of those nodes only.
-     * 
+     *
      * If no nodes are found, search for nearest ways. If there are ways
      * within BBox found, return a collection of those ways only.
-     * 
+     *
      * If nothing is found, return an empty collection.
-     * 
+     *
      * @return Primitives nearest to the given screen point that are not in ignore.
      * @see #getNearestNodes(Point, Collection, Predicate)
      * @see #getNearestWays(Point, Collection, Predicate)
-     * 
+     *
      * @param p The point on screen.
      * @param ignore a collection of ways which are not to be returned.
@@ -867,8 +870,8 @@
      * neither does the result *order*.
      * It solely depends on the distance to point p.
-     * 
+     *
      * @return Primitives nearest to the given screen point.
      * @see #getNearests(Point, Collection, Predicate)
-     * 
+     *
      * @param p The point on screen.
      * @param predicate the returned object has to fulfill certain properties.
@@ -880,7 +883,7 @@
     /**
      * This is used as a helper routine to {@link #getNearestNodeOrWay(Point, Predicate, boolean)}
-     * 
+     *
      * @return true, if the node fulfills certain properties wrt p and use_sel
-     * 
+     *
      * @param osm node to check
      * @param p point clicked
@@ -903,15 +906,15 @@
     /**
      * The *result* depends on the current map selection state IF use_selected is true.
-     * 
+     *
      * IF use_selected is true, use {@link #getNearestNode(Point, Predicate)} to find
      * the nearest, selected node.  If not found, try {@link #getNearestWaySegment(Point, Predicate)}
      * to find the nearest selected way.
-     * 
+     *
      * IF use_selected is false, or if no selected primitive was found, do the following.
-     * 
+     *
      * If the nearest node found is within 4px of p, simply take it.
      * Else, find the nearest way segment. Then, if p is closer to its
      * middle than to the node, take the way segment, else take the node.
-     * 
+     *
      * Finally, if no nearest primitive is found at all, return null.
      *
@@ -974,5 +977,5 @@
                         osm = ws.way;
                     } else {
-                        int maxWaySegLenSq = 3*Main.pref.getInteger("mappaint.node.snap-distance", 10);
+                        int maxWaySegLenSq = 3*PROP_SNAP_DISTANCE.get();
                         maxWaySegLenSq *= maxWaySegLenSq;
 
@@ -996,5 +999,5 @@
     /**
      * Convenience method to {@link #getNearestNodeOrWay(Point, Predicate, boolean)}.
-     * 
+     *
      * @return The nearest primitive to point p.
      */
@@ -1033,5 +1036,5 @@
 
     /**
-     * 
+     *
      * @param pt point to project onto (ab)
      * @param a root of vector
@@ -1054,5 +1057,5 @@
      * if r = 0 returns a, if r=1 returns b,
      * if r = 0.5 returns center between a and b, etc..
-     * 
+     *
      * @param r scale value
      * @param a root of vector
@@ -1074,8 +1077,8 @@
      * neither does the result *order*.
      * It solely depends on the distance to point p.
-     * 
+     *
      * @return a list of all objects that are nearest to point p and
      *          not in ignore or an empty list if nothing was found.
-     * 
+     *
      * @param p The point on screen.
      * @param ignore a collection of ways which are not to be returned.
@@ -1108,9 +1111,9 @@
      * neither does the result *order*.
      * It solely depends on the distance to point p.
-     * 
+     *
      * @return a list of all objects that are nearest to point p
      *          or an empty list if nothing was found.
      * @see #getAllNearest(Point, Collection, Predicate)
-     * 
+     *
      * @param p The point on screen.
      * @param predicate the returned object has to fulfill certain properties.
