You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2014/08/09 08:32:01 UTC
[3/5] Added more spark examples
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/TextInspectorController.as
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/TextInspectorController.as b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/TextInspectorController.as
new file mode 100644
index 0000000..3bf6f6a
--- /dev/null
+++ b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/TextInspectorController.as
@@ -0,0 +1,614 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package flashx.textLayout.ui.inspectors
+{
+ import flash.events.EventDispatcher;
+ import flash.events.IEventDispatcher;
+ import flash.text.engine.RenderingMode;
+
+ import flashx.textLayout.compose.TextFlowLine;
+ import flashx.textLayout.container.ContainerController;
+ import flashx.textLayout.edit.ElementRange;
+ import flashx.textLayout.edit.IEditManager;
+ import flashx.textLayout.edit.SelectionState;
+ import flashx.textLayout.elements.FlowElement;
+ import flashx.textLayout.elements.FlowLeafElement;
+ import flashx.textLayout.elements.LinkElement;
+ import flashx.textLayout.elements.ParagraphElement;
+ import flashx.textLayout.elements.SpanElement;
+ import flashx.textLayout.elements.TCYElement;
+ import flashx.textLayout.elements.TextFlow;
+ import flashx.textLayout.events.SelectionEvent;
+ import flashx.textLayout.formats.ITextLayoutFormat;
+ import flashx.textLayout.formats.TextAlign;
+ import flashx.textLayout.formats.TextLayoutFormat;
+ import flashx.textLayout.tlf_internal;
+ import flashx.textLayout.ui.rulers.RulerBar;
+
+ use namespace tlf_internal;
+
+ public class TextInspectorController extends EventDispatcher
+ {
+ public static const CHAR_DOMAIN:String = "char"
+ public static const PAR_DOMAIN:String = "par"
+ public static const CONT_DOMAIN:String = "cont"
+ public static const FLOW_DOMAIN:String = "flow"
+ public static const SCROLL_DOMAIN:String = "sp"
+ public static const TCY_DOMAIN:String = "tcy"
+ public static const LINK_DOMAIN:String = "link"
+
+ public static const FONT_SIZE_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.fontSizeProperty.name;
+ public static const FONT_FAMILY_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.fontFamilyProperty.name;
+ public static const FONT_LOOKUP_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.fontLookupProperty.name;
+ public static const TRACKING_RIGHT_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.trackingRightProperty.name;
+ public static const TRACKING_LEFT_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.trackingLeftProperty.name;
+ public static const KERNING_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.kerningProperty.name;
+ public static const LINE_HEIGHT_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.lineHeightProperty.name;
+ public static const COLOR_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.colorProperty.name;
+ public static const BGCOLOR_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.backgroundColorProperty.name;
+ public static const FONT_WEIGHT_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.fontWeightProperty.name;
+ public static const FONT_STYLE_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.fontStyleProperty.name;
+ public static const TEXT_DECORATION_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.textDecorationProperty.name;
+ public static const LINE_THROUGH_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.lineThroughProperty.name;
+ public static const DIGIT_CASE_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.digitCaseProperty.name;
+ public static const DIGIT_WIDTH_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.digitWidthProperty.name;
+ public static const DOMINANT_BASELINE_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.dominantBaselineProperty.name;
+ public static const ALIGNMENT_BASELINE_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.alignmentBaselineProperty.name;
+ public static const BASELINE_SHIFT_SUPER_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.baselineShiftProperty.name + "#super";
+ public static const BASELINE_SHIFT_SUB_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.baselineShiftProperty.name + "#sub";
+ public static const BASELINE_SHIFT_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.baselineShiftProperty.name;
+ public static const TYPOGRAPHIC_CASE_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.typographicCaseProperty.name;
+ public static const LIGATURE_LEVEL_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.ligatureLevelProperty.name;
+ public static const TEXT_ROTATION_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.textRotationProperty.name;
+ public static const TEXT_ALPHA_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.textAlphaProperty.name;
+ public static const BACKGROUND_ALPHA_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.backgroundAlphaProperty.name;
+ public static const LOCALE_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.localeProperty.name;
+ public static const BREAK_OPPORTUNITY_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.breakOpportunityProperty.name;
+ public static const RENDERING_MODE_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.renderingModeProperty.name;
+ public static const CFF_HINTING_UIPROP:String = CHAR_DOMAIN + "/" + TextLayoutFormat.cffHintingProperty.name;
+
+ public static const PARA_LOCALE_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.localeProperty.name;
+ public static const TEXT_INDENT_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.textIndentProperty.name;
+ public static const START_INDENT_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.paragraphStartIndentProperty.name;
+ public static const END_INDENT_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.paragraphEndIndentProperty.name;
+ public static const SPACE_BEFORE_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.paragraphSpaceBeforeProperty.name;
+ public static const SPACE_AFTER_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.paragraphSpaceAfterProperty.name;
+ public static const TEXT_ALIGN_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.textAlignProperty.name;
+ public static const TEXT_ALIGN_LAST_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.textAlignLastProperty.name;
+ public static const JUSTIFICATION_RULE_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.justificationRuleProperty.name;
+ public static const TEXT_JUSTIFY_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.textJustifyProperty.name;
+ public static const JUSTIFICATION_STYLE_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.justificationStyleProperty.name;
+ public static const DIRECTION_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.directionProperty.name;
+ public static const LEADING_MODEL_UIPROP:String = PAR_DOMAIN + "/" + TextLayoutFormat.leadingModelProperty.name;
+
+ public static const VERTICAL_ALIGN_UIPROP:String = CONT_DOMAIN + "/" + TextLayoutFormat.verticalAlignProperty.name;
+ public static const COLUMN_COUNT_UIPROP:String = CONT_DOMAIN + "/" + TextLayoutFormat.columnCountProperty.name;
+ public static const COLUMN_WIDTH_UIPROP:String = CONT_DOMAIN + "/" + TextLayoutFormat.columnWidthProperty.name;
+ public static const COLUMN_GAP_UIPROP:String = CONT_DOMAIN + "/" + TextLayoutFormat.columnGapProperty.name;
+ public static const PADDING_LEFT_UIPROP:String = CONT_DOMAIN + "/" + TextLayoutFormat.paddingLeftProperty.name;
+ public static const PADDING_TOP_UIPROP:String = CONT_DOMAIN + "/" + TextLayoutFormat.paddingTopProperty.name;
+ public static const PADDING_RIGHT_UIPROP:String = CONT_DOMAIN + "/" + TextLayoutFormat.paddingRightProperty.name;
+ public static const PADDING_BOTTOM_UIPROP:String = CONT_DOMAIN + "/" + TextLayoutFormat.paddingBottomProperty.name;
+ public static const FIRST_BASELINE_UIPROP:String = CONT_DOMAIN + "/" + TextLayoutFormat.firstBaselineOffsetProperty.name;
+
+ public static const BLOCK_PROGRESSION_UIPROP:String = FLOW_DOMAIN + "/" + TextLayoutFormat.blockProgressionProperty.name;
+ public static const FLOW_DIRECTION_UIPROP:String = FLOW_DOMAIN + "/" + TextLayoutFormat.directionProperty.name;
+ public static const LINE_BREAK_UIPROP:String = FLOW_DOMAIN + "/" + TextLayoutFormat.lineBreakProperty.name;
+
+ public static const VERTICAL_SCROLL_UIPROP:String = SCROLL_DOMAIN + "/" + "verticalScrollPolicy";
+ public static const HORIZONTAL_SCROLL_UIPROP:String = SCROLL_DOMAIN + "/" + "horizontalScrollPolicy";
+
+ public static const TCY_UIPROP:String = TCY_DOMAIN + "/" + "tcy";
+
+ public static const LINK_URL_UIPROP:String = LINK_DOMAIN + "/" + "linkURL";
+ public static const LINK_TARGET_UIPROP:String = LINK_DOMAIN + "/" + "linkTarget";
+ public static const LINK_EXTEND_UIPROP:String = LINK_DOMAIN + "/" + "linkExtend";
+ private static var sInstance:TextInspectorController = null;
+
+ private var processingCharacterFormatChange:Boolean = false;
+
+ public function TextInspectorController(target:IEventDispatcher=null)
+ {
+ super(target);
+ if (sInstance != null)
+ throw new Error("Can't create another TextEditingController. Call TextEditingController.Instance.");
+ }
+
+ public static function Instance():TextInspectorController
+ {
+ if (!sInstance)
+ sInstance = new TextInspectorController();
+ return sInstance;
+ }
+
+ public function set activeFlow(inFlow:TextFlow):void
+ {
+ if (inFlow && !inFlow.interactionManager is IEditManager)
+ throw new Error("Can't set the active flow to a flow without an EditManager.");
+ if (mActiveFlow)
+ {
+ mActiveFlow.removeEventListener(SelectionEvent.SELECTION_CHANGE, onTextSelectionChanged);
+ mEditManager = null;
+ }
+ mActiveFlow = inFlow;
+ if (mActiveFlow)
+ {
+ mEditManager = mActiveFlow.interactionManager as IEditManager;
+ mActiveFlow.addEventListener(SelectionEvent.SELECTION_CHANGE, onTextSelectionChanged);
+ }
+ else
+ onTextSelectionChanged(null);
+ for each (var ruler:RulerBar in mRulers)
+ ruler.activeFlow = mActiveFlow;
+ }
+
+ public function get activeFlow():TextFlow
+ {
+ return mActiveFlow;
+ }
+
+ public function set rulerVisible(inVisible:Boolean):void
+ {
+ for each (var ruler:RulerBar in mRulers)
+ {
+ ruler.active = inVisible;
+ if (inVisible)
+ {
+ ruler.RedrawRuler();
+ }
+ }
+ if (mActiveFlow && (mActiveFlow.interactionManager))
+ {
+ mActiveFlow.interactionManager.setFocus();
+ }
+ }
+
+ public function get rulerVisible():Boolean
+ {
+ if (mRulers.length > 0)
+ return mRulers[0].active;
+ return false;
+ }
+
+ public function AddRuler(inRuler:RulerBar):void
+ {
+ mRulers.push(inRuler);
+ }
+
+ private function onTextSelectionChanged(e:SelectionEvent):void
+ {
+ if ((processingCharacterFormatChange) && (mEditManager.absoluteStart == mEditManager.absoluteEnd)) return;
+
+ if (e)
+ {
+ var selState:SelectionState = e.selectionState;
+ var selectedElementRange:ElementRange = selState ? ElementRange.createElementRange(selState.textFlow, selState.absoluteStart, selState.absoluteEnd) : null;
+ if (selectedElementRange)
+ {
+ var format:Object = GetFormatFromRange(selectedElementRange,selState.pointFormat);
+ if (mLastFormat == null || FormatChanged(mLastFormat, format))
+ {
+ dispatchEvent(new SelectionUpdateEvent(format));
+ mLastFormat = format;
+ }
+ }
+ }
+ else
+ {
+ dispatchEvent(new SelectionUpdateEvent(new Object()));
+ mLastFormat = null;
+ }
+ }
+
+ public function forceBroadcastFormats():void
+ {
+ if (mEditManager)
+ {
+ var format:Object = GetFormatFromRange(ElementRange.createElementRange(mActiveFlow, mActiveFlow.interactionManager.anchorPosition, mActiveFlow.interactionManager.activePosition),null);
+ dispatchEvent(new SelectionUpdateEvent(format));
+ mLastFormat = format;
+ }
+ }
+
+ private function FormatChanged(format1:Object, format2:Object):Boolean
+ {
+ if (format1.numProps == format2.numProps)
+ {
+ for(var key:String in format1)
+ {
+ if (format2[key] == null)
+ return true;
+ var prop1:Array = format1[key];
+ var prop2:Array = format2[key];
+ var n:int = prop1.length;
+ if (n != prop2.length)
+ return true;
+ for (var i:int = 0; i < n; ++i)
+ if (prop1[i] != prop2[i])
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ private function GetFormatFromRange(inRange:ElementRange,pendingFormat:ITextLayoutFormat):Object
+ {
+ var format:Object = new Object();
+ format.numProps = 0;
+ format.setPropertyIsEnumerable("numProps", false);
+ var leafIter:FlowLeafElement = inRange.firstLeaf;
+ while (leafIter)
+ {
+ var charFormat:ITextLayoutFormat = leafIter.computedFormat;
+ if (pendingFormat)
+ {
+ var scratch:TextLayoutFormat = new TextLayoutFormat(charFormat);
+ scratch.apply(pendingFormat);
+ charFormat = scratch;
+ }
+ AddAttributeToFormat(format, FONT_FAMILY_UIPROP, charFormat.fontFamily);
+ if (!IsMetaFontName(charFormat.fontFamily))
+ AddAttributeToFormat(format, FONT_LOOKUP_UIPROP, charFormat.fontLookup);
+ AddAttributeToFormat(format, FONT_SIZE_UIPROP, charFormat.fontSize);
+ AddAttributeToFormat(format, TRACKING_RIGHT_UIPROP, charFormat.trackingRight);
+ AddAttributeToFormat(format, TRACKING_LEFT_UIPROP, charFormat.trackingLeft);
+ AddAttributeToFormat(format, KERNING_UIPROP, charFormat.kerning);
+ AddAttributeToFormat(format, LINE_HEIGHT_UIPROP, charFormat.lineHeight);
+ AddAttributeToFormat(format, COLOR_UIPROP, charFormat.color);
+ AddAttributeToFormat(format, BGCOLOR_UIPROP, charFormat.backgroundColor);
+ AddAttributeToFormat(format, FONT_WEIGHT_UIPROP, charFormat.fontWeight);
+ AddAttributeToFormat(format, FONT_STYLE_UIPROP, charFormat.fontStyle);
+ AddAttributeToFormat(format, TEXT_DECORATION_UIPROP, charFormat.textDecoration);
+ AddAttributeToFormat(format, LINE_THROUGH_UIPROP, charFormat.lineThrough);
+ // This little kludge allows me to have two controls operate on the same property
+ AddAttributeToFormat(format, BASELINE_SHIFT_SUPER_UIPROP,
+ charFormat.baselineShift == flashx.textLayout.formats.BaselineShift.SUPERSCRIPT ?
+ flashx.textLayout.formats.BaselineShift.SUPERSCRIPT :
+ 0);
+ AddAttributeToFormat(format, BASELINE_SHIFT_SUB_UIPROP,
+ charFormat.baselineShift == flashx.textLayout.formats.BaselineShift.SUBSCRIPT ?
+ flashx.textLayout.formats.BaselineShift.SUBSCRIPT :
+ 0);
+ AddAttributeToFormat(format, DIGIT_CASE_UIPROP, charFormat.digitCase);
+ AddAttributeToFormat(format, DIGIT_WIDTH_UIPROP, charFormat.digitWidth);
+ AddAttributeToFormat(format, DOMINANT_BASELINE_UIPROP, charFormat.dominantBaseline);
+ AddAttributeToFormat(format, ALIGNMENT_BASELINE_UIPROP, charFormat.alignmentBaseline);
+ AddAttributeToFormat(format, BASELINE_SHIFT_UIPROP, charFormat.baselineShift);
+ AddAttributeToFormat(format, TYPOGRAPHIC_CASE_UIPROP, charFormat.typographicCase);
+ AddAttributeToFormat(format, LIGATURE_LEVEL_UIPROP, charFormat.ligatureLevel);
+ AddAttributeToFormat(format, TEXT_ROTATION_UIPROP, charFormat.textRotation);
+ AddAttributeToFormat(format, TEXT_ALPHA_UIPROP, charFormat.textAlpha);
+ AddAttributeToFormat(format, BACKGROUND_ALPHA_UIPROP, charFormat.backgroundAlpha);
+ AddAttributeToFormat(format, LOCALE_UIPROP, charFormat.locale);
+ AddAttributeToFormat(format, BREAK_OPPORTUNITY_UIPROP, charFormat.breakOpportunity);
+ AddAttributeToFormat(format, RENDERING_MODE_UIPROP, charFormat.renderingMode);
+ if (charFormat.renderingMode == flash.text.engine.RenderingMode.CFF)
+ AddAttributeToFormat(format, CFF_HINTING_UIPROP, charFormat.cffHinting);
+
+
+ var paragraph:ParagraphElement = leafIter.getParagraph();
+ var paraFormat:ITextLayoutFormat = paragraph.computedFormat;
+ AddAttributeToFormat(format, PARA_LOCALE_UIPROP, paraFormat.locale);
+ AddAttributeToFormat(format, TEXT_INDENT_UIPROP, paraFormat.textIndent);
+ AddAttributeToFormat(format, START_INDENT_UIPROP, paraFormat.paragraphStartIndent);
+ AddAttributeToFormat(format, END_INDENT_UIPROP, paraFormat.paragraphEndIndent);
+ AddAttributeToFormat(format, SPACE_BEFORE_UIPROP, paraFormat.paragraphSpaceBefore);
+ AddAttributeToFormat(format, SPACE_AFTER_UIPROP, paraFormat.paragraphSpaceAfter);
+ AddAttributeToFormat(format, TEXT_ALIGN_UIPROP, paraFormat.textAlign);
+ if (paraFormat.textAlign == TextAlign.JUSTIFY)
+ AddAttributeToFormat(format, TEXT_ALIGN_LAST_UIPROP, paraFormat.textAlignLast);
+ AddAttributeToFormat(format, JUSTIFICATION_RULE_UIPROP, paraFormat.justificationRule);
+ AddAttributeToFormat(format, TEXT_JUSTIFY_UIPROP, paraFormat.textJustify);
+ AddAttributeToFormat(format, JUSTIFICATION_STYLE_UIPROP, paraFormat.justificationStyle);
+ AddAttributeToFormat(format, DIRECTION_UIPROP, paraFormat.direction);
+ AddAttributeToFormat(format, LEADING_MODEL_UIPROP, paraFormat.leadingModel);
+
+ addLinkSettings(format, leafIter);
+
+ if (leafIter == inRange.lastLeaf)
+ break;
+
+ leafIter = leafIter.getNextLeaf();
+
+ //if this is a single point selection between differing elements, we don't want to pick up the second one
+ //is start == end, break...
+ if(inRange.absoluteStart == inRange.absoluteEnd)
+ break;
+ }
+ var containerFormat:ITextLayoutFormat = null;
+ var selStart:int = Math.min(mActiveFlow.interactionManager.activePosition, mActiveFlow.interactionManager.anchorPosition);
+ var selEnd:int = Math.max(mActiveFlow.interactionManager.activePosition, mActiveFlow.interactionManager.anchorPosition);
+ var line:TextFlowLine = mActiveFlow.flowComposer.findLineAtPosition(selStart);
+
+ // this is some odd logic - probably because ElementRange is not telling about the containercontroller range
+ if (line && line.controller)
+ {
+ var controller:ContainerController = line.controller;
+ line = mActiveFlow.flowComposer.findLineAtPosition(selEnd);
+ var lastController:ContainerController = null;
+ if (line && line.controller)
+ lastController = line.controller;
+ while (controller)
+ {
+ containerFormat = controller.computedFormat;
+ AddAttributeToFormat(format, VERTICAL_ALIGN_UIPROP, containerFormat.verticalAlign);
+ AddAttributeToFormat(format, COLUMN_COUNT_UIPROP, containerFormat.columnCount);
+ AddAttributeToFormat(format, COLUMN_WIDTH_UIPROP, containerFormat.columnWidth);
+ AddAttributeToFormat(format, COLUMN_GAP_UIPROP, containerFormat.columnGap);
+ AddAttributeToFormat(format, PADDING_LEFT_UIPROP, containerFormat.paddingLeft);
+ AddAttributeToFormat(format, PADDING_TOP_UIPROP, containerFormat.paddingTop);
+ AddAttributeToFormat(format, PADDING_RIGHT_UIPROP, containerFormat.paddingRight);
+ AddAttributeToFormat(format, PADDING_BOTTOM_UIPROP, containerFormat.paddingBottom);
+ // Note: These attributes are in the API but don't cause anything to be drawn. It looks like support
+ // for drawing borders on text containers is probably post-1.0. I have left in the XML description of
+ // how to build a UI for these properties, but commented this code out. If the DynamicPropertyEditorBase
+ // is never givena value for these properties, it will not display the UI.
+ // AddAttributeToFormat(format, BORDER_COLOR_UIPROP, containerFormat.borderColor);
+ // AddAttributeToFormat(format, BORDER_STYLE_UIPROP, containerFormat.borderStyle);
+ // AddAttributeToFormat(format, BORDER_THICKNESS_UIPROP, containerFormat.borderThickness);
+ AddAttributeToFormat(format, FIRST_BASELINE_UIPROP, containerFormat.firstBaselineOffset);
+
+ if (controller == lastController)
+ break;
+ var myIdx:int = controller.flowComposer.getControllerIndex(controller);
+ controller = myIdx+1 == controller.flowComposer.numControllers ? null : controller.flowComposer.getControllerAt(myIdx+1);
+ }
+ }
+ containerFormat = inRange.containerFormat;
+ var tf:TextFlow = inRange.firstLeaf.getTextFlow();
+ AddAttributeToFormat(format, BLOCK_PROGRESSION_UIPROP, tf.computedFormat.blockProgression);
+ AddAttributeToFormat(format, FLOW_DIRECTION_UIPROP, tf.computedFormat.direction);
+ AddAttributeToFormat(format, LINE_BREAK_UIPROP, tf.computedFormat.lineBreak);
+
+ // TODO: uses first container only
+ AddAttributeToFormat(format, VERTICAL_SCROLL_UIPROP, mActiveFlow.flowComposer.getControllerAt(0).verticalScrollPolicy);
+ AddAttributeToFormat(format, HORIZONTAL_SCROLL_UIPROP, mActiveFlow.flowComposer.getControllerAt(0).horizontalScrollPolicy);
+
+ if (isTCYEnabled())
+ AddAttributeToFormat(format, TCY_UIPROP, TCY(inRange));
+
+ if (shouldExtendLink(format))
+ AddAttributeToFormat(format, LINK_EXTEND_UIPROP, true);
+
+ return format;
+ }
+
+ private function addLinkSettings(format:Object, leaf:FlowElement):void
+ {
+ var linkElement:LinkElement = leaf.getParentByType(LinkElement) as LinkElement;
+ if (linkElement)
+ {
+ AddAttributeToFormat(format, LINK_URL_UIPROP, linkElement.href);
+ AddAttributeToFormat(format, LINK_TARGET_UIPROP, linkElement.target ? linkElement.target : "");
+ }
+ else
+ {
+ AddAttributeToFormat(format, LINK_URL_UIPROP, "");
+ // Don't show link target or extend link if there's no URL property in the selection
+ }
+
+ }
+
+ private function shouldExtendLink(format:Object):Boolean
+ {
+ // Check box is added if the selection contains mixed link settings (more than one, and at least one a valid link)
+ var extendLink:Boolean = false;
+ var urlArray:Array = format[LINK_URL_UIPROP];
+ if (urlArray && urlArray.length > 1)
+ {
+ for each (var urlString:String in urlArray)
+ if (urlString.length > 1)
+ {
+ extendLink = true;
+ break;
+ }
+ }
+ return extendLink;
+ }
+
+ private function isTCYEnabled():Boolean
+ {
+ var okToTurnOnTCY:Boolean = false;
+ if (mActiveFlow.interactionManager.isRangeSelection())
+ {
+ //have to also check if more than just the end of paragraph markers
+ //are selected
+
+ var selBegIdx:int = mActiveFlow.interactionManager.anchorPosition;
+ var selEndIdx:int = mActiveFlow.interactionManager.activePosition;
+ if (selBegIdx > selEndIdx)
+ {
+ var tempInt:int = selBegIdx;
+ selBegIdx = selEndIdx;
+ selEndIdx = tempInt;
+ }
+
+ var para:ParagraphElement;
+ var startParaPos:int;
+ var endParaPos:int;
+ var beginCheckPos:int;
+ var endCheckPos:int;
+ while ((!okToTurnOnTCY) && (selBegIdx < selEndIdx))
+ {
+ para = mActiveFlow.findAbsoluteParagraph(selBegIdx);
+ startParaPos = para.getAbsoluteStart();
+ endParaPos = startParaPos + para.textLength;
+
+ if (startParaPos > selBegIdx)
+ beginCheckPos = startParaPos;
+ else
+ beginCheckPos = selBegIdx
+
+ if (endParaPos > selEndIdx)
+ endCheckPos = selEndIdx;
+ else
+ endCheckPos = endParaPos;
+
+ var numSelInPar:int = endCheckPos - beginCheckPos;
+ if ((numSelInPar > 1) || ((numSelInPar == 1) && (endCheckPos != endParaPos)))
+ {
+ okToTurnOnTCY = true;
+ } else {
+ selBegIdx = endParaPos;
+ }
+ }
+ }
+ return okToTurnOnTCY;
+ }
+
+ public function TCY(range:ElementRange):Boolean
+ {
+ if(range != null)
+ {
+ var anchorEl:FlowElement = range.firstLeaf;
+ var endEl:FlowElement = range.lastLeaf;
+ if ((endEl is SpanElement) && ((endEl as SpanElement).hasParagraphTerminator) && (endEl.textLength == 1))
+ {
+ endEl = endEl.getTextFlow().findLeaf(endEl.getAbsoluteStart() - 1);
+ }
+
+ var anchorIsTCY:Boolean = false;
+ var endIsTCY:Boolean = false;
+
+ //if this or any of it's parents are TCY, then anchorIsTCY is true
+ while(anchorEl != null && !anchorIsTCY)
+ {
+ if(anchorEl is TCYElement)
+ anchorIsTCY = true;
+
+ anchorEl = anchorEl.parent;
+ }
+
+ //if this or any of it's parents are TCY, then anchorIsTCY is true
+ //NOTE: anchorEl and endEl may differing parent counts.
+ while(endEl != null && !endIsTCY)
+ {
+ if(endEl is TCYElement)
+ endIsTCY = true;
+
+ endEl = endEl.parent;
+ }
+
+ return endIsTCY && anchorIsTCY;
+ }
+ else
+ return false;
+ }
+
+ private function IsMetaFontName(inFont:String):Boolean
+ {
+ return (inFont == "_sans" || inFont == "_serif" || inFont == "_typewriter");
+ }
+
+ private function AddAttributeToFormat(inFormat:Object, key:String, value:Object):void
+ {
+ if (inFormat[key] == null)
+ {
+ inFormat[key] = [];
+ ++inFormat.numProps;
+ }
+ if (inFormat[key].indexOf(value) == -1)
+ inFormat[key].push(value);
+ }
+
+ public function SetTextProperty(inKey:String, inValue:Object):void
+ {
+ var slashIndex:int = inKey.indexOf("/");
+ if (slashIndex == -1)
+ throw new Error("Expected a key with a slash in it.");
+ var domain:String = inKey.slice(0, slashIndex);
+ var key:String = inKey.slice(slashIndex + 1);
+ // This little kludge allows me to have two controls operate on the same property
+ var hashIndex:int = key.indexOf("#");
+ if (hashIndex > -1)
+ key = key.slice(0, hashIndex);
+ if (mEditManager)
+ {
+ // scratch vars
+ var pa:TextLayoutFormat;
+ var cont:TextLayoutFormat;
+ var ca:TextLayoutFormat;
+
+ switch(domain) {
+ case CHAR_DOMAIN:
+ ca = new TextLayoutFormat();
+ if (key == "color")
+ {
+ inValue = uint(inValue);
+ if (mActiveFlow)
+ {
+ mActiveFlow.interactionManager.setFocus();
+ }
+ }
+ if (key == "backgroundColor")
+ {
+ inValue = uint(inValue);
+ }
+ if (key == "lineThrough")
+ inValue = inValue == "true" ? true : false;
+ ca[key] = inValue;
+ if (key == "fontFamily" && IsMetaFontName(inValue as String))
+ ca["fontLookup"] = flash.text.engine.FontLookup.DEVICE;
+ processingCharacterFormatChange = true;
+ mEditManager.applyLeafFormat(ca);
+ processingCharacterFormatChange = false;
+ break;
+ case PAR_DOMAIN:
+ pa = new TextLayoutFormat();
+ pa[key] = inValue;
+ mEditManager.applyParagraphFormat(pa);
+ break;
+ case FLOW_DOMAIN:
+ pa = new TextLayoutFormat();
+ pa[key] = inValue;
+ mEditManager.applyFormatToElement(mActiveFlow,pa);
+ break;
+ case CONT_DOMAIN:
+ cont = new TextLayoutFormat();
+ cont[key] = inValue;
+
+ // always modify the containers
+ mEditManager.applyContainerFormat(cont,null);
+ break;
+ case SCROLL_DOMAIN: // scroll policy props
+ mActiveFlow.flowComposer.getControllerAt(0)[key] = inValue;
+ mActiveFlow.flowComposer.updateAllControllers();
+ break;
+ case TCY_DOMAIN:
+ if (key == "tcy")
+ mEditManager.applyTCY(inValue == "true" ? true : false);
+ break;
+ case LINK_DOMAIN:
+ if (key == "linkURL")
+ mEditManager.applyLink(inValue as String);
+ break;
+ }
+ }
+ mLastFormat = null;
+ }
+
+ private var mActiveFlow:TextFlow = null;
+ private var mEditManager:IEditManager = null;
+ private var mLastFormat:Object = null;
+ private var mRulers:Array = [];
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_center_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_center_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_center_icon.png
new file mode 100644
index 0000000..14e18cd
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_center_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_end_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_end_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_end_icon.png
new file mode 100644
index 0000000..917f0a0
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_end_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_justify_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_justify_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_justify_icon.png
new file mode 100644
index 0000000..01ccc34
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_justify_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_center_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_center_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_center_icon.png
new file mode 100644
index 0000000..e5fb315
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_center_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_left_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_left_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_left_icon.png
new file mode 100644
index 0000000..bd67ea2
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_left_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_right_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_right_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_right_icon.png
new file mode 100644
index 0000000..d33328c
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_right_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_left_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_left_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_left_icon.png
new file mode 100644
index 0000000..4524f7a
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_left_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_right_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_right_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_right_icon.png
new file mode 100644
index 0000000..d84624c
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_right_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_start_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_start_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_start_icon.png
new file mode 100644
index 0000000..80b6b9e
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_start_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/bold_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/bold_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/bold_icon.png
new file mode 100644
index 0000000..cef2c4b
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/bold_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_bottom_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_bottom_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_bottom_icon.png
new file mode 100644
index 0000000..a6ec4b1
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_bottom_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_justify_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_justify_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_justify_icon.png
new file mode 100644
index 0000000..4c45bc2
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_justify_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_middle_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_middle_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_middle_icon.png
new file mode 100644
index 0000000..a1f5ae8
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_middle_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_top_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_top_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_top_icon.png
new file mode 100644
index 0000000..9981848
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_top_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/italic_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/italic_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/italic_icon.png
new file mode 100644
index 0000000..9bcce71
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/italic_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/strikethrough_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/strikethrough_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/strikethrough_icon.png
new file mode 100644
index 0000000..2d4e528
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/strikethrough_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/subscript_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/subscript_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/subscript_icon.png
new file mode 100644
index 0000000..7ee2a86
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/subscript_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/superscript_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/superscript_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/superscript_icon.png
new file mode 100644
index 0000000..210f933
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/superscript_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/tcy_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/tcy_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/tcy_icon.png
new file mode 100644
index 0000000..86797f1
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/tcy_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/underline_icon.png
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/underline_icon.png b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/underline_icon.png
new file mode 100644
index 0000000..355ac65
Binary files /dev/null and b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/underline_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarker.as
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarker.as b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarker.as
new file mode 100644
index 0000000..b5f4327
--- /dev/null
+++ b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarker.as
@@ -0,0 +1,98 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package flashx.textLayout.ui.rulers
+{
+ import flashx.textLayout.formats.TextLayoutFormat;
+ import flashx.textLayout.tlf_internal;
+ use namespace tlf_internal;
+
+ public class ParagraphPropertyMarker extends RulerMarker
+ {
+ public function ParagraphPropertyMarker(inRuler:RulerBar, inProperty:String)
+ {
+ super(inRuler, 6, 13, 0, 0, 0);
+ setStyle("propkind", inProperty);
+ setStyle("rightToLeftPar", false);
+ mProperty = inProperty;
+ }
+
+ public function get property():String
+ {
+ return mProperty;
+ }
+
+ override protected function get alignToRight():Boolean
+ {
+ switch(mProperty)
+ {
+ case TextLayoutFormat.textIndentProperty.name:
+ return mRightToLeftPar ? true : false;
+ case TextLayoutFormat.paragraphStartIndentProperty.name:
+ return mRightToLeftPar;
+ case TextLayoutFormat.paragraphEndIndentProperty.name:
+ return !mRightToLeftPar;
+ }
+ return false;
+ }
+
+ override protected function get originPosition():Number
+ {
+ return mRelativeToPosition;
+ }
+
+ public function set relativeToPosition(inRelPos:Number):void
+ {
+ mRelativeToPosition = inRelPos;
+ positionMarker();
+ }
+
+ override public function get hOffset():Number
+ {
+ switch(mProperty)
+ {
+ case TextLayoutFormat.textIndentProperty.name:
+ return mRightToLeftPar ? -6 : 0;
+ case TextLayoutFormat.paragraphStartIndentProperty.name:
+ return mRightToLeftPar ? -6 : 0;
+ case TextLayoutFormat.paragraphEndIndentProperty.name:
+ return mRightToLeftPar ? 0 : -6;
+ }
+ return 0;
+ }
+
+ public function set rightToLeftPar(inRightToLeft:Boolean):void
+ {
+ if (inRightToLeft != mRightToLeftPar)
+ {
+ mRightToLeftPar = inRightToLeft;
+ setStyle("rightToLeftPar", mRightToLeftPar);
+
+ if (mProperty == TextLayoutFormat.paragraphStartIndentProperty.name)
+ mProperty = TextLayoutFormat.paragraphEndIndentProperty.name;
+ else if (mProperty == TextLayoutFormat.paragraphEndIndentProperty.name)
+ mProperty = TextLayoutFormat.paragraphStartIndentProperty.name;
+ }
+ }
+
+ private var mProperty:String;
+ private var mRelativeToPosition:Number = 0;
+ private var mRightToLeftPar:Boolean = false;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarkerSkin.as
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarkerSkin.as b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarkerSkin.as
new file mode 100644
index 0000000..930f1c7
--- /dev/null
+++ b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarkerSkin.as
@@ -0,0 +1,103 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package flashx.textLayout.ui.rulers
+{
+ import mx.skins.RectangularBorder;
+
+ public class ParagraphPropertyMarkerSkin extends RectangularBorder
+ {
+ public function ParagraphPropertyMarkerSkin()
+ {
+ super();
+ }
+
+ override protected function updateDisplayList(w:Number, h:Number):void
+ {
+ super.updateDisplayList(w, h);
+
+ var propKind:String = getStyle("propkind");
+ var rightToLeftPar:Boolean = getStyle("rightToLeftPar");
+
+ var t:Number = 0;
+ var b:Number = h;
+
+ graphics.clear();
+
+ graphics.beginFill(0x000000);
+ if (rightToLeftPar)
+ {
+ switch(propKind) {
+ case "textIndent":
+ b = (h - 1) / 2;
+ graphics.moveTo(w, 0);
+ graphics.lineTo(w, b);
+ graphics.lineTo(0, b);
+ graphics.lineTo(w, 0);
+ break;
+ case "paragraphStartIndent":
+ graphics.moveTo(0, 0);
+ graphics.lineTo(0, h);
+ graphics.lineTo(w, h / 2);
+ graphics.lineTo(0, 0);
+ break;
+ case "paragraphEndIndent":
+ t = h - (h - 1) / 2;
+ graphics.moveTo(w, h);
+ graphics.lineTo(0, t);
+ graphics.lineTo(w, t);
+ graphics.lineTo(w, h);
+ break;
+ }
+ }
+ else
+ {
+ switch(propKind) {
+ case "textIndent":
+ b = (h - 1) / 2;
+ graphics.moveTo(0, 0);
+ graphics.lineTo(w, b);
+ graphics.lineTo(0, b);
+ graphics.lineTo(0, 0);
+ break;
+ case "paragraphStartIndent":
+ t = h - (h - 1) / 2;
+ graphics.moveTo(0, h);
+ graphics.lineTo(0, t);
+ graphics.lineTo(w, t);
+ graphics.lineTo(0, h);
+ break;
+ case "paragraphEndIndent":
+ graphics.moveTo(w, 0);
+ graphics.lineTo(w, h);
+ graphics.lineTo(0, h / 2);
+ graphics.lineTo(w, 0);
+ break;
+ }
+ }
+ graphics.endFill();
+
+ // this makes the whole rect hittable
+ graphics.lineStyle();
+ graphics.beginFill(0x0000ff, 0);
+ graphics.drawRect(0, t, w, b);
+ graphics.endFill();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerBar.as
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerBar.as b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerBar.as
new file mode 100644
index 0000000..73817f2
--- /dev/null
+++ b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerBar.as
@@ -0,0 +1,672 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package flashx.textLayout.ui.rulers
+{
+ import bxf.ui.inspectors.DynamicPropertyEditorBase;
+
+ import flash.display.DisplayObject;
+ import flash.display.GradientType;
+ import flash.events.MouseEvent;
+ import flash.geom.Matrix;
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ import flash.text.engine.TabAlignment;
+
+ import flashx.textLayout.container.ContainerController;
+ import flashx.textLayout.edit.EditManager;
+ import flashx.textLayout.edit.ElementRange;
+ import flashx.textLayout.edit.SelectionState;
+ import flashx.textLayout.elements.ContainerFormattedElement;
+ import flashx.textLayout.elements.ParagraphElement;
+ import flashx.textLayout.elements.TextFlow;
+ import flashx.textLayout.compose.TextFlowLine;
+ import flashx.textLayout.events.SelectionEvent;
+ import flashx.textLayout.formats.ITextLayoutFormat;
+ import flashx.textLayout.formats.ITabStopFormat;
+ import flashx.textLayout.formats.TextLayoutFormat;
+ import flashx.textLayout.formats.TabStopFormat;
+ import flashx.textLayout.formats.BlockProgression;
+ import flashx.textLayout.tlf_internal;
+ import flashx.textLayout.ui.inspectors.TabPropertyEditor;
+ import flashx.textLayout.ui.inspectors.TextInspectorController;
+
+ import mx.containers.Canvas;
+ import mx.core.ScrollPolicy;
+ import mx.core.UIComponent;
+ import mx.events.PropertyChangeEvent;
+ import mx.events.ResizeEvent;
+ use namespace tlf_internal;
+
+ public class RulerBar extends Canvas
+ {
+ public static const RULER_HORIZONTAL:String = "horizontal";
+ public static const RULER_VERTICAL:String = "vertical";
+
+ public function RulerBar()
+ {
+ super();
+ horizontalScrollPolicy = ScrollPolicy.OFF;
+ verticalScrollPolicy = ScrollPolicy.OFF;
+ mDefaultTabStop = new TabStopFormat(TabStopFormat.defaultFormat);
+ addEventListener(MouseEvent.MOUSE_DOWN, onRulerMouseDown);
+ selectMarker(null);
+ TextInspectorController.Instance().AddRuler(this);
+ curParagraphFormat = null;
+ }
+
+ override public function initialize():void
+ {
+ super.initialize();
+ adjustForActive();
+ }
+
+ public function creationComplete():void
+ {
+ if (mSyncToPanel)
+ {
+ mSyncToPanel.addEventListener(ResizeEvent.RESIZE, onSyncPanelResize);
+ }
+ SyncRulerToPanel();
+ mIndentMarker = addParagraphPropertyMarker(TextLayoutFormat.textIndentProperty.name);
+ mLeftMarginMarker = addParagraphPropertyMarker(TextLayoutFormat.paragraphStartIndentProperty.name);
+ mRightMarginMarker = addParagraphPropertyMarker(TextLayoutFormat.paragraphEndIndentProperty.name);
+ }
+
+ public function set activeFlow(inFlow:TextFlow):void
+ {
+ if (inFlow && !inFlow.interactionManager is EditManager)
+ throw new Error("Can't set the active flow to a flow without an EditManager.");
+ if (mActiveFlow)
+ {
+ mActiveFlow.removeEventListener(SelectionEvent.SELECTION_CHANGE, onTextSelectionChanged);
+ mEditManager = null;
+ }
+ mActiveFlow = inFlow;
+ mLastSelActiveIdx = -1;
+ mLastSelAnchorIdx = -1;
+ mTabSet = null;
+ RemoveTabMarkers();
+ selectMarker(null);
+
+ if (mActiveFlow)
+ {
+ mEditManager = mActiveFlow.interactionManager as EditManager;
+ mActiveFlow.addEventListener(SelectionEvent.SELECTION_CHANGE, onTextSelectionChanged);
+ }
+ else
+ onTextSelectionChanged(null);
+ }
+
+ public function get activeFlow():TextFlow
+ {
+ return mActiveFlow;
+ }
+
+ public function set active(inActive:Boolean):void
+ {
+ mActive = inActive;
+ selectMarker(null);
+ adjustForActive();
+ }
+
+ public function get active():Boolean
+ {
+ return mActive;
+ }
+
+ private function set rightRuler(inActive:Boolean):void
+ {
+ mRightRuler = inActive;
+ adjustForActive();
+ }
+
+ private function get rightRuler():Boolean
+ {
+ return mRightRuler;
+ }
+
+ private function adjustForActive():void
+ {
+ if (parent)
+ {
+ if (mActive && mRightRuler)
+ {
+ parent.visible = true;
+ if (parent is Canvas)
+ (parent as Canvas).includeInLayout = true;
+ }
+ else
+ {
+ parent.visible = false;
+ if (parent is Canvas)
+ (parent as Canvas).includeInLayout = false;
+ }
+ }
+ }
+
+ public function set orientation(inOrientation:String):void
+ {
+ if (inOrientation != mOrientation && (inOrientation == RULER_HORIZONTAL || inOrientation == RULER_VERTICAL))
+ {
+ mOrientation = inOrientation;
+ }
+ }
+
+ public function set syncToPanel(inPanel:UIComponent):void
+ {
+ mSyncToPanel = inPanel;
+ }
+
+ public function set tabPropertyEditor(inEditor:TabPropertyEditor):void
+ {
+ mPropertyEditor = inEditor;
+ mPropertyEditor.addEventListener(DynamicPropertyEditorBase.MODELCHANGED_EVENT, onFormatValueChanged, false, 0, true);
+ mPropertyEditor.addEventListener(DynamicPropertyEditorBase.MODELEDITED_EVENT, onFormatValueChanged, false, 0, true);
+ selectMarker(mSelectedMarker);
+ }
+
+ private function onSyncPanelResize(evt:ResizeEvent):void
+ {
+ RedrawRuler();
+ }
+
+ public function RedrawRuler():void
+ {
+ SyncRulerToPanel();
+ if (curParagraphFormat != null) {
+ ShowTabs(curParagraphFormat);
+ }
+ }
+
+ private function SyncRulerToPanel():void
+ {
+ if (mActiveFlow && mActiveFlow.flowComposer && rightRuler)
+ {
+ var selStart:int = Math.min(mActiveFlow.interactionManager.activePosition, mActiveFlow.interactionManager.anchorPosition);
+ var line:TextFlowLine = selStart != -1 ? mActiveFlow.flowComposer.findLineAtPosition(selStart) : null;
+ if (line)
+ {
+ var controller:ContainerController;
+ var containerDO:DisplayObject;
+ if (line.controller)
+ {
+ controller = line.controller;
+ containerDO = controller.container as DisplayObject;
+ }
+ else
+ {
+ // get the last container
+ controller = mActiveFlow.flowComposer.getControllerAt(mActiveFlow.flowComposer.numControllers-1);
+ containerDO = controller.container as DisplayObject;
+ }
+ var localOrigin:Point = parent.globalToLocal(containerDO.parent.localToGlobal(new Point(containerDO.x, containerDO.y)));
+ var columnBounds:Rectangle;
+ var columnIndex:int = line.columnIndex;
+ if (columnIndex == -1)
+ columnBounds = controller.columnState.getColumnAt(controller.columnState.columnCount - 1);
+ else
+ {
+ // columnIndex is an index into all the columns in the flow, so to get the actual
+ // column bounds
+ var idx:int = 0;
+ var ch:ContainerController = mActiveFlow.flowComposer.getControllerAt(idx);
+ while (ch && ch != controller)
+ {
+ columnIndex -= ch.columnState.columnCount;
+ idx++;
+ ch = idx == mActiveFlow.flowComposer.numControllers ? null : mActiveFlow.flowComposer.getControllerAt(idx);
+ }
+ // Pin the column number to the actual range of column indices. I have found this
+ // is needed when the insertion point is inside a table (because the line's container
+ // is not in the flow's list of containers) or when the insertion point is in regular
+ // text after a table (the column number doesn't make sense, and I think it's a bug, which
+ // I have written to Robin about.
+ columnIndex = Math.max(0, Math.min(line.columnIndex, controller.columnState.columnCount - 1));
+ columnBounds = controller.columnState.getColumnAt(columnIndex);
+ }
+
+ if (columnBounds)
+ {
+ if (mOrientation == RULER_HORIZONTAL)
+ {
+ x = localOrigin.x + columnBounds.x;
+ y = 0;
+ height = parent.height;
+ width = columnBounds.width;
+ }
+ else
+ {
+ x = parent.width;
+ y = localOrigin.y + columnBounds.y;
+ rotation = 90;
+ height = parent.width;
+ width = columnBounds.height;
+ }
+ }
+ }
+ }
+ }
+
+ private function onTextSelectionChanged(e:SelectionEvent):void
+ {
+ curParagraphFormat = null;
+ if (mEditManager && (mEditManager.activePosition != mLastSelActiveIdx || mEditManager.anchorPosition != mLastSelAnchorIdx))
+ {
+ mLastSelActiveIdx = mActiveFlow.interactionManager.activePosition;
+ mLastSelAnchorIdx = mActiveFlow.interactionManager.anchorPosition;
+ selectMarker(null);
+ }
+ if (e)
+ {
+ var selState:SelectionState = e.selectionState;
+ var selectedElementRange:ElementRange = selState ? ElementRange.createElementRange(selState.textFlow, selState.absoluteStart, selState.absoluteEnd) : null;
+ if (selectedElementRange)
+ {
+ var rootElement:ContainerFormattedElement = selectedElementRange.firstLeaf.getAncestorWithContainer();
+ if ((rootElement.computedFormat.blockProgression == BlockProgression.RL) == (mOrientation == RULER_VERTICAL))
+ {
+ // should be active
+ if (rightRuler != true)
+ {
+ mTabSet = null;
+ }
+ if (!rightRuler)
+ rightRuler = true;
+ }
+ else
+ {
+ // should be inactive
+ if (rightRuler != false)
+ {
+ mTabSet = null;
+ }
+ if (rightRuler)
+ rightRuler = false;
+ }
+
+ curParagraphFormat = new TextLayoutFormat(selectedElementRange.firstParagraph.computedFormat);
+ setRightToLeft(curParagraphFormat.direction == flashx.textLayout.formats.Direction.RTL);
+ ShowTabs(curParagraphFormat);
+ }
+ else
+ ShowTabs(null);
+ }
+ else
+ ShowTabs(null);
+ }
+
+
+ private function RemoveTabMarkers():void
+ {
+ var markers:Array = getChildren();
+ for each (var marker:UIComponent in markers)
+ if (marker is TabMarker)
+ this.removeChild(marker);
+ }
+
+
+ private function ShowTabs(inFormat:ITextLayoutFormat):void
+ {
+ SyncRulerToPanel();
+ var tabs:Array = inFormat ? ((inFormat.tabStops && (inFormat.tabStops.length > 0)) ? inFormat.tabStops as Array : null) : null;
+ if (isNewTabSet(tabs))
+ {
+ mTabSet = tabs;
+ if (mUpdateFromSelection)
+ {
+ RemoveTabMarkers();
+ var oldSel:RulerMarker = mSelectedMarker;
+ selectMarker(null);
+ if (mTabSet)
+ for each(var tab:TabStopFormat in mTabSet)
+ {
+ var tabMarker:TabMarker = addTabMarker(tab);
+ if (oldSel && oldSel.pos == tabMarker.pos)
+ selectMarker(tabMarker);
+ }
+ }
+ }
+ if (inFormat)
+ {
+ if(mIndentMarker)
+ {
+ mIndentMarker.rightToLeftPar = mRightToLeft;
+ mIndentMarker.pos = Number(inFormat.textIndent);
+ mIndentMarker.relativeToPosition = inFormat.paragraphStartIndent;
+ }
+
+ if(mLeftMarginMarker)
+ {
+ mLeftMarginMarker.rightToLeftPar = mRightToLeft;
+ mLeftMarginMarker.pos = rightToLeft ? Number(inFormat.paragraphEndIndent): Number(inFormat.paragraphStartIndent);
+ }
+
+ if(mRightMarginMarker)
+ {
+ mRightMarginMarker.rightToLeftPar = mRightToLeft;
+ mRightMarginMarker.pos = rightToLeft ? Number(inFormat.paragraphStartIndent): Number(inFormat.paragraphEndIndent);
+ }
+ }
+ }
+
+
+ private function addTabMarker(tabAttrs:ITabStopFormat):TabMarker
+ {
+ var tabMarker:TabMarker = new TabMarker(this, tabAttrs);
+ tabMarker.addEventListener(MouseEvent.MOUSE_DOWN, onMarkerMouseDown);
+ addChild(tabMarker);
+ return tabMarker;
+ }
+
+
+ private function addParagraphPropertyMarker(inProperty:String):ParagraphPropertyMarker
+ {
+ var propMarker:ParagraphPropertyMarker = new ParagraphPropertyMarker(this, inProperty);
+ propMarker.addEventListener(MouseEvent.MOUSE_DOWN, onMarkerMouseDown);
+ addChild(propMarker);
+ return propMarker;
+ }
+
+
+ private function isNewTabSet(inTabs:Array):Boolean
+ {
+ if (inTabs == mTabSet)
+ return false;
+ if ((inTabs == null) != (mTabSet == null))
+ return true;
+ if (inTabs)
+ {
+ if (inTabs.length == mTabSet.length)
+ {
+ var n:int = inTabs.length;
+ for (var i:int = 0; i < n; ++i)
+ {
+ if (inTabs[i] != mTabSet[i])
+ return true;
+ }
+ return false;
+ }
+ else
+ return true;
+ }
+ return false;
+ }
+
+
+ override protected function updateDisplayList(w:Number, h:Number):void
+ {
+ super.updateDisplayList(w, h);
+
+ graphics.clear();
+ var m:Matrix = new Matrix();
+ m.createGradientBox(height, height, Math.PI / 2);
+ graphics.beginGradientFill(GradientType.LINEAR, [0xffffff, 0xe0e0e0], [1, 1], [0, 255], m);
+ graphics.drawRect(0, 0, w, h);
+ graphics.endFill();
+
+ graphics.lineStyle(1, 0x404040, 1.0, true);
+ for (var x:int = 0; x < w; x += 10)
+ {
+ var rulerX:Number = rightToLeft ? w - x - 1 : x;
+ if (x % 100 == 0)
+ graphics.moveTo(rulerX, 12);
+ else if (x % 50 == 0)
+ graphics.moveTo(rulerX, 9);
+ else
+ graphics.moveTo(rulerX, 5);
+ graphics.lineTo(rulerX, 0);
+ }
+ }
+
+ private function onMarkerMouseDown(e:MouseEvent):void
+ {
+ if (mEditManager)
+ {
+ var cookie:Object;
+ if (e.target is TabMarker)
+ {
+ var tabMarker:TabMarker = e.target as TabMarker;
+ selectMarker(tabMarker);
+ e.stopPropagation();
+ cookie = new Object();
+ cookie["marker"] = tabMarker;
+ cookie["offset"] = e.localX;
+ cookie["onRuler"] = true;
+ mUpdateFromSelection = false;
+ new RulerDragTracker(this.parentApplication as UIComponent, this, cookie).BeginTracking(e, false);
+ }
+ else if (e.target is ParagraphPropertyMarker)
+ {
+ var propMarker:ParagraphPropertyMarker = e.target as ParagraphPropertyMarker;
+ selectMarker(null);
+ e.stopPropagation();
+ cookie = new Object();
+ cookie["marker"] = propMarker;
+ cookie["offset"] = e.localX;
+ new RulerDragTracker(this.parentApplication as UIComponent, this, cookie).BeginTracking(e, false);
+ }
+ }
+ }
+
+ private function onRulerMouseDown(e:MouseEvent):void
+ {
+ if (e.target is RulerBar && mEditManager)
+ {
+ var tabMarker:TabMarker = addTabMarker(mDefaultTabStop);
+ tabMarker.markerLeft = e.localX + tabMarker.hOffset;
+ selectMarker(tabMarker);
+ mUpdateFromSelection = false;
+ setFormatFromRuler();
+ e.stopPropagation();
+ var cookie:Object = new Object();
+ cookie["marker"] = tabMarker;
+ cookie["offset"] = -tabMarker.hOffset;
+ cookie["onRuler"] = true;
+ new RulerDragTracker(this.parentApplication as UIComponent, this, cookie, 0).BeginTracking(e, false);
+ }
+ }
+
+ public function TrackDrag(inCurPos:Point, inCookie:Object, inCommit:Boolean):void
+ {
+ if (inCookie)
+ {
+ if (inCookie["marker"] is TabMarker)
+ {
+ var tabMarker:TabMarker = inCookie["marker"] as TabMarker;
+ var wasOnRuler:Boolean = inCookie["onRuler"];
+ if (inCookie["onRuler"] && inCurPos.y > height + 16)
+ {
+ inCookie["onRuler"] = false;
+ removeChild(tabMarker);
+ selectMarker(null);
+ }
+ else if (!inCookie["onRuler"] && inCurPos.y <= height + 16)
+ {
+ inCookie["onRuler"] = true;
+ addChild(tabMarker);
+ selectMarker(tabMarker);
+ }
+
+ tabMarker.markerLeft = inCurPos.x - inCookie["offset"];
+ if (wasOnRuler || inCookie["onRuler"])
+ setFormatFromRuler();
+ }
+ else if (inCookie["marker"] is ParagraphPropertyMarker)
+ {
+ var propMarker:ParagraphPropertyMarker = inCookie["marker"] as ParagraphPropertyMarker;
+ propMarker.markerLeft = inCurPos.x - inCookie["offset"];
+ var pa:TextLayoutFormat = new TextLayoutFormat();
+ pa[propMarker.property] = propMarker.pos;
+ mEditManager.applyParagraphFormat(pa);
+ }
+ }
+ if (inCommit)
+ mUpdateFromSelection = true;
+ }
+
+ public function DragCancelled():void
+ {
+ mUpdateFromSelection = true;
+ }
+
+ private function selectMarker(inMarker:RulerMarker):void
+ {
+ if (mSelectedMarker)
+ mSelectedMarker.setStyle("selected", false);
+ mSelectedMarker = inMarker;
+ if (mSelectedMarker)
+ mSelectedMarker.setStyle("selected", true);
+ updatePropertyEditor();
+ }
+
+ private function updatePropertyEditor():void
+ {
+ if (mRightRuler && mPropertyEditor && mTabPanelActive)
+ {
+ mPropertyEditor.reset();
+ mPropertyEditor.properties["rulervisible"] = TextInspectorController.Instance().rulerVisible;
+ if (TextInspectorController.Instance().rulerVisible)
+ {
+ var tab:ITabStopFormat = mSelectedMarker as ITabStopFormat;
+ if (!tab)
+ tab = mDefaultTabStop as ITabStopFormat;
+ if (tab)
+ {
+ mPropertyEditor.properties["alignment"] = tab.alignment;
+ if (tab != mDefaultTabStop)
+ mPropertyEditor.properties["position"] = tab.position;
+ if (tab.alignment == flash.text.engine.TabAlignment.DECIMAL)
+ mPropertyEditor.properties["decimalAlignmentToken"] = tab.decimalAlignmentToken;
+ }
+ }
+ mPropertyEditor.rebuildUI();
+ }
+ }
+
+ private function onFormatValueChanged(e:PropertyChangeEvent):void
+ {
+ if (mRightRuler)
+ {
+ var property:String = e.property as String;
+ if (property == "rulervisible")
+ TextInspectorController.Instance().rulerVisible = (e.newValue == "true" ? true : false);
+ else
+ {
+ if (e.type == DynamicPropertyEditorBase.MODELEDITED_EVENT)
+ mUpdateFromSelection = false;
+ var tab:Object = mSelectedMarker;
+ if (!tab)
+ tab = mDefaultTabStop;
+ var newValue:Object = e.newValue;
+ if (property == "position")
+ newValue = Number(newValue);
+ tab[property] = newValue;
+ if (property == "alignment" && newValue == flash.text.engine.TabAlignment.DECIMAL && tab["decimalAlignmentToken"] == null)
+ tab["decimalAlignmentToken"] = "";
+ if (mSelectedMarker)
+ setFormatFromRuler();
+ if (e.type == DynamicPropertyEditorBase.MODELCHANGED_EVENT)
+ mUpdateFromSelection = true;
+ updatePropertyEditor();
+ }
+ }
+ }
+
+ private function setFormatFromRuler():void
+ {
+ var newTabs:Array = [];
+ if (mSelectedMarker && mSelectedMarker.parent)
+ newTabs.push(new TabStopFormat(mSelectedMarker as ITabStopFormat));
+ var markers:Array = getChildren();
+ for each (var marker:UIComponent in markers)
+ if (marker is TabMarker)
+ {
+ var tab:TabMarker = marker as TabMarker;
+ if (isUniquePosition(newTabs, tab.pos))
+ newTabs.push(new TabStopFormat(tab));
+
+ }
+ newTabs.sortOn("position", Array.NUMERIC);
+ var pa:TextLayoutFormat = new TextLayoutFormat();
+ pa.tabStops = newTabs;
+ mEditManager.applyParagraphFormat(pa);
+ updatePropertyEditor();
+ }
+
+ private static function isUniquePosition(inTabFormat:Array, inNewPosition:Number):Boolean
+ {
+ for each (var tab:TabStopFormat in inTabFormat)
+ if (tab.position == inNewPosition)
+ return false;
+ return true;
+ }
+
+ public function set tabPanelActive(inActive:Boolean):void
+ {
+ if (mTabPanelActive != inActive)
+ {
+ mTabPanelActive = inActive;
+ if (mTabPanelActive)
+ updatePropertyEditor();
+ }
+ }
+
+ public function get tabPanelActive():Boolean
+ {
+ return mTabPanelActive;
+ }
+
+ public function get rightToLeft():Boolean
+ {
+ return mRightToLeft;
+ }
+
+ private function setRightToLeft(inRTL:Boolean):void
+ {
+ if (inRTL != mRightToLeft)
+ {
+ mTabSet = null;
+ mRightToLeft = inRTL;
+ invalidateDisplayList();
+ }
+ }
+
+ private var mActive:Boolean = true;
+ private var mActiveFlow:TextFlow = null;
+ private var mEditManager:EditManager = null;
+ private var mTabSet:Array = null;
+ private var mSelectedMarker:RulerMarker = null;
+ private var mUpdateFromSelection:Boolean = true;
+ private var mDefaultTabStop:TabStopFormat;
+ private var mPropertyEditor:TabPropertyEditor = null;
+ private var mOrientation:String = RULER_HORIZONTAL;
+ private var mSyncToPanel:UIComponent = null;
+ private var mRightRuler:Boolean = true;
+ private var mLastSelAnchorIdx:int = -1;
+ private var mLastSelActiveIdx:int = -1;
+ private var mIndentMarker:ParagraphPropertyMarker = null;
+ private var mLeftMarginMarker:ParagraphPropertyMarker = null;
+ private var mRightMarginMarker:ParagraphPropertyMarker = null;
+ private var mTabPanelActive:Boolean = false;
+ private var mRightToLeft:Boolean = false;
+ private var curParagraphFormat:TextLayoutFormat = null;
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerDragTracker.as
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerDragTracker.as b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerDragTracker.as
new file mode 100644
index 0000000..042a92c
--- /dev/null
+++ b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerDragTracker.as
@@ -0,0 +1,88 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package flashx.textLayout.ui.rulers
+{
+ import flash.events.MouseEvent;
+ import flash.geom.Point;
+
+ import mx.core.UIComponent;
+
+ import bxf.ui.toolkit.Tracker;
+
+ public class RulerDragTracker extends Tracker
+ {
+ public function RulerDragTracker(inPeerToTrackTo:UIComponent, inController:RulerBar, inCookie:Object, inDragThreshold:Number = 2)
+ {
+ super(inPeerToTrackTo, 0, 0);
+ mController = inController;
+ mDragCookie = inCookie;
+ mDragThreshold = inDragThreshold;
+ }
+
+ /** Override to get cursor adjust hook and mouse down.
+ * @param inMouseEvent mouse info.
+ * @param inCursorAdjust true if this is a mouse up track.*/
+ override public function BeginTracking(inMouseEvent:MouseEvent, inCursorAdjust:Boolean):void
+ {
+ super.BeginTracking(inMouseEvent, inCursorAdjust);
+ }
+
+ /** Override to get mouse move.
+ * @param inMouseEvent mouse info.*/
+ override public function ContinueTracking(inMouseEvent:MouseEvent):void
+ {
+ super.ContinueTracking(inMouseEvent);
+ if (!mDragThresholdReached)
+ {
+ if (Point.distance(mAnchorPt, mTrackPt) >= mDragThreshold)
+ mDragThresholdReached = true;
+ }
+ if (mDragThresholdReached)
+ mController.TrackDrag(mTrackPt, mDragCookie, false);
+ inMouseEvent.stopPropagation();
+ }
+
+ /** Override to get mouse up.
+ * @param inMouseEvent mouse info.*/
+ override public function EndTracking(inMouseEvent:MouseEvent):void
+ {
+ super.EndTracking(inMouseEvent);
+ if (mDragThresholdReached)
+ mController.TrackDrag(mTrackPt, mDragCookie, true);
+ else
+ mController.DragCancelled();
+ inMouseEvent.stopPropagation();
+ }
+
+ override protected function TrackPoint(inMouseEvent:MouseEvent, inAlsoSetAnchor:Boolean): void
+ {
+ mTrackPt.x = inMouseEvent.stageX;
+ mTrackPt.y = inMouseEvent.stageY;
+ mTrackPt = mController.globalToLocal(mTrackPt);
+ if (inAlsoSetAnchor)
+ mAnchorPt = mTrackPt.clone();
+ }
+
+ private var mController:RulerBar = null;
+ private var mDragCookie:Object = null;
+ private var mDragThreshold:Number;
+ private var mDragThresholdReached:Boolean = false;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerMarker.as
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerMarker.as b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerMarker.as
new file mode 100644
index 0000000..7cc2848
--- /dev/null
+++ b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/RulerMarker.as
@@ -0,0 +1,124 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package flashx.textLayout.ui.rulers
+{
+ import mx.containers.Canvas;
+
+ public class RulerMarker extends Canvas
+ {
+ public function RulerMarker(inRuler:RulerBar, inWidth:Number, inHeight:Number, inHOffset:Number, inVOffset:Number, inPos:Number)
+ {
+ super();
+ width = inWidth;
+ height = inHeight;
+ mHOffset = inHOffset;
+ mVOffset = inVOffset;
+ mPos = inPos;
+ mRuler = inRuler;
+ }
+
+ override public function initialize():void
+ {
+ super.initialize();
+ positionMarker();
+ }
+
+ protected function positionMarker():void
+ {
+ if (parent)
+ {
+ if (alignToRight)
+ {
+ x = parent.width - originPosition - pos + hOffset;
+ y = parent.height - height + vOffset;
+ }
+ else
+ {
+ x = originPosition + pos + hOffset;
+ y = parent.height - height + vOffset;
+ }
+ }
+ }
+
+ protected function get alignToRight():Boolean
+ {
+ return ruler.rightToLeft;
+ }
+
+ protected function get originPosition():Number
+ {
+ return 0;
+ }
+
+ public function set pos(inPos:Number):void
+ {
+ mPos = inPos;
+ positionMarker();
+ }
+
+ public function get pos():Number
+ {
+ return mPos;
+ }
+
+ public function set hOffset(inOffset:Number):void
+ {
+ mHOffset = inOffset;
+ positionMarker();
+ }
+
+ public function get hOffset():Number
+ {
+ return mHOffset;
+ }
+
+ public function set vOffset(inOffset:Number):void
+ {
+ mVOffset = inOffset;
+ positionMarker();
+ }
+
+ public function get vOffset():Number
+ {
+ return mVOffset;
+ }
+
+ public function get ruler():RulerBar
+ {
+ return mRuler;
+ }
+
+ public function set markerLeft(inNewLeft:Number):void
+ {
+ if (parent)
+ {
+ if (alignToRight)
+ pos = parent.width - (inNewLeft + hOffset > parent.width ? parent.width : inNewLeft + hOffset) - originPosition;
+ else
+ pos = (inNewLeft < 0 ? 0 : inNewLeft) - originPosition - hOffset;
+ }
+ }
+
+ private var mPos:Number;
+ private var mHOffset:Number;
+ private var mVOffset:Number;
+ private var mRuler:RulerBar = null;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/TabMarker.as
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/TabMarker.as b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/TabMarker.as
new file mode 100644
index 0000000..9b6a31e
--- /dev/null
+++ b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/TabMarker.as
@@ -0,0 +1,86 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package flashx.textLayout.ui.rulers
+{
+ import mx.messaging.management.Attribute;
+
+ import flashx.textLayout.formats.ITabStopFormat;
+
+ public class TabMarker extends RulerMarker implements ITabStopFormat
+ {
+ public function TabMarker(inRuler:RulerBar, tabAttrs:ITabStopFormat)
+ {
+ super(inRuler, 9, 10, -4, 0, Number(tabAttrs.position));
+ mTabKind = tabAttrs.alignment;
+ mAlignmentToken = tabAttrs.decimalAlignmentToken;
+ setStyle("tabkind", mTabKind);
+ }
+
+ public function get alignment():*
+ {
+ return mTabKind;
+ }
+
+ public function set alignment(inAlignment:String):void
+ {
+ mTabKind = inAlignment;
+ setStyle("tabkind", mTabKind);
+ }
+
+ public function get decimalAlignmentToken():*
+ {
+ return mAlignmentToken;
+ }
+
+ public function set decimalAlignmenyToken(inToken:String):void
+ {
+ mAlignmentToken = inToken;
+ }
+
+ public function set decimalAlignmentToken(inToken:String):void
+ {
+ mAlignmentToken = inToken;
+ }
+
+ public function get position():*
+ {
+ return pos;
+ }
+
+ public function set position(inPosition:Object):void
+ {
+ pos = inPosition as Number;
+ }
+
+
+ public function isDifferentPosition(element:*, index:int, arr:Array):Boolean
+ {
+ var other:TabMarker = element as TabMarker;
+ if (other)
+ return other.position != position;
+ else
+ return true;
+ }
+
+
+ private var mTabKind:String;
+ private var mAlignmentToken:String = null;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/TabMarkerSkin.as
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/TabMarkerSkin.as b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/TabMarkerSkin.as
new file mode 100644
index 0000000..a6c4aaf
--- /dev/null
+++ b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/rulers/TabMarkerSkin.as
@@ -0,0 +1,94 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package flashx.textLayout.ui.rulers
+{
+ import flash.text.engine.TabAlignment;
+
+ import mx.skins.RectangularBorder;
+
+ public class TabMarkerSkin extends RectangularBorder
+ {
+ public function TabMarkerSkin()
+ {
+ super();
+ }
+
+ override protected function updateDisplayList(w:Number, h:Number):void
+ {
+ super.updateDisplayList(w, h);
+
+ var tabKind:String = getStyle("tabkind");
+
+ graphics.clear();
+
+ graphics.lineStyle(3, 0xffffff);
+ drawOrnament(tabKind, w, h);
+ graphics.lineStyle(1, 0x000000);
+ drawOrnament(tabKind, w, h);
+
+ if (tabKind == flash.text.engine.TabAlignment.DECIMAL)
+ {
+ graphics.beginFill(0x000000);
+ graphics.drawCircle(w / 2 + 3, (h - w / 2) / 2, .75);
+ graphics.endFill();
+ }
+
+ graphics.beginFill(0x000000);
+ graphics.moveTo(0, h - w / 2);
+ graphics.lineTo(w / 2, h);
+ graphics.lineTo(w, h - w / 2);
+ graphics.lineTo(0, h - w / 2);
+ graphics.endFill();
+
+ var selected:Boolean = getStyle("selected");
+ graphics.lineStyle();
+ graphics.beginFill(0x0000ff, selected ? .3 : 0);
+ graphics.drawRect(0, 0, w, h);
+ graphics.endFill();
+ }
+
+ private function drawOrnament(inKind:String, w:Number, h:Number):void
+ {
+ switch (inKind)
+ {
+ case flash.text.engine.TabAlignment.START:
+ graphics.moveTo(w / 2, h - w / 2);
+ graphics.lineTo(w / 2, 1);
+ graphics.lineTo(w, 1);
+ break;
+ case flash.text.engine.TabAlignment.CENTER:
+ graphics.moveTo(w / 2, h - w / 2);
+ graphics.lineTo(w / 2, 0);
+ break;
+ case flash.text.engine.TabAlignment.END:
+ graphics.moveTo(w / 2, h - w / 2);
+ graphics.lineTo(w / 2, 1);
+ graphics.lineTo(0, 1);
+ break;
+ case flash.text.engine.TabAlignment.DECIMAL:
+ graphics.moveTo(w / 2, h - w / 2);
+ graphics.lineTo(w / 2, 0);
+ break;
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/styles/PopupMenuSkin.as
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/styles/PopupMenuSkin.as b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/styles/PopupMenuSkin.as
new file mode 100644
index 0000000..78b3ccb
--- /dev/null
+++ b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/styles/PopupMenuSkin.as
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package flashx.textLayout.ui.styles
+{
+ import flash.filters.DropShadowFilter;
+
+ import mx.skins.RectangularBorder;
+
+ public class PopupMenuSkin extends RectangularBorder
+ {
+ public function PopupMenuSkin()
+ {
+ super();
+ filters = [new DropShadowFilter(2, 90, 0x000000, .45, 2, 2)];
+ }
+
+ override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
+ {
+ super.updateDisplayList(unscaledWidth, unscaledHeight);
+
+ if (getStyle("cornerRadius") != undefined)
+ mCornerRadius = getStyle("cornerRadius");
+ if (getStyle("backColor") != undefined)
+ mBackColor = getStyle("backColor");
+ if (getStyle("backAlpha") != undefined)
+ mBackAlpha = getStyle("backAlpha");
+ if (getStyle("lineColor") != undefined)
+ mLineColor = getStyle("lineColor");
+ if (getStyle("lineAlpha") != undefined)
+ mLineAlpha = getStyle("lineAlpha");
+ if (getStyle("lineWidth") != undefined)
+ mLineWidth = getStyle("lineWidth");
+
+ graphics.clear();
+ graphics.lineStyle(mLineWidth, mLineColor, mLineAlpha);
+ graphics.beginFill(mBackColor, mBackAlpha);
+ graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
+ graphics.endFill();
+
+ }
+
+ private var mCornerRadius:Number = 0;
+ private var mLineWidth:Number = 1;
+ private var mBackColor:uint = 0x1a1a1a;
+ private var mBackAlpha:Number = 0.9;
+ private var mLineColor:uint = 0xffffff;
+ private var mLineAlpha:Number = 0.15;
+
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/47a67608/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/styles/ScrollbarDownArrowUpSkin.as
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/styles/ScrollbarDownArrowUpSkin.as b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/styles/ScrollbarDownArrowUpSkin.as
new file mode 100644
index 0000000..f2c4e5e
--- /dev/null
+++ b/TourDeFlex/TourDeFlex3/src/spark/tlf/flashx/textLayout/ui/styles/ScrollbarDownArrowUpSkin.as
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flashx.textLayout.ui.styles
+{
+ import mx.skins.RectangularBorder;
+
+ public class ScrollbarDownArrowUpSkin extends RectangularBorder
+ {
+ public function ScrollbarDownArrowUpSkin()
+ {
+ super();
+ }
+
+ override public function get measuredWidth():Number
+ {
+ return 13;
+ }
+
+ override public function get measuredHeight():Number
+ {
+ return 14;
+ }
+
+ override protected function updateDisplayList(w:Number, h:Number):void
+ {
+ super.updateDisplayList(w, h);
+ }
+ }
+}
\ No newline at end of file