OSDN Git Service

ウィンドウの幅が変わったら折り返しの幅も再計算するようにした
authortest <test@yahoo.co.jp>
Mon, 4 Jan 2021 05:28:47 +0000 (14:28 +0900)
committertest <test@yahoo.co.jp>
Mon, 4 Jan 2021 05:28:47 +0000 (14:28 +0900)
Core/Document.cs
Core/ViewBase.cs
WPF/FooEditEngine/FooPrintText.cs
WPF/FooEditEngine/FooTextBox.cs

index 9c5932f..526bfec 100644 (file)
@@ -754,11 +754,19 @@ namespace FooEditEngine
         /// <summary>
         /// レイアウト行をすべて破棄し、再度レイアウトを行う
         /// </summary>
-        public void PerformLayout()
+        /// <param name="quick">真の場合、レイアウトキャッシュのみ再構築します</param>
+        public void PerformLayout(bool quick = true)
         {
-            this.LayoutLines.IsFrozneDirtyFlag = true;
-            this.FireUpdate(new DocumentUpdateEventArgs(UpdateType.RebuildLayout, -1, -1, -1));
-            this.LayoutLines.IsFrozneDirtyFlag = false;
+            if (quick)
+            {
+                this.LayoutLines.ClearLayoutCache();
+            }
+            else
+            {
+                this.LayoutLines.IsFrozneDirtyFlag = true;
+                this.FireUpdate(new DocumentUpdateEventArgs(UpdateType.RebuildLayout, -1, -1, -1));
+                this.LayoutLines.IsFrozneDirtyFlag = false;
+            }
             if (this.PerformLayouted != null)
                 this.PerformLayouted(this, null);
         }
@@ -1163,7 +1171,7 @@ namespace FooEditEngine
             }
             finally
             {
-                this.PerformLayout();
+                this.PerformLayout(false);
                 if (this.LoadProgress != null)
                     this.LoadProgress(this, new ProgressEventArgs(ProgressState.Complete));
             }
index 4fad84e..26dda4c 100644 (file)
@@ -153,14 +153,7 @@ namespace FooEditEngine
 
         private void Document_LineBreakChanged(object sender, EventArgs e)
         {
-            if (this.Document.LineBreak == LineBreakMethod.PageBound)
-                this._LayoutLines.WrapWidth = this.render.TextArea.Width - LineBreakingMarginWidth;  //余白を残さないと欠ける
-            else if (this.Document.LineBreak == LineBreakMethod.CharUnit)
-                this._LayoutLines.WrapWidth = this.render.emSize.Width * this.Document.LineBreakCharCount;
-            else
-                this._LayoutLines.WrapWidth = LineToIndexTable.NONE_BREAK_LINE;
-
-            this._LayoutLines.ClearLayoutCache();
+            this.CalculateLineBreak();
         }
 
         protected LineToIndexTable _LayoutLines
@@ -260,6 +253,7 @@ namespace FooEditEngine
             set {
                 this._Padding = value;
                 CalculateClipRect();
+                CalculateLineBreak();
                 CalculateLineCountOnScreen();
                 if (this.Document.RightToLeft)
                     this._LayoutLines.ClearLayoutCache();
@@ -279,6 +273,7 @@ namespace FooEditEngine
                     throw new ArgumentOutOfRangeException("");
                 this._Rect = value;
                 CalculateClipRect();
+                CalculateLineBreak();
                 CalculateLineCountOnScreen();
                 if (this.Document.RightToLeft)
                     this._LayoutLines.ClearLayoutCache();
@@ -398,6 +393,16 @@ namespace FooEditEngine
             GC.SuppressFinalize(this);
         }
 
+        public virtual void CalculateLineBreak()
+        {
+            if (this.Document.LineBreak == LineBreakMethod.PageBound)
+                this._LayoutLines.WrapWidth = this.render.TextArea.Width - LineBreakingMarginWidth;  //余白を残さないと欠ける
+            else if (this.Document.LineBreak == LineBreakMethod.CharUnit)
+                this._LayoutLines.WrapWidth = this.render.emSize.Width * this.Document.LineBreakCharCount;
+            else
+                this._LayoutLines.WrapWidth = LineToIndexTable.NONE_BREAK_LINE;
+        }
+
         public virtual void CalculateLineCountOnScreen()
         {
         }
index 2ff5219..dd6ee02 100644 (file)
@@ -297,7 +297,7 @@ namespace FooEditEngine.WPF
             documentSnap.LineBreakCharCount = this.LineBreakCharCount;
             documentSnap.DrawLineNumber = this.DrawLineNumber;
             documentSnap.UrlMark = this.MarkURL;
-            view.PerfomLayouts();
+            documentSnap.PerformLayout(false);
 
             try
             {
index d387507..b5a1806 100644 (file)
@@ -349,7 +349,7 @@ namespace FooEditEngine.WPF
         /// </summary>
         public void PerfomLayouts()
         {
-            this._View.PerfomLayouts();
+            this.Document.PerformLayout();
         }
 
         /// <summary>