Index: /src/org/openstreetmap/josm/actions/AutoScaleAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 15)
+++ /src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 15)
@@ -0,0 +1,30 @@
+package org.openstreetmap.josm.actions;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.ImageIcon;
+
+import org.openstreetmap.josm.gui.Layer;
+import org.openstreetmap.josm.gui.Main;
+
+/**
+ * Toggles the autoScale feature of the layer
+ * @author imi
+ */
+public class AutoScaleAction extends AbstractAction {
+	/**
+	 * The Layer, that belongs to this AutoScaleSction.
+	 */
+	private final Layer layer;
+	
+	public AutoScaleAction(Layer layer) {
+		super("Auto Scale", new ImageIcon(Main.class.getResource("/images/autoscale.png")));
+		this.layer = layer;
+		putValue(MNEMONIC_KEY, KeyEvent.VK_A);
+	}
+	public void actionPerformed(ActionEvent e) {
+		layer.setAutoScale(!layer.isAutoScale());
+	}
+}
Index: /src/org/openstreetmap/josm/actions/OpenGpxAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/OpenGpxAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/OpenGpxAction.java	(revision 15)
@@ -15,5 +15,4 @@
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.gui.Main;
-import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.io.GpxReader;
 import org.openstreetmap.josm.io.DataReader.ConnectionException;
@@ -55,6 +54,5 @@
 		try {
 			DataSet dataSet = new GpxReader(new FileReader(gpxFile)).parse();
-			MapFrame map = new MapFrame(dataSet);
-			Main.main.setMapFrame(gpxFile.getName(), map);
+			Main.main.setMapFrame(gpxFile.getName(), dataSet);
 		} catch (ParseException x) {
 			x.printStackTrace();
Index: /src/org/openstreetmap/josm/actions/SaveGpxAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/SaveGpxAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/SaveGpxAction.java	(revision 15)
@@ -46,5 +46,5 @@
 		try {
 			FileWriter fileWriter = new FileWriter(gpxFile);
-			GpxWriter out = new GpxWriter(fileWriter, Main.main.getMapFrame().mapView.dataSet);
+			GpxWriter out = new GpxWriter(fileWriter, Main.main.getMapFrame().layer.dataSet);
 			out.output();
 			fileWriter.close();
Index: /src/org/openstreetmap/josm/actions/mapmode/AddLineSegmentAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/mapmode/AddLineSegmentAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/mapmode/AddLineSegmentAction.java	(revision 15)
@@ -59,6 +59,6 @@
 	public void registerListener() {
 		super.registerListener();
-		mv.addMouseListener(this);
-		mv.addMouseMotionListener(this);
+		layer.addMouseListener(this);
+		layer.addMouseMotionListener(this);
 	}
 
@@ -66,6 +66,6 @@
 	public void unregisterListener() {
 		super.unregisterListener();
-		mv.removeMouseListener(this);
-		mv.removeMouseMotionListener(this);
+		layer.removeMouseListener(this);
+		layer.removeMouseMotionListener(this);
 		drawHint(false);
 	}
@@ -79,5 +79,5 @@
 			return;
 
-		OsmPrimitive clicked = mv.getNearest(e.getPoint(), false);
+		OsmPrimitive clicked = layer.getNearest(e.getPoint(), false);
 		if (clicked == null || !(clicked instanceof Node))
 			return;
@@ -96,5 +96,5 @@
 			return;
 
-		OsmPrimitive clicked = mv.getNearest(e.getPoint(), (e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) != 0);
+		OsmPrimitive clicked = layer.getNearest(e.getPoint(), (e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) != 0);
 		if (clicked == null || clicked == second || !(clicked instanceof Node))
 			return;
@@ -161,5 +161,5 @@
 		}
 		
-		mv.repaint();
+		layer.repaint();
 	}
 
@@ -175,9 +175,9 @@
 			return;
 
-		Graphics g = mv.getGraphics();
+		Graphics g = layer.getGraphics();
 		g.setColor(Color.BLACK);
 		g.setXORMode(Color.WHITE);
-		Point firstDrawn = mv.getScreenPoint(first.coor);
-		Point secondDrawn = mv.getScreenPoint(second.coor);
+		Point firstDrawn = layer.getScreenPoint(first.coor);
+		Point secondDrawn = layer.getScreenPoint(second.coor);
 		g.drawLine(firstDrawn.x, firstDrawn.y, secondDrawn.x, secondDrawn.y);
 		hintDrawn = !hintDrawn;
Index: /src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java	(revision 15)
@@ -30,5 +30,5 @@
 	public void registerListener() {
 		super.registerListener();
-		mv.addMouseListener(this);
+		layer.addMouseListener(this);
 	}
 
@@ -36,5 +36,5 @@
 	public void unregisterListener() {
 		super.unregisterListener();
-		mv.removeMouseListener(this);
+		layer.removeMouseListener(this);
 	}
 
@@ -47,7 +47,7 @@
 		if (e.getButton() == MouseEvent.BUTTON1) {
 			Node node = new Node();
-			node.coor = mv.getPoint(e.getX(), e.getY(), true);
+			node.coor = layer.getPoint(e.getX(), e.getY(), true);
 			ds.nodes.add(node);
-			mv.repaint();
+			layer.repaint();
 		}
 	}
Index: /src/org/openstreetmap/josm/actions/mapmode/AddTrackAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/mapmode/AddTrackAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/mapmode/AddTrackAction.java	(revision 15)
@@ -43,5 +43,5 @@
 	public AddTrackAction(MapFrame mapFrame) {
 		super("Add Track", "addtrack", "Combine line segments to a new track.", KeyEvent.VK_T, mapFrame);
-		this.selectionManager = new SelectionManager(this, false, mv);
+		this.selectionManager = new SelectionManager(this, false, layer);
 	}
 
@@ -49,5 +49,5 @@
 	public void registerListener() {
 		super.registerListener();
-		selectionManager.register(mv);
+		selectionManager.register(layer);
 	}
 
@@ -55,5 +55,5 @@
 	public void unregisterListener() {
 		super.unregisterListener();
-		selectionManager.unregister(mv);
+		selectionManager.unregister(layer);
 	}
 
@@ -82,5 +82,5 @@
 			osm.setSelected(!ctrl, ds);
 
-		mv.repaint(); // from now on, the map has to be repainted.
+		layer.repaint(); // from now on, the map has to be repainted.
 
 		if (ctrl || shift)
Index: /src/org/openstreetmap/josm/actions/mapmode/CombineAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/mapmode/CombineAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/mapmode/CombineAction.java	(revision 15)
@@ -80,6 +80,6 @@
 	public void registerListener() {
 		super.registerListener();
-		mv.addMouseListener(this);
-		mv.addMouseMotionListener(this);
+		layer.addMouseListener(this);
+		layer.addMouseMotionListener(this);
 		ds.clearSelection();
 	}
@@ -88,6 +88,6 @@
 	public void unregisterListener() {
 		super.unregisterListener();
-		mv.removeMouseListener(this);
-		mv.removeMouseMotionListener(this);
+		layer.removeMouseListener(this);
+		layer.removeMouseMotionListener(this);
 		drawCombineHint(false);
 	}
@@ -103,5 +103,5 @@
 			return;
 
-		OsmPrimitive clicked = mv.getNearest(e.getPoint(), true);
+		OsmPrimitive clicked = layer.getNearest(e.getPoint(), true);
 		if (clicked == null || clicked instanceof Node)
 			return;
@@ -119,5 +119,5 @@
 			return;
 		
-		OsmPrimitive clicked = mv.getNearest(e.getPoint(), true);
+		OsmPrimitive clicked = layer.getNearest(e.getPoint(), true);
 		if (clicked == null || clicked == second || clicked instanceof Node)
 			return;
@@ -168,5 +168,5 @@
 			}
 		}
-		mv.repaint();
+		layer.repaint();
 	}
 
@@ -198,5 +198,5 @@
 			return;
 
-		Graphics g = mv.getGraphics();
+		Graphics g = layer.getGraphics();
 		g.setColor(Color.BLACK);
 		g.setXORMode(Color.WHITE);
@@ -214,7 +214,7 @@
 		if (osm instanceof LineSegment) {
 			LineSegment ls = (LineSegment)osm;
-			Point start = mv.getScreenPoint(ls.getStart().coor);
-			Point end = mv.getScreenPoint(ls.getEnd().coor);
-			if (mv.dataSet.pendingLineSegments().contains(osm) && g.getColor() == Color.GRAY)
+			Point start = layer.getScreenPoint(ls.getStart().coor);
+			Point end = layer.getScreenPoint(ls.getEnd().coor);
+			if (layer.dataSet.pendingLineSegments().contains(osm) && g.getColor() == Color.GRAY)
 				g.drawLine(start.x, start.y, end.x, end.y);
 			else
Index: /src/org/openstreetmap/josm/actions/mapmode/DebugAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/mapmode/DebugAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/mapmode/DebugAction.java	(revision 15)
@@ -31,6 +31,6 @@
 	public void registerListener() {
 		super.registerListener();
-		mv.addMouseMotionListener(this);
-		mv.addMouseListener(this);
+		layer.addMouseMotionListener(this);
+		layer.addMouseListener(this);
 		mapFrame.add(label, BorderLayout.SOUTH);
 	}
@@ -39,6 +39,6 @@
 	public void unregisterListener() {
 		super.unregisterListener();
-		mv.removeMouseMotionListener(this);
-		mv.removeMouseListener(this);
+		layer.removeMouseMotionListener(this);
+		layer.removeMouseListener(this);
 		mapFrame.remove(label);
 	}
@@ -46,10 +46,10 @@
 	@Override
 	public void mouseClicked(MouseEvent e) {
-		Graphics g = mapFrame.mapView.getGraphics();
+		Graphics g = mapFrame.layer.getGraphics();
 		g.setColor(Color.WHITE);
-		for (Track t :mapFrame.mapView.dataSet.tracks())
+		for (Track t :mapFrame.layer.dataSet.tracks())
 			for (LineSegment ls : t.segments()) {
-				Point A = mapFrame.mapView.getScreenPoint(ls.getStart().coor);
-				Point B = mapFrame.mapView.getScreenPoint(ls.getEnd().coor);
+				Point A = mapFrame.layer.getScreenPoint(ls.getStart().coor);
+				Point B = mapFrame.layer.getScreenPoint(ls.getEnd().coor);
 				Point C = e.getPoint();
 				Rectangle r = new Rectangle(A.x, A.y, B.x-A.x, B.y-A.y);
Index: /src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java	(revision 15)
@@ -71,5 +71,5 @@
 	public void registerListener() {
 		super.registerListener();
-		mv.addMouseListener(this);
+		layer.addMouseListener(this);
 	}
 
@@ -77,5 +77,5 @@
 	public void unregisterListener() {
 		super.unregisterListener();
-		mv.removeMouseListener(this);
+		layer.removeMouseListener(this);
 	}
 
@@ -89,5 +89,5 @@
 			return;
 		
-		OsmPrimitive sel = mv.getNearest(e.getPoint(), (e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) != 0);
+		OsmPrimitive sel = layer.getNearest(e.getPoint(), (e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) != 0);
 		if (sel == null)
 			return;
@@ -98,5 +98,5 @@
 			delete(sel);
 
-		mv.repaint();
+		layer.repaint();
 	}
 
Index: /src/org/openstreetmap/josm/actions/mapmode/MapMode.java
===================================================================
--- /src/org/openstreetmap/josm/actions/mapmode/MapMode.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/mapmode/MapMode.java	(revision 15)
@@ -14,5 +14,5 @@
 import org.openstreetmap.josm.gui.Main;
 import org.openstreetmap.josm.gui.MapFrame;
-import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.Layer;
 
 /**
@@ -31,7 +31,7 @@
 	protected final MapFrame mapFrame;
 	/**
-	 * Shortcut to the MapView.
+	 * Shortcut to the Layer.
 	 */
-	protected final MapView mv;
+	protected final Layer layer;
 	/**
 	 * Shortcut to the DataSet.
@@ -53,11 +53,10 @@
 		mapFrame.getActionMap().put(this, this);
 		this.mapFrame = mapFrame;
-		mv = mapFrame.mapView;
-		ds = mv.dataSet;
+		layer = mapFrame.layer;
+		ds = layer.dataSet;
 	}
 	
 	/**
-	 * Register all listener to the mapView
-	 * @param mapView	The view, where the listener should be registered.
+	 * Register all listener to the layer
 	 */
 	public void registerListener() {
@@ -67,5 +66,4 @@
 	/**
 	 * Unregister all listener previously registered. 
-	 * @param mapView	The view from which the listener should be deregistered.
 	 */
 	public void unregisterListener() {
Index: /src/org/openstreetmap/josm/actions/mapmode/MoveAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/mapmode/MoveAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/mapmode/MoveAction.java	(revision 15)
@@ -48,6 +48,6 @@
 	public void registerListener() {
 		super.registerListener();
-		mv.addMouseListener(this);
-		mv.addMouseMotionListener(this);
+		layer.addMouseListener(this);
+		layer.addMouseMotionListener(this);
 	}
 
@@ -55,6 +55,6 @@
 	public void unregisterListener() {
 		super.unregisterListener();
-		mv.removeMouseListener(this);
-		mv.removeMouseMotionListener(this);
+		layer.removeMouseListener(this);
+		layer.removeMouseMotionListener(this);
 	}
 
@@ -86,10 +86,10 @@
 
 		for (Node n : movingNodes) {
-			Point pos = mv.getScreenPoint(n.coor);
+			Point pos = layer.getScreenPoint(n.coor);
 			pos.x += dx;
 			pos.y += dy;
-			n.coor = mv.getPoint(pos.x, pos.y, true);
+			n.coor = layer.getPoint(pos.x, pos.y, true);
 		}
-		mv.repaint();
+		layer.repaint();
 		
 		mousePos = e.getPoint();
@@ -111,15 +111,15 @@
 
 		if (ds.getSelected().size() == 0) {
-			OsmPrimitive osm = mv.getNearest(e.getPoint(), (e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) != 0);
+			OsmPrimitive osm = layer.getNearest(e.getPoint(), (e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) != 0);
 			if (osm != null)
 				osm.setSelected(true, ds);
 			singleOsmPrimitive = osm;
-			mv.repaint();
+			layer.repaint();
 		} else
 			singleOsmPrimitive = null;
 		
 		mousePos = e.getPoint();
-		oldCursor = mv.getCursor();
-		mv.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
+		oldCursor = layer.getCursor();
+		layer.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
 	}
 	
@@ -129,8 +129,8 @@
 	@Override
 	public void mouseReleased(MouseEvent e) {
-		mv.setCursor(oldCursor);
+		layer.setCursor(oldCursor);
 		if (singleOsmPrimitive != null) {
 			singleOsmPrimitive.setSelected(false, ds);
-			mv.repaint();
+			layer.repaint();
 		}
 	}
Index: /src/org/openstreetmap/josm/actions/mapmode/SelectionAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/mapmode/SelectionAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/mapmode/SelectionAction.java	(revision 15)
@@ -46,5 +46,5 @@
  * and the user clicked in or 10 pixel away from an area, this area is selected. 
  * If there is even no area, nothing is selected. Shift and Ctrl key applies to 
- * this as usual. For more, @see MapView#getNearest(Point, boolean)
+ * this as usual. For more, @see Layer#getNearest(Point, boolean)
  *
  * @author imi
@@ -63,5 +63,5 @@
 	public SelectionAction(MapFrame mapFrame) {
 		super("Selection", "selection", "Select objects by dragging or clicking", KeyEvent.VK_S, mapFrame);
-		this.selectionManager = new SelectionManager(this, false, mv);
+		this.selectionManager = new SelectionManager(this, false, layer);
 	}
 
@@ -69,5 +69,5 @@
 	public void registerListener() {
 		super.registerListener();
-		selectionManager.register(mv);
+		selectionManager.register(layer);
 	}
 
@@ -75,5 +75,5 @@
 	public void unregisterListener() {
 		super.unregisterListener();
-		selectionManager.unregister(mv);
+		selectionManager.unregister(layer);
 	}
 
@@ -92,5 +92,5 @@
 		for (OsmPrimitive osm : selectionList)
 			osm.setSelected(!ctrl, ds);
-		mv.repaint();
+		layer.repaint();
 	}
 }
Index: /src/org/openstreetmap/josm/actions/mapmode/ZoomAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/mapmode/ZoomAction.java	(revision 14)
+++ /src/org/openstreetmap/josm/actions/mapmode/ZoomAction.java	(revision 15)
@@ -6,5 +6,5 @@
 import org.openstreetmap.josm.data.GeoPoint;
 import org.openstreetmap.josm.gui.MapFrame;
-import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.Layer;
 import org.openstreetmap.josm.gui.SelectionManager;
 import org.openstreetmap.josm.gui.SelectionManager.SelectionEnded;
@@ -14,5 +14,5 @@
  * 
  * Holding down the left mouse button select a rectangle with the same aspect 
- * ratio than the current map view.
+ * ratio than the current layer.
  * Holding down left and right let the user move the former selected rectangle.
  * Releasing the left button zoom to the selection.
@@ -28,8 +28,8 @@
 	 * Shortcut to the mapview.
 	 */
-	private final MapView mv;
+	private final Layer mv;
 	/**
 	 * Manager that manages the selection rectangle with the aspect ratio of the
-	 * MapView.
+	 * Layer.
 	 */
 	private final SelectionManager selectionManager;
@@ -42,5 +42,5 @@
 	public ZoomAction(MapFrame mapFrame) {
 		super("Zoom", "zoom", "Zoom in by dragging", KeyEvent.VK_Z, mapFrame);
-		mv = mapFrame.mapView;
+		mv = mapFrame.layer;
 		selectionManager = new SelectionManager(this, true, mv);
 	}
Index: /src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- /src/org/openstreetmap/josm/data/Preferences.java	(revision 14)
+++ /src/org/openstreetmap/josm/data/Preferences.java	(revision 15)
@@ -1,7 +1,10 @@
 package org.openstreetmap.josm.data;
 
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
+import java.util.LinkedList;
 import java.util.List;
 
@@ -25,21 +28,29 @@
 public class Preferences {
 
+	
 	/**
 	 * The look and feel. Classname of the look and feel class to use.
 	 */
-	public LookAndFeelInfo laf = UIManager.getInstalledLookAndFeels()[0];
-
+	private LookAndFeelInfo laf = UIManager.getInstalledLookAndFeels()[0];
 	/**
 	 * The convertor used to translate lat/lon points to screen points.
 	 */
-	public Projection projection = new UTM();
+	private Projection projection = new UTM();
+	/**
+	 * Whether nodes on the same place should be considered identical.
+	 */
+	private boolean mergeNodes = true;
+
 
 
 	/**
-	 * Whether nodes on the same place should be considered identical.
+	 * Exception thrown in case of any loading/saving error (including parse errors).
+	 * @author imi
 	 */
-	public boolean mergeNodes = true;
-	
-	
+	public static class PreferencesException extends Exception {
+		public PreferencesException(String message, Throwable cause) {
+			super(message, cause);
+		}
+	}
 
 	/**
@@ -51,4 +62,41 @@
 	};
 
+
+
+
+	// listener stuff
+	
+	/**
+	 * The event listener list
+	 */
+	private List<PropertyChangeListener> listener = new LinkedList<PropertyChangeListener>();
+	/**
+	 * If <code>listener != null</code>, add it to the listener list.
+	 */
+	public void addPropertyChangeListener(PropertyChangeListener listener) {
+		if (listener != null)
+			this.listener.add(listener);
+	}
+	/**
+	 * If <code>listener != null</code>, remove it from the listener list.
+	 */
+	public void removePropertyChangeListener(PropertyChangeListener listener) {
+		if (listener != null)
+			this.listener.remove(listener);
+	}
+	/**
+	 * Fires an event that the property has changed.
+	 */
+	private void firePropertyChanged(String propName, Object oldValue, Object newValue) {
+		PropertyChangeEvent event = null;
+		for (PropertyChangeListener l : listener) {
+			if (event == null)
+				event = new PropertyChangeEvent(this, propName, oldValue, newValue);
+			l.propertyChange(event);
+		}
+	}
+
+	
+	
 	/**
 	 * Return the location of the preferences file
@@ -58,13 +106,4 @@
 	}
 	
-	/**
-	 * Exception thrown in case of any loading/saving error (including parse errors).
-	 * @author imi
-	 */
-	public static class PreferencesException extends Exception {
-		public PreferencesException(String message, Throwable cause) {
-			super(message, cause);
-		}
-	}
 	/**
 	 * Load from disk.
@@ -81,12 +120,21 @@
 			for (LookAndFeelInfo lafInfo : UIManager.getInstalledLookAndFeels())
 				if (lafInfo.getClassName().equals(lafClassName)) {
-					laf = lafInfo;
+					setLaf(lafInfo);
 					break;
 				}
-			if (laf == null)
+			if (getLaf() == null)
 				throw new PreferencesException("Look and Feel not found.", null);
-			
-			projection = (Projection)Class.forName(root.getChildText("projection")).newInstance();
-			mergeNodes = root.getChild("mergeNodes") != null;
+
+			// set projection
+			Class<?> projectionClass = Class.forName(root.getChildText("projection"));
+			projection = allProjections[0]; // defaults to UTM
+			for (Projection p : allProjections) {
+				if (p.getClass() == projectionClass) {
+					projection = p;
+					break;
+				}
+			}
+
+			setMergeNodes(root.getChild("mergeNodes") != null);
 		} catch (Exception e) {
 			if (e instanceof PreferencesException)
@@ -105,7 +153,7 @@
 		
 		List children = root.getChildren();
-		children.add(new Element("laf").setText(laf.getClassName()));
-		children.add(new Element("projection").setText(projection.getClass().getName()));
-		if (mergeNodes)
+		children.add(new Element("laf").setText(getLaf().getClassName()));
+		children.add(new Element("projection").setText(getProjection().getClass().getName()));
+		if (isMergeNodes())
 			children.add(new Element("mergeNodes"));
 
@@ -118,3 +166,30 @@
 		}
 	}
+
+	// getter / setter
+
+	public void setProjection(Projection projection) {
+		Projection old = this.projection;
+		this.projection = projection;
+		firePropertyChanged("projection", old, projection);
+	}
+	public Projection getProjection() {
+		return projection;
+	}
+	public void setMergeNodes(boolean mergeNodes) {
+		boolean old = this.mergeNodes;
+		this.mergeNodes = mergeNodes;
+		firePropertyChanged("mergeNodes", old, mergeNodes);
+	}
+	public boolean isMergeNodes() {
+		return mergeNodes;
+	}
+	public void setLaf(LookAndFeelInfo laf) {
+		LookAndFeelInfo old = this.laf;
+		this.laf = laf;
+		firePropertyChanged("laf", old, laf);
+	}
+	public LookAndFeelInfo getLaf() {
+		return laf;
+	}
 }
Index: /src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- /src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 14)
+++ /src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 15)
@@ -113,16 +113,16 @@
 		Node first = nodes.iterator().next();
 		Bounds b = new Bounds(first.coor.clone(), first.coor.clone());
-		for (Node w : nodes)
+		for (Node n : nodes)
 		{
-			if (Double.isNaN(w.coor.x) || Double.isNaN(w.coor.y))
+			if (Double.isNaN(n.coor.x) || Double.isNaN(n.coor.y))
 				return null;
-			if (w.coor.x < b.min.x)
-				b.min.x = w.coor.x;
-			if (w.coor.y < b.min.y)
-				b.min.y = w.coor.y;
-			if (w.coor.x > b.max.x)
-				b.max.x = w.coor.x;
-			if (w.coor.y > b.max.y)
-				b.max.y = w.coor.y;
+			if (n.coor.x < b.min.x)
+				b.min.x = n.coor.x;
+			if (n.coor.y < b.min.y)
+				b.min.y = n.coor.y;
+			if (n.coor.x > b.max.x)
+				b.max.x = n.coor.x;
+			if (n.coor.y > b.max.y)
+				b.max.y = n.coor.y;
 		}
 		return b;
Index: /src/org/openstreetmap/josm/data/projection/Projection.java
===================================================================
--- /src/org/openstreetmap/josm/data/projection/Projection.java	(revision 14)
+++ /src/org/openstreetmap/josm/data/projection/Projection.java	(revision 15)
@@ -10,5 +10,4 @@
 import org.openstreetmap.josm.data.GeoPoint;
 import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.data.osm.Node;
 
 /**
@@ -66,17 +65,16 @@
 	 */
 	abstract public JComponent getConfigurationPanel();
-	
+
 	/**
 	 * Initialize itself with the given dataSet.
 	 * 
 	 * This function should initialize own parameters needed to do the
-	 * projection and then initialize every Node of the dataset with x/y
-	 * projection values.
+	 * projection at best effort.
 	 * 
-	 * This implementation loops through the dataset's nodes and call latlon2xy
-	 * for each member. Subclasses can call this to initialize the dataset.
-	 * 
-	 * init must not fire an state changed event, since it is usually called
-	 * from the event handler.
+	 * Init must not fire an state changed event, since it is usually called
+	 * during the initialization of the mapFrame.
+	 *
+	 * This implementation does nothing. It is provided only for subclasses
+	 * to initialize their data members.
 	 * 
 	 * @param dataSet
@@ -88,17 +86,5 @@
 	 *            is far away from any coordinate in the dataset)
 	 */
-	public void init(DataSet dataSet) {
-		for (Node w : dataSet.nodes)
-			latlon2xy(w.coor);
-	}
-	
-	/**
-	 * All projections support cloning.
-	 */
-	@Override
-	public Projection clone() {
-		try {return (Projection)super.clone();} catch (CloneNotSupportedException e) {}
-		return null;
-	}
+	public void init(DataSet dataSet) {}
 	
 	/**
Index: /src/org/openstreetmap/josm/data/projection/UTM.java
===================================================================
--- /src/org/openstreetmap/josm/data/projection/UTM.java	(revision 14)
+++ /src/org/openstreetmap/josm/data/projection/UTM.java	(revision 15)
@@ -210,5 +210,4 @@
 			hemisphere = lat > 0 ? Hemisphere.north : Hemisphere.south;
 		}
-		super.init(dataSet);
 	}
 
Index: /src/org/openstreetmap/josm/gui/Layer.java
===================================================================
--- /src/org/openstreetmap/josm/gui/Layer.java	(revision 15)
+++ /src/org/openstreetmap/josm/gui/Layer.java	(revision 15)
@@ -0,0 +1,373 @@
+package org.openstreetmap.josm.gui;
+
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JComponent;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.openstreetmap.josm.data.Bounds;
+import org.openstreetmap.josm.data.GeoPoint;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.osm.LineSegment;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Track;
+import org.openstreetmap.josm.data.projection.Projection;
+import org.openstreetmap.josm.gui.engine.Engine;
+import org.openstreetmap.josm.gui.engine.SimpleEngine;
+
+/**
+ * This is a component used in the MapFrame for browsing the map. It use is to
+ * provide the MapMode's enough capabilities to operate.
+ * 
+ * Layer holds one dataset. There can be more than one Layer active.
+ * 
+ * Layer hold data of the current displayed graphics as scale level and
+ * center point view.
+ * 
+ * @author imi
+ */
+public class Layer extends JComponent implements ComponentListener, ChangeListener, PropertyChangeListener {
+
+	/**
+	 * Whether to adjust the scale property on every resize.
+	 */
+	private boolean autoScale = true;
+
+	/**
+	 * The scale factor in meter per pixel.
+	 */
+	private double scale;
+	/**
+	 * Center n/e coordinate of the desired screen center.
+	 */
+	private GeoPoint center;
+
+	/**
+	 * The underlying DataSet.
+	 */
+	public final DataSet dataSet;
+
+	/**
+	 * The drawing engine.
+	 */
+	private Engine engine;
+	
+	/**
+	 * Construct a Layer.
+	 */
+	public Layer(DataSet dataSet) {
+		this.dataSet = dataSet;
+		addComponentListener(this);
+
+		// initialize the movement listener
+		new MapMover(this);
+
+		// initialize the drawing engine
+		engine = new SimpleEngine(this);
+		
+		// initialize on the preferences for projection changes.
+		Main.pref.addPropertyChangeListener(this);
+	}
+
+	/**
+	 * Get geographic coordinates from a specific pixel coordination
+	 * on the screen.
+	 * 
+	 * If you don't need it, provide false at third parameter to speed
+	 * up the calculation.
+	 *  
+	 * @param x X-Pixelposition to get coordinate from
+	 * @param y Y-Pixelposition to get coordinate from
+	 * @param latlon If set, the return value will also have the 
+	 * 				 latitude/longitude filled.
+	 * 
+	 * @return The geographic coordinate, filled with x/y (northing/easting)
+	 * 		settings and, if requested with latitude/longitude.
+	 */
+	public GeoPoint getPoint(int x, int y, boolean latlon) {
+		GeoPoint p = new GeoPoint();
+		p.x = (x - getWidth()/2.0)*scale + center.x;
+		p.y = (getHeight()/2.0 - y)*scale + center.y;
+		if (latlon)
+			Main.pref.getProjection().xy2latlon(p);
+		return p;
+	}
+	
+	/**
+	 * Return the point on the screen where this GeoPoint would be.
+	 * @param point The point, where this geopoint would be drawn.
+	 * @return The point on screen where "point" would be drawn, relative
+	 * 		to the own top/left.
+	 */
+	public Point getScreenPoint(GeoPoint point) {
+		GeoPoint p;
+		if (!Double.isNaN(point.x) && !Double.isNaN(point.y))
+			p = point;
+		else {
+			if (Double.isNaN(point.lat) || Double.isNaN(point.lon))
+				throw new IllegalArgumentException("point: Either lat/lon or x/y must be set.");
+			p = point.clone();
+			Main.pref.getProjection().latlon2xy(p);
+		}
+		int x = ((int)Math.round((p.x-center.x) / scale + getWidth()/2));
+		int y = ((int)Math.round((center.y-p.y) / scale + getHeight()/2));
+		return new Point(x,y);
+	}
+
+	/**
+	 * Return the object, that is nearest to the given screen point.
+	 * 
+	 * First, a node will be searched. If a node within 10 pixel is found, the
+	 * nearest node is returned.
+	 * 
+	 * If no node is found, search for pending line segments.
+	 * 
+	 * If no such line segment is found, and a non-pending line segment is 
+	 * within 10 pixel to p, this segment is returned, except when 
+	 * <code>wholeTrack</code> is <code>true</code>, in which case the 
+	 * corresponding Track is returned.
+	 * 
+	 * If no line segment is found and the point is within an area, return that
+	 * area.
+	 * 
+	 * If no area is found, return <code>null</code>.
+	 * 
+	 * @param p				The point on screen.
+	 * @param wholeTrack	Whether the whole track or only the line segment
+	 * 					 	should be returned.
+	 * @return	The primitive, that is nearest to the point p.
+	 */
+	public OsmPrimitive getNearest(Point p, boolean wholeTrack) {
+		double minDistanceSq = Double.MAX_VALUE;
+		OsmPrimitive minPrimitive = null;
+		
+		// nodes
+		for (Node n : dataSet.nodes) {
+			Point sp = getScreenPoint(n.coor);
+			double dist = p.distanceSq(sp);
+			if (minDistanceSq > dist && dist < 100) {
+				minDistanceSq = p.distanceSq(sp);
+				minPrimitive = n;
+			}
+		}
+		if (minPrimitive != null)
+			return minPrimitive;
+		
+		// pending line segments
+		for (LineSegment ls : dataSet.pendingLineSegments()) {
+			Point A = getScreenPoint(ls.getStart().coor);
+			Point B = getScreenPoint(ls.getEnd().coor);
+			double c = A.distanceSq(B);
+			double a = p.distanceSq(B);
+			double b = p.distanceSq(A);
+			double perDist = a-(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared
+			if (perDist < 100 && minDistanceSq > perDist && a < c+100 && b < c+100) {
+				minDistanceSq = perDist;
+				minPrimitive = ls;
+			}
+		}
+
+		// tracks & line segments
+		minDistanceSq = Double.MAX_VALUE;
+		for (Track t : dataSet.tracks()) {
+			for (LineSegment ls : t.segments()) {
+				Point A = getScreenPoint(ls.getStart().coor);
+				Point B = getScreenPoint(ls.getEnd().coor);
+				double c = A.distanceSq(B);
+				double a = p.distanceSq(B);
+				double b = p.distanceSq(A);
+				double perDist = a-(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared
+				if (perDist < 100 && minDistanceSq > perDist && a < c+100 && b < c+100) {
+					minDistanceSq = perDist;
+					minPrimitive = wholeTrack ? t : ls;
+				}
+			}			
+		}
+		if (minPrimitive != null)
+			return minPrimitive;
+		
+		// TODO areas
+		
+		return null; // nothing found
+	}
+
+	
+	/**
+	 * Zoom to the given coordinate.
+	 * @param centerX The center x-value (easting) to zoom to.
+	 * @param centerY The center y-value (northing) to zoom to.
+	 * @param scale The scale to use.
+	 */
+	public void zoomTo(GeoPoint newCenter, double scale) {
+		boolean oldAutoScale = autoScale;
+		GeoPoint oldCenter = center;
+		double oldScale = this.scale;
+		
+		autoScale = false;
+		center = newCenter.clone();
+		Main.pref.getProjection().xy2latlon(center);
+		this.scale = scale;
+		recalculateCenterScale();
+
+		firePropertyChange("center", oldCenter, center);
+		if (oldAutoScale != autoScale)
+			firePropertyChange("autoScale", oldAutoScale, autoScale);
+		if (oldScale != scale)
+			firePropertyChange("scale", oldScale, scale);
+	}
+	
+	/**
+	 * Draw the component.
+	 */
+	@Override
+	public void paint(Graphics g) {
+		engine.init(g);
+		engine.drawBackground(getPoint(0,0,true), getPoint(getWidth(), getHeight(), true));
+
+		for (Track t : dataSet.tracks())
+			engine.drawTrack(t);
+		for (LineSegment ls : dataSet.pendingLineSegments())
+			engine.drawPendingLineSegment(ls);
+		for (Node n : dataSet.nodes)
+			engine.drawNode(n);
+	}
+
+	/**
+	 * Notify from the projection, that something has changed.
+	 * @param e
+	 */
+	public void stateChanged(ChangeEvent e) {
+		initDataSet();
+	}
+
+	/**
+	 * Called when a property, as example the projection of the Main preferences
+	 * changes.
+	 */
+	public void propertyChange(PropertyChangeEvent evt) {
+		if (evt.getPropertyName().equals("projection")) {
+			Projection oldProjection = (Projection)evt.getOldValue();
+			if (oldProjection != null)
+				oldProjection.removeChangeListener(this);
+
+			Projection newProjection = (Projection)evt.getNewValue();
+			if (newProjection != null)
+				newProjection.addChangeListener(this);
+
+			initDataSet();
+		}
+	}
+
+	/**
+	 * Return the current scale value.
+	 * @return The scale value currently used in display
+	 */
+	public double getScale() {
+		return scale;
+	}
+
+	/**
+	 * @return Returns the autoScale.
+	 */
+	public boolean isAutoScale() {
+		return autoScale;
+	}
+
+	/**
+	 * @param autoScale The autoScale to set.
+	 */
+	public void setAutoScale(boolean autoScale) {
+		if (this.autoScale != autoScale) {
+			this.autoScale = autoScale;
+			if (autoScale)
+				recalculateCenterScale();
+			firePropertyChange("autoScale", !autoScale, autoScale);
+		}
+	}
+	/**
+	 * @return Returns the center point. A copy is returned, so users cannot
+	 * 		change the center by accessing the return value. Use zoomTo instead.
+	 */
+	public GeoPoint getCenter() {
+		return center.clone();
+	}
+
+	/**
+	 * Initialize the DataSet with the projection taken from the preference
+	 * settings.
+	 */
+	public void initDataSet() {
+		for (Node n : dataSet.nodes)
+			Main.pref.getProjection().latlon2xy(n.coor);
+		recalculateCenterScale();
+	}
+	
+	
+	/**
+	 * Set the new dimension to the projection class. Also adjust the components 
+	 * scale, if in autoScale mode.
+	 */
+	private void recalculateCenterScale() {
+		if (autoScale) {
+			// -20 to leave some border
+			int w = getWidth()-20;
+			if (w < 20)
+				w = 20;
+			int h = getHeight()-20;
+			if (h < 20)
+				h = 20;
+			Bounds bounds = dataSet.getBoundsXY();
+			
+			boolean oldAutoScale = autoScale;
+			GeoPoint oldCenter = center;
+			double oldScale = this.scale;
+			
+			if (bounds == null) {
+				// no bounds means standard scale and center 
+				center = new GeoPoint(51.526447, -0.14746371);
+				Main.pref.getProjection().latlon2xy(center);
+				scale = 10;
+			} else {
+				center = bounds.centerXY();
+				Main.pref.getProjection().xy2latlon(center);
+				double scaleX = (bounds.max.x-bounds.min.x)/w;
+				double scaleY = (bounds.max.y-bounds.min.y)/h;
+				scale = Math.max(scaleX, scaleY); // minimum scale to see all of the screen
+			}
+	
+			firePropertyChange("center", oldCenter, center);
+			if (oldAutoScale != autoScale)
+				firePropertyChange("autoScale", oldAutoScale, autoScale);
+			if (oldScale != scale)
+				firePropertyChange("scale", oldScale, scale);
+		}
+		repaint();
+	}
+
+	/**
+	 * Call to recalculateCenterScale.
+	 */
+	public void componentResized(ComponentEvent e) {
+		recalculateCenterScale();
+	}
+
+	/**
+	 * Does nothing. Just to satisfy ComponentListener.
+	 */
+	public void componentMoved(ComponentEvent e) {}
+	/**
+	 * Does nothing. Just to satisfy ComponentListener.
+	 */
+	public void componentShown(ComponentEvent e) {}
+	/**
+	 * Does nothing. Just to satisfy ComponentListener.
+	 */
+	public void componentHidden(ComponentEvent e) {}
+}
Index: /src/org/openstreetmap/josm/gui/Main.java
===================================================================
--- /src/org/openstreetmap/josm/gui/Main.java	(revision 14)
+++ /src/org/openstreetmap/josm/gui/Main.java	(revision 15)
@@ -19,4 +19,6 @@
 import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.Preferences.PreferencesException;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.projection.Projection;
 
 /**
@@ -119,5 +121,5 @@
 		
 		try {
-			UIManager.setLookAndFeel(pref.laf.getClassName());
+			UIManager.setLookAndFeel(pref.getLaf().getClassName());
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -131,10 +133,11 @@
 
 	/**
-	 * Set the main's mapframe. If a changed old mapFrame is already set, 
-	 * ask the user whether he want to save, discard or abort. If the user
+	 * Create and set the main's mapframe. If a changed old mapFrame is already 
+	 * set, ask the user whether he want to save, discard or abort. If the user
 	 * aborts, nothing happens. 
 	 */
-	public void setMapFrame(String name, MapFrame mapFrame) {
+	public void setMapFrame(String name, DataSet dataSet) {
 		//TODO: Check for changes and ask user
+		MapFrame mapFrame = new MapFrame(dataSet);
 		this.name = name;
 		this.mapFrame = mapFrame;
@@ -144,4 +147,7 @@
 		panel.add(mapFrame.toolBarActions, BorderLayout.WEST);
 		panel.add(mapFrame.statusLine, BorderLayout.SOUTH);
+		for (Projection p : Preferences.allProjections)
+			p.init(dataSet);
+		mapFrame.layer.initDataSet();
 		panel.setVisible(true);
 	}
Index: /src/org/openstreetmap/josm/gui/MapFrame.java
===================================================================
--- /src/org/openstreetmap/josm/gui/MapFrame.java	(revision 14)
+++ /src/org/openstreetmap/josm/gui/MapFrame.java	(revision 15)
@@ -14,4 +14,5 @@
 import javax.swing.JToolBar;
 
+import org.openstreetmap.josm.actions.AutoScaleAction;
 import org.openstreetmap.josm.actions.mapmode.AddLineSegmentAction;
 import org.openstreetmap.josm.actions.mapmode.AddNodeAction;
@@ -25,5 +26,4 @@
 import org.openstreetmap.josm.actions.mapmode.ZoomAction;
 import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.gui.dialogs.PropertiesDialog;
 import org.openstreetmap.josm.gui.dialogs.SelectionListDialog;
 
@@ -43,5 +43,5 @@
 	 * The view control displayed.
 	 */
-	public MapView mapView;
+	public Layer layer;
 	/**
 	 * The toolbar with the action icons
@@ -61,5 +61,5 @@
 		setLayout(new BorderLayout());
 
-		add(mapView = new MapView(dataSet), BorderLayout.CENTER);
+		add(layer = new Layer(dataSet), BorderLayout.CENTER);
 
 		// toolbar
@@ -84,17 +84,14 @@
 		// autoScale
 		toolBarActions.addSeparator();
-		final JToggleButton autoScaleButton = new IconToggleButton(this, mapView.new AutoScaleAction());
+		final JToggleButton autoScaleButton = new IconToggleButton(this, new AutoScaleAction(layer));
 		toolBarActions.add(autoScaleButton);
 		autoScaleButton.setText(null);
-		autoScaleButton.setSelected(mapView.isAutoScale());
-		mapView.addPropertyChangeListener(new PropertyChangeListener(){
+		autoScaleButton.setSelected(layer.isAutoScale());
+		layer.addPropertyChangeListener(new PropertyChangeListener(){
 			public void propertyChange(PropertyChangeEvent evt) {
 				if (evt.getPropertyName().equals("autoScale"))
-					autoScaleButton.setSelected(mapView.isAutoScale());
+					autoScaleButton.setSelected(layer.isAutoScale());
 			}
 		});
-
-		// properties
-		toolBarActions.add(new IconToggleButton(this, new PropertiesDialog(this)));
 
 		// selection dialog
@@ -110,5 +107,5 @@
 
 		// status line below the map
-		statusLine = new MapStatus(mapView);
+		statusLine = new MapStatus(layer);
 	}
 
Index: /src/org/openstreetmap/josm/gui/MapMover.java
===================================================================
--- /src/org/openstreetmap/josm/gui/MapMover.java	(revision 14)
+++ /src/org/openstreetmap/josm/gui/MapMover.java	(revision 15)
@@ -26,5 +26,5 @@
 	 * The map to move around.
 	 */
-	private final MapView mv;
+	private final Layer mv;
 	/**
 	 * The old cursor when we changed it to movement cursor.
@@ -34,8 +34,8 @@
 	/**
 	 * Create a new MapMover
-	 * @param mapView The map that should be moved.
+	 * @param layer The map that should be moved.
 	 */
-	public MapMover(MapView mapView) {
-		this.mv = mapView;
+	public MapMover(Layer layer) {
+		this.mv = layer;
 		mv.addMouseListener(this);
 		mv.addMouseMotionListener(this);
Index: /src/org/openstreetmap/josm/gui/MapStatus.java
===================================================================
--- /src/org/openstreetmap/josm/gui/MapStatus.java	(revision 14)
+++ /src/org/openstreetmap/josm/gui/MapStatus.java	(revision 15)
@@ -39,7 +39,7 @@
 
 	/**
-	 * The MapView this status belongs. 
+	 * The Layer this status belongs. 
 	 */
-	final MapView mv;
+	final Layer mv;
 	/**
 	 * The position of the mouse cursor.
@@ -145,8 +145,8 @@
 	
 	/**
-	 * Construct a new MapStatus and attach it to the map view.
-	 * @param mv The MapView the status line is part of.
+	 * Construct a new MapStatus and attach it to the Layer.
+	 * @param mv The Layer the status line is part of.
 	 */
-	public MapStatus(final MapView mv) {
+	public MapStatus(final Layer mv) {
 		this.mv = mv;
 		
Index: c/org/openstreetmap/josm/gui/MapView.java
===================================================================
--- /src/org/openstreetmap/josm/gui/MapView.java	(revision 14)
+++ 	(revision )
@@ -1,397 +1,0 @@
-package org.openstreetmap.josm.gui;
-
-import java.awt.Graphics;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.KeyEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.ImageIcon;
-import javax.swing.JComponent;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-import org.openstreetmap.josm.data.Bounds;
-import org.openstreetmap.josm.data.GeoPoint;
-import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.data.osm.LineSegment;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.Track;
-import org.openstreetmap.josm.data.projection.Projection;
-import org.openstreetmap.josm.gui.engine.Engine;
-import org.openstreetmap.josm.gui.engine.SimpleEngine;
-
-/**
- * This is a component used in the MapFrame for browsing the map. It use is to
- * provide the MapMode's enough capabilities to operate. 
- * 
- * MapView holds the map data, organize it, convert it, provide access to it.
- * 
- * MapView hold meta-data about the data set currently displayed, as scale level,
- * center point viewed, what scrolling mode or editing mode is selected or with
- * what projection the map is viewed etc..
- *
- * @author imi
- */
-public class MapView extends JComponent implements ComponentListener, ChangeListener {
-
-	/**
-	 * Toggles the autoScale feature of the mapView
-	 * @author imi
-	 */
-	public class AutoScaleAction extends AbstractAction {
-		public AutoScaleAction() {
-			super("Auto Scale", new ImageIcon(Main.class.getResource("/images/autoscale.png")));
-			putValue(MNEMONIC_KEY, KeyEvent.VK_A);
-		}
-		public void actionPerformed(ActionEvent e) {
-			autoScale = !autoScale;
-			recalculateCenterScale();
-		}
-	}
-
-	/**
-	 * Whether to adjust the scale property on every resize.
-	 */
-	private boolean autoScale = true;
-
-	/**
-	 * The scale factor in meter per pixel.
-	 */
-	private double scale;
-	/**
-	 * Center n/e coordinate of the desired screen center.
-	 */
-	private GeoPoint center;
-
-	/**
-	 * Used projection method in this map
-	 */
-	private Projection projection = Main.pref.projection.clone();
-
-	/**
-	 * The underlying DataSet.
-	 */
-	public final DataSet dataSet;
-
-	/**
-	 * The drawing engine.
-	 */
-	private Engine engine;
-	
-	/**
-	 * Construct a MapView.
-	 */
-	public MapView(DataSet dataSet) {
-		this.dataSet = dataSet;
-		addComponentListener(this);
-
-		// initialize the movement listener
-		new MapMover(this);
-
-		// initialize the projection
-		setProjection(Main.pref.projection.clone());
-
-		// initialize the drawing engine
-		engine = new SimpleEngine(this);
-	}
-
-	/**
-	 * Get geographic coordinates from a specific pixel coordination
-	 * on the screen.
-	 * 
-	 * If you don't need it, provide false at third parameter to speed
-	 * up the calculation.
-	 *  
-	 * @param x X-Pixelposition to get coordinate from
-	 * @param y Y-Pixelposition to get coordinate from
-	 * @param latlon If set, the return value will also have the 
-	 * 				 latitude/longitude filled.
-	 * 
-	 * @return The geographic coordinate, filled with x/y (northing/easting)
-	 * 		settings and, if requested with latitude/longitude.
-	 */
-	public GeoPoint getPoint(int x, int y, boolean latlon) {
-		GeoPoint p = new GeoPoint();
-		p.x = (x - getWidth()/2.0)*scale + center.x;
-		p.y = (getHeight()/2.0 - y)*scale + center.y;
-		if (latlon)
-			getProjection().xy2latlon(p);
-		return p;
-	}
-	
-	/**
-	 * Return the point on the screen where this GeoPoint would be.
-	 * @param point The point, where this geopoint would be drawn.
-	 * @return The point on screen where "point" would be drawn, relative
-	 * 		to the own top/left.
-	 */
-	public Point getScreenPoint(GeoPoint point) {
-		GeoPoint p;
-		if (!Double.isNaN(point.x) && !Double.isNaN(point.y))
-			p = point;
-		else {
-			if (Double.isNaN(point.lat) || Double.isNaN(point.lon))
-				throw new IllegalArgumentException("point: Either lat/lon or x/y must be set.");
-			p = point.clone();
-			projection.latlon2xy(p);
-		}
-		int x = ((int)Math.round((p.x-center.x) / scale + getWidth()/2));
-		int y = ((int)Math.round((center.y-p.y) / scale + getHeight()/2));
-		return new Point(x,y);
-	}
-
-	/**
-	 * Return the object, that is nearest to the given screen point.
-	 * 
-	 * First, a node will be searched. If a node within 10 pixel is found, the
-	 * nearest node is returned.
-	 * 
-	 * If no node is found, search for pending line segments.
-	 * 
-	 * If no such line segment is found, and a non-pending line segment is 
-	 * within 10 pixel to p, this segment is returned, except when 
-	 * <code>wholeTrack</code> is <code>true</code>, in which case the 
-	 * corresponding Track is returned.
-	 * 
-	 * If no line segment is found and the point is within an area, return that
-	 * area.
-	 * 
-	 * If no area is found, return <code>null</code>.
-	 * 
-	 * @param p				The point on screen.
-	 * @param wholeTrack	Whether the whole track or only the line segment
-	 * 					 	should be returned.
-	 * @return	The primitive, that is nearest to the point p.
-	 */
-	public OsmPrimitive getNearest(Point p, boolean wholeTrack) {
-		double minDistanceSq = Double.MAX_VALUE;
-		OsmPrimitive minPrimitive = null;
-		
-		// nodes
-		for (Node n : dataSet.nodes) {
-			Point sp = getScreenPoint(n.coor);
-			double dist = p.distanceSq(sp);
-			if (minDistanceSq > dist && dist < 100) {
-				minDistanceSq = p.distanceSq(sp);
-				minPrimitive = n;
-			}
-		}
-		if (minPrimitive != null)
-			return minPrimitive;
-		
-		// pending line segments
-		for (LineSegment ls : dataSet.pendingLineSegments()) {
-			Point A = getScreenPoint(ls.getStart().coor);
-			Point B = getScreenPoint(ls.getEnd().coor);
-			double c = A.distanceSq(B);
-			double a = p.distanceSq(B);
-			double b = p.distanceSq(A);
-			double perDist = a-(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared
-			if (perDist < 100 && minDistanceSq > perDist && a < c+100 && b < c+100) {
-				minDistanceSq = perDist;
-				minPrimitive = ls;
-			}
-		}
-
-		// tracks & line segments
-		minDistanceSq = Double.MAX_VALUE;
-		for (Track t : dataSet.tracks()) {
-			for (LineSegment ls : t.segments()) {
-				Point A = getScreenPoint(ls.getStart().coor);
-				Point B = getScreenPoint(ls.getEnd().coor);
-				double c = A.distanceSq(B);
-				double a = p.distanceSq(B);
-				double b = p.distanceSq(A);
-				double perDist = a-(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared
-				if (perDist < 100 && minDistanceSq > perDist && a < c+100 && b < c+100) {
-					minDistanceSq = perDist;
-					minPrimitive = wholeTrack ? t : ls;
-				}
-			}			
-		}
-		if (minPrimitive != null)
-			return minPrimitive;
-		
-		// TODO areas
-		
-		return null; // nothing found
-	}
-
-	
-	/**
-	 * Zoom to the given coordinate.
-	 * @param centerX The center x-value (easting) to zoom to.
-	 * @param centerY The center y-value (northing) to zoom to.
-	 * @param scale The scale to use.
-	 */
-	public void zoomTo(GeoPoint newCenter, double scale) {
-		boolean oldAutoScale = autoScale;
-		GeoPoint oldCenter = center;
-		double oldScale = this.scale;
-		
-		autoScale = false;
-		center = newCenter.clone();
-		projection.xy2latlon(center);
-		this.scale = scale;
-		recalculateCenterScale();
-
-		firePropertyChange("center", oldCenter, center);
-		if (oldAutoScale != autoScale)
-			firePropertyChange("autoScale", oldAutoScale, autoScale);
-		if (oldScale != scale)
-			firePropertyChange("scale", oldScale, scale);
-	}
-	
-	/**
-	 * Draw the component.
-	 */
-	@Override
-	public void paint(Graphics g) {
-		engine.init(g);
-		engine.drawBackground(getPoint(0,0,true), getPoint(getWidth(), getHeight(), true));
-
-		for (Track t : dataSet.tracks())
-			engine.drawTrack(t);
-		for (LineSegment ls : dataSet.pendingLineSegments())
-			engine.drawPendingLineSegment(ls);
-		for (Node n : dataSet.nodes)
-			engine.drawNode(n);
-	}
-
-	/**
-	 * Notify from the projection, that something has changed.
-	 * @param e
-	 */
-	public void stateChanged(ChangeEvent e) {
-		projection.init(dataSet);
-		recalculateCenterScale();
-	}
-
-	/**
-	 * Set a new projection method. This call is not cheap, as it will
-	 * transform the whole underlying dataSet and repaint itself.
-	 * 
-	 * @param projection The new projection method to set.
-	 */
-	public void setProjection(Projection projection) {
-		if (projection == this.projection)
-			return;
-
-		Projection oldProjection = this.projection;
-		
-		if (this.projection != null)
-			this.projection.removeChangeListener(this);
-		this.projection = projection;
-		projection.addChangeListener(this);
-		
-		stateChanged(new ChangeEvent(this));
-		firePropertyChange("projection", oldProjection, projection);
-	}
-
-	/**
-	 * Return the projection method for this map view.
-	 * @return The projection method.
-	 */
-	public Projection getProjection() {
-		return projection;
-	}
-
-	/**
-	 * Return the current scale value.
-	 * @return The scale value currently used in display
-	 */
-	public double getScale() {
-		return scale;
-	}
-
-	/**
-	 * @return Returns the autoScale.
-	 */
-	public boolean isAutoScale() {
-		return autoScale;
-	}
-
-	/**
-	 * @param autoScale The autoScale to set.
-	 */
-	public void setAutoScale(boolean autoScale) {
-		if (this.autoScale != autoScale) {
-			this.autoScale = autoScale;
-			firePropertyChange("autoScale", !autoScale, autoScale);
-		}
-	}
-	/**
-	 * @return Returns the center point. A copy is returned, so users cannot
-	 * 		change the center by accessing the return value. Use zoomTo instead.
-	 */
-	public GeoPoint getCenter() {
-		return center.clone();
-	}
-
-	
-	
-	/**
-	 * Set the new dimension to the projection class. Also adjust the components 
-	 * scale, if in autoScale mode.
-	 */
-	private void recalculateCenterScale() {
-		if (autoScale) {
-			// -20 to leave some border
-			int w = getWidth()-20;
-			if (w < 20)
-				w = 20;
-			int h = getHeight()-20;
-			if (h < 20)
-				h = 20;
-			Bounds bounds = dataSet.getBoundsXY();
-			
-			boolean oldAutoScale = autoScale;
-			GeoPoint oldCenter = center;
-			double oldScale = this.scale;
-			
-			if (bounds == null) {
-				// no bounds means standard scale and center 
-				center = new GeoPoint(51.526447, -0.14746371);
-				getProjection().latlon2xy(center);
-				scale = 10;
-			} else {
-				center = bounds.centerXY();
-				getProjection().xy2latlon(center);
-				double scaleX = (bounds.max.x-bounds.min.x)/w;
-				double scaleY = (bounds.max.y-bounds.min.y)/h;
-				scale = Math.max(scaleX, scaleY); // minimum scale to see all of the screen
-			}
-	
-			firePropertyChange("center", oldCenter, center);
-			if (oldAutoScale != autoScale)
-				firePropertyChange("autoScale", oldAutoScale, autoScale);
-			if (oldScale != scale)
-				firePropertyChange("scale", oldScale, scale);
-		}
-		repaint();
-	}
-
-	/**
-	 * Call to recalculateCenterScale.
-	 */
-	public void componentResized(ComponentEvent e) {
-		recalculateCenterScale();
-	}
-
-	/**
-	 * Does nothing. Just to satisfy ComponentListener.
-	 */
-	public void componentMoved(ComponentEvent e) {}
-	/**
-	 * Does nothing. Just to satisfy ComponentListener.
-	 */
-	public void componentShown(ComponentEvent e) {}
-	/**
-	 * Does nothing. Just to satisfy ComponentListener.
-	 */
-	public void componentHidden(ComponentEvent e) {}
-}
Index: /src/org/openstreetmap/josm/gui/PreferenceDialog.java
===================================================================
--- /src/org/openstreetmap/josm/gui/PreferenceDialog.java	(revision 14)
+++ /src/org/openstreetmap/josm/gui/PreferenceDialog.java	(revision 15)
@@ -48,8 +48,8 @@
 		public void actionPerformed(ActionEvent e) {
 			Preferences pref = new Preferences();
-			pref.laf = (LookAndFeelInfo)lafCombo.getSelectedItem();
-			pref.projection = (Projection)projectionCombo.getSelectedItem();
-			pref.mergeNodes = mergeNodes.isSelected();
-			Main.pref.projection = pref.projection;
+			pref.setLaf((LookAndFeelInfo)lafCombo.getSelectedItem());
+			pref.setProjection((Projection)projectionCombo.getSelectedItem());
+			pref.setMergeNodes(mergeNodes.isSelected());
+			Main.pref.setProjection(pref.getProjection());
 			try {
 				pref.save();
@@ -125,5 +125,5 @@
 				return oldRenderer.getListCellRendererComponent(list, ((LookAndFeelInfo)value).getName(), index, isSelected, cellHasFocus);
 			}});
-		lafCombo.setSelectedItem(pref.laf);
+		lafCombo.setSelectedItem(pref.getLaf());
 		lafCombo.addActionListener(new ActionListener(){
 			public void actionPerformed(ActionEvent e) {
@@ -133,5 +133,5 @@
 		// projection method combo box
 		for (int i = 0; i < projectionCombo.getItemCount(); ++i) {
-			if (projectionCombo.getItemAt(i).getClass().equals(pref.projection.getClass())) {
+			if (projectionCombo.getItemAt(i).getClass().equals(pref.getProjection().getClass())) {
 				projectionCombo.setSelectedIndex(i);
 				break;
@@ -160,5 +160,5 @@
 		map.add(labelNoteProjection, GBC.eol().insets(0,5,0,20));
 		map.add(new JLabel("GPX import / export"), GBC.eol());
-		mergeNodes.setSelected(pref.mergeNodes);
+		mergeNodes.setSelected(pref.isMergeNodes());
 		map.add(mergeNodes, GBC.eol());
 		map.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));
Index: /src/org/openstreetmap/josm/gui/SelectionManager.java
===================================================================
--- /src/org/openstreetmap/josm/gui/SelectionManager.java	(revision 14)
+++ /src/org/openstreetmap/josm/gui/SelectionManager.java	(revision 15)
@@ -88,7 +88,7 @@
 	private Point mousePos;
 	/**
-	 * The MapView, the selection rectangle is drawn onto.
-	 */
-	private final MapView mv;
+	 * The Layer, the selection rectangle is drawn onto.
+	 */
+	private final Layer mv;
 	/**
 	 * Whether the selection rectangle must obtain the aspect ratio of the 
@@ -104,10 +104,10 @@
 	 * @param aspectRatio If true, the selection window must obtain the aspect
 	 * 		ratio of the drawComponent.
-	 * @param mapView The view, the rectangle is drawn onto.
-	 */
-	public SelectionManager(SelectionEnded selectionEndedListener, boolean aspectRatio, MapView mapView) {
+	 * @param layer The view, the rectangle is drawn onto.
+	 */
+	public SelectionManager(SelectionEnded selectionEndedListener, boolean aspectRatio, Layer layer) {
 		this.selectionEndedListener = selectionEndedListener;
 		this.aspectRatio = aspectRatio;
-		this.mv = mapView;
+		this.mv = layer;
 	}
 	
Index: /src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
===================================================================
--- /src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java	(revision 14)
+++ /src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java	(revision 15)
@@ -1,19 +1,9 @@
 package org.openstreetmap.josm.gui.dialogs;
 
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 
 import javax.swing.BorderFactory;
 import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.Border;
 
-import org.openstreetmap.josm.data.Preferences;
-import org.openstreetmap.josm.data.projection.Projection;
 import org.openstreetmap.josm.gui.Main;
 import org.openstreetmap.josm.gui.MapFrame;
@@ -35,38 +25,38 @@
 		putValue(MNEMONIC_KEY, KeyEvent.VK_P);
 
-		final Border panelBorder = BorderFactory.createEmptyBorder(5,0,0,0);
+//		final Border panelBorder = BorderFactory.createEmptyBorder(5,0,0,0);
 		Box panel = Box.createVerticalBox();
 
 		// making an array of all projections and the current one within
-		Projection[] allProjections = Preferences.allProjections.clone();
-		for (int i = 0; i < allProjections.length; ++i)
-			if (allProjections[i].getClass() == frame.mapView.getProjection().getClass())
-				allProjections[i] = frame.mapView.getProjection();
-		
-		// projection
-		Box projectionPanel = Box.createHorizontalBox();
-		projectionPanel.setBorder(panelBorder);
-		projectionPanel.add(new JLabel("Projection"));
-		final JComboBox projectionCombo = new JComboBox(allProjections);
-		projectionPanel.add(projectionCombo);
-		panel.add(projectionPanel);
-		final JPanel configurationPanel = new JPanel();
-		configurationPanel.setLayout(new BoxLayout(configurationPanel, BoxLayout.X_AXIS));
-		
-		// projections details
-		projectionCombo.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				configurationPanel.removeAll();
-				frame.mapView.setProjection((Projection)projectionCombo.getSelectedItem());
-				JComponent panel = frame.mapView.getProjection().getConfigurationPanel();
-				if (panel != null) {
-					panel.setBorder(panelBorder);
-					configurationPanel.add(panel);
-				}
-				pack();
-			}
-		});
-		panel.add(configurationPanel);
-		projectionCombo.setSelectedItem(frame.mapView.getProjection());
+//		Projection[] allProjections = Preferences.allProjections.clone();
+//		for (int i = 0; i < allProjections.length; ++i)
+//			if (allProjections[i].getClass() == frame.layer.getProjection().getClass())
+//				allProjections[i] = frame.layer.getProjection();
+//		
+//		// projection
+//		Box projectionPanel = Box.createHorizontalBox();
+//		projectionPanel.setBorder(panelBorder);
+//		projectionPanel.add(new JLabel("Projection"));
+//		final JComboBox projectionCombo = new JComboBox(allProjections);
+//		projectionPanel.add(projectionCombo);
+//		panel.add(projectionPanel);
+//		final JPanel configurationPanel = new JPanel();
+//		configurationPanel.setLayout(new BoxLayout(configurationPanel, BoxLayout.X_AXIS));
+//		
+//		// projections details
+//		projectionCombo.addActionListener(new ActionListener(){
+//			public void actionPerformed(ActionEvent e) {
+//				configurationPanel.removeAll();
+//				frame.layer.setProjection((Projection)projectionCombo.getSelectedItem());
+//				JComponent panel = frame.layer.getProjection().getConfigurationPanel();
+//				if (panel != null) {
+//					panel.setBorder(panelBorder);
+//					configurationPanel.add(panel);
+//				}
+//				pack();
+//			}
+//		});
+//		panel.add(configurationPanel);
+//		projectionCombo.setSelectedItem(frame.layer.getProjection());
 		
 		panel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
Index: /src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
===================================================================
--- /src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java	(revision 14)
+++ /src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java	(revision 15)
@@ -2,5 +2,4 @@
 
 import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
 import java.util.HashMap;
 import java.util.Map;
@@ -31,6 +30,6 @@
 		putValue(NAME, name);
 		putValue(MNEMONIC_KEY, mnemonic);
-		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E,0));
-		putValue(LONG_DESCRIPTION, "Open a selection list window.");
+		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(mnemonic,0));
+		putValue(LONG_DESCRIPTION, tooltip);
 	}
 
Index: /src/org/openstreetmap/josm/gui/engine/Engine.java
===================================================================
--- /src/org/openstreetmap/josm/gui/engine/Engine.java	(revision 14)
+++ /src/org/openstreetmap/josm/gui/engine/Engine.java	(revision 15)
@@ -2,6 +2,4 @@
 
 import java.awt.Graphics;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
 
 import org.openstreetmap.josm.data.GeoPoint;
@@ -9,6 +7,5 @@
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.Track;
-import org.openstreetmap.josm.data.projection.Projection;
-import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.Layer;
 
 /**
@@ -18,10 +15,6 @@
  * @author imi
  */
-abstract public class Engine implements PropertyChangeListener {
+abstract public class Engine {
 
-	/**
-	 * The projection method, this engine uses to render the graphics.
-	 */
-	protected Projection projection;
 	/**
 	 * The Graphics surface to draw on. This should be set before each painting
@@ -30,16 +23,15 @@
 	protected Graphics g;
 	/**
-	 * The mapView, this engine was created for.
+	 * The layer, this engine was created for.
 	 */
-	protected final MapView mv;
+	protected final Layer layer;
 
 	
 	/**
-	 * Creates an Engine from an MapView it belongs to.
-	 * @param mapView The mapview this engine belongs to.
+	 * Creates an Engine from an Layer it belongs to.
+	 * @param layer The mapview this engine belongs to.
 	 */
-	public Engine(MapView mapView) {
-		mv = mapView;
-		mv.addPropertyChangeListener(this);
+	public Engine(Layer layer) {
+		this.layer = layer;
 	}
 	
@@ -73,12 +65,3 @@
 	 */
 	abstract public void drawPendingLineSegment(LineSegment ls);
-
-	/**
-	 * Called when the projection method for the map changed. Subclasses with
-	 * caches depending on the projection should empty the cache now.
-	 */
-	public void propertyChange(PropertyChangeEvent e) {
-		if (e.getPropertyName().equals("projection"))
-			projection = (Projection)e.getNewValue();
-	}
 }
Index: /src/org/openstreetmap/josm/gui/engine/SimpleEngine.java
===================================================================
--- /src/org/openstreetmap/josm/gui/engine/SimpleEngine.java	(revision 14)
+++ /src/org/openstreetmap/josm/gui/engine/SimpleEngine.java	(revision 15)
@@ -10,5 +10,5 @@
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.Track;
-import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.Layer;
 
 /**
@@ -23,6 +23,6 @@
 	private final static Color darkgreen = new Color(0,128,0);
 
-	public SimpleEngine(MapView mapView) {
-		super(mapView);
+	public SimpleEngine(Layer layer) {
+		super(layer);
 	}
 
@@ -33,5 +33,5 @@
 	public void drawBackground(GeoPoint ulGeo, GeoPoint lrGeo) {
 		g.setColor(Color.BLACK);
-		g.fillRect(0,0,mv.getWidth(),mv.getHeight());
+		g.fillRect(0,0,layer.getWidth(),layer.getHeight());
 	}
 
@@ -109,6 +109,6 @@
 	private void drawLineSegment(LineSegment ls, Color color) {
 		g.setColor(ls.isSelected() ? Color.WHITE : color);
-		Point p1 = mv.getScreenPoint(ls.getStart().coor);
-		Point p2 = mv.getScreenPoint(ls.getEnd().coor);
+		Point p1 = layer.getScreenPoint(ls.getStart().coor);
+		Point p2 = layer.getScreenPoint(ls.getEnd().coor);
 		g.drawLine(p1.x, p1.y, p2.x, p2.y);
 	}
@@ -121,5 +121,5 @@
 	 */
 	private void drawNode(Node n, Color color) {
-		Point p = mv.getScreenPoint(n.coor);
+		Point p = layer.getScreenPoint(n.coor);
 		g.setColor(color);
 		g.drawRect(p.x-1, p.y-1, 2, 2);
Index: /src/org/openstreetmap/josm/io/GpxReader.java
===================================================================
--- /src/org/openstreetmap/josm/io/GpxReader.java	(revision 14)
+++ /src/org/openstreetmap/josm/io/GpxReader.java	(revision 15)
@@ -161,5 +161,5 @@
 	 */
 	private Node addNode (DataSet data, Node node) {
-		if (Main.pref.mergeNodes)
+		if (Main.pref.isMergeNodes())
 			for (Node n : data.nodes)
 				if (node.coor.lat == n.coor.lat && node.coor.lon == n.coor.lon)
