### Eclipse Workspace Patch 1.0
#P sophie
Index: modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/rotate/FrameRotateHaloButton.java
===================================================================
--- modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/rotate/FrameRotateHaloButton.java	(revision 8517)
+++ modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/rotate/FrameRotateHaloButton.java	(working copy)
@@ -48,7 +48,7 @@
 		final FrameH frame = frameView.model().get();
 		final double oldAngle = frame.getRotationAngle();
 
-		PageWorkArea pwa = AppHaloUtil.getWorkArea(this);
+		final PageWorkArea pwa = AppHaloUtil.getWorkArea(this);
 		final Scene scene = pwa.scene().get();
 		final ImmMatrix sceneToParent = SceneHelper.getElementToSceneTransform(scene,
 				frameView.parent().get().sceneElement().get()).inverse();
@@ -75,6 +75,8 @@
 			@Override
 			public void shouldMove(int newX, int newY) {
 
+				pwa.mouseCaptureOn().set(Boolean.TRUE);
+				
 				ImmPoint newP = sceneToParent.transform(new ImmPoint(newX, newY));
 				// offset in our space
 				ImmSize offset = newP.minus(zero);
@@ -93,6 +95,8 @@
 				// set the focus to the scene
 				sceneVisual.swingComponent().get().requestFocusInWindow();
 				sceneVisual.swingComponent().get().requestFocus();
+				
+				pwa.mouseCaptureOn().set(Boolean.FALSE);
 			}
 
 			private void templatedRotation(final double newAngle, 
Index: modules/org.sophie2.base.layout/src/test/java/org/sophie2/base/layout/model/LayoutDemo.java
===================================================================
--- modules/org.sophie2.base.layout/src/test/java/org/sophie2/base/layout/model/LayoutDemo.java	(revision 0)
+++ modules/org.sophie2.base.layout/src/test/java/org/sophie2/base/layout/model/LayoutDemo.java	(revision 0)
@@ -0,0 +1,59 @@
+package org.sophie2.base.layout.model;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+
+/**
+ * Demo for demonstrating the usage of {@link CustomLayout}.
+ * @author tanya
+ */
+public class LayoutDemo {
+
+	/**
+	 * Constructor that creates {@link JFrame}, adds a {@link JDesktopPane} with
+	 * {@link CustomLayout} and set different layers to be with different
+	 * layouts.
+	 */
+	public LayoutDemo() {
+		
+		JFrame frame = new JFrame();
+		frame.setSize(300, 300);
+		frame.setVisible(true);
+		
+		JDesktopPane pane = new JDesktopPane();
+		
+		frame.setContentPane(pane);
+		pane.setLayout(new CustomLayout(new BorderLayout()));
+		
+		JInternalFrame frame1 = new JInternalFrame();
+		frame1.setLocation(10, 10);
+		frame1.setSize(90, 90);
+		frame1.setVisible(true);
+		
+		pane.setLayer(frame1, JLayeredPane.DEFAULT_LAYER);
+		
+		pane.add(frame1, BorderLayout.CENTER);
+		
+		JInternalFrame frame2 = new JInternalFrame();
+		frame2.setLocation(110, 110);
+		frame2.setSize(90, 90);
+		frame2.setVisible(true);
+		
+		pane.setLayer(frame2, JLayeredPane.PALETTE_LAYER);
+		
+		pane.add(frame2, CustomLayout.CUSTOM);
+	}
+	
+	/**
+	 * The main method.
+	 * @param args
+	 */
+	public static void main(String args[]) {
+		new LayoutDemo();
+	}
+}
+
Index: modules/org.sophie2.extra.func.annotations/src/main/java/org/sophie2/extra/func/annotations/view/halos/StickyMoveHaloButton.java
===================================================================
--- modules/org.sophie2.extra.func.annotations/src/main/java/org/sophie2/extra/func/annotations/view/halos/StickyMoveHaloButton.java	(revision 8517)
+++ modules/org.sophie2.extra.func.annotations/src/main/java/org/sophie2/extra/func/annotations/view/halos/StickyMoveHaloButton.java	(working copy)
@@ -83,11 +83,12 @@
 			public void released() {
 				sv.wantedViewRect().set(null);
 				releaseAction(channel);
-
+				workArea().get().mouseCaptureOn().set(Boolean.FALSE);
 			}
 
 			@Override
 			public void shouldMove(final int newX, final int newY) {
+				workArea().get().mouseCaptureOn().set(Boolean.TRUE);
 				moveAction(channel, newX, newY);
 			}
 		};
Index: modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/interfaces/Scene.java
===================================================================
--- modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/interfaces/Scene.java	(revision 8517)
+++ modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/interfaces/Scene.java	(working copy)
@@ -1,6 +1,7 @@
 package org.sophie2.base.scene.interfaces;
 
 import org.sophie2.base.commons.util.ImmColor;
+import org.sophie2.base.commons.util.position.ImmRect;
 import org.sophie2.base.scene.helpers.SceneHelper;
 import org.sophie2.core.prolib.impl.BaseProObject;
 import org.sophie2.core.prolib.interfaces.Prop;
@@ -35,6 +36,13 @@
 	 * @return property
 	 */
 	public abstract Prop<? extends SceneElement> rootElement();
+	
+	/**
+	 * The rectangle over which the actual view rectangle will be centered.
+	 * 
+	 * @return property
+	 */
+	public abstract Prop<ImmRect> centeringRect();
 
 	/**
 	 * The background color of the scene. This is the infinite area that is
Index: modules/org.sophie2.base.scene/src/test/java/org/sophie2/base/scene/SceneDemo.java
===================================================================
--- modules/org.sophie2.base.scene/src/test/java/org/sophie2/base/scene/SceneDemo.java	(revision 8517)
+++ modules/org.sophie2.base.scene/src/test/java/org/sophie2/base/scene/SceneDemo.java	(working copy)
@@ -475,7 +475,12 @@
 
 		public RwProp<ImmRect> actualViewRectCache() { 
 		        return getBean().makeValueProp("actualViewRectCache", ImmRect.class, null); 
-		} 
+		}
+
+		public RwProp<ImmPoint> translationPoint() {
+			// TODO Auto-generated method stub
+			return null;
+		}
 	}
 
 	/**
Index: modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/BaseSceneVisual.java
===================================================================
--- modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/BaseSceneVisual.java	(revision 8517)
+++ modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/BaseSceneVisual.java	(working copy)
@@ -6,7 +6,9 @@
 import javax.swing.JComponent;
 
 import org.sophie2.base.commons.util.OSUtil;
+import org.sophie2.base.commons.util.position.ImmPoint;
 import org.sophie2.base.commons.util.position.ImmRect;
+import org.sophie2.base.commons.util.position.ImmSize;
 import org.sophie2.base.dnd.SophieDragDropHandler;
 import org.sophie2.base.scene.helpers.ElementHelper;
 import org.sophie2.base.scene.helpers.SceneHelper;
@@ -164,6 +166,10 @@
 	protected static final ImmRect DEFAULT_VIEW_RECT =
 		new ImmRect(0, 0, 256, 256);
 
+	public RwProp<ImmPoint> translationPoint() {
+		return getBean().makeValueProp("translationPoint", ImmPoint.class, ImmPoint.ZERO);
+	}
+	
 	public Prop<ImmRect> actualViewRect() {
 		class actualViewRect extends AutoProperty<ImmRect> {
 
@@ -177,11 +183,39 @@
 						&& scene().get().rootElement().get() != null) {
 					ImmRect bound = SceneHelper.getBoundingRect(scene().get(),
 							scene().get().rootElement().get());
+					
+					res = bound;
+					ImmPoint oldLocation = res.getLocation();
+					
+					float before = Math.abs(res.getX());
+					float after = res.getWidth() - scene().get().centeringRect().get().getWidth() - before;
+					float newWidth = Math.abs(after - before);
+
+					float top = Math.abs(res.getY());
+					float bottom = res.getHeight() - scene().get().centeringRect().get().getHeight() - top;
+					float newHeight = Math.abs(top - bottom);
+					
+					float locationX = 0f;
+					if(before < after) {
+						locationX = after - before;
+					}
+
+					float locationY = 0f;
+					if(top < bottom) {
+						locationY = bottom - top;
+					}
+
+					
+					ImmPoint newLocation = new ImmPoint(oldLocation.getX() - locationX ,
+							oldLocation.getY() - locationY);
+
+					res = new ImmRect(newLocation, new ImmSize(res.getWidth() + newWidth, res.getHeight() + newHeight));
+
 					res = new ImmRect(
-							bound.getX() - DEFAULT_PADDING_L, 
-							bound.getY() - DEFAULT_PADDING_T, 
-							bound.getWidth() + DEFAULT_PADDING_R + DEFAULT_PADDING_L, 
-							bound.getHeight() + DEFAULT_PADDING_B + DEFAULT_PADDING_T);
+					res.getX() - DEFAULT_PADDING_L, 
+					res.getY() - DEFAULT_PADDING_T, 
+					res.getWidth() + DEFAULT_PADDING_R + DEFAULT_PADDING_L, 
+					res.getHeight() + DEFAULT_PADDING_B + DEFAULT_PADDING_T);
 				} else {
 					// can not determine...
 					// just make something...
Index: modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/helpers/SceneHelper.java
===================================================================
--- modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/helpers/SceneHelper.java	(revision 8517)
+++ modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/helpers/SceneHelper.java	(working copy)
@@ -253,6 +253,8 @@
 		SophieLog.trace("sceneToSwing: viewRect=" + viewRect);
 		ImmRect res = Position.translate(sceneRect, -viewRect.getX(), -viewRect
 				.getY());
+		
+		res = res.translate(-visual.translationPoint().get().getX(), -visual.translationPoint().get().getY());
 		SophieLog.trace("sceneToSwing: res= " + res);
 		return res;
 
@@ -275,6 +277,9 @@
 		assert viewRect != null;
 		SophieLog.trace("sceneToSwing: viewRect=" + viewRect);
 		ImmPoint res = scenePoint.translate(-viewRect.getX(), -viewRect.getY());
+		
+		res = res.translate(-visual.translationPoint().get().getX(), -visual.translationPoint().get().getY());
+
 		SophieLog.trace("sceneToSwing: res= " + res);
 		return res;
 
@@ -292,7 +297,8 @@
 	public static ImmRect swingToScene(SceneVisual visual, ImmRect swingRect) {
 		// only translation...
 		ImmRect viewRect = visual.actualViewRect().get();
-		return Position.translate(swingRect, viewRect.getX(), viewRect.getY());
+		return Position.translate(swingRect, viewRect.getX(), viewRect.getY())
+			.translate(visual.translationPoint().get().getX(), visual.translationPoint().get().getY());
 	}
 
 	/**
@@ -308,7 +314,8 @@
 		// only translation...
 		ImmRect viewRect = visual.actualViewRect().get();
 		assert viewRect != null;
-		return swingPoint.translate(viewRect.getX(), viewRect.getY());
+		return swingPoint.translate(viewRect.getX(), viewRect.getY())
+			.translate(visual.translationPoint().get().getX(), visual.translationPoint().get().getY());
 	}
 
 	/**
Index: modules/org.sophie2.base.layout/src/main/java/org/sophie2/base/layout/model/CustomLayout.java
===================================================================
--- modules/org.sophie2.base.layout/src/main/java/org/sophie2/base/layout/model/CustomLayout.java	(revision 0)
+++ modules/org.sophie2.base.layout/src/main/java/org/sophie2/base/layout/model/CustomLayout.java	(revision 0)
@@ -0,0 +1,92 @@
+package org.sophie2.base.layout.model;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.LayoutManager2;
+
+import javax.swing.JDesktopPane;
+import javax.swing.JLayeredPane;
+
+/**
+ * LayoutManager that support adding of components with different layouts - null
+ * and some specific layout. An object is created with a specific
+ * {@link LayoutManager2}. When different components are added, they can be with
+ * constraint - CustomLayout.CUSTOM. This means that for layouting of these
+ * components will be used null layout. For all other components added, it will
+ * be used the given layout manager. This layout manager can be used for example
+ * for {@link JDesktopPane}. For example, components at
+ * {@link JLayeredPane#DEFAULT_LAYER} can be with {@link BorderLayout} and the
+ * components at {@link JLayeredPane#PALETTE_LAYER} to be with null layout.
+ * 
+ * @author tanya
+ */
+public class CustomLayout implements LayoutManager2,java.io.Serializable {
+
+	/**
+	 * Used for serialization.
+	 */
+	private static final long serialVersionUID = 810513263396699528L;
+
+	private LayoutManager2 layoutManager;
+	
+	/**
+	 * The constraint for the objects which we want to be with null layout.
+	 */
+	public static final String CUSTOM   = "Custom";
+	
+	/**
+	 * Constructs an object with another layout manager. The components added
+	 * will be with null layout or will be added according
+	 * 
+	 * @param manager
+	 *            The manager which will be responsible for how the components
+	 *            will be added and how will be layouted.
+	 */
+	public CustomLayout(LayoutManager2 manager) {
+		this.layoutManager = manager;
+	}
+	
+	public void addLayoutComponent(Component comp, Object constraints) {
+		if (constraints != CUSTOM) {
+			this.layoutManager.addLayoutComponent(comp, constraints);
+		}
+	}
+
+	public float getLayoutAlignmentX(Container target) {
+		return this.layoutManager.getLayoutAlignmentX(target);
+	}
+
+	public float getLayoutAlignmentY(Container target) {
+		return this.layoutManager.getLayoutAlignmentY(target);
+	}
+
+	public void invalidateLayout(Container target) {
+		this.layoutManager.invalidateLayout(target);
+	}
+
+	public Dimension maximumLayoutSize(Container target) {
+		return this.layoutManager.maximumLayoutSize(target);
+	}
+
+	public void addLayoutComponent(String name, Component comp) {
+		this.layoutManager.addLayoutComponent(name, comp);
+	}
+
+	public void layoutContainer(Container parent) {
+		this.layoutManager.layoutContainer(parent);
+	}
+
+	public Dimension minimumLayoutSize(Container parent) {
+		return this.layoutManager.minimumLayoutSize(parent);
+	}
+
+	public Dimension preferredLayoutSize(Container parent) {
+		return this.layoutManager.preferredLayoutSize(parent);
+	}
+
+	public void removeLayoutComponent(Component comp) {
+		this.layoutManager.removeLayoutComponent(comp);
+	}
+}
\ No newline at end of file
Index: modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/page/PageWorkArea.java
===================================================================
--- modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/page/PageWorkArea.java	(revision 8517)
+++ modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/page/PageWorkArea.java	(working copy)
@@ -1,5 +1,6 @@
 package org.sophie2.main.app.commons.page;
 
+import java.awt.BorderLayout;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -10,7 +11,10 @@
 import org.sophie2.base.commons.util.ImmColor;
 import org.sophie2.base.commons.util.position.ImmArea;
 import org.sophie2.base.commons.util.position.ImmMatrix;
+import org.sophie2.base.commons.util.position.ImmPoint;
 import org.sophie2.base.commons.util.position.ImmRect;
+import org.sophie2.base.commons.util.position.ImmSize;
+import org.sophie2.base.layout.model.CustomLayout;
 import org.sophie2.base.model.book.PageH;
 import org.sophie2.base.scene.SceneVisual;
 import org.sophie2.base.scene.effects.ColorEffect;
@@ -157,6 +161,13 @@
 					@Override
 					protected void setupScene() {
 						rootElement().set(rootSceneElement().get());
+						
+						ImmPoint pageLocation = new ImmPoint(0, 0);
+						ImmSize pageSize = bookView().get().model().get().getPageSize();
+						
+						ImmRect centeringRect = new ImmRect(pageLocation, pageSize);
+						
+						centeringRect().set(centeringRect);
 						topEventSource().set(PageWorkArea.this);
 					}
 				};
@@ -208,13 +219,17 @@
 			@Override
 			protected void setup(JDesktopPane res) {
 			
+				res.setLayout(new CustomLayout(new BorderLayout()));
+				
 				JComponent sceneComp = sceneVisual().get().swingComponent().get();
 
 				sceneComp.setLocation(0, 0);
 				SophieLog.debug("PageWorkArea.layeredPage: sceneComp:" + sceneComp);
 
 				res.removeAll();
-				res.add(sceneComp, JLayeredPane.DEFAULT_LAYER);
+				res.setLayer(sceneComp, JLayeredPane.DEFAULT_LAYER);
+				
+				res.add(sceneComp, BorderLayout.CENTER);
 
 				res.revalidate();
 				res.repaint();
@@ -226,7 +241,7 @@
 			protected void setupActualSize(JLayeredPane res) {
 
 				// grab the value to set up the property sync
-				ImmRect actualCache = sceneVisual().get().actualViewRect().get();
+//				ImmRect actualCache = sceneVisual().get().actualViewRect().get();
 
 				JDesktopPane desktopPane = swingComponent().get();
 				desktopPane.revalidate();
@@ -427,4 +442,14 @@
 		}
 		return getBean().makeProp(selectionRisenElement.class);
 	}
+	
+	/**
+	 * Property which have True or False value depending on whether mouse capture event is started or not.
+	 * <b>true</b> if mouse capture is on, <b>false</b> otherwise.
+	 * 
+	 * @return property
+	 */
+	public RwProp<Boolean> mouseCaptureOn() {
+		return getBean().makeValueProp("mouseCaptureOn", Boolean.class, Boolean.FALSE);	
+	}
 }
\ No newline at end of file
Index: modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/page/resize/PageResizeHaloButton.java
===================================================================
--- modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/page/resize/PageResizeHaloButton.java	(revision 8517)
+++ modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/page/resize/PageResizeHaloButton.java	(working copy)
@@ -49,7 +49,7 @@
 
 	@Override
 	protected MouseCapture captureClick(MouseEvent e) {
-		PageWorkArea pwa = AppHaloUtil.getWorkArea(PageResizeHaloButton.this);
+		final PageWorkArea pwa = AppHaloUtil.getWorkArea(PageResizeHaloButton.this);
 
 		if(pwa !=null ){
 
@@ -70,6 +70,7 @@
 				public void released() {
 					sv.wantedViewRect().set(null);
 
+					pwa.mouseCaptureOn().set(Boolean.TRUE);
 
 					new AutoAction("Set page size", true) {
 
@@ -83,6 +84,8 @@
 				@Override
 				public void shouldMove(final int newX, final int newY) {
 
+					pwa.mouseCaptureOn().set(Boolean.TRUE);
+					
 					if (newX <= 0 || newY <= 0) {
 						return;
 					}
Index: modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/page/ScenePageLogic.java
===================================================================
--- modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/page/ScenePageLogic.java	(revision 8517)
+++ modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/page/ScenePageLogic.java	(working copy)
@@ -134,10 +134,15 @@
 				@Override
 				public void released() {
 					pwa.selectionArea().set(ImmArea.EMPTY);
+					
+					pwa.mouseCaptureOn().set(Boolean.FALSE);
 				}
 
 				@Override
 				public void shouldMove(int newX, int newY) {
+					
+					pwa.mouseCaptureOn().set(Boolean.TRUE);
+					
 					ImmPoint endPoint = transf.transform(new ImmPoint(newX, newY));
 
 					float x = Math.min(startPoint.getX(), endPoint.getX());
Index: modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/app/AppMainWindow.java
===================================================================
--- modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/app/AppMainWindow.java	(revision 8517)
+++ modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/app/AppMainWindow.java	(working copy)
@@ -15,6 +15,7 @@
 import org.sophie2.base.halos.HaloMenu;
 import org.sophie2.base.halos.HudDialog;
 import org.sophie2.base.layout.impl.DefaultMainWindow;
+import org.sophie2.base.layout.model.CustomLayout;
 import org.sophie2.base.layout.model.DocView;
 import org.sophie2.base.media.MediaComposite;
 import org.sophie2.base.media.MediaUtil;
@@ -212,7 +213,9 @@
 					if (hm.visible().get()) {
 						for (JComponent c : hm.swingComponents().get()) {
 							
-							res.add(c, JLayeredPane.PALETTE_LAYER);
+							res.setLayer(c, JLayeredPane.PALETTE_LAYER);
+							res.add(c, CustomLayout.CUSTOM);
+							
 						}
 					}
 				}
@@ -236,35 +239,38 @@
 				}
 				PageWorkArea workArea = bookDocView.workArea().get();
 				
-				JDesktopPane res = workArea.swingComponent().get(); 
-				
-				// The scene bounds
-				ImmRect bounds = workArea.sceneVisual().get().actualViewRect().get();
-				// The bounds of visible huds
-				for (HaloMenu hm : haloMenus().get()) {
-					
-					if (hm.visible().get()) {
-						
-						bounds = bounds.union(SceneHelper.swingToScene(
-								workArea.sceneVisual().get(), hm.bounds().get()));
-						
-						for (HudDialog hud = hm.activeHud().get(); 
-									hud!=null && hud.visible().get(); hud = hud.subHud().get()) {
-							
-							ImmRect hudBounds = new ImmRect(hud.location().get(), hud.size().get());
-							
+				if (!workArea.mouseCaptureOn().get()) {
+
+					JDesktopPane res = workArea.swingComponent().get(); 
+
+					// The scene bounds
+					ImmRect bounds = workArea.sceneVisual().get().actualViewRect().get();
+					// The bounds of visible huds
+					for (HaloMenu hm : haloMenus().get()) {
+
+						if (hm.visible().get()) {
+
 							bounds = bounds.union(SceneHelper.swingToScene(
-									workArea.sceneVisual().get(), hudBounds));
+									workArea.sceneVisual().get(), hm.bounds().get()));
+
+							for (HudDialog hud = hm.activeHud().get(); 
+							hud!=null && hud.visible().get(); hud = hud.subHud().get()) {
+
+								ImmRect hudBounds = new ImmRect(hud.location().get(), hud.size().get());
+
+								bounds = bounds.union(SceneHelper.swingToScene(
+										workArea.sceneVisual().get(), hudBounds));
+							}
 						}
 					}
-				}
 
-				bounds = SceneHelper.sceneToSwing(workArea.sceneVisual().get(), bounds);
-				Dimension d = bounds.getSize().toDimension();
+					bounds = SceneHelper.sceneToSwing(workArea.sceneVisual().get(), bounds);
+					Dimension d = bounds.getSize().toDimension();
 
-				res.setPreferredSize(d);
-				res.setSize(d);
-				res.revalidate();
+					res.setPreferredSize(d);
+					res.setSize(d);
+					res.revalidate();
+				}
 			}
 			
 		}
Index: modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/impl/BaseScene.java
===================================================================
--- modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/impl/BaseScene.java	(revision 8517)
+++ modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/impl/BaseScene.java	(working copy)
@@ -1,6 +1,7 @@
 package org.sophie2.base.scene.impl;
 
 import org.sophie2.base.commons.util.ImmColor;
+import org.sophie2.base.commons.util.position.ImmRect;
 import org.sophie2.base.scene.interfaces.Scene;
 import org.sophie2.base.scene.interfaces.SceneElement;
 import org.sophie2.core.prolib.impl.ResourceProperty;
@@ -20,6 +21,11 @@
 	}
 
 	@Override
+	public RwProp<ImmRect> centeringRect() {
+		return getBean().makeValueProp("centeringRect", ImmRect.class, ImmRect.ZERO_RECT);
+	}
+	
+	@Override
 	public RwProp<ImmColor> backgroundColor() {
 		return getBean().makeValueProp("backgroundColor", ImmColor.class,
 				ImmColor.GRAY);
Index: modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/frame/FrameLogic.java
===================================================================
--- modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/frame/FrameLogic.java	(revision 8517)
+++ modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/frame/FrameLogic.java	(working copy)
@@ -55,7 +55,7 @@
 			final ElementView elementView = event.getSource(ElementView.class);
 			final ResourceAccess access = elementView.getAccess();
 		
-			PageWorkArea pwa = elementView.getPwa();
+			final PageWorkArea pwa = elementView.getPwa();
 			Mode sizeTemplateMode = ResizableElement.KEY_SIZE.getMode(access);
 			Mode locTemplateMode = MemberElement.KEY_LOCATION.getMode(access);
 
@@ -102,6 +102,7 @@
 				@Override
 				public void released() {
 					doResize(channel);
+					pwa.mouseCaptureOn().set(Boolean.TRUE);
 					sv.wantedViewRect().set(null);
 				}
 
@@ -124,6 +125,8 @@
 				@Override
 				public void shouldMove(int newX, int newY) {
 
+					pwa.mouseCaptureOn().set(Boolean.TRUE);
+					
 					ImmVector v0InFr = frameToScene.inverseTransform(new ImmVector(0, 0));
 					ImmVector v = new ImmVector(newX, newY);
 					ImmVector vInFrame = frameToScene.inverseTransform(v);
Index: modules/org.sophie2.main.scene.simple/src/main/java/org/sophie2/main/scene/simple/SimpleSceneVisual.java
===================================================================
--- modules/org.sophie2.main.scene.simple/src/main/java/org/sophie2/main/scene/simple/SimpleSceneVisual.java	(revision 8517)
+++ modules/org.sophie2.main.scene.simple/src/main/java/org/sophie2/main/scene/simple/SimpleSceneVisual.java	(working copy)
@@ -6,7 +6,9 @@
 import javax.swing.JComponent;
 import javax.swing.JPanel;
 
+import org.sophie2.base.commons.util.position.ImmPoint;
 import org.sophie2.base.commons.util.position.ImmRect;
+import org.sophie2.base.commons.util.position.ImmSize;
 import org.sophie2.base.scene.BaseSceneVisual;
 import org.sophie2.base.scene.SceneVisual;
 import org.sophie2.base.scene.helpers.SceneHelper;
@@ -55,8 +57,24 @@
 			Graphics2D g2d = (Graphics2D) graphics.create();
 			ImmRect visRect = actualViewRect().get();
 
-			SceneHelper.paint(g2d, visRect, scene().get());
+			//Centering the actual view rectangle.
+			int w = this.getWidth();
+			int h = this.getHeight();
+
+			float tx = (w - visRect.getWidth())/2;
+			float ty = (h - visRect.getHeight())/2;  
+
+			
+			ImmPoint point = new ImmPoint(-tx, -ty);
+			translationPoint().set(point);
+			
+			ImmPoint oldLocation = visRect.getLocation();
+			ImmPoint newLocation = new ImmPoint(oldLocation.getX() - tx , oldLocation.getY() - ty);
 
+			visRect = new ImmRect(newLocation, new ImmSize(w, h));
+			
+			SceneHelper.paint(g2d, visRect, scene().get());
+			
 			SophieLog.debug("paintComponent: total paint time="
 					+ (System.currentTimeMillis() - startTime));
 		}
Index: modules/org.sophie2.dev/src/main/java/org/sophie2/dev/author/FakeAuthorMain.java
===================================================================
--- modules/org.sophie2.dev/src/main/java/org/sophie2/dev/author/FakeAuthorMain.java	(revision 8517)
+++ modules/org.sophie2.dev/src/main/java/org/sophie2/dev/author/FakeAuthorMain.java	(working copy)
@@ -107,7 +107,7 @@
 		//SophieLog.setMinLevel("org.sophie2.main.func.timelines", LogLevel.DEBUG);
 		//SophieLog.setMinLevel("org.sophie2.main.func.media.view", LogLevel.ALL);
 		//SophieLog.setMinLevel("org.sophie2.base.bound", LogLevel.ALL);
-		SophieLog.setMinLevel("org.sophie2.main.scene.simple", LogLevel.NONE);
+		SophieLog.setMinLevel("org.sophie2.main.scene.simple", LogLevel.WARN);
 		SophieLog.setMinLevel("org.sophie2.main.func.media.logic", LogLevel.DEBUG);
 		
 		assert System.getProperty(SophieEditions.PROP_ID) == null :
Index: modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/SceneVisual.java
===================================================================
--- modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/SceneVisual.java	(revision 8517)
+++ modules/org.sophie2.base.scene/src/main/java/org/sophie2/base/scene/SceneVisual.java	(working copy)
@@ -2,6 +2,7 @@
 
 import javax.swing.JComponent;
 
+import org.sophie2.base.commons.util.position.ImmPoint;
 import org.sophie2.base.commons.util.position.ImmRect;
 import org.sophie2.base.scene.interfaces.Scene;
 import org.sophie2.base.visual.VisualElement;
@@ -73,4 +74,12 @@
 	 * @return property
 	 */
 	Prop<ImmRect> actualViewRect();
+	
+	/**
+	 * Returns with what distance by x-coordinate and y-coordinate should visual
+	 * component be translated. Used with halos when the actual view rectangle is centered.
+	 * 
+	 * @return property
+	 */
+	public RwProp<ImmPoint> translationPoint();
 }
Index: modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/MainTitleBarHalo.java
===================================================================
--- modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/MainTitleBarHalo.java	(revision 8517)
+++ modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/MainTitleBarHalo.java	(working copy)
@@ -344,10 +344,12 @@
 			public void released() {
 				sv.wantedViewRect().set(null);
 				releasedAction(finalOldLocations, finalFrameRefs, finalTimes);
+				workArea().get().mouseCaptureOn().set(Boolean.FALSE);
 			}
 
 			@Override
 			public void shouldMove(final int newX, final int newY) {
+				workArea().get().mouseCaptureOn().set(Boolean.TRUE);
 				moveAction(finalOldLocations, finalFrameRefs, finalTimes, newX, newY);
 
 			}

