OSDN Git Service

コンパイルエラーを修正した
[fooeditengine/FooEditEngine.git] / Core / EditView.cs
index 24600b7..6a266f0 100644 (file)
@@ -35,7 +35,7 @@ namespace FooEditEngine
     {
         internal const float LineMarkerThickness = 2;
         long tickCount;
-        bool _CaretBlink, _HideRuler = true;
+        bool _CaretBlink;
         internal const int LineNumberLength = 6;
         const int UpdateAreaPaddingWidth = 2;
         const int UpdateAreaWidth = 4;
@@ -275,12 +275,10 @@ namespace FooEditEngine
 
                     if (foldingData != null)
                     {
-                        if ((!this.LayoutLines.FoldingCollection.IsHasParent(foldingData) || 
-                             !this.LayoutLines.FoldingCollection.IsParentHidden(foldingData))
-                            && foldingData.IsFirstLine(this.LayoutLines, i))
-                            render.DrawFoldingMark(foldingData.Expand, this.PageBound.X + this.GetRealtiveX(AreaType.FoldingArea), pos.Y);
                         if (this.LayoutLines.FoldingCollection.IsHidden(lineIndex))
                             continue;
+                        if (foldingData.IsFirstLine(this.LayoutLines, i))
+                            render.DrawFoldingMark(foldingData.Expand, this.PageBound.X + this.GetRealtiveX(AreaType.FoldingArea), pos.Y);
                     }
 
                     if (this.Document.DrawLineNumber)
@@ -290,7 +288,7 @@ namespace FooEditEngine
 
                     DrawUpdateArea(i, pos.Y);
 
-                    pos.Y += this.LayoutLines.GetLayout(i).Height;
+                    pos.Y += layout.Height;
                     //pos.Y += this.render.emSize.Height;
                 }
 
@@ -312,13 +310,17 @@ namespace FooEditEngine
                     if (pos.Y > endposy)
                         break;
 
-                    var selectRange = from s in this.Selections.Get(lineIndex, lineLength)
-                                      let n = Util.ConvertAbsIndexToRelIndex(s, lineIndex, lineLength)
-                                      select n;
+                    FoldingItem foldingData = this.LayoutLines.FoldingCollection.Get(lineIndex, lineLength);
 
-                    this.render.DrawOneLine(this.LayoutLines, i, pos.X, pos.Y, selectRange);
+                    if (foldingData != null)
+                    {
+                        if (this.LayoutLines.FoldingCollection.IsHidden(lineIndex))
+                            continue;
+                    }
+
+                    this.render.DrawOneLine(this.Document, this.LayoutLines, i, pos.X, pos.Y);
 
-                    pos.Y += this.LayoutLines.GetLayout(i).Height;
+                    pos.Y += layout.Height;
                     //pos.Y += this.render.emSize.Height;
                 }
 
@@ -442,8 +444,9 @@ namespace FooEditEngine
             IEditorRender render = (IEditorRender)base.render;
 
             int row = this.Document.CaretPostion.row;
-            double lineHeight = this.LayoutLines.GetLayout(row).Height;
-            double charWidth = this.LayoutLines.GetLayout(row).GetWidthFromIndex(this.Document.CaretPostion.col);
+            ITextLayout layout = this.LayoutLines.GetLayout(row);
+            double lineHeight = layout.Height;
+            double charWidth = layout.GetWidthFromIndex(this.Document.CaretPostion.col);
 
             if (this.InsertMode || charWidth == 0)
             {
@@ -516,11 +519,12 @@ namespace FooEditEngine
             if (this.LayoutLines.Count == 0)
                 return tp;
 
+            //表示領域から探索を始めるのでパディングの分だけ引く
             p.Y -= this.render.TextArea.Y;
 
             int lineHeadIndex, lineLength;
 
-            if(p.Y >= this.render.TextArea.TopLeft.Y)
+            if(p.Y >= 0)
             {
                 double y = 0;
                 tp.row = this.LayoutLines.Count - 1;
@@ -541,9 +545,8 @@ namespace FooEditEngine
                     }
                     y += height;
                 }
-            }else
-            {
-                double y = this.render.TextArea.TopLeft.Y;
+            }else{
+                double y = 0;
                 tp.row = 0;
                 for (int i = this.Src.Row; i >= 0; i--)
                 {
@@ -683,7 +686,8 @@ namespace FooEditEngine
                 }
             }
 
-            this.Document.CaretPostion = new TextPoint(row, col);
+            //イベント呼び出しの再入防止のため
+            this.Document.SetCaretPostionWithoutEvent(new TextPoint(row, col));
         }
 
         /// <summary>