OSDN Git Service

MVVM化の準備のため、Selections、HideRuler、CaretPostion、InsertModeをDocumentに移動させた
authorgdkhd812 <test@nnn.co.jp>
Sun, 25 Oct 2015 10:51:13 +0000 (16:21 +0530)
committergdkhd812 <test@nnn.co.jp>
Sun, 25 Oct 2015 10:51:13 +0000 (16:21 +0530)
Core/Document.cs
Core/EditView.cs

index c1c98e2..e0fbd8a 100644 (file)
@@ -138,7 +138,7 @@ namespace FooEditEngine
         Match match;
         StringBuffer buffer;
         LineToIndexTable _LayoutLines;
-        bool _EnableFireUpdateEvent = true,_UrlMark = false, _DrawLineNumber = false;
+        bool _EnableFireUpdateEvent = true,_UrlMark = false, _DrawLineNumber = false, _HideRuler = true;
         SemaphoreSlim Semaphore = new SemaphoreSlim(MaxSemaphoreCount);
         LineBreakMethod _LineBreak;
         int _TabStops, _LineBreakCharCount = 80;
@@ -178,6 +178,10 @@ namespace FooEditEngine
             this.LineBreakChanged += (s, e) => { };
             this.TabStopsChanged += (s, e) => { };
             this.DrawLineNumberChanged += (s, e) => { };
+            this.Selections = new SelectCollection();
+            this.HideLineMarker = true;
+            this.HideRulerChanged += (s, e) => { };
+            this.CaretPostion = TextPoint.Null;
         }
 
         void WacthDogPattern_Updated(object sender, EventArgs e)
@@ -186,6 +190,70 @@ namespace FooEditEngine
         }
 
         /// <summary>
+        /// ラインマーカーを描くなら偽。そうでなければ真
+        /// </summary>
+        public bool HideLineMarker
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        /// キャレットを描くなら偽。そうでなければ真
+        /// </summary>
+        public bool HideCaret
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        /// 挿入モードなら真を返し、上書きモードなら偽を返す
+        /// </summary>
+        public bool InsertMode
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        /// HideRulerの値が変わったときに通知します
+        /// </summary>
+        public event EventHandler HideRulerChanged;
+
+        /// <summary>
+        /// ルーラーを表示しないなら真、そうでないなら偽
+        /// </summary>
+        public bool HideRuler
+        {
+            get { return this._HideRuler; }
+            set
+            {
+                this._HideRuler = value;
+                this.LayoutLines.ClearLayoutCache();
+                this.HideRulerChanged(this, null);
+            }
+        }
+
+        /// <summary>
+        /// レイアウト行のどこにキャレットがあるかを表す
+        /// </summary>
+        public TextPoint CaretPostion
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        /// 選択範囲コレクション
+        /// </summary>
+        internal SelectCollection Selections
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
         /// DrawLineNumberの値が変わったときに通知される
         /// </summary>
         public event EventHandler DrawLineNumberChanged;
index b83d6f9..04283f3 100644 (file)
@@ -55,13 +55,14 @@ namespace FooEditEngine
             this.CaretBlinkTime = 500;
             this.CaretWidthOnInsertMode = 1;
             this.CalculateClipRect();
-            this.CaretPostion = TextPoint.Null;
             this.CaretLocation = new Point(this.render.TextArea.X, this.render.TextArea.Y);
             this.LayoutLines.FoldingCollection.StatusChanged += FoldingCollection_StatusChanged;
-            this.HideLineMarker = true;
             this.IsFocused = false;
-            this.Selections = new SelectCollection();
             this.SelectGrippers = new GripperRectangle(new GripperView(this.render), new GripperView(this.render));
+            this.Document.HideRulerChanged += (s, e) => {
+                CalculateClipRect();
+                CalculateLineCountOnScreen();
+            };
         }
 
         /// <summary>
@@ -69,8 +70,8 @@ namespace FooEditEngine
         /// </summary>
         internal SelectCollection Selections
         {
-            get;
-            set;
+            get { return this.Document.Selections; }
+            set { this.Document.Selections = value; }
         }
 
         /// <summary>
@@ -87,8 +88,8 @@ namespace FooEditEngine
         /// </summary>
         public bool HideLineMarker
         {
-            get;
-            set;
+            get { return this.Document.HideLineMarker; }
+            set { this.Document.HideLineMarker = value; }
         }
 
         /// <summary>
@@ -96,8 +97,8 @@ namespace FooEditEngine
         /// </summary>
         public bool HideCaret
         {
-            get;
-            set;
+            get { return this.Document.HideCaret; }
+            set { this.Document.HideCaret = value; }
         }
 
         /// <summary>
@@ -105,8 +106,8 @@ namespace FooEditEngine
         /// </summary>
         public bool InsertMode
         {
-            get;
-            set;
+            get { return this.Document.InsertMode; }
+            set { this.Document.InsertMode = value; }
         }
 
         /// <summary>
@@ -173,13 +174,10 @@ namespace FooEditEngine
         /// </summary>
         public bool HideRuler
         {
-            get { return this._HideRuler; }
+            get { return this.Document.HideRuler; }
             set
             {
-                this._HideRuler = value;
-                this.LayoutLines.ClearLayoutCache();
-                CalculateClipRect();
-                CalculateLineCountOnScreen();
+                this.Document.HideRuler = value;
             }
         }
 
@@ -197,8 +195,8 @@ namespace FooEditEngine
         /// </summary>
         public TextPoint CaretPostion
         {
-            get;
-            private set;
+            get { return this.Document.CaretPostion; }
+            private set { this.Document.CaretPostion = value; }
         }
 
         /// <summary>