Index: /trunk/src/org/expeditee/core/Anchoring.java
===================================================================
--- /trunk/src/org/expeditee/core/Anchoring.java	(revision 1512)
+++ /trunk/src/org/expeditee/core/Anchoring.java	(revision 1513)
@@ -4,154 +4,174 @@
 
 /**
- * Class for anchoring the position of items within the frame.
- * Anchoring is when the position of the item is defined relative
- * to the edge of the frame instead of being defined in absolute
- * coordinates. Can't be anchored to the left and right edge at
- * the same time, nor the top and bottom edge at the same time.
+ * Class for anchoring the position of items within the frame. Anchoring is when
+ * the position of the item is defined relative to the edge of the frame instead
+ * of being defined in absolute coordinates. Can't be anchored to the left and
+ * right edge at the same time, nor the top and bottom edge at the same time.
  * 
  * @author cts16
  */
 public class Anchoring {
+	
+	private enum VerticalDirection { left, center, right }
+	private enum HorizontalDirection { top, center, bottom }
 
-	/** The relative distance from the left or right edge (null means unanchored). */
+	/**
+	 * The relative distance from the left, center or right edge (null means unanchored).
+	 */
 	private Integer _xAnchor = null;
-	/** The relative distance from the top or bottom edge (null means unanchored). */
+	/**
+	 * The relative distance from the top, center or bottom edge (null means unanchored).
+	 */
 	private Integer _yAnchor = null;
+
 	/** Whether the x-anchor is relative to the left or right edge. */
-	private boolean _left = true;
+	private VerticalDirection verticalDirection = VerticalDirection.left;
 	/** Whether the y-anchor is relative to the top or bottom edge. */
-	private boolean _top = true;
-	
-	public Anchoring()
-	{
+	private HorizontalDirection horizonalDirection = HorizontalDirection.top;
+
+	public Anchoring() {
 	}
 	
-	public void setXAnchor(Integer offset, boolean left)
-	{
-		_xAnchor = offset;
-		_left = left;
+	public void setXAnchor(Anchoring other) {
+		if (other == null) {
+			return;
+		}
+		
+		setXAnchor(other._xAnchor, other.verticalDirection);
+	}
+
+	public void setYAnchor(Anchoring other) {
+		if (other == null)
+			return;
+
+		setYAnchor(other._yAnchor, other.horizonalDirection);
+	}
+
+	public void setLeftAnchor(Integer offset) {
+		setXAnchor(offset, VerticalDirection.left);
 	}
 	
-	public void setYAnchor(Integer offset, boolean top)
-	{
-		_yAnchor = offset;
-		_top = top;
+	public void setCenterXAnchor(Integer offset) {
+		setXAnchor(offset, VerticalDirection.center);
+	}
+
+	public void setRightAnchor(Integer offset) {
+		setXAnchor(offset, VerticalDirection.right);
+	}
+
+	public void setTopAnchor(Integer offset) {
+		setYAnchor(offset, HorizontalDirection.top);
 	}
 	
-	public void setXAnchor(Anchoring other)
-	{
-		if (other == null) return;
-		
-		setXAnchor(other._xAnchor, other._left);
+	public void setCenterYAnchor(Integer offset) {
+		setYAnchor(offset, HorizontalDirection.center);
 	}
 
-	public void setYAnchor(Anchoring other)
-	{
-		if (other == null) return;
-		
-		setYAnchor(other._yAnchor, other._top);
+	public void setBottomAnchor(Integer offset) {
+		setYAnchor(offset, HorizontalDirection.bottom);
 	}
 	
-	public void setLeftAnchor(Integer offset)
-	{
-		setXAnchor(offset, true);
+	public void removeXAnchor() {
+		setXAnchor(null, verticalDirection);
 	}
-	
-	public void setRightAnchor(Integer offset)
-	{
-		setXAnchor(offset, false);
+
+	public void removeYAnchor() {
+		setYAnchor(null, horizonalDirection);
 	}
-	
-	public void setTopAnchor(Integer offset)
-	{
-		setYAnchor(offset, true);
-	}
-	
-	public void setBottomAnchor(Integer offset)
-	{
-		setYAnchor(offset, false);
-	}
-	
-	public void removeXAnchor()
-	{
-		setXAnchor(null, _left);
-	}
-	
-	public void removeYAnchor()
-	{
-		setYAnchor(null, _top);
-	}
-	
-	public void removeAllAnchors()
-	{
+
+	public void removeAllAnchors() {
 		removeXAnchor();
 		removeYAnchor();
 	}
+
+	public Point getPositionInBox(AxisAlignedBoxBounds box) {
+		Integer x = getXPositionInBox(box);
+		Integer y = getYPositionInBox(box);
+
+		if (x == null || y == null)
+			return null;
+
+		return new Point(x, y);
+	}
+
+	public boolean isXAnchored() {
+		return _xAnchor != null;
+	}
+
+	public boolean isYAnchored() {
+		return _yAnchor != null;
+	}
+
+	public boolean isAnchored() {
+		return isXAnchored() || isYAnchored();
+	}
 	
-	public Integer getXPositionInBox(AxisAlignedBoxBounds box)
-	{
-		if (box == null || _xAnchor == null) return null;
+	public Integer getLeftAnchor() {
+		return verticalDirection.equals(VerticalDirection.left) ? _xAnchor : null;
+	}
+	
+	public Integer getCenterXAnchor() {
+		return verticalDirection.equals(VerticalDirection.center) ? _xAnchor : null;
+	}
+
+	public Integer getRightAnchor() {
+		return verticalDirection.equals(VerticalDirection.right) ? _xAnchor : null;
+	}
+
+	public Integer getTopAnchor() {
+		return horizonalDirection.equals(HorizontalDirection.top) ? _yAnchor : null;
+	}
+	
+	public Integer getCenterYAnchor() {
+		return horizonalDirection.equals(HorizontalDirection.center) ? _yAnchor : null;
+	}
+	
+	public Integer getBottomAnchor() {
+		return horizonalDirection.equals(HorizontalDirection.bottom) ? _yAnchor : null;
+	}
+			
+	private void setXAnchor(Integer offset, VerticalDirection left) {
+		_xAnchor = offset;
+		verticalDirection = left;
+	}
+
+	private void setYAnchor(Integer offset, HorizontalDirection top) {
+		_yAnchor = offset;
+		horizonalDirection = top;
+	}
+	
+	private Integer getXPositionInBox(AxisAlignedBoxBounds box) {
+		if (box == null || _xAnchor == null)
+			return null;
 		
-		if (_left) {
+		switch (verticalDirection) {
+		case left:
 			return box.getMinX() + _xAnchor;
-		} else {
+		case center:
+			return box.getCentreX() + _xAnchor;
+		case right:
 			return box.getMaxX() - _xAnchor;
+		default:
+			System.err.println("Anchoring::getXPositionInBox::VerticalDirection does not match available options.  Has the enum been updated without this function being updated?");
+			return null;
 		}
 	}
 	
-	public Integer getYPositionInBox(AxisAlignedBoxBounds box)
-	{
-		if (box == null || _yAnchor == null) return null;
+	private Integer getYPositionInBox(AxisAlignedBoxBounds box) {
+		if (box == null || _yAnchor == null) {
+			return null;
+		}
 		
-		if (_top) {
+		switch (horizonalDirection) {
+		case top:
 			return box.getMinY() + _yAnchor;
-		} else {
+		case center:
+			return box.getCentreY() + _yAnchor;
+		case bottom:
 			return box.getMaxY() - _yAnchor;
+		default:
+			System.err.println("Anchoring::getYPositionInBox::HorizonalDirection does not match available options.  Has the enum been updated without this function being updated?");
+			return null;
 		}
 	}
-	
-	public Point getPositionInBox(AxisAlignedBoxBounds box)
-	{
-		Integer x = getXPositionInBox(box);
-		Integer y = getYPositionInBox(box);
-		
-		if (x == null || y == null) return null;
-		
-		return new Point(x, y);
-	}
-	
-	public boolean isXAnchored()
-	{
-		return _xAnchor != null;
-	}
-	
-	public boolean isYAnchored()
-	{
-		return _yAnchor != null;
-	}
-	
-	public boolean isAnchored()
-	{
-		return isXAnchored() || isYAnchored();
-	}
-	
-	public Integer getLeftAnchor()
-	{
-		return _left ? _xAnchor : null;
-	}
-	
-	public Integer getRightAnchor()
-	{
-		return !_left ? _xAnchor : null;
-	}
-	
-	public Integer getTopAnchor()
-	{
-		return _top ? _yAnchor : null;
-	}
-	
-	public Integer getBottomAnchor()
-	{
-		return !_top ? _yAnchor : null;
-	}
 }
Index: /trunk/src/org/expeditee/gio/gesture/StandardGestureActions.java
===================================================================
--- /trunk/src/org/expeditee/gio/gesture/StandardGestureActions.java	(revision 1512)
+++ /trunk/src/org/expeditee/gio/gesture/StandardGestureActions.java	(revision 1513)
@@ -2670,6 +2670,8 @@
 		for (Item i : items) {
 			Integer anchorLeft = i.getAnchorLeft();
+			Integer anchorCenterX = i.getAnchorCenterX();
 			Integer anchorRight = i.getAnchorRight();
 			Integer anchorTop = i.getAnchorTop();
+			Integer anchorCenterY = i.getAnchorCenterY();
 			Integer anchorBottom = i.getAnchorBottom();
 
@@ -2680,4 +2682,11 @@
 				}
 			}
+			
+			if (anchorCenterX != null) {
+				i.setAnchorCenterX(anchorCenterX);
+				if (i.hasVector()) {
+					bReparse = true;
+				}
+			}
 
 			if (anchorRight != null) {
@@ -2690,4 +2699,11 @@
 			if (anchorTop != null) {
 				i.setAnchorTop(anchorTop);
+				if (i.hasVector()) {
+					bReparse = true;
+				}
+			}
+			
+			if (anchorCenterY != null) {
+				i.setAnchorCenterY(anchorCenterY);
 				if (i.hasVector()) {
 					bReparse = true;
Index: /trunk/src/org/expeditee/gui/AttributeUtils.java
===================================================================
--- /trunk/src/org/expeditee/gui/AttributeUtils.java	(revision 1512)
+++ /trunk/src/org/expeditee/gui/AttributeUtils.java	(revision 1513)
@@ -244,4 +244,8 @@
 			_Attrib.put("AnchorBottom",         Item.class.getMethod("getAnchorBottom"),
 			                                    Item.class.getMethod("setAnchorBottom", pIntO));
+			_Attrib.put("AnchorCenterX", 		Item.class.getMethod("getAnchorCenterX"), 
+												Item.class.getMethod("setAnchorCenterX", pIntO));
+			_Attrib.put("AnchorCenterY", 		Item.class.getMethod("getAnchorCenterY"), 
+												Item.class.getMethod("setAnchorCenterY", pIntO));
 			_Attrib.put("Position",             Item.class.getMethod("getPosition"),
 			                                    Item.class.getMethod("setPosition", pPoint));
Index: /trunk/src/org/expeditee/gui/Frame.java
===================================================================
--- /trunk/src/org/expeditee/gui/Frame.java	(revision 1512)
+++ /trunk/src/org/expeditee/gui/Frame.java	(revision 1513)
@@ -1004,6 +1004,8 @@
 		for (Item i : getSortedItems()) {
 			Integer anchorLeft   = i.getAnchorLeft();
+			Integer anchorCenterX = i.getAnchorCenterX();
 			Integer anchorRight  = i.getAnchorRight();
 			Integer anchorTop    = i.getAnchorTop();
+			Integer anchorCenterY = i.getAnchorCenterY();
 			Integer anchorBottom = i.getAnchorBottom();
 	
@@ -1016,4 +1018,11 @@
 			}
 			
+			if (anchorCenterX != null) {
+				i.setAnchorCenterX(anchorCenterX);
+				if (i.hasVector()) {
+					bReparse = true;
+				}
+			}
+			
 			if (anchorRight != null) {
 				i.setAnchorRight(anchorRight);
@@ -1025,4 +1034,11 @@
 			if (anchorTop != null) {
 				i.setAnchorTop(anchorTop);
+				if (i.hasVector()) {
+					bReparse = true;
+				}
+			}
+			
+			if (anchorCenterY != null) {
+				i.setAnchorCenterY(anchorCenterY);
 				if (i.hasVector()) {
 					bReparse = true;
Index: /trunk/src/org/expeditee/io/DefaultFrameReader.java
===================================================================
--- /trunk/src/org/expeditee/io/DefaultFrameReader.java	(revision 1512)
+++ /trunk/src/org/expeditee/io/DefaultFrameReader.java	(revision 1513)
@@ -195,4 +195,5 @@
 			_ItemTagsExt.put(DefaultFrameWriter.TAB_INDEX_STR, Text.class.getMethod("setTabIndex", pInt));
 			_ItemTagsExt.put(DefaultFrameWriter.ACCEPTS_ENTER, Item.class.getMethod("setAcceptsEnter", pBool));
+			_ItemTagsExt.put(DefaultFrameWriter.ANCHOR_CENTERX_STR, Item.class.getMethod("setAnchorCenterX", pIntO));
 		} catch (Exception e) {
 			e.printStackTrace();
Index: /trunk/src/org/expeditee/io/DefaultFrameWriter.java
===================================================================
--- /trunk/src/org/expeditee/io/DefaultFrameWriter.java	(revision 1512)
+++ /trunk/src/org/expeditee/io/DefaultFrameWriter.java	(revision 1513)
@@ -101,4 +101,6 @@
 	public static final String ENCRYPTION_LABEL_STR = "_el";
 	public static final String ACCEPTS_ENTER = "_ae";
+	public static final String ANCHOR_CENTERX_STR = "_ax";
+	public static final String ANCHOR_CENTERY_STR = "_ay";
 	public static final String MAGNETIZED_ITEM_BOTTOM_STR = MAGNETIZED_ITEM_BOTTOM + "";
 	public static final String MAGNETIZED_ITEM_TOP_STR = MAGNETIZED_ITEM_TOP + "";
@@ -276,4 +278,5 @@
 			_ItemStrTags.put(DefaultFrameWriter.TAB_INDEX_STR, Text.class.getMethod("getTabIndex"));
 			_ItemStrTags.put(DefaultFrameWriter.ACCEPTS_ENTER, Item.class.getMethod("acceptsKeyboardEnter"));
+			_ItemStrTags.put(DefaultFrameWriter.ANCHOR_CENTERX_STR, Item.class.getMethod("getAnchorCenterX"));
 		} catch (Exception e) {
 			e.printStackTrace();
Index: /trunk/src/org/expeditee/items/Item.java
===================================================================
--- /trunk/src/org/expeditee/items/Item.java	(revision 1512)
+++ /trunk/src/org/expeditee/items/Item.java	(revision 1513)
@@ -3658,4 +3658,23 @@
 		}
 	}
+	
+	public void setAnchorCenterX(Integer anchor) {
+		this._anchoring.setCenterXAnchor(anchor);
+		if (anchor != null) {
+			anchorConstraints();
+			int alignedToLeft = DisplayController.getFramePaintArea().getCentreX() + anchor;
+			int alignedToCenter = alignedToLeft - (getBoundsWidth() / 2);
+			setX(alignedToCenter);
+		}
+		
+		if (isSurrogate()) {
+			surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_CENTERX_STR, false);
+			Item primary = getPrimary();
+			if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_CENTERX_STR)) {
+				EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave);
+				primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_CENTERX_STR, inheritanceCheckOnSave);
+			}
+		}
+	}
 
 	public void setAnchorRight(Integer anchor) {
@@ -3694,4 +3713,23 @@
 		}
 	}
+	
+	public void setAnchorCenterY(Integer anchor) {
+		this._anchoring.setCenterYAnchor(anchor);
+		if (anchor != null) {
+			anchorConstraints();
+			int alignedToTop = DisplayController.getFramePaintArea().getCentreY() + anchor;
+			int alignedToCenter = alignedToTop - (getBoundsHeight() / 2);
+			setY(alignedToCenter);
+		}
+		
+		if (isSurrogate()) {
+			surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_CENTERY_STR, false);
+			Item primary = getPrimary();
+			if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_CENTERY_STR)) {
+				EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave);
+				primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_CENTERY_STR, inheritanceCheckOnSave);
+			}
+		}
+	}
 
 
@@ -3712,5 +3750,5 @@
 		}
 	}
-
+		
 	public boolean isAnchored()
 	{
@@ -3755,4 +3793,20 @@
 		} else {
 			return _anchoring.getBottomAnchor();
+		}
+	}
+	
+	public Integer getAnchorCenterX() {
+		if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ANCHOR_CENTERX_STR)) {
+			return this.getPrimary().getAnchorCenterX();
+		} else {
+			return _anchoring.getCenterXAnchor();
+		}
+	}
+	
+	public Integer getAnchorCenterY() {
+		if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ANCHOR_CENTERY_STR)) {
+			return this.getPrimary().getAnchorCenterY();
+		} else {
+			return _anchoring.getCenterYAnchor();
 		}
 	}
Index: /trunk/src/org/expeditee/items/Text.java
===================================================================
--- /trunk/src/org/expeditee/items/Text.java	(revision 1512)
+++ /trunk/src/org/expeditee/items/Text.java	(revision 1513)
@@ -393,5 +393,4 @@
 	@Override
 	public void setWidth(Integer width) {
-		System.err.println("Text::setWidth::Text content=" + getText() + ", new width=" + width);
 		invalidateAll();
 
