OSDN Git Service

行番号が表示されないバグを修正した
[fooeditengine/FooEditEngine.git] / Metro / FooEditEngine / FooTextBox.cs
index 22ac9a8..79ca99b 100644 (file)
@@ -320,6 +320,16 @@ namespace FooEditEngine.Metro
         }\r
 \r
         /// <summary>\r
+        /// 指定行までスクロールする\r
+        /// </summary>\r
+        /// <param name="row">行</param>\r
+        /// <param name="alignTop">指定行を画面上に置くなら真。そうでないなら偽</param>\r
+        public void ScrollIntoView(int row, bool alignTop)\r
+        {\r
+            this.View.ScrollIntoView(row, alignTop);\r
+        }\r
+\r
+        /// <summary>\r
         /// ファイルからドキュメントを構築する\r
         /// </summary>\r
         /// <param name="sr">StremReader</param>\r
@@ -739,7 +749,7 @@ namespace FooEditEngine.Metro
             this.Refresh();\r
         }\r
 \r
-        void _textStore_InsertAtSelection(string i_value)\r
+        void _textStore_InsertAtSelection(string i_value,ref int o_stratIndex,ref int o_endIndex)\r
         {\r
             TextStoreHelper.InsertTextAtSelection(this._Controller, i_value);\r
             this.Refresh();\r
@@ -953,6 +963,7 @@ namespace FooEditEngine.Metro
             if (this.peer != null)\r
                 this.peer.OnNotifyCaretChanged();\r
             this.View.IsFocused = true;\r
+            this.Focus(FocusState.Programmatic);\r
             this.Refresh();\r
         }\r
 \r
@@ -976,7 +987,7 @@ namespace FooEditEngine.Metro
         }\r
         void Refresh(Rectangle updateRect)\r
         {\r
-            if (this.rectangle.ActualWidth == 0 || this.rectangle.ActualHeight == 0/* || !this.Render.IsCanDraw()*/)\r
+            if (this.rectangle.ActualWidth == 0 || this.rectangle.ActualHeight == 0 || this.Visibility == Windows.UI.Xaml.Visibility.Collapsed)\r
                 return;\r
 \r
             this.Render.BegineDraw();\r
@@ -1082,6 +1093,8 @@ namespace FooEditEngine.Metro
         public static void OnPropertyChanged(object sender, DependencyPropertyChangedEventArgs e)\r
         {\r
             FooTextBox source = (FooTextBox)sender;\r
+            if (e.Property.Equals(IndentModeProperty))\r
+                source.Controller.IndentMode = source.IndentMode;\r
             if (e.Property.Equals(SelectionProperty) && !source.nowCaretMove)\r
                 source._Controller.Select(source.Selection.Index,source.Selection.Length);\r
             if (e.Property.Equals(CaretPostionPropertyKey) && !source.nowCaretMove)\r
@@ -1153,6 +1166,8 @@ namespace FooEditEngine.Metro
                 source.View.LineBreakCharCount = source.LineBreakCharCount;\r
             if (e.Property.Equals(UpdateAreaProperty))\r
                 source.Render.UpdateArea = D2DRenderBase.ToColor4(source.UpdateArea);\r
+            if (e.Property.Equals(LineNumberProperty))\r
+                source.Render.LineNumber = D2DRenderBase.ToColor4(source.LineNumber);\r
             if (e.Property.Equals(FlowDirectionProperty))\r
             {\r
                 source.Render.RightToLeft = source.FlowDirection == Windows.UI.Xaml.FlowDirection.RightToLeft;\r
@@ -1163,7 +1178,7 @@ namespace FooEditEngine.Metro
             {\r
                 source.View.HideRuler = !source.DrawRuler;\r
                 source._Controller.JumpCaret(source.View.CaretPostion.row, source.View.CaretPostion.col);\r
-            }            \r
+            }\r
         }\r
         #endregion\r
 \r
@@ -1279,6 +1294,21 @@ namespace FooEditEngine.Metro
         }\r
 \r
         /// <summary>\r
+        /// インデントの方法を表す\r
+        /// </summary>\r
+        public IndentMode IndentMode\r
+        {\r
+            get { return (IndentMode)GetValue(IndentModeProperty); }\r
+            set { SetValue(IndentModeProperty, value); }\r
+        }\r
+\r
+        /// <summary>\r
+        /// IndentModeの依存プロパティを表す\r
+        /// </summary>\r
+        public static readonly DependencyProperty IndentModeProperty =\r
+            DependencyProperty.Register("IndentMode", typeof(IndentMode), typeof(FooTextBox), new PropertyMetadata(IndentMode.Tab,OnPropertyChanged));\r
+\r
+        /// <summary>\r
         /// 選択範囲を表す\r
         /// </summary>\r
         /// <remarks>\r
@@ -1595,6 +1625,21 @@ namespace FooEditEngine.Metro
             DependencyProperty.Register("OverwriteCaret", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.Black, OnPropertyChanged));\r
 \r
         /// <summary>\r
+        /// 行番号の色を表す\r
+        /// </summary>\r
+        public Windows.UI.Color LineNumber\r
+        {\r
+            get { return (Windows.UI.Color)GetValue(LineNumberProperty); }\r
+            set { SetValue(LineNumberProperty, value); }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Using a DependencyProperty as the backing store for LineNumber.  This enables animation, styling, binding, etc...\r
+        /// </summary>\r
+        public static readonly DependencyProperty LineNumberProperty =\r
+            DependencyProperty.Register("LineNumber", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.DimGray,OnPropertyChanged));\r
+\r
+        /// <summary>\r
         /// 余白を表す\r
         /// </summary>\r
         public new Thickness Padding\r