Exemplo n.º 1
0
        public void GetFoldingItem()
        {
            FoldingCollection collection = new FoldingCollection();

            collection.Add(new FoldingItem(0, 10));
            collection.Add(new FoldingItem(1, 5));
            collection.Add(new FoldingItem(11, 12));
            FoldingItem item = collection.Get(2, 1);

            Assert.IsTrue(item.Start == 1 && item.End == 5);
        }
Exemplo n.º 2
0
        public void GetFarestFoldingItem()
        {
            FoldingCollection collection = new FoldingCollection();
            FoldingItem       item       = new FoldingItem(0, 10);

            item.Expand = false;
            collection.Add(item);
            collection.Add(new FoldingItem(1, 5));
            collection.Add(new FoldingItem(11, 12));
            item = collection.GetFarestHiddenFoldingData(2, 1);
            Assert.IsTrue(item.Start == 0 && item.End == 10);
        }
Exemplo n.º 3
0
        public void HasParrentTest()
        {
            FoldingCollection collection = new FoldingCollection();
            FoldingItem       item       = new FoldingItem(0, 10, false);

            collection.Add(item);
            FoldingItem item1 = new FoldingItem(1, 5);

            collection.Add(item1);
            Assert.IsTrue(collection.IsHasParent(item1));
            Assert.IsTrue(!collection.IsHasParent(item));
        }
Exemplo n.º 4
0
        public void CollapseFoldingItem()
        {
            FoldingCollection collection = new FoldingCollection();
            FoldingItem       newItem    = new FoldingItem(0, 10);

            collection.Add(newItem);
            collection.Add(new FoldingItem(1, 5));
            collection.Add(new FoldingItem(11, 12));
            collection.Collapse(newItem);
            foreach (FoldingItem item in collection.GetRange(0, 10))
            {
                Assert.IsFalse(item.Expand);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// MouseDownイベントを発生させます
        /// </summary>
        /// <param name="e">インベントデータ</param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            TextPoint tp = this.View.GetTextPointFromPostion(e.Location);

            if (tp == TextPoint.Null)
            {
                return;
            }
            int index = this.View.LayoutLines.GetIndexFromTextPoint(tp);

            FooMouseEventArgs mouseEvent = new FooMouseEventArgs(index, e.Button, e.Clicks, e.X, e.Y, e.Delta);

            base.OnMouseDown(mouseEvent);

            if (mouseEvent.Handled)
            {
                return;
            }

            if (e.Button == MouseButtons.Left)
            {
                FoldingItem foldingData = this.View.HitFoldingData(e.Location.X, tp.row);
                if (foldingData != null)
                {
                    if (foldingData.Expand)
                    {
                        this.View.LayoutLines.FoldingCollection.Collapse(foldingData);
                    }
                    else
                    {
                        this.View.LayoutLines.FoldingCollection.Expand(foldingData);
                    }
                    this.Controller.JumpCaret(foldingData.Start, false);
                }
                else
                {
                    this.Controller.JumpCaret(tp.row, tp.col, false);
                }
                this.View.IsFocused = true;
                this.Focus();
                this.Refresh();
            }
        }