OSDN Git Service

ドラッグしながらの選択ができなくなるので元に戻した
[fooeditengine/FooEditEngine.git] / WPF / FooEditEngine / FooTextBox.cs
index 5d14d39..30a3bb8 100644 (file)
@@ -48,7 +48,7 @@ namespace FooEditEngine.WPF
         Document _Document;
         Popup popup;
 
-        const int Interval = 17;
+        const int Interval = 96;
         const int IntervalWhenLostFocuse = 160;
 
         static FooTextBox()
@@ -193,7 +193,7 @@ namespace FooEditEngine.WPF
             {
                 this.verticalScrollBar.SmallChange = 1;
                 this.verticalScrollBar.LargeChange = 10;
-                this.verticalScrollBar.Maximum = this.View.LayoutLines.Count;
+                this.verticalScrollBar.Maximum = this.Document.LayoutLines.Count - 1;
                 this.verticalScrollBar.Scroll += new ScrollEventHandler(verticalScrollBar_Scroll);
             }
         }
@@ -340,7 +340,7 @@ namespace FooEditEngine.WPF
         /// </summary>
         public void Refresh()
         {
-            this.Document.RequestRedraw();
+            this.Refresh(this.View.PageBound);
         }
 
         /// <summary>
@@ -397,6 +397,7 @@ 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.IsEnabled = true;
                 this.Refresh(this.View.PageBound);
@@ -930,16 +931,25 @@ namespace FooEditEngine.WPF
 
             TextPointSearchRange searchRange;
             if (this.View.HitTextArea(p.X, p.Y))
+            {
                 searchRange = TextPointSearchRange.TextAreaOnly;
+            }
             else if (leftPressed)
+            {
                 searchRange = TextPointSearchRange.Full;
+            }
             else
-                searchRange = TextPointSearchRange.TextAreaOnly;
+            {
+                this.Cursor = Cursors.Arrow;
+                base.OnMouseMove(e);
+                return;
+            }
 
             TextPoint tp = this.View.GetTextPointFromPostion(p, searchRange);
 
             if (tp == TextPoint.Null)
             {
+                this.Cursor = Cursors.Arrow;
                 base.OnMouseMove(e);
                 return;
             }
@@ -965,7 +975,6 @@ namespace FooEditEngine.WPF
             {
                 this.Cursor = Cursors.Arrow;
             }
-
             if (leftPressed)
             {
                 bool controlPressed = (Keyboard.GetKeyStates(Key.LeftCtrl) & KeyStates.Down) == KeyStates.Down;
@@ -1163,7 +1172,7 @@ namespace FooEditEngine.WPF
                 toX = this.horizontalScrollBar.Value;
             else
                 toX = -this.horizontalScrollBar.Value;
-            this._Controller.Scroll(toX, this.View.Src.Row, false, false);
+            this.Controller.ScrollByPixel(ScrollDirection.Left, (int)toX, false, false);
             this.Refresh();
         }
 
@@ -1171,10 +1180,7 @@ namespace FooEditEngine.WPF
         {
             if (this.verticalScrollBar == null)
                 return;
-            int newRow = (int)this.verticalScrollBar.Value;
-            if (newRow >= this.View.LayoutLines.Count)
-                return;
-            this._Controller.Scroll(this.View.Src.X,newRow, false, false);
+            this.Controller.Scroll(this.Document.Src.X, (int)this.verticalScrollBar.Value, false, false);
             this.Refresh();
         }
 
@@ -1183,8 +1189,8 @@ namespace FooEditEngine.WPF
             if (this.horizontalScrollBar == null || this.verticalScrollBar == null)
                 return;
             EditView view = this.View;
-            if (view.Src.Row > this.verticalScrollBar.Maximum)
-                this.verticalScrollBar.Maximum = view.Src.Row + view.LineCountOnScreen + 1;
+            if (view.Src.Row > this.Document.LayoutLines.Count)
+                this.verticalScrollBar.Maximum = this.Document.LayoutLines.Count - 1;
             double absoulteX = Math.Abs(view.Src.X);
             if(absoulteX > this.horizontalScrollBar.Maximum)
                 this.horizontalScrollBar.Maximum = absoulteX + view.PageBound.Width + 1;
@@ -1306,7 +1312,7 @@ namespace FooEditEngine.WPF
             this._Document.AutoComplete.GetPostion = (tp, edoc) =>
             {
                 var p = this.View.GetPostionFromTextPoint(tp);
-                int height = (int)doc.LayoutLines.GetLayout(edoc.CaretPostion.row).Height;
+                int height = (int)this.Render.emSize.Height;
                 p.Y += height;
                 return PointToScreen(this.TranslatePoint(p.Scale(Util.GetScale()), this));
             };