示例#1
0
 public Controller(Document doc, EditView view)
 {
     this.Document = doc;
     this.View     = view;
     this.View.PageBoundChanged += View_PageBoundChanged;
     //this.Document.Clear();
 }
示例#2
0
        public ITextRangeProvider GetCaretRange(out bool isActive)
        {
            EditView view = this.fooTextBox.View;
            Document doc  = this.fooTextBox.Document;

            isActive = true;
            int index  = view.GetIndexFromLayoutLine(doc.CaretPostion);
            int length = 1;

            if (index == this.fooTextBox.Document.Length)
            {
                length = 0;
            }

            return(new FooTextBoxRangeProvider(this.fooTextBox, index, length, this));
        }
示例#3
0
        public ITextRangeProvider[] GetVisibleRanges()
        {
            ITextRangeProvider[] ret = new ITextRangeProvider[1];
            if (this.fooTextBox.LayoutLineCollection.Count == 0)
            {
                ret[0] = new FooTextBoxRangeProvider(this.fooTextBox, 0, 0, this);
            }
            else
            {
                EditView view = this.fooTextBox.View;

                int startIndex = view.GetIndexFromLayoutLine(new TextPoint(view.Src.Row, 0));
                int endIndex   = view.GetIndexFromLayoutLine(new TextPoint(view.Src.Row + view.LineCountOnScreen, 0));
                ret[0] = new FooTextBoxRangeProvider(this.fooTextBox, startIndex, endIndex - startIndex, this);
            }
            return(ret);
        }
 public static bool ScrollToCompstionUpdated(TextStoreBase textStore, EditView view, int start, int end)
 {
     if (textStore.IsLocked() == false)
     {
         return(false);
     }
     using (Unlocker locker = textStore.LockDocument(false))
     {
         foreach (TextDisplayAttribute attr in textStore.EnumAttributes(start, end))
         {
             if (attr.attribute.bAttr == TF_DA_ATTR_INFO.TF_ATTR_TARGET_CONVERTED)
             {
                 if (view.AdjustSrc(attr.startIndex))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
示例#5
0
        public ITextRangeProvider RangeFromPoint(System.Windows.Point screenLocation)
#endif
        {
            Point    pt   = Util.GetClientPoint(screenLocation, fooTextBox);
            EditView view = this.fooTextBox.View;

            TextPoint tp = view.GetTextPointFromPostion(pt);

            if (tp == TextPoint.Null)
            {
                tp = new TextPoint(view.Src.Row, 0);
            }
            int index  = view.GetIndexFromLayoutLine(tp);
            int length = 1;

            if (index == this.fooTextBox.Document.Length)
            {
                length = 0;
            }

            return(new FooTextBoxRangeProvider(this.fooTextBox, index, length, this));
        }
示例#6
0
 public void DrawContent(EditView view, bool isEnabled, Rectangle updateRect)
 {
 }
示例#7
0
 public void MoveByIndex(EditView view, int index)
 {
     this.Rectangle = view.GetRectFromIndex(index, Gripper.GripperWidth, Gripper.GripperWidth);
     this.HitArea   = view.GetRectFromIndex(index, Gripper.HitAreaWidth, Gripper.HitAreaWidth);
 }
示例#8
0
 public void Move(EditView view, TextPoint tp)
 {
     this.Rectangle = view.GetRectFromTextPoint(tp, Gripper.GripperWidth, Gripper.GripperWidth);
     this.HitArea   = view.GetRectFromTextPoint(tp, Gripper.HitAreaWidth, Gripper.HitAreaWidth);
 }