OSDN Git Service

互換性のないメソッドをいつか廃止した
[fooeditengine/FooEditEngine.git] / Core / EditView.cs
index fa9a17c..af89761 100644 (file)
@@ -277,7 +277,7 @@ namespace FooEditEngine
                     {
                         if (this.LayoutLines.FoldingCollection.IsHidden(lineIndex))
                             continue;
-                        if (foldingData.IsFirstLine(this.LayoutLines, i))
+                        if (foldingData.IsFirstLine(this.LayoutLines, i) && foldingData.End >= lineIndex + lineLength)
                             render.DrawFoldingMark(foldingData.Expand, this.PageBound.X + this.GetRealtiveX(AreaType.FoldingArea), pos.Y);
                     }
 
@@ -474,7 +474,7 @@ namespace FooEditEngine
                 return;
             IEditorRender render = (IEditorRender)base.render;
             Point p = this.CaretLocation;
-            double height = this.LayoutLines.GetLayout(this.Document.CaretPostion.row).Height;
+            double height = this.LayoutLines.GetLineHeight(this.Document.CaretPostion);
             double width = this.render.TextArea.Width;
             render.FillRectangle(new Rectangle(this.PageBound.X + this.render.TextArea.X, this.CaretLocation.Y, width, height), FillRectType.LineMarker);
         }
@@ -489,7 +489,7 @@ namespace FooEditEngine
             double width = layout.GetWidthFromIndex(this.Document.CaretPostion.col);
             if (width == 0.0)
                 width = this.CaretWidthOnInsertMode;
-            double height = this.render.emSize.Height;
+            double height = this.LayoutLines.GetLineHeight(this.Document.CaretPostion);
             Rectangle updateRect = new Rectangle(
                 this.CaretLocation.X,
                 this.CaretLocation.Y,
@@ -605,6 +605,9 @@ namespace FooEditEngine
         {
             if (tp.row < this.Src.Row)
                 return Rectangle.Empty;
+            //画面外にある時は計算する必要がそもそもない
+            if (tp.row - this.Src.Row > this.LineCountOnScreen)
+                return Rectangle.Empty;
             double radius = width / 2;
             Point point = this.GetPostionFromTextPoint(tp);
             double lineHeight = this.render.emSize.Height;
@@ -741,7 +744,7 @@ namespace FooEditEngine
                 //キャレットのY座標を求める
                 double lineHeight = this.render.emSize.Height;
                 double caret_y = this.Src.OffsetY;  //src.rowからキャレット位置
-                double alignedHeight = PhyLineCountOnScreen * this.render.emSize.Height;
+                double alignedHeight = PhyLineCountOnScreen * lineHeight - lineHeight;
                 for (int i = this.Src.Row; i < tp.row; i++)
                 {
                     int lineHeadIndex = this.LayoutLines.GetIndexFromLineNumber(i);
@@ -955,30 +958,6 @@ namespace FooEditEngine
             this.LineCountOnScreenWithInVisible = Math.Max(i - this.Src.Row - 1, 0);
         }
 
-        public override void CalculateWhloeViewPort()
-        {
-            if(this.Document.LineBreak == LineBreakMethod.None)
-            {
-                this._LongestHeight = this.LayoutLines.Count * this.render.emSize.Height;
-                //CalculateLineCountOnScreenで最小幅は計算する
-                return;
-            }
-            double width = 0, height = 0;
-            for(int i = 0; i < this.LayoutLines.Count; i++)
-            {
-                int lineHeadIndex = this.LayoutLines.GetIndexFromLineNumber(i);
-                int lineLength = this.LayoutLines.GetLengthFromLineNumber(i);
-
-                if (this.LayoutLines.FoldingCollection.IsHidden(lineHeadIndex) && i < this.LayoutLines.Count - 1)
-                    continue;
-
-                ITextLayout layout = this.LayoutLines.GetLayout(i);
-                if (width > this._LongestWidth)
-                    this._LongestWidth = width;
-                height += layout.Height;
-            }
-        }
-
         void SetCaretPostion(double x, double y)
         {
             this.CaretLocation = new Point(x + this.PageBound.X, y + this.PageBound.Y);