OSDN Git Service

ウィンドウの幅が変わったら折り返しの幅も再計算するようにした
[fooeditengine/FooEditEngine.git] / Core / ViewBase.cs
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()
         {
         }