http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/CharacterPropertyEditor.as ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/CharacterPropertyEditor.as b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/CharacterPropertyEditor.as new file mode 100644 index 0000000..6581152 --- /dev/null +++ b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/CharacterPropertyEditor.as @@ -0,0 +1,179 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.text.engine.*; + + import flashx.textLayout.formats.TextLayoutFormat; + import flashx.textLayout.tlf_internal; + use namespace tlf_internal; + + public class CharacterPropertyEditor extends DynamicTextPropertyEditor + { + [Embed(source="./assets/bold_icon.png")] + private var boldIcon:Class; + + [Embed(source="./assets/italic_icon.png")] + private var italicIcon:Class; + + [Embed(source="./assets/underline_icon.png")] + private var underlineIcon:Class; + + [Embed(source="./assets/strikethrough_icon.png")] + private var strikethroughIcon:Class; + + [Embed(source="./assets/superscript_icon.png")] + private var superscriptIcon:Class; + + [Embed(source="./assets/subscript_icon.png")] + private var subscriptIcon:Class; + + [Embed(source="./assets/tcy_icon.png")] + private var tcyIcon:Class; + + public function CharacterPropertyEditor() + { + var recipe:XML = + <recipe> + <row> + <editor type="fontPicker" label="$$$/stage/TextEditing/Label/Font=Font:"> + <property name={TextInspectorController.FONT_FAMILY_UIPROP}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/FontLookup=Lookup:"> + <property name={TextInspectorController.FONT_LOOKUP_UIPROP}/> + <choice display="Device" value={flash.text.engine.FontLookup.DEVICE}/> + <choice display="Embedded CFF" value={flash.text.engine.FontLookup.EMBEDDED_CFF}/> + </editor> + </row> + <row> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/Size=Size:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.FONT_SIZE_UIPROP} + minValue={TextLayoutFormat.fontSizeProperty.minValue} + maxValue={TextLayoutFormat.fontSizeProperty.maxValue}/> + </editor> + <editor type="hotnumberunit" label="$$$/stage/TextEditing/Label/Leading=Leading:"> + <property name={TextInspectorController.LINE_HEIGHT_UIPROP}/> + <defaultunit>pix</defaultunit> + <numericunit displayname="%" + min={TextLayoutFormat.lineHeightProperty.minPercentValue} + max={TextLayoutFormat.lineHeightProperty.maxPercentValue} + default="120"/> + <numericunit displayname="pix" + min={TextLayoutFormat.lineHeightProperty.minNumberValue} + max={TextLayoutFormat.lineHeightProperty.maxNumberValue} + default="14" + decimals="1"/> + </editor> + </row> + <row style="toggleButtonRow"> + <editor type="toggleButton" style="toggleIconButton" iconClass="boldIcon" width="17" commit="yes"> + <property name={TextInspectorController.FONT_WEIGHT_UIPROP} falseValue="normal" trueValue="bold"/> + </editor> + <editor type="toggleButton" style="toggleIconButton" iconClass="italicIcon" width="17" commit="yes"> + <property name={TextInspectorController.FONT_STYLE_UIPROP} falseValue="normal" trueValue="italic"/> + </editor> + <editor type="toggleButton" style="toggleIconButton" iconClass="underlineIcon" width="17" commit="yes"> + <property name={TextInspectorController.TEXT_DECORATION_UIPROP} falseValue="none" trueValue="underline"/> + </editor> + <editor type="toggleButton" style="toggleIconButton" iconClass="strikethroughIcon" width="17" commit="yes"> + <property name={TextInspectorController.LINE_THROUGH_UIPROP}/> + </editor> + <editor type="toggleButton" style="toggleIconButton" iconClass="superscriptIcon" width="17" commit="yes"> + <property name={TextInspectorController.BASELINE_SHIFT_SUPER_UIPROP} falseValue="0" trueValue={flashx.textLayout.formats.BaselineShift.SUPERSCRIPT}/> + </editor> + <editor type="toggleButton" style="toggleIconButton" iconClass="subscriptIcon" width="17" commit="yes"> + <property name={TextInspectorController.BASELINE_SHIFT_SUB_UIPROP} falseValue="0" trueValue={flashx.textLayout.formats.BaselineShift.SUBSCRIPT}/> + </editor> + <editor type="toggleButton" style="toggleIconButton" iconClass="tcyIcon" width="17" commit="yes"> + <property name={TextInspectorController.TCY_UIPROP}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/Kerning=Kerning:"> + <property name={TextInspectorController.KERNING_UIPROP}/> + <choice display="On" value={flash.text.engine.Kerning.ON}/> + <choice display="Off" value={flash.text.engine.Kerning.OFF}/> + <choice display="Auto" value={flash.text.engine.Kerning.AUTO}/> + </editor> + </row> + <row> + <editor type="hotnumberunit" label="$$$/stage/TextEditing/Label/Tracking=Track R:"> + <property name={TextInspectorController.TRACKING_RIGHT_UIPROP}/> + <defaultunit>pix</defaultunit> + <numericunit displayname="%" + min={TextLayoutFormat.trackingRightProperty.minPercentValue} + max={TextLayoutFormat.trackingRightProperty.maxPercentValue} + default="0"/> + <numericunit displayname="pix" + min={TextLayoutFormat.trackingRightProperty.minNumberValue} + max={TextLayoutFormat.trackingRightProperty.maxNumberValue} + default="0" + decimals="1"/> + </editor> + </row> + <row> + <editor type="hotnumberunit" label="$$$/stage/TextEditing/Label/Tracking=Track L:"> + <property name={TextInspectorController.TRACKING_LEFT_UIPROP}/> + <defaultunit>pix</defaultunit> + <numericunit displayname="%" + min={TextLayoutFormat.trackingLeftProperty.minPercentValue} + max={TextLayoutFormat.trackingLeftProperty.maxPercentValue} + default="0"/> + <numericunit displayname="pix" + min={TextLayoutFormat.trackingLeftProperty.minNumberValue} + max={TextLayoutFormat.trackingLeftProperty.maxNumberValue} + default="0" + decimals="1"/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/Case=Case:"> + <property name={TextInspectorController.TYPOGRAPHIC_CASE_UIPROP}/> + <choice display="Default" value={flashx.textLayout.formats.TLFTypographicCase.DEFAULT}/> + <choice display="Caps to Small Caps" value={flashx.textLayout.formats.TLFTypographicCase.CAPS_TO_SMALL_CAPS}/> + <choice display="Upper" value={flashx.textLayout.formats.TLFTypographicCase.UPPERCASE}/> + <choice display="Lower" value={flashx.textLayout.formats.TLFTypographicCase.LOWERCASE}/> + <choice display="Lowercase to Small Caps" value={flashx.textLayout.formats.TLFTypographicCase.LOWERCASE_TO_SMALL_CAPS}/> + </editor> + </row> + <row> + <editor type="color" label="$$$/stage/TextEditing/Label/Color=Color:"> + <property name={TextInspectorController.COLOR_UIPROP}/> + </editor> + <editor type="color" label="$$$/stage/TextEditing/Label/BackgroundColor=Background color:"> + <property name={TextInspectorController.BGCOLOR_UIPROP}/> + </editor> + </row> + </recipe>; + + super(recipe); + SetIcon("boldIcon", boldIcon); + SetIcon("italicIcon", italicIcon); + SetIcon("underlineIcon", underlineIcon); + SetIcon("strikethroughIcon", strikethroughIcon); + SetIcon("superscriptIcon", superscriptIcon); + SetIcon("subscriptIcon", subscriptIcon); + SetIcon("tcyIcon", tcyIcon); + } + + } +} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/DynamicTextPropertyEditor.as ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/DynamicTextPropertyEditor.as b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/DynamicTextPropertyEditor.as new file mode 100644 index 0000000..e3a931a --- /dev/null +++ b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/DynamicTextPropertyEditor.as @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 bxf.ui.inspectors.DynamicPropertyEditorBase; + + import mx.events.PropertyChangeEvent; + + public class DynamicTextPropertyEditor extends DynamicPropertyEditorBase + { + public function DynamicTextPropertyEditor(inRecipe:XML) + { + super(inRecipe); + TextInspectorController.Instance().addEventListener(SelectionUpdateEvent.SELECTION_UPDATE, onSelectionUpdate); + addEventListener(DynamicPropertyEditorBase.MODELCHANGED_EVENT, onFormatValueChanged, false, 0, true); + addEventListener(DynamicPropertyEditorBase.MODELEDITED_EVENT, onFormatValueChanged, false, 0, true); + } + + public function set active(inActive:Boolean):void + { + if (mActive != inActive) + { + mActive = inActive; + if (mActive) + TextInspectorController.Instance().forceBroadcastFormats(); + } + } + + public function get active():Boolean + { + return mActive; + } + + private function onSelectionUpdate(e:SelectionUpdateEvent):void + { + if (mActive) + { + reset(); + for (var id:String in e.format) + { + if (e.format[id].length == 1) + properties[id] = e.format[id][0]; + else + properties[id] = e.format[id]; + } + rebuildUI(); + } + } + + private function onFormatValueChanged(e:PropertyChangeEvent):void + { + TextInspectorController.Instance().SetTextProperty(e.property as String, e.newValue); + } + + private var mActive:Boolean = false; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/LinkPropertyEditor.as ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/LinkPropertyEditor.as b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/LinkPropertyEditor.as new file mode 100644 index 0000000..33bb311 --- /dev/null +++ b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/LinkPropertyEditor.as @@ -0,0 +1,50 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + public class LinkPropertyEditor extends DynamicTextPropertyEditor + { + public function LinkPropertyEditor() + { + var recipe:XML = + <recipe> + <row> + <editor type="string" label="$$$/stage/TextEditing/Label/linkURL=URL:" width="150"> + <property name={TextInspectorController.LINK_URL_UIPROP}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/linkTarget=Target:"> + <property name={TextInspectorController.LINK_TARGET_UIPROP}/> + <choice display="_blank" value={"_blank"}/> + <choice display="_self" value={"_self"}/> + <choice display="_parent" value={"_parent"}/> + <choice display="_top" value={"_top"}/> + </editor> + <editor type="checkbox" label="$$$/stage/TextEditing/Label/linkExtend=Extend:"> + <property name={TextInspectorController.LINK_EXTEND_UIPROP}/> + </editor> + </row> + </recipe>; + super(recipe); + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/ParagraphPropertyEditor.as ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/ParagraphPropertyEditor.as b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/ParagraphPropertyEditor.as new file mode 100644 index 0000000..4b8a8cc --- /dev/null +++ b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/ParagraphPropertyEditor.as @@ -0,0 +1,226 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.text.engine.*; + + import flashx.textLayout.formats.Direction; + import flashx.textLayout.formats.FormatValue; + import flashx.textLayout.formats.TextJustify; + import flashx.textLayout.formats.TextLayoutFormat; + import flashx.textLayout.tlf_internal; + import flashx.textLayout.formats.LeadingModel; + use namespace tlf_internal; + + public class ParagraphPropertyEditor extends DynamicTextPropertyEditor + { + [Embed(source="./assets/align_start_icon.png")] + private var alignStartIcon:Class; + + [Embed(source="./assets/align_end_icon.png")] + private var alignEndIcon:Class; + + [Embed(source="./assets/align_left_icon.png")] + private var alignLeftIcon:Class; + + [Embed(source="./assets/align_center_icon.png")] + private var alignCenterIcon:Class; + + [Embed(source="./assets/align_right_icon.png")] + private var alignRightIcon:Class; + + [Embed(source="./assets/align_justify_icon.png")] + private var alignJustifyIcon:Class; + + [Embed(source="./assets/align_last_left_icon.png")] + private var alignLastLeftIcon:Class; + + [Embed(source="./assets/align_last_center_icon.png")] + private var alignLastCenterIcon:Class; + + [Embed(source="./assets/align_last_right_icon.png")] + private var alignLastRightIcon:Class; + + public function ParagraphPropertyEditor() + { + var recipe:XML = + <recipe> + <row> + <editor type="multiIconButton" style="iconButtonGroup" label="$$$/stage/TextEditing/Label/Alignment=Alignment:"> + <property name={TextInspectorController.TEXT_ALIGN_UIPROP}/> + <button icon="alignStartIcon" value="start"/> + <button icon="alignEndIcon" value="end"/> + <button icon="alignLeftIcon" value="left"/> + <button icon="alignCenterIcon" value="center"/> + <button icon="alignRightIcon" value="right"/> + <button icon="alignJustifyIcon" value="justify"/> + </editor> + </row> + <row> + <editor type="multiIconButton" style="iconButtonGroup" label="$$$/stage/TextEditing/Label/LastLine=Last Line:"> + <property name={TextInspectorController.TEXT_ALIGN_LAST_UIPROP}/> + <button icon="alignStartIcon" value="start"/> + <button icon="alignEndIcon" value="end"/> + <button icon="alignLastLeftIcon" value="left"/> + <button icon="alignLastCenterIcon" value="center"/> + <button icon="alignLastRightIcon" value="right"/> + <button icon="alignJustifyIcon" value="justify"/> + </editor> + </row> + <row> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/Indent=Text Indent:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.TEXT_INDENT_UIPROP} + minValue={TextLayoutFormat.textIndentProperty.minValue} + maxValue={TextLayoutFormat.textIndentProperty.maxValue}/> + </editor> + </row> + <row> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/Left=Start Indent:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.START_INDENT_UIPROP} + minValue={TextLayoutFormat.paragraphStartIndentProperty.minValue} + maxValue={TextLayoutFormat.paragraphStartIndentProperty.maxValue}/> + </editor> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/Right=End:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.END_INDENT_UIPROP} + minValue={TextLayoutFormat.paragraphEndIndentProperty.minValue} + maxValue={TextLayoutFormat.paragraphEndIndentProperty.maxValue}/> + </editor> + </row> + <row> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/Before=Space Before:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.SPACE_BEFORE_UIPROP} + minValue={TextLayoutFormat.paragraphSpaceBeforeProperty.minValue} + maxValue={TextLayoutFormat.paragraphSpaceBeforeProperty.maxValue}/> + </editor> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/After=After:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.SPACE_AFTER_UIPROP} + minValue={TextLayoutFormat.paragraphSpaceAfterProperty.minValue} + maxValue={TextLayoutFormat.paragraphSpaceAfterProperty.maxValue}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/justRule=Just. Rule:"> + <property name={TextInspectorController.JUSTIFICATION_RULE_UIPROP}/> + <choice display="Auto" value={FormatValue.AUTO}/> + <choice display="Roman" value={flashx.textLayout.formats.JustificationRule.SPACE}/> + <choice display="East Asian" value={flashx.textLayout.formats.JustificationRule.EAST_ASIAN}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/textJust=Text Justify:"> + <property name={TextInspectorController.TEXT_JUSTIFY_UIPROP}/> + <choice display="Inter-word" value={flashx.textLayout.formats.TextJustify.INTER_WORD}/> + <choice display="Distribute" value={flashx.textLayout.formats.TextJustify.DISTRIBUTE}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/justStyle=Just. Style:"> + <property name={TextInspectorController.JUSTIFICATION_STYLE_UIPROP}/> + <choice display="Auto" value={FormatValue.AUTO}/> + <choice display="Prioritize Least Adjustment" value={flash.text.engine.JustificationStyle.PRIORITIZE_LEAST_ADJUSTMENT}/> + <choice display="Push in Kinsoku" value={flash.text.engine.JustificationStyle.PUSH_IN_KINSOKU}/> + <choice display="Push out Only" value={flash.text.engine.JustificationStyle.PUSH_OUT_ONLY}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/direction=Direction:"> + <property name={TextInspectorController.DIRECTION_UIPROP}/> + <choice display="Left to Right" value={flashx.textLayout.formats.Direction.LTR}/> + <choice display="Right to Left" value={flashx.textLayout.formats.Direction.RTL}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/leadingModel=Leading Model:"> + <property name={TextInspectorController.LEADING_MODEL_UIPROP}/> + <choice display="Roman; Up" value={flashx.textLayout.formats.LeadingModel.ROMAN_UP}/> + <choice display="Ideographic Top; Up" value={flashx.textLayout.formats.LeadingModel.IDEOGRAPHIC_TOP_UP}/> + <choice display="Ideographic Center; Up" value={flashx.textLayout.formats.LeadingModel.IDEOGRAPHIC_CENTER_UP}/> + <choice display="Ideographic Top; Down" value={flashx.textLayout.formats.LeadingModel.IDEOGRAPHIC_TOP_DOWN}/> + <choice display="Ideographic Center; Down" value={flashx.textLayout.formats.LeadingModel.IDEOGRAPHIC_CENTER_DOWN}/> + <choice display="Ascent-Descent; Up" value={flashx.textLayout.formats.LeadingModel.ASCENT_DESCENT_UP}/> + <choice display="Approximate TextField" value={flashx.textLayout.formats.LeadingModel.APPROXIMATE_TEXT_FIELD}/> + <choice display="Auto" value={flashx.textLayout.formats.LeadingModel.AUTO}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/Lacale=Locale:"> + <property name={TextInspectorController.PARA_LOCALE_UIPROP}/> + <choice display="Arabic" value="ar"/>, + <choice display="Bengali" value="bn"/>, + <choice display="Bulgarian" value="bg"/>, + <choice display="Catalan" value="ca"/>, + <choice display="Chinese, Simplified (China)" value="zh-CN"/>, + <choice display="Chinese, Traditional (Taiwan)" value="zh-TW"/>, + <choice display="Croatian" value="hr"/>, + <choice display="Czech" value="cs"/>, + <choice display="Danish" value="da"/>, + <choice display="Dutch" value="nl"/>, + <choice display="English" value="en"/>, + <choice display="Estonian" value="et"/>, + <choice display="Finnish" value="fi"/>, + <choice display="French" value="fr"/>, + <choice display="German" value="de"/>, + <choice display="Greek" value="el"/>, + <choice display="Gujarati" value="gu"/>, + <choice display="Hindi" value="hi"/>, + <choice display="Hebrew" value="he"/>, + <choice display="Hungarian" value="hu"/>, + <choice display="Italian" value="it"/>, + <choice display="Japanese" value="ja"/>, + <choice display="Korean" value="ko"/>, + <choice display="Latvian" value="lv"/>, + <choice display="Lithuanian" value="lt"/>, + <choice display="Marathi" value="mr"/>, + <choice display="Norwegian" value="no"/>, + <choice display="Persian" value="fa"/>, + <choice display="Polish" value="pl"/>, + <choice display="Portuguese" value="pt"/>, + <choice display="Punjabi" value="pa"/>, + <choice display="Romanian" value="ro"/>, + <choice display="Russian" value="ru"/>, + <choice display="Slovak" value="sk"/>, + <choice display="Slovenian" value="sl"/>, + <choice display="Spanish" value="es"/>, + <choice display="Swedish" value="sv"/>, + <choice display="Tamil" value="ta"/>, + <choice display="Telugu" value="te"/>, + <choice display="Thai" value="th"/>, + <choice display="Turkish" value="tr"/>, + <choice display="Ukrainian" value="uk"/>, + <choice display="Urdu" value="ur"/>, + <choice display="Vietnamese" value="vi"/> + </editor> + </row> + </recipe>; + + super(recipe); + + SetIcon("alignStartIcon", alignStartIcon); + SetIcon("alignEndIcon", alignEndIcon); + SetIcon("alignLeftIcon", alignLeftIcon); + SetIcon("alignCenterIcon", alignCenterIcon); + SetIcon("alignRightIcon", alignRightIcon); + SetIcon("alignJustifyIcon", alignJustifyIcon); + SetIcon("alignLastLeftIcon", alignLastLeftIcon); + SetIcon("alignLastCenterIcon", alignLastCenterIcon); + SetIcon("alignLastRightIcon", alignLastRightIcon); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/SelectionUpdateEvent.as ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/SelectionUpdateEvent.as b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/SelectionUpdateEvent.as new file mode 100644 index 0000000..f8bde2f --- /dev/null +++ b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/SelectionUpdateEvent.as @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.Event; + + public class SelectionUpdateEvent extends Event + { + public static const SELECTION_UPDATE:String = "selectionUpdate"; + + public function SelectionUpdateEvent(inFormat:Object) + { + super(SELECTION_UPDATE); + mFormat = inFormat; + } + + public function get format():Object + { + return mFormat; + } + + private var mFormat:Object; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TabPropertyEditor.as ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TabPropertyEditor.as b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TabPropertyEditor.as new file mode 100644 index 0000000..4118857 --- /dev/null +++ b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TabPropertyEditor.as @@ -0,0 +1,64 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 bxf.ui.inspectors.DynamicPropertyEditorBase; + + import flash.text.engine.*; + + import flashx.textLayout.formats.TabStopFormat; + import flashx.textLayout.tlf_internal; + use namespace tlf_internal; + + public class TabPropertyEditor extends DynamicPropertyEditorBase + { + public function TabPropertyEditor() + { + var recipe:XML = + <recipe> + <row> + <editor type="checkbox" label="$$$/stage/TextEditing/Label/showRuler=Show Ruler" labelSide="right"> + <property name="rulervisible"/> + </editor> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/tabPosition=Position:" decimals="1" enforcePrecision="no"> + <property name={TabStopFormat.positionProperty.name} + minValue={TabStopFormat.positionProperty.minValue} + maxValue={TabStopFormat.positionProperty.maxValue}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/tabType=Tab Type:"> + <property name={TabStopFormat.alignmentProperty.name}/> + <choice display="Start" value={flash.text.engine.TabAlignment.START}/> + <choice display="Center" value={flash.text.engine.TabAlignment.CENTER}/> + <choice display="End" value={flash.text.engine.TabAlignment.END}/> + <choice display="Align" value={flash.text.engine.TabAlignment.DECIMAL}/> + </editor> + <editor type="string" label="$$$/stage/TextEditing/Label/tabAlign=Align to:" width="50"> + <property name={TabStopFormat.decimalAlignmentTokenProperty.name}/> + </editor> + </row> + </recipe>; + + super(recipe); + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextContainerPropertyEditor.as ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextContainerPropertyEditor.as b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextContainerPropertyEditor.as new file mode 100644 index 0000000..36d62f8 --- /dev/null +++ b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextContainerPropertyEditor.as @@ -0,0 +1,151 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.text.engine.*; + + import flashx.textLayout.formats.FormatValue; + import flashx.textLayout.formats.TextLayoutFormat; + import flashx.textLayout.tlf_internal; + use namespace tlf_internal; + + public class TextContainerPropertyEditor extends DynamicTextPropertyEditor + { + [Embed(source="./assets/cont_align_top_icon.png")] + private var contAlignTopIcon:Class; + + [Embed(source="./assets/cont_align_middle_icon.png")] + private var contAlignMiddleIcon:Class; + + [Embed(source="./assets/cont_align_bottom_icon.png")] + private var contAlignBottomIcon:Class; + + [Embed(source="./assets/cont_align_justify_icon.png")] + private var contAlignJustifyIcon:Class; + + public function TextContainerPropertyEditor() + { + var recipe:XML = + <recipe> + <row> + <editor type="multiIconButton" style="iconButtonGroup" label="$$$/stage/TextEditing/Label/Container/Alignment=Alignment:"> + <property name={TextInspectorController.VERTICAL_ALIGN_UIPROP}/> + <button icon="contAlignTopIcon" value="top"/> + <button icon="contAlignMiddleIcon" value="middle"/> + <button icon="contAlignBottomIcon" value="bottom"/> + <button icon="contAlignJustifyIcon" value="justify"/> + </editor> + </row> + <row> + <editor type="hotnumberunit" label="$$$/stage/TextEditing/Label/NumColumns=Columns:"> + <property name={TextInspectorController.COLUMN_COUNT_UIPROP}/> + <defaultunit>count</defaultunit> + <numericunit displayname="count" + min={TextLayoutFormat.columnCountProperty.minValue} + max={TextLayoutFormat.columnCountProperty.maxValue} + default="1"/> + <enumval displayname="Auto" value={flashx.textLayout.formats.FormatValue.AUTO}/> + </editor> + </row> + <row> + <editor type="hotnumberunit" label="$$$/stage/TextEditing/Label/ColumnWidth=Column Width:"> + <property name={TextInspectorController.COLUMN_WIDTH_UIPROP}/> + <defaultunit>pix</defaultunit> + <numericunit displayname="pix" + min={TextLayoutFormat.columnWidthProperty.minValue} + max={TextLayoutFormat.columnWidthProperty.maxValue} + default="200"/> + <enumval displayname="Auto" value={flashx.textLayout.formats.FormatValue.AUTO}/> + </editor> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/ColumnGap=Gap:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.COLUMN_GAP_UIPROP} + minValue={TextLayoutFormat.columnGapProperty.minValue} + maxValue={TextLayoutFormat.columnGapProperty.maxValue}/> + </editor> + </row> + <row label="$$$/stage/TextEditing/Label/ContainerGeometry=Geometry:"/> + <row> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/PaddingLeft=Left:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.PADDING_LEFT_UIPROP} + minValue={TextLayoutFormat.paddingLeftProperty.minValue} + maxValue={TextLayoutFormat.paddingLeftProperty.maxValue}/> + </editor> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/PaddingTop=Top:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.PADDING_TOP_UIPROP} + minValue={TextLayoutFormat.paddingTopProperty.minValue} + maxValue={TextLayoutFormat.paddingTopProperty.maxValue}/> + </editor> + </row> + <row> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/PaddingRight=Right:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.PADDING_RIGHT_UIPROP} + minValue={TextLayoutFormat.paddingRightProperty.minValue} + maxValue={TextLayoutFormat.paddingRightProperty.maxValue}/> + </editor> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/PaddingBottom=Bottom:" decimals="1" enforcePrecision="no"> + <property name={TextInspectorController.PADDING_BOTTOM_UIPROP} + minValue={TextLayoutFormat.paddingBottomProperty.minValue} + maxValue={TextLayoutFormat.paddingBottomProperty.maxValue}/> + </editor> + </row> + <row> + <editor type="hotnumberunit" label="$$$/stage/TextEditing/Label/FirstBaseline=First Line Offset:"> + <property name={TextInspectorController.FIRST_BASELINE_UIPROP}/> + <defaultunit>pix</defaultunit> + <numericunit displayname="pix" + min={TextLayoutFormat.firstBaselineOffsetProperty.minValue} + max={TextLayoutFormat.firstBaselineOffsetProperty.maxValue} + default="1"/> + <enumval displayname="Auto" value={flashx.textLayout.formats.BaselineOffset.AUTO}/> + <enumval displayname="Ascent" value={flashx.textLayout.formats.BaselineOffset.ASCENT}/> + <enumval displayname="Line Height" value={flashx.textLayout.formats.BaselineOffset.LINE_HEIGHT}/> + </editor> + </row> + <!-- <row label="$$$/stage/TextEditing/Label/Border=Border:"> + <editor type="combo" label="$$$/stage/TextEditing/Label/BorderStyle=Style:"> + <property name={TextInspectorController.BORDER_STYLE_UIPROP}/> + <choice display="None" value={text.BorderStyle.NONE}/> + <choice display="Solid" value={text.BorderStyle.SOLID}/> + <choice display="Innie" value={text.BorderStyle.INSET}/> + <choice display="Outie" value={text.BorderStyle.OUTSET}/> + </editor> + </row> + <row> + <editor type="hotnumber" label="$$$/stage/TextEditing/Label/BorderThickness=Thickness:" decimals="0" enforcePrecision="yes"> + <property name={TextInspectorController.BORDER_THICKNESS_UIPROP} + minValue={TextLayoutFormat.borderThicknessProperty.minValue} + maxValue={TextLayoutFormat.borderThicknessProperty.maxValue}/> + </editor> + <editor type="color" label="$$$/stage/TextEditing/Label/BorderColor=Color:"> + <property name={TextInspectorController.BORDER_COLOR_UIPROP}/> + </editor> + </row> --> + </recipe>; + + super(recipe); + + SetIcon("contAlignTopIcon", contAlignTopIcon); + SetIcon("contAlignMiddleIcon", contAlignMiddleIcon); + SetIcon("contAlignBottomIcon", contAlignBottomIcon); + SetIcon("contAlignJustifyIcon", contAlignJustifyIcon); + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextFlowPropertyEditor.as ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextFlowPropertyEditor.as b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextFlowPropertyEditor.as new file mode 100644 index 0000000..9b9530a --- /dev/null +++ b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextFlowPropertyEditor.as @@ -0,0 +1,71 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flashx.textLayout.formats.BlockProgression; + import flashx.textLayout.formats.LineBreak; + + public class TextFlowPropertyEditor extends DynamicTextPropertyEditor + { + public function TextFlowPropertyEditor() + { + var recipe:XML = + <recipe> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/LineProgression=Orientation:"> + <property name={TextInspectorController.BLOCK_PROGRESSION_UIPROP}/> + <choice display="Horizontal" value={flashx.textLayout.formats.BlockProgression.TB}/> + <choice display="Vertical" value={flashx.textLayout.formats.BlockProgression.RL}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/direction=Direction:"> + <property name={TextInspectorController.FLOW_DIRECTION_UIPROP}/> + <choice display="Left to Right" value={flashx.textLayout.formats.Direction.LTR}/> + <choice display="Right to Left" value={flashx.textLayout.formats.Direction.RTL}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/Linebreak=Line Breaks:"> + <property name={TextInspectorController.LINE_BREAK_UIPROP}/> + <choice display="Auto Line Wrap" value={flashx.textLayout.formats.LineBreak.TO_FIT}/> + <choice display="Hard Breaks Only" value={flashx.textLayout.formats.LineBreak.EXPLICIT}/> + </editor> + </row> + <row> + <editor type="combo" label="$$$/stage/TextEditing/Label/vertScroll=V. Scroll:"> + <property name={TextInspectorController.VERTICAL_SCROLL_UIPROP}/> + <choice display="Off" value="off"/> + <choice display="On" value="on"/> + <choice display="Auto" value="auto"/> + </editor> + <editor type="combo" label="$$$/stage/TextEditing/Label/horzScroll=H. Scroll:"> + <property name={TextInspectorController.HORIZONTAL_SCROLL_UIPROP}/> + <choice display="Off" value="off"/> + <choice display="On" value="on"/> + <choice display="Auto" value="auto"/> + </editor> + </row> + </recipe>; + super(recipe); + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextInspectorController.as ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextInspectorController.as b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/TextInspectorController.as new file mode 100644 index 0000000..3bf6f6a --- /dev/null +++ b/tourdeflexmodules/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-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_center_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_center_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_center_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_end_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_end_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_end_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_justify_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_justify_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_justify_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_center_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_center_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_center_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_left_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_left_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_left_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_right_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_right_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_last_right_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_left_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_left_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_left_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_right_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_right_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_right_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_start_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_start_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/align_start_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/bold_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/bold_icon.png b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/bold_icon.png new file mode 100644 index 0000000..cef2c4b Binary files /dev/null and b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/bold_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_bottom_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_bottom_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_bottom_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_justify_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_justify_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_justify_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_middle_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_middle_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_middle_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_top_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_top_icon.png b/tourdeflexmodules/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/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/cont_align_top_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/italic_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/italic_icon.png b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/italic_icon.png new file mode 100644 index 0000000..9bcce71 Binary files /dev/null and b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/italic_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/strikethrough_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/strikethrough_icon.png b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/strikethrough_icon.png new file mode 100644 index 0000000..2d4e528 Binary files /dev/null and b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/strikethrough_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/subscript_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/subscript_icon.png b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/subscript_icon.png new file mode 100644 index 0000000..7ee2a86 Binary files /dev/null and b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/subscript_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/superscript_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/superscript_icon.png b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/superscript_icon.png new file mode 100644 index 0000000..210f933 Binary files /dev/null and b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/superscript_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/tcy_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/tcy_icon.png b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/tcy_icon.png new file mode 100644 index 0000000..86797f1 Binary files /dev/null and b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/tcy_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/underline_icon.png ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/underline_icon.png b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/underline_icon.png new file mode 100644 index 0000000..355ac65 Binary files /dev/null and b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/inspectors/assets/underline_icon.png differ http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarker.as ---------------------------------------------------------------------- diff --git a/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarker.as b/tourdeflexmodules/src/spark/tlf/flashx/textLayout/ui/rulers/ParagraphPropertyMarker.as new file mode 100644 index 0000000..b5f4327 --- /dev/null +++ b/tourdeflexmodules/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