OSDN Git Service

ナレーター周りをリファクタリングした&UWP版でナレーターがうまく動かないバグを修正した
authortest <test@yahoo.co.jp>
Sun, 3 Jan 2021 10:52:53 +0000 (19:52 +0900)
committertest <test@yahoo.co.jp>
Sun, 3 Jan 2021 10:52:53 +0000 (19:52 +0900)
Core/Automaion/FooTextBoxAutomationPeer.cs
Core/Automaion/FooTextBoxRangeProvider.cs
Core/Util.cs
UWP/FooEditEngine.UWP/FooTextBox.cs
WPF/FooEditEngine/FooEditEngine.csproj
WPF/FooEditEngine/FooTextBox.cs

index 71c765e..fe4403f 100644 (file)
@@ -32,6 +32,7 @@ using System.Windows.Automation;
 using System.Windows.Automation.Peers;
 using System.Windows.Automation.Provider;
 using System.Windows.Automation.Text;
+using FooEditEngine;
 using FooEditEngine.WPF;
 #endif
 
@@ -45,7 +46,11 @@ namespace FooEditEngine
     /// Text Pattern (ITextProvider) and Value Pattern (IValuePattern) interfaces.  So Touch keyboard shows 
     /// automatically when user taps on the control with Touch or Pen.
     /// </summary>
+#if METRO || WINDOWS_UWP
+    sealed class FooTextBoxAutomationPeer : FrameworkElementAutomationPeer, ITextProvider, ITextProvider2, IValueProvider
+#elif WPF
     sealed class FooTextBoxAutomationPeer : FrameworkElementAutomationPeer, ITextProvider, IValueProvider
+#endif
     {
         private FooTextBox fooTextBox;
         private string accClass = "FooTextBox";
@@ -87,10 +92,13 @@ namespace FooEditEngine
             {
                 return this;
             }
+            else if (patternInterface == PatternInterface.Text2)
+            {
+                return this;
+            }
             return base.GetPatternCore(patternInterface);
         }
-#endif
-#if WPF
+#elif WPF
         public override object GetPattern(PatternInterface patternInterface)
         {
             if (patternInterface == PatternInterface.Value)
@@ -138,24 +146,23 @@ namespace FooEditEngine
         protected override Windows.Foundation.Rect GetBoundingRectangleCore()
         {
             double scale = Util.GetScale();
-            return new Windows.Foundation.Rect(0, 0, this.fooTextBox.ActualWidth * scale, this.fooTextBox.ActualHeight * scale);
-        }
-#endif
-#if WPF
+            Point left = Util.GetPointInWindow(new Point(0, 0),this.fooTextBox).Scale(scale);
+            Point bottom = Util.GetPointInWindow(new Point(this.fooTextBox.ActualWidth, this.fooTextBox.ActualHeight),this.fooTextBox).Scale(scale);
+#elif WPF
         protected override System.Windows.Rect GetBoundingRectangleCore()
         {
-            System.Windows.Point left = this.fooTextBox.PointToScreen(new System.Windows.Point(0, 0));
-            System.Windows.Point bottom = this.fooTextBox.PointToScreen(new System.Windows.Point(this.fooTextBox.ActualWidth, this.fooTextBox.ActualHeight));
-            return new System.Windows.Rect(left, bottom);
-        }
+            Point left = Util.GetScreentPoint(new Point(0, 0), this.fooTextBox);
+            Point bottom = Util.GetScreentPoint(new Point(this.fooTextBox.ActualWidth, this.fooTextBox.ActualHeight), this.fooTextBox);
 #endif
+            return new Rectangle(left,bottom);
+        }
 
-    #region Implementation for ITextPattern interface
+        #region Implementation for ITextPattern and ITextPattern2 interface
         // Complete implementation of the ITextPattern is beyond the scope of this sample.  The implementation provided
         // is specific to this sample's custom control, so it is unlikely that they are directly transferable to other 
         // custom control.
 
-        ITextRangeProvider ITextProvider.DocumentRange
+        public ITextRangeProvider DocumentRange
         {
             // A real implementation of this method is beyond the scope of this sample.
             // If your custom control has complex text involving both readonly and non-readonly ranges, 
@@ -166,7 +173,7 @@ namespace FooEditEngine
             }
         }
 
-        ITextRangeProvider[] ITextProvider.GetSelection()
+        public ITextRangeProvider[] GetSelection()
         {
             ITextRangeProvider[] ret = new ITextRangeProvider[1];
             int selStart = this.fooTextBox.Selection.Index;
@@ -175,7 +182,7 @@ namespace FooEditEngine
             return ret;
         }
 
-        ITextRangeProvider[] ITextProvider.GetVisibleRanges()
+        public ITextRangeProvider[] GetVisibleRanges()
         {
             ITextRangeProvider[] ret = new ITextRangeProvider[1];
             if (this.fooTextBox.LayoutLineCollection.Count == 0)
@@ -184,59 +191,63 @@ namespace FooEditEngine
             }
             else
             {
-#if METRO || WINDOWS_UWP
-                int startIndex = this.fooTextBox.GetIndexFromPostion(new Windows.Foundation.Point(0,0));
-                int endIndex = this.fooTextBox.GetIndexFromPostion(new Windows.Foundation.Point(this.fooTextBox.ActualWidth, this.fooTextBox.ActualHeight));
-#endif
-#if WPF
-                int startIndex = this.fooTextBox.GetIndexFromPostion(new System.Windows.Point(0, 0));
-                int endIndex = this.fooTextBox.GetIndexFromPostion(new System.Windows.Point(this.fooTextBox.ActualWidth, this.fooTextBox.ActualHeight));
-#endif
+                EditView view = this.fooTextBox.View;
+                
+                int startIndex = view.GetIndexFromLayoutLine(new TextPoint(view.Src.Row,0));
+                int endIndex = view.GetIndexFromLayoutLine(new TextPoint(view.Src.Row + view.LineCountOnScreen, 0));
                 ret[0] = new FooTextBoxRangeProvider(this.fooTextBox, startIndex, endIndex - startIndex, this);
             }
             return ret;
         }
 
-        ITextRangeProvider ITextProvider.RangeFromChild(IRawElementProviderSimple childElement)
+        public ITextRangeProvider RangeFromChild(IRawElementProviderSimple childElement)
         {
             return new FooTextBoxRangeProvider(this.fooTextBox,0,0, this);
         }
 
 #if METRO || WINDOWS_UWP
-        ITextRangeProvider ITextProvider.RangeFromPoint(Windows.Foundation.Point screenLocation)
+        public ITextRangeProvider RangeFromPoint(Windows.Foundation.Point screenLocation)
+#elif WPF
+        public ITextRangeProvider RangeFromPoint(System.Windows.Point screenLocation)
+#endif
         {
-            Point pt = Util.GetClientPoint(screenLocation, this.fooTextBox);
+            Point pt = Util.GetClientPoint(screenLocation, fooTextBox);
+            EditView view = this.fooTextBox.View;
 
-            int index = this.fooTextBox.GetIndexFromPostion(pt);
+            int index = view.GetIndexFromLayoutLine(view.GetTextPointFromPostion(pt));
             int length = 1;
             if (index == this.fooTextBox.Document.Length)
                 length = 0;
-            
+
             return new FooTextBoxRangeProvider(this.fooTextBox, index, length, this);
         }
-#endif
-#if WPF
-        ITextRangeProvider ITextProvider.RangeFromPoint(System.Windows.Point screenLocation)
+
+        public SupportedTextSelection SupportedTextSelection
         {
-            System.Windows.Point pt = this.fooTextBox.PointFromScreen(screenLocation);
+            get { return SupportedTextSelection.Single; }
+        }
 
-            int index = this.fooTextBox.GetIndexFromPostion(pt);
+        public ITextRangeProvider RangeFromAnnotation(IRawElementProviderSimple annotationElement)
+        {
+            throw new NotImplementedException();
+        }
+
+        public ITextRangeProvider GetCaretRange(out bool isActive)
+        {
+
+            EditView view = this.fooTextBox.View;
+            Document doc = this.fooTextBox.Document;
+            isActive = true;
+            int index = view.GetIndexFromLayoutLine(doc.CaretPostion);
             int length = 1;
             if (index == this.fooTextBox.Document.Length)
                 length = 0;
 
             return new FooTextBoxRangeProvider(this.fooTextBox, index, length, this);
         }
-#endif
-
-        SupportedTextSelection ITextProvider.SupportedTextSelection
-        {
-            get { return SupportedTextSelection.Single; }
-        }
+        #endregion
 
-    #endregion
-
-    #region Implementation for IValueProvider interface
+        #region Implementation for IValueProvider interface
         // Complete implementation of the IValueProvider is beyond the scope of this sample.  The implementation provided
         // is specific to this sample's custom control, so it is unlikely that they are directly transferable to other 
         // custom control.
@@ -245,19 +256,19 @@ namespace FooEditEngine
         /// The value needs to be false for the Touch keyboard to be launched automatically because Touch keyboard
         /// does not appear when the input focus is in a readonly UI control.
         /// </summary>
-        bool IValueProvider.IsReadOnly
+        public bool IsReadOnly
         {
             get { return false; }
         }
 
-        void IValueProvider.SetValue(string value)
+        public void SetValue(string value)
         {
             string oldText = this.fooTextBox.Document.ToString(0);
             this.fooTextBox.Document.Replace(0,this.fooTextBox.Document.Length,value);
             this.RaisePropertyChangedEvent(ValuePatternIdentifiers.ValueProperty, oldText, this.fooTextBox.Document.ToString(0));
         }
 
-        string IValueProvider.Value
+        public string Value
         {
             get
             {
@@ -271,6 +282,7 @@ namespace FooEditEngine
         {
             return ProviderFromPeer(this);
         }
+
     }
 
 #endif
index 8fcb2e5..53841d4 100644 (file)
@@ -32,6 +32,7 @@ using System.Windows.Automation;
 using System.Windows.Automation.Peers;
 using System.Windows.Automation.Provider;
 using System.Windows.Automation.Text;
+using FooEditEngine;
 using FooEditEngine.WPF;
 #endif
 
@@ -121,6 +122,9 @@ namespace FooEditEngine
             Document doc = this.textbox.Document;
             if (unit == TextUnit.Character)
             {
+                this.end = this.start + 1;
+                if (this.end > doc.Length)
+                    this.end = this.start;
                 return;
             }
             if (unit == TextUnit.Format || unit == TextUnit.Word)
index 1d4d86a..00432ea 100644 (file)
@@ -106,6 +106,16 @@ namespace FooEditEngine
             return dpi / 96.0;
         }
 
+        public static Point GetClientPoint(Point screen, System.Windows.FrameworkElement element)
+        {
+            return element.PointFromScreen(screen);
+        }
+
+        public static Point GetScreentPoint(Point client, System.Windows.FrameworkElement element)
+        {
+            return element.PointFromScreen(client);
+        }
+
         public static IEnumerable<char> GetEnumrator(string s)
         {
             return s;
index 71da92f..ae36510 100644 (file)
@@ -38,7 +38,7 @@ namespace FooEditEngine.UWP
     /// </summary>
     public sealed class FooTextBox : Control,IDisposable
     {
-        EditView View;
+        EditView _View;
         Controller _Controller;
 #if !DUMMY_RENDER
         D2DRender Render;
@@ -79,17 +79,17 @@ namespace FooEditEngine.UWP
 
             this.Document = new Document();
 
-            this.View = new EditView(this.Document, this.Render, new Padding(5, 5, Gripper.HitAreaWidth / 2, Gripper.HitAreaWidth));
-            this.View.SrcChanged += View_SrcChanged;
-            this.View.InsertMode = this.InsertMode;
+            this._View = new EditView(this.Document, this.Render, new Padding(5, 5, Gripper.HitAreaWidth / 2, Gripper.HitAreaWidth));
+            this._View.SrcChanged += View_SrcChanged;
+            this._View.InsertMode = this.InsertMode;
             this.Document.DrawLineNumber = this.DrawLineNumber;
-            this.View.HideCaret = !this.DrawCaret;
-            this.View.HideLineMarker = !this.DrawCaretLine;
+            this._View.HideCaret = !this.DrawCaret;
+            this._View.HideLineMarker = !this.DrawCaretLine;
             this.Document.HideRuler = !this.DrawRuler;
             this.Document.UrlMark = this.MarkURL;
             this.Document.TabStops = this.TabChars;
 
-            this._Controller = new Controller(this.Document, this.View);
+            this._Controller = new Controller(this.Document, this._View);
 
             this.gestureRecongnizer.GestureSettings = GestureSettings.Drag | 
                 GestureSettings.RightTap | 
@@ -144,7 +144,7 @@ namespace FooEditEngine.UWP
                 return;
             if (disposing)
             {
-                this.View.Dispose();
+                this._View.Dispose();
                 this.Render.Dispose();
             }
         }
@@ -257,7 +257,7 @@ namespace FooEditEngine.UWP
         {
             if (this.Document.FireUpdateEvent == false)
                 throw new InvalidOperationException("");
-            return this.View.GetPostionFromTextPoint(tp);
+            return this._View.GetPostionFromTextPoint(tp);
         }
 
         /// <summary>
@@ -269,7 +269,7 @@ namespace FooEditEngine.UWP
         {
             if (this.Document.FireUpdateEvent == false)
                 throw new InvalidOperationException("");
-            return this.View.GetTextPointFromPostion(p);
+            return this._View.GetTextPointFromPostion(p);
         }
 
         /// <summary>
@@ -281,7 +281,7 @@ namespace FooEditEngine.UWP
         {
             if (this.Document.FireUpdateEvent == false)
                 throw new InvalidOperationException("");
-            return this.View.LayoutLines.GetLayout(row).Height; ;
+            return this._View.LayoutLines.GetLayout(row).Height; ;
         }
 
         /// <summary>
@@ -293,8 +293,8 @@ namespace FooEditEngine.UWP
         {
             if (this.Document.FireUpdateEvent == false)
                 throw new InvalidOperationException("");
-            TextPoint tp = this.View.GetLayoutLineFromIndex(index);
-            return this.View.GetPostionFromTextPoint(tp);
+            TextPoint tp = this._View.GetLayoutLineFromIndex(index);
+            return this._View.GetPostionFromTextPoint(tp);
         }
 
         /// <summary>
@@ -306,8 +306,8 @@ namespace FooEditEngine.UWP
         {
             if (this.Document.FireUpdateEvent == false)
                 throw new InvalidOperationException("");
-            TextPoint tp = this.View.GetTextPointFromPostion(p);
-            return this.View.GetIndexFromLayoutLine(tp);
+            TextPoint tp = this._View.GetTextPointFromPostion(p);
+            return this._View.GetIndexFromLayoutLine(tp);
         }
         
 
@@ -317,7 +317,7 @@ namespace FooEditEngine.UWP
         public void Refresh(bool immidately=true)
         {
             if(immidately)
-                this.Refresh(this.View.PageBound);
+                this.Refresh(this._View.PageBound);
             else
                 this.Document.RequestRedraw();
         }
@@ -337,7 +337,7 @@ namespace FooEditEngine.UWP
         /// <param name="alignTop">指定行を画面上に置くなら真。そうでないなら偽</param>
         public void ScrollIntoView(int row, bool alignTop)
         {
-            this.View.ScrollIntoView(row, alignTop);
+            this._View.ScrollIntoView(row, alignTop);
         }
 
         /// <summary>
@@ -366,7 +366,7 @@ namespace FooEditEngine.UWP
                     this.textEditContext.NotifyTextChanged(modified_range, this.Document.Length, modified_range);
 
                 if (this.verticalScrollBar != null)
-                    this.verticalScrollBar.Maximum = this.View.LayoutLines.Count;
+                    this.verticalScrollBar.Maximum = this._View.LayoutLines.Count;
                 this.IsEnabled = true;
                 this.Refresh(false);
             }
@@ -439,7 +439,7 @@ namespace FooEditEngine.UWP
             {
                 this.verticalScrollBar.SmallChange = 1;
                 this.verticalScrollBar.LargeChange = 10;
-                this.verticalScrollBar.Maximum = this.View.LayoutLines.Count;
+                this.verticalScrollBar.Maximum = this._View.LayoutLines.Count;
                 this.verticalScrollBar.Scroll += new ScrollEventHandler(verticalScrollBar_Scroll);
             }
         }
@@ -477,7 +477,7 @@ namespace FooEditEngine.UWP
 
             System.Diagnostics.Debug.WriteLine("got focus");
 
-            this.View.IsFocused = true;
+            this._View.IsFocused = true;
             this.timer.Interval = new TimeSpan(0, 0, 0, 0, Interval);
             this.Refresh(false);
         }
@@ -494,7 +494,7 @@ namespace FooEditEngine.UWP
 
             System.Diagnostics.Debug.WriteLine("lost focus");
             
-            this.View.IsFocused = false;
+            this._View.IsFocused = false;
             this.Refresh(false);
             this.timer.Interval = new TimeSpan(0, 0, 0, 0, IntervalWhenLostFocus);
         }
@@ -576,12 +576,12 @@ namespace FooEditEngine.UWP
                     isMovedCaret = true;
                     break;
                 case VirtualKey.PageUp:
-                    this._Controller.Scroll(ScrollDirection.Up, this.View.LineCountOnScreen, isShiftPressed, true);
+                    this._Controller.Scroll(ScrollDirection.Up, this._View.LineCountOnScreen, isShiftPressed, true);
                     this.Refresh();
                     isMovedCaret = true;
                     break;
                 case VirtualKey.PageDown:
-                    this._Controller.Scroll(ScrollDirection.Down, this.View.LineCountOnScreen, isShiftPressed, true);
+                    this._Controller.Scroll(ScrollDirection.Down, this._View.LineCountOnScreen, isShiftPressed, true);
                     this.Refresh();
                     isMovedCaret = true;
                     break;
@@ -620,10 +620,10 @@ namespace FooEditEngine.UWP
                     e.Handled = true;
                     break;
                 case VirtualKey.Insert:
-                    if(this.View.InsertMode)
-                        this.View.InsertMode = false;
+                    if(this._View.InsertMode)
+                        this._View.InsertMode = false;
                     else
-                        this.View.InsertMode = true;
+                        this._View.InsertMode = true;
                     this.Refresh();
                     e.Handled = true;
                     break;
@@ -694,10 +694,6 @@ namespace FooEditEngine.UWP
                     e.Handled = true;
                     break;
             }
-#if ENABLE_AUTMATION
-            if (isMovedCaret && this.peer != null)
-                this.peer.OnNotifyCaretChanged();
-#endif
             base.OnKeyDown(e);
         }
 
@@ -727,9 +723,9 @@ namespace FooEditEngine.UWP
             if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse)
             {
                 Point p = e.GetCurrentPoint(this).Position;
-                if (this.View.HitTextArea(p.X, p.Y))
+                if (this._View.HitTextArea(p.X, p.Y))
                 {
-                    TextPoint tp = this.View.GetTextPointFromPostion(p);
+                    TextPoint tp = this._View.GetTextPointFromPostion(p);
                     if (this._Controller.IsMarker(tp, HilightType.Url))
                         Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Hand, 101);
                     else
@@ -817,7 +813,7 @@ namespace FooEditEngine.UWP
 
             if (args.Reason == CoreTextFormatUpdatingReason.CompositionTargetConverted)
             {
-                this.View.AdjustSrc(args.Range.StartCaretPosition);
+                this._View.AdjustSrc(args.Range.StartCaretPosition);
             }
             this.Refresh();
 
@@ -862,7 +858,7 @@ namespace FooEditEngine.UWP
 
             if (i_startIndex != -1 && i_endIndex != -1)
             {
-                TextStoreHelper.GetStringExtent(this.Document, this.View, i_startIndex, i_endIndex, out startPos, out endPos);
+                TextStoreHelper.GetStringExtent(this.Document, this._View, i_startIndex, i_endIndex, out startPos, out endPos);
 
                 double scale = Util.GetScale();
 
@@ -899,7 +895,7 @@ namespace FooEditEngine.UWP
                 return;
             }
             TextRange currentSelection = new TextRange();
-            TextStoreHelper.GetSelection(this._Controller, this.View.Selections, out currentSelection);
+            TextStoreHelper.GetSelection(this._Controller, this._View.Selections, out currentSelection);
 
             CoreTextRange currentSelectionRange = new CoreTextRange();
             currentSelectionRange.StartCaretPosition = currentSelection.Index;
@@ -917,7 +913,7 @@ namespace FooEditEngine.UWP
             }
             CoreTextRange sel = args.Selection;
             System.Diagnostics.Debug.WriteLine("update selection start:{0} end:{1}", sel.StartCaretPosition, sel.EndCaretPosition);
-            TextStoreHelper.SetSelectionIndex(this.Controller, this.View, sel.StartCaretPosition, sel.EndCaretPosition);
+            TextStoreHelper.SetSelectionIndex(this.Controller, this._View, sel.StartCaretPosition, sel.EndCaretPosition);
             args.Result = CoreTextSelectionUpdatingResult.Succeeded;
             this.Refresh();
         }
@@ -934,7 +930,7 @@ namespace FooEditEngine.UWP
                 args.NewSelection.EndCaretPosition);
             bool isTip = args.InputLanguage.Script == "Latan";
             CoreTextRange sel = args.Range;
-            TextStoreHelper.SetSelectionIndex(this.Controller, this.View, sel.StartCaretPosition, sel.EndCaretPosition);
+            TextStoreHelper.SetSelectionIndex(this.Controller, this._View, sel.StartCaretPosition, sel.EndCaretPosition);
             TextStoreHelper.InsertTextAtSelection(this._Controller, args.Text, isTip);
             this.Refresh();
             args.Result = CoreTextTextUpdatingResult.Succeeded;
@@ -974,13 +970,14 @@ namespace FooEditEngine.UWP
             //こうしないと選択できなくなってしまう
             this.nowCaretMove = true;
             SetValue(SelectedTextProperty, this._Controller.SelectedText);
+            SetValue(SelectionProperty, new TextRange(this._Controller.SelectionStart, this._Controller.SelectionLength));
             SetValue(CaretPostionPropertyKey, this.Document.CaretPostion);
             this.nowCaretMove = false;
 
             if(!this.nowCompstion)
             {
                 TextRange currentSelection = new TextRange();
-                TextStoreHelper.GetSelection(this._Controller, this.View.Selections, out currentSelection);
+                TextStoreHelper.GetSelection(this._Controller, this._View.Selections, out currentSelection);
 
                 CoreTextRange currentSelectionRange = new CoreTextRange();
                 currentSelectionRange.StartCaretPosition = currentSelection.Index;
@@ -991,13 +988,17 @@ namespace FooEditEngine.UWP
                 if (this.textEditContext != null)
                     this.textEditContext.NotifySelectionChanged(currentSelectionRange);
             }
+#if ENABLE_AUTMATION
+            if (this.peer != null)
+                this.peer.OnNotifyCaretChanged();
+#endif
         }
 
         Gripper hittedGripper;
         void gestureRecongnizer_ManipulationStarted(GestureRecognizer sender, ManipulationStartedEventArgs e)
         {
             //Updateedの段階でヒットテストしてしまうとグリッパーを触ってもヒットしないことがある
-            this.hittedGripper = this.View.HitGripperFromPoint(e.Position);
+            this.hittedGripper = this._View.HitGripperFromPoint(e.Position);
         }
 
         private void GestureRecongnizer_ManipulationInertiaStarting(GestureRecognizer sender, ManipulationInertiaStartingEventArgs args)
@@ -1033,10 +1034,6 @@ namespace FooEditEngine.UWP
 
             if (this._Controller.MoveCaretAndGripper(e.Position, this.hittedGripper))
             {
-#if ENABLE_AUTMATION
-                if (this.peer != null)
-                    this.peer.OnNotifyCaretChanged();
-#endif
                 this.Refresh();                
                 return;
             }
@@ -1074,7 +1071,7 @@ namespace FooEditEngine.UWP
         {
             ResourceMap map = ResourceManager.Current.MainResourceMap.GetSubtree("FooEditEngine.UWP/Resources");
             ResourceContext context = ResourceContext.GetForCurrentView();
-            if (this.View.HitTextArea(e.Position.X, e.Position.Y))
+            if (this._View.HitTextArea(e.Position.X, e.Position.Y))
             {
                 FooContextMenuEventArgs args = new FooContextMenuEventArgs(e.Position);
                 if (this.ContextMenuOpening != null)
@@ -1144,30 +1141,26 @@ namespace FooEditEngine.UWP
 
         void JumpCaret(Point p)
         {
-            TextPoint tp = this.View.GetTextPointFromPostion(p);
+            TextPoint tp = this._View.GetTextPointFromPostion(p);
             if (tp == TextPoint.Null)
                 return;
 
-            int index = this.View.LayoutLines.GetIndexFromTextPoint(tp);
+            int index = this._View.LayoutLines.GetIndexFromTextPoint(tp);
 
-            FoldingItem foldingData = this.View.HitFoldingData(p.X, tp.row);
+            FoldingItem foldingData = this._View.HitFoldingData(p.X, tp.row);
             if (foldingData != null)
             {
                 if (foldingData.Expand)
-                    this.View.LayoutLines.FoldingCollection.Collapse(foldingData);
+                    this._View.LayoutLines.FoldingCollection.Collapse(foldingData);
                 else
-                    this.View.LayoutLines.FoldingCollection.Expand(foldingData);
+                    this._View.LayoutLines.FoldingCollection.Expand(foldingData);
                 this._Controller.JumpCaret(foldingData.Start, false);
             }
             else
             {
                 this._Controller.JumpCaret(tp.row, tp.col, false);
             }
-#if ENABLE_AUTMATION
-            if (this.peer != null)
-                this.peer.OnNotifyCaretChanged();
-#endif
-            this.View.IsFocused = true;
+            this._View.IsFocused = true;
             this.Focus(FocusState.Programmatic);
             this.Refresh();
         }
@@ -1176,18 +1169,14 @@ namespace FooEditEngine.UWP
         {
             Point p = e.Position;
             TextPointSearchRange searchRange;
-            if (this.View.HitTextArea(p.X, p.Y))
+            if (this._View.HitTextArea(p.X, p.Y))
                 searchRange = TextPointSearchRange.TextAreaOnly;
             else if (this._Controller.SelectionLength > 0)
                 searchRange = TextPointSearchRange.Full;
             else
                 return;
-            TextPoint tp = this.View.GetTextPointFromPostion(p, searchRange);
+            TextPoint tp = this._View.GetTextPointFromPostion(p, searchRange);
             this._Controller.MoveCaretAndSelect(tp, this.IsModiferKeyPressed(VirtualKey.LeftControl));
-#if ENABLE_AUTMATION
-            if (this.peer != null)
-                this.peer.OnNotifyCaretChanged();
-#endif
             this.Refresh();
         }
 
@@ -1201,7 +1190,7 @@ namespace FooEditEngine.UWP
             if (this.rectangle.ActualWidth == 0 || this.rectangle.ActualHeight == 0 || this.Visibility == Windows.UI.Xaml.Visibility.Collapsed)
                 return;
 
-            this.Render.DrawContent(this.View, this.IsEnabled, updateRect);
+            this.Render.DrawContent(this._View, this.IsEnabled, updateRect);
 
             this.Document.IsRequestRedraw = false;
         }
@@ -1213,17 +1202,17 @@ namespace FooEditEngine.UWP
                 throw new ArgumentOutOfRangeException();
             if (this.Render.Resize(this.rectangle, width, height))
             {
-                this.View.PageBound = new Rectangle(0, 0, width, height);
+                this._View.PageBound = new Rectangle(0, 0, width, height);
 
                 if (this.horizontalScrollBar != null)
                 {
-                    this.horizontalScrollBar.LargeChange = this.View.PageBound.Width;
-                    this.horizontalScrollBar.Maximum = this.View.LongestWidth + this.horizontalScrollBar.LargeChange + 1;
+                    this.horizontalScrollBar.LargeChange = this._View.PageBound.Width;
+                    this.horizontalScrollBar.Maximum = this._View.LongestWidth + this.horizontalScrollBar.LargeChange + 1;
                 }
                 if (this.verticalScrollBar != null)
                 {
-                    this.verticalScrollBar.LargeChange = this.View.LineCountOnScreen;
-                    this.verticalScrollBar.Maximum = this.View.LayoutLines.Count + this.verticalScrollBar.LargeChange + 1;
+                    this.verticalScrollBar.LargeChange = this._View.LineCountOnScreen;
+                    this.verticalScrollBar.Maximum = this._View.LayoutLines.Count + this.verticalScrollBar.LargeChange + 1;
                 }
                 return true;
             }
@@ -1234,7 +1223,7 @@ namespace FooEditEngine.UWP
         {
             if (this.horizontalScrollBar == null || this.verticalScrollBar == null)
                 return;
-            EditView view = this.View;
+            EditView view = this._View;
             if (view.Src.Row > this.verticalScrollBar.Maximum)
                 this.verticalScrollBar.Maximum = view.Src.Row + view.LineCountOnScreen + 1;
             double absoulteX = Math.Abs(view.Src.X);
@@ -1261,7 +1250,7 @@ namespace FooEditEngine.UWP
                 toX = this.horizontalScrollBar.Value;
             else
                 toX = -this.horizontalScrollBar.Value;
-            this._Controller.Scroll(toX, this.View.Src.Row, false, false);
+            this._Controller.Scroll(toX, this._View.Src.Row, false, false);
             this.Refresh();
         }
 
@@ -1270,9 +1259,9 @@ namespace FooEditEngine.UWP
             if (this.verticalScrollBar == null)
                 return;
             int newRow = (int)this.verticalScrollBar.Value;
-            if (newRow >= this.View.LayoutLines.Count)
+            if (newRow >= this._View.LayoutLines.Count)
                 return;
-            this._Controller.Scroll(this.View.Src.X, newRow, false, false);
+            this._Controller.Scroll(this._View.Src.X, newRow, false, false);
             this.Refresh();
         }
 
@@ -1289,7 +1278,7 @@ namespace FooEditEngine.UWP
                     oldTextRange.EndCaretPosition += e.removeLength;
 
                 TextRange currentSelection = new TextRange();
-                TextStoreHelper.GetSelection(this._Controller, this.View.Selections, out currentSelection);
+                TextStoreHelper.GetSelection(this._Controller, this._View.Selections, out currentSelection);
 
                 CoreTextRange newSelection = new CoreTextRange();
                 newSelection.StartCaretPosition = e.startIndex;
@@ -1324,13 +1313,13 @@ namespace FooEditEngine.UWP
                 if (this.Resize(this.rectangle.ActualWidth, this.rectangle.ActualHeight))
                 {
                     //普通に再描写するとちらつく
-                    this.Refresh(this.View.PageBound);
+                    this.Refresh(this._View.PageBound);
                 }
                 this.requestSizeChange = false;
             }
-            else if (this.View.LayoutLines.HilightAll() || this.View.LayoutLines.GenerateFolding() || this.Document.IsRequestRedraw)
+            else if (this._View.LayoutLines.HilightAll() || this._View.LayoutLines.GenerateFolding() || this.Document.IsRequestRedraw)
             {
-                this.Refresh(this.View.PageBound);
+                this.Refresh(this._View.PageBound);
             }
             this.timer.Start();
         }
@@ -1368,10 +1357,10 @@ namespace FooEditEngine.UWP
             if (this._Document.AutoComplete != null && this._Document.AutoComplete.GetPostion == null)
                 this._Document_AutoCompleteChanged(this._Document, null);
             //初期化が終わっていればすべて存在する
-            if (this.Controller != null && this.View != null)
+            if (this.Controller != null && this._View != null)
             {
                 this.Controller.Document = value;
-                this.View.Document = value;
+                this._View.Document = value;
 
                 this.Controller.AdjustCaret();
 
@@ -1404,7 +1393,7 @@ namespace FooEditEngine.UWP
             Document doc = (Document)sender;
             doc.AutoComplete.GetPostion = (tp, e_doc) =>
             {
-                var p = this.View.GetPostionFromTextPoint(tp);
+                var p = this._View.GetPostionFromTextPoint(tp);
                 int height = (int)e_doc.LayoutLines.GetLayout(e_doc.CaretPostion.row).Height;
 
                 if (p.Y + AutoCompleteBox.CompleteListBoxHeight + height > e_doc.LayoutLines.Render.TextArea.Height)
@@ -1426,9 +1415,9 @@ namespace FooEditEngine.UWP
             if (e.Property.Equals(DocumentProperty))
                 source.SetDocument(source.Document);
             if(e.Property.Equals(HilighterProperty))
-                source.View.Hilighter = source.Hilighter;
+                source._View.Hilighter = source.Hilighter;
             if (e.Property.Equals(FoldingStrategyProperty))
-                source.View.LayoutLines.FoldingStrategy = source.FoldingStrategy;
+                source._View.LayoutLines.FoldingStrategy = source.FoldingStrategy;
             if (e.Property.Equals(IndentModeProperty))
                 source.Controller.IndentMode = source.IndentMode;
             if (e.Property.Equals(SelectionProperty) && !source.nowCaretMove)
@@ -1436,15 +1425,15 @@ namespace FooEditEngine.UWP
             if (e.Property.Equals(CaretPostionPropertyKey) && !source.nowCaretMove)
                 source.JumpCaret(source.CaretPostion.row, source.CaretPostion.col);
             if (e.Property.Equals(InsertModeProperty))
-                source.View.InsertMode = source.InsertMode;
+                source._View.InsertMode = source.InsertMode;
             if (e.Property.Equals(TabCharsProperty))
                 source.Document.TabStops = source.TabChars;
             if (e.Property.Equals(RectSelectModeProperty))
                 source._Controller.RectSelection = source.RectSelectMode;
             if (e.Property.Equals(DrawCaretProperty))
-                source.View.HideCaret = !source.DrawCaret;
+                source._View.HideCaret = !source.DrawCaret;
             if (e.Property.Equals(DrawCaretLineProperty))
-                source.View.HideLineMarker = !source.DrawCaretLine;
+                source._View.HideLineMarker = !source.DrawCaretLine;
             if (e.Property.Equals(DrawLineNumberProperty))
                 source.Document.DrawLineNumber = source.DrawLineNumber;
             if (e.Property.Equals(MarkURLProperty))
@@ -1502,7 +1491,7 @@ namespace FooEditEngine.UWP
             if (e.Property.Equals(OverwriteCaretProperty))
                 source.Render.OverwriteCaret = D2DRenderBase.ToColor4(source.OverwriteCaret);
             if (e.Property.Equals(PaddingProperty))
-                source.View.Padding = new Padding((int)source.Padding.Left, (int)source.Padding.Top, (int)source.Padding.Right, (int)source.Padding.Bottom);
+                source._View.Padding = new Padding((int)source.Padding.Left, (int)source.Padding.Top, (int)source.Padding.Right, (int)source.Padding.Bottom);
             if (e.Property.Equals(LineMarkerProperty))
                 source.Render.LineMarker = D2DRenderBase.ToColor4(source.LineMarker);
             if (e.Property.Equals(ShowFullSpaceProperty))
@@ -1540,6 +1529,14 @@ namespace FooEditEngine.UWP
             }
         }
 
+        internal EditView View
+        {
+            get
+            {
+                return this._View;
+            }
+        }
+
         /// <summary>
         /// 文字列の描写に使用されるアンチエイリアシング モードを表します
         /// </summary>
@@ -1617,7 +1614,7 @@ namespace FooEditEngine.UWP
         /// </summary>
         public LineToIndexTable LayoutLineCollection
         {
-            get { return this.View.LayoutLines; }
+            get { return this._View.LayoutLines; }
         }
 
         /// <summary>
index 94ef883..aee4e7b 100644 (file)
@@ -22,7 +22,7 @@
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
     <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>TRACE;DEBUG;WPF,ENABLE_AUTMATION</DefineConstants>
+    <DefineConstants>TRACE;DEBUG;WPF;ENABLE_AUTMATION</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <DocumentationFile>bin\Debug\FooEditEngine.WPF.XML</DocumentationFile>
@@ -32,7 +32,7 @@
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
     <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE;WPF,ENABLE_AUTMATION</DefineConstants>
+    <DefineConstants>TRACE;WPF;ENABLE_AUTMATION</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <Prefer32Bit>false</Prefer32Bit>
index 57b07aa..d387507 100644 (file)
@@ -35,7 +35,7 @@ namespace FooEditEngine.WPF
         const double MaxFontSize = 72.0f;
         const double MinFontSize = 1;
 
-        EditView View;
+        EditView _View;
         Controller _Controller;
         D2DRender Render;
         Image image;
@@ -89,12 +89,12 @@ namespace FooEditEngine.WPF
 
             this.Document = new Document();
 
-            this.View = new EditView(this.Document, this.Render, new Padding(5, 5, 5, 5));
-            this.View.SrcChanged += View_SrcChanged;
-            this.View.InsertMode = this.InsertMode;
+            this._View = new EditView(this.Document, this.Render, new Padding(5, 5, 5, 5));
+            this._View.SrcChanged += View_SrcChanged;
+            this._View.InsertMode = this.InsertMode;
             this.Document.DrawLineNumber = this.DrawLineNumber;
-            this.View.HideCaret = !this.DrawCaret;
-            this.View.HideLineMarker = !this.DrawCaretLine;
+            this._View.HideCaret = !this.DrawCaret;
+            this._View.HideLineMarker = !this.DrawCaretLine;
             this.Document.HideRuler = !this.DrawRuler;
             this.Document.UrlMark = this.MarkURL;
             this.Document.TabStops = this.TabChars;
@@ -102,7 +102,7 @@ namespace FooEditEngine.WPF
             this.Document.ShowHalfSpace = this.ShowHalfSpace;
             this.Document.ShowTab = this.ShowTab;
 
-            this._Controller = new Controller(this.Document, this.View);
+            this._Controller = new Controller(this.Document, this._View);
             this._Document.SelectionChanged += new EventHandler(Controller_SelectionChanged);
 
             this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, CopyCommand, CanExecute));
@@ -282,7 +282,7 @@ namespace FooEditEngine.WPF
         {
             if (this.Document.FireUpdateEvent == false)
                 throw new InvalidOperationException("");
-            return this.image.TranslatePoint(this.View.GetPostionFromTextPoint(tp),this);
+            return this.image.TranslatePoint(this._View.GetPostionFromTextPoint(tp),this);
         }
 
         /// <summary>
@@ -295,7 +295,7 @@ namespace FooEditEngine.WPF
             if (this.Document.FireUpdateEvent == false)
                 throw new InvalidOperationException("");
             System.Windows.Point relP = this.TranslatePoint(p, this.image);
-            return this.View.GetTextPointFromPostion(p);
+            return this._View.GetTextPointFromPostion(p);
         }
 
         /// <summary>
@@ -307,7 +307,7 @@ namespace FooEditEngine.WPF
         {
             if (this.Document.FireUpdateEvent == false)
                 throw new InvalidOperationException("");
-            return this.View.LayoutLines.GetLayout(row).Height;;
+            return this._View.LayoutLines.GetLayout(row).Height;;
         }
 
         /// <summary>
@@ -319,8 +319,8 @@ namespace FooEditEngine.WPF
         {
             if (this.Document.FireUpdateEvent == false)
                 throw new InvalidOperationException("");
-            TextPoint tp = this.View.GetLayoutLineFromIndex(index);
-            return this.View.GetPostionFromTextPoint(tp);
+            TextPoint tp = this._View.GetLayoutLineFromIndex(index);
+            return this._View.GetPostionFromTextPoint(tp);
         }
 
         /// <summary>
@@ -332,8 +332,8 @@ namespace FooEditEngine.WPF
         {
             if (this.Document.FireUpdateEvent == false)
                 throw new InvalidOperationException("");
-            TextPoint tp = this.View.GetTextPointFromPostion(p);
-            return this.View.GetIndexFromLayoutLine(tp);
+            TextPoint tp = this._View.GetTextPointFromPostion(p);
+            return this._View.GetIndexFromLayoutLine(tp);
         }
 
         /// <summary>
@@ -341,7 +341,7 @@ namespace FooEditEngine.WPF
         /// </summary>
         public void Refresh()
         {
-            this.Refresh(this.View.PageBound);
+            this.Refresh(this._View.PageBound);
         }
 
         /// <summary>
@@ -349,7 +349,7 @@ namespace FooEditEngine.WPF
         /// </summary>
         public void PerfomLayouts()
         {
-            this.View.PerfomLayouts();
+            this._View.PerfomLayouts();
         }
 
         /// <summary>
@@ -359,7 +359,7 @@ namespace FooEditEngine.WPF
         /// <param name="alignTop">指定行を画面上に置くなら真。そうでないなら偽</param>
         public void ScrollIntoView(int row, bool alignTop)
         {
-            this.View.ScrollIntoView(row, alignTop);
+            this._View.ScrollIntoView(row, alignTop);
         }
 
         /// <summary>
@@ -397,11 +397,11 @@ namespace FooEditEngine.WPF
             {
                 TextStoreHelper.NotifyTextChanged(this.textStore, 0, 0, this.Document.Length);
                 if (this.verticalScrollBar != null)
-                    this.verticalScrollBar.Maximum = this.View.LayoutLines.Count;
-                this.View.CalculateWhloeViewPort();
-                this.View.CalculateLineCountOnScreen();
+                    this.verticalScrollBar.Maximum = this._View.LayoutLines.Count;
+                this._View.CalculateWhloeViewPort();
+                this._View.CalculateLineCountOnScreen();
                 this.IsEnabled = true;
-                this.Refresh(this.View.PageBound);
+                this.Refresh(this._View.PageBound);
             }
         }
 
@@ -443,7 +443,7 @@ namespace FooEditEngine.WPF
             {
                 this.textStore.Dispose();
                 this.timer.Stop();
-                this.View.Dispose();
+                this._View.Dispose();
                 this.Render.Dispose();
             }
             SystemEvents.UserPreferenceChanged -= new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
@@ -454,7 +454,7 @@ namespace FooEditEngine.WPF
             if (this.disposed || this.Visibility == Visibility.Collapsed)
                 return;
 
-            this.Render.DrawContent(this.View, this.IsEnabled, updateRect);
+            this.Render.DrawContent(this._View, this.IsEnabled, updateRect);
             this.Document.IsRequestRedraw = false;
         }
 
@@ -565,7 +565,7 @@ namespace FooEditEngine.WPF
 
         void textStore_CompositionUpdated(int start, int end)
         {
-            if (TextStoreHelper.ScrollToCompstionUpdated(this.textStore, this.View, start, end))
+            if (TextStoreHelper.ScrollToCompstionUpdated(this.textStore, this._View, start, end))
                 this.Refresh();
         }
         bool textStore_CompositionStarted()
@@ -598,7 +598,7 @@ namespace FooEditEngine.WPF
         )
         {
             Point startPos, endPos;
-            TextStoreHelper.GetStringExtent(this.Document, this.View, i_startIndex, i_endIndex, out startPos, out endPos);
+            TextStoreHelper.GetStringExtent(this.Document, this._View, i_startIndex, i_endIndex, out startPos, out endPos);
 
             double scale = this.Render.GetScale();
             
@@ -624,7 +624,7 @@ namespace FooEditEngine.WPF
         void _textStore_GetSelectionIndex(int start_index, int max_count, out DotNetTextStore.TextSelection[] sels)
         {
             TextRange selRange;
-            TextStoreHelper.GetSelection(this._Controller, this.View.Selections, out selRange);
+            TextStoreHelper.GetSelection(this._Controller, this._View.Selections, out selRange);
 
             sels = new DotNetTextStore.TextSelection[1];
             sels[0] = new DotNetTextStore.TextSelection();
@@ -634,7 +634,7 @@ namespace FooEditEngine.WPF
 
         void _textStore_SetSelectionIndex(DotNetTextStore.TextSelection[] sels)
         {
-            TextStoreHelper.SetSelectionIndex(this._Controller, this.View, sels[0].start, sels[0].end);
+            TextStoreHelper.SetSelectionIndex(this._Controller, this._View, sels[0].start, sels[0].end);
             this.Refresh();
         }
 
@@ -652,7 +652,7 @@ namespace FooEditEngine.WPF
         {
             base.OnGotKeyboardFocus(e);
             this.textStore.SetFocus();
-            this.View.IsFocused = true;
+            this._View.IsFocused = true;
             this.timer.Interval = new TimeSpan(0,0,0,0,Interval);
             this.Refresh();
         }
@@ -664,7 +664,7 @@ namespace FooEditEngine.WPF
         protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
         {
             base.OnLostKeyboardFocus(e);
-            this.View.IsFocused = false;
+            this._View.IsFocused = false;
             this.timer.Interval = new TimeSpan(0, 0, 0, 0, IntervalWhenLostFocuse);
             this.Refresh();
         }
@@ -760,12 +760,12 @@ namespace FooEditEngine.WPF
                     movedCaret = true;
                     break;
                 case Key.PageUp:
-                    this._Controller.Scroll(ScrollDirection.Up,this.View.LineCountOnScreen, this.IsPressedModifierKey(modiferKeys, ModifierKeys.Shift),true);
+                    this._Controller.Scroll(ScrollDirection.Up,this._View.LineCountOnScreen, this.IsPressedModifierKey(modiferKeys, ModifierKeys.Shift),true);
                     this.Refresh();
                     movedCaret = true;
                     break;
                 case Key.PageDown:
-                    this._Controller.Scroll(ScrollDirection.Down,this.View.LineCountOnScreen, this.IsPressedModifierKey(modiferKeys, ModifierKeys.Shift),true);
+                    this._Controller.Scroll(ScrollDirection.Down,this._View.LineCountOnScreen, this.IsPressedModifierKey(modiferKeys, ModifierKeys.Shift),true);
                     this.Refresh();
                     movedCaret = true;
                     break;
@@ -822,10 +822,10 @@ namespace FooEditEngine.WPF
         protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
         {
             var p = this.GetDipFromPoint(e.GetPosition(this));
-            TextPoint tp = this.View.GetTextPointFromPostion(p);
+            TextPoint tp = this._View.GetTextPointFromPostion(p);
             if (tp == TextPoint.Null)
                 return;
-            int index = this.View.LayoutLines.GetIndexFromTextPoint(tp);
+            int index = this._View.LayoutLines.GetIndexFromTextPoint(tp);
 
             FooMouseButtonEventArgs newEventArgs = new FooMouseButtonEventArgs(e.MouseDevice,
                 e.Timestamp,
@@ -865,10 +865,10 @@ namespace FooEditEngine.WPF
             this.CaptureMouse();
 
             var p = this.GetDipFromPoint(e.GetPosition(this));
-            TextPoint tp = this.View.GetTextPointFromPostion(p);
+            TextPoint tp = this._View.GetTextPointFromPostion(p);
             if (tp == TextPoint.Null)
                 return;
-            int index = this.View.LayoutLines.GetIndexFromTextPoint(tp);
+            int index = this._View.LayoutLines.GetIndexFromTextPoint(tp);
 
             FooMouseButtonEventArgs newEventArgs = new FooMouseButtonEventArgs(e.MouseDevice,
                 e.Timestamp,
@@ -883,13 +883,13 @@ namespace FooEditEngine.WPF
 
             if (e.LeftButton == MouseButtonState.Pressed)
             {
-                FoldingItem foldingData = this.View.HitFoldingData(p.X,tp.row);
+                FoldingItem foldingData = this._View.HitFoldingData(p.X,tp.row);
                 if (foldingData != null)
                 {
                     if (foldingData.Expand)
-                        this.View.LayoutLines.FoldingCollection.Collapse(foldingData);
+                        this._View.LayoutLines.FoldingCollection.Collapse(foldingData);
                     else
-                        this.View.LayoutLines.FoldingCollection.Expand(foldingData);
+                        this._View.LayoutLines.FoldingCollection.Expand(foldingData);
                     this._Controller.JumpCaret(foldingData.Start,false);
                 }
                 else
@@ -898,7 +898,7 @@ namespace FooEditEngine.WPF
                 }
                 if (this.peer != null)
                     this.peer.OnNotifyCaretChanged();
-                this.View.IsFocused = true;
+                this._View.IsFocused = true;
                 this.Focus();
                 this.Document.SelectGrippers.BottomLeft.Enabled = false;
                 this.Document.SelectGrippers.BottomRight.Enabled = false;
@@ -931,7 +931,7 @@ namespace FooEditEngine.WPF
             var p = this.GetDipFromPoint(e.GetPosition(this));
 
             TextPointSearchRange searchRange;
-            if (this.View.HitTextArea(p.X, p.Y))
+            if (this._View.HitTextArea(p.X, p.Y))
             {
                 searchRange = TextPointSearchRange.TextAreaOnly;
             }
@@ -946,7 +946,7 @@ namespace FooEditEngine.WPF
                 return;
             }
 
-            TextPoint tp = this.View.GetTextPointFromPostion(p, searchRange);
+            TextPoint tp = this._View.GetTextPointFromPostion(p, searchRange);
 
             if (tp == TextPoint.Null)
             {
@@ -955,7 +955,7 @@ namespace FooEditEngine.WPF
                 return;
             }
 
-            int index = this.View.GetIndexFromLayoutLine(tp);
+            int index = this._View.GetIndexFromLayoutLine(tp);
 
             FooMouseEventArgs newEventArgs = new FooMouseEventArgs(e.MouseDevice, e.Timestamp, e.StylusDevice, index);
             newEventArgs.RoutedEvent = e.RoutedEvent;
@@ -995,7 +995,7 @@ namespace FooEditEngine.WPF
         protected override void OnTouchDown(TouchEventArgs e)
         {
             var p = this.GetDipFromPoint(e.GetTouchPoint(this).Position);
-            this.hittedGripper = this.View.HitGripperFromPoint(p);
+            this.hittedGripper = this._View.HitGripperFromPoint(p);
             this.CaptureTouch(e.TouchDevice);
         }
 
@@ -1011,18 +1011,18 @@ namespace FooEditEngine.WPF
             }
 
             var p = this.GetDipFromPoint(e.GetTouchPoint(this).Position);
-            TextPoint tp = this.View.GetTextPointFromPostion(p);
+            TextPoint tp = this._View.GetTextPointFromPostion(p);
             if (tp == TextPoint.Null)
                 return;
-            int index = this.View.LayoutLines.GetIndexFromTextPoint(tp);
+            int index = this._View.LayoutLines.GetIndexFromTextPoint(tp);
 
-            FoldingItem foldingData = this.View.HitFoldingData(p.X, tp.row);
+            FoldingItem foldingData = this._View.HitFoldingData(p.X, tp.row);
             if (foldingData != null)
             {
                 if (foldingData.Expand)
-                    this.View.LayoutLines.FoldingCollection.Collapse(foldingData);
+                    this._View.LayoutLines.FoldingCollection.Collapse(foldingData);
                 else
-                    this.View.LayoutLines.FoldingCollection.Expand(foldingData);
+                    this._View.LayoutLines.FoldingCollection.Expand(foldingData);
                 this._Controller.JumpCaret(foldingData.Start, false);
             }
             else
@@ -1031,7 +1031,7 @@ namespace FooEditEngine.WPF
             }
             if (this.peer != null)
                 this.peer.OnNotifyCaretChanged();
-            this.View.IsFocused = true;
+            this._View.IsFocused = true;
             this.Focus();
             this.Document.SelectGrippers.BottomLeft.Enabled = false;
             this.Document.SelectGrippers.BottomRight.Enabled = true;
@@ -1129,12 +1129,12 @@ namespace FooEditEngine.WPF
             if (e.Category == UserPreferenceCategory.Keyboard)
             {
                 int blinkTime = (int)NativeMethods.GetCaretBlinkTime();
-                this.View.CaretBlink = blinkTime >= 0;
-                this.View.CaretBlinkTime = blinkTime * 2;
+                this._View.CaretBlink = blinkTime >= 0;
+                this._View.CaretBlinkTime = blinkTime * 2;
             }
             if (e.Category == UserPreferenceCategory.General)
             {
-                this.View.CaretWidthOnInsertMode = SystemParameters.CaretWidth;
+                this._View.CaretWidthOnInsertMode = SystemParameters.CaretWidth;
             }
         }
 
@@ -1154,16 +1154,16 @@ namespace FooEditEngine.WPF
                 return;
             if (this.Resize(this.image.ActualWidth, this.image.ActualHeight))
             {
-                this.Refresh(this.View.PageBound);
+                this.Refresh(this._View.PageBound);
                 return;
             }
 
-            bool updateAll = this.View.LayoutLines.HilightAll() || this.View.LayoutLines.GenerateFolding() || this.Document.IsRequestRedraw;
+            bool updateAll = this._View.LayoutLines.HilightAll() || this._View.LayoutLines.GenerateFolding() || this.Document.IsRequestRedraw;
 
             if (updateAll)
-                this.Refresh(this.View.PageBound);
+                this.Refresh(this._View.PageBound);
             else
-                this.Refresh(this.View.GetCurrentCaretRect());
+                this.Refresh(this._View.GetCurrentCaretRect());
         }
 
         void horizontalScrollBar_Scroll(object sender, ScrollEventArgs e)
@@ -1191,7 +1191,7 @@ namespace FooEditEngine.WPF
         {
             if (this.horizontalScrollBar == null || this.verticalScrollBar == null)
                 return;
-            EditView view = this.View;
+            EditView view = this._View;
             if (view.Src.Row > this.Document.LayoutLines.Count)
                 this.verticalScrollBar.Maximum = this.Document.LayoutLines.Count - 1;
             double absoulteX = Math.Abs(view.Src.X);
@@ -1205,7 +1205,7 @@ namespace FooEditEngine.WPF
 
         void Controller_SelectionChanged(object sender, EventArgs e)
         {
-            this.View.CaretBlink = this.View.CaretBlink;
+            this._View.CaretBlink = this._View.CaretBlink;
             this.CaretMoved(this, null);
             //こうしないと選択できなくなってしまう
             this.isNotifyChanged = true;
@@ -1232,17 +1232,17 @@ namespace FooEditEngine.WPF
             {
                 double scale = this.Render.GetScale();
                 // RenderはレタリングはDIPだが、widthとheightの値はDPI依存なのでDIPに変換する
-                this.View.PageBound = new Rectangle(0, 0, width / scale, height / scale);
+                this._View.PageBound = new Rectangle(0, 0, width / scale, height / scale);
 
                 if (this.horizontalScrollBar != null)
                 {
-                    this.horizontalScrollBar.LargeChange = this.View.PageBound.Width;
-                    this.horizontalScrollBar.Maximum = this.View.LongestWidth + this.horizontalScrollBar.LargeChange + 1;
+                    this.horizontalScrollBar.LargeChange = this._View.PageBound.Width;
+                    this.horizontalScrollBar.Maximum = this._View.LongestWidth + this.horizontalScrollBar.LargeChange + 1;
                 }
                 if (this.verticalScrollBar != null)
                 {
-                    this.verticalScrollBar.LargeChange = this.View.LineCountOnScreen;
-                    this.verticalScrollBar.Maximum = this.View.LayoutLines.Count + this.verticalScrollBar.LargeChange + 1;
+                    this.verticalScrollBar.LargeChange = this._View.LineCountOnScreen;
+                    this.verticalScrollBar.Maximum = this._View.LayoutLines.Count + this.verticalScrollBar.LargeChange + 1;
                 }
                 return true;
             }
@@ -1279,12 +1279,12 @@ namespace FooEditEngine.WPF
             if (this._Document.AutoComplete != null && this.Document.AutoComplete.GetPostion == null)
                 this._Document_AutoCompleteChanged(this.Document, null);
             //初期化が終わっていればすべて存在する
-            if (this.Controller != null && this.View != null && this.textStore != null)
+            if (this.Controller != null && this._View != null && this.textStore != null)
             {
                 this._Document.SelectionChanged += new EventHandler(Controller_SelectionChanged);
 
                 this.Controller.Document = value;
-                this.View.Document = value;
+                this._View.Document = value;
                 this.Controller.AdjustCaret();
                 this.textStore.NotifyTextChanged(oldLength, value.Length);
 
@@ -1314,7 +1314,7 @@ namespace FooEditEngine.WPF
             ((AutoCompleteBox)this._Document.AutoComplete).TargetPopup = this.popup;
             this._Document.AutoComplete.GetPostion = (tp, edoc) =>
             {
-                var p = this.View.GetPostionFromTextPoint(tp);
+                var p = this._View.GetPostionFromTextPoint(tp);
                 int height = (int)this.Render.emSize.Height;
                 p.Y += height;
                 return PointToScreen(this.TranslatePoint(p.Scale(Util.GetScale()), this));
@@ -1333,13 +1333,13 @@ namespace FooEditEngine.WPF
                     this.SetDocument(this.Document);
                     break;
                 case "Hilighter":
-                    this.View.Hilighter = this.Hilighter;
+                    this._View.Hilighter = this.Hilighter;
                     break;
                 case "TextAntialiasMode":
                     this.Render.TextAntialiasMode = this.TextAntialiasMode;
                     break;
                 case "FoldingStrategy":
-                    this.View.LayoutLines.FoldingStrategy = this.FoldingStrategy;
+                    this._View.LayoutLines.FoldingStrategy = this.FoldingStrategy;
                     break;
                 case "SelectedText":
                     if (!this.isNotifyChanged)
@@ -1363,7 +1363,7 @@ namespace FooEditEngine.WPF
                     this.Document.LineBreakCharCount = this.LineBreakCharCount;
                     break;
                 case "InsertMode":
-                    this.View.InsertMode = this.InsertMode;
+                    this._View.InsertMode = this.InsertMode;
                     break;
                 case "TabChars":
                     this.Document.TabStops = this.TabChars;
@@ -1372,10 +1372,10 @@ namespace FooEditEngine.WPF
                     this._Controller.RectSelection = this.RectSelectMode;
                     break;
                 case "DrawCaret":
-                    this.View.HideCaret = !this.DrawCaret;
+                    this._View.HideCaret = !this.DrawCaret;
                     break;
                 case "DrawCaretLine":
-                    this.View.HideLineMarker = !this.DrawCaretLine;
+                    this._View.HideLineMarker = !this.DrawCaretLine;
                     break;
                 case "DrawLineNumber":
                     this.Document.DrawLineNumber = this.DrawLineNumber;
@@ -1429,7 +1429,7 @@ namespace FooEditEngine.WPF
                     this.Render.OverwriteCaret = D2DRender.ToColor4(this.OverwriteCaret);
                     break;
                 case "Padding":
-                    this.View.Padding = new Padding((int)this.Padding.Left, (int)this.Padding.Top, (int)this.Padding.Right, (int)this.Padding.Bottom);
+                    this._View.Padding = new Padding((int)this.Padding.Left, (int)this.Padding.Top, (int)this.Padding.Right, (int)this.Padding.Bottom);
                     break;
                 case "LineMarker":
                     this.Render.LineMarker = D2DRender.ToColor4(this.LineMarker);
@@ -1469,6 +1469,14 @@ namespace FooEditEngine.WPF
         #endregion
         #region property
 
+        internal EditView View
+        {
+            get
+            {
+                return this._View;
+            }
+        }
+
         internal Controller Controller
         {
             get
@@ -1555,7 +1563,7 @@ namespace FooEditEngine.WPF
         /// </summary>
         public LineToIndexTable LayoutLineCollection
         {
-            get { return this.View.LayoutLines; }
+            get { return this._View.LayoutLines; }
         }
 
         /// <summary>