OSDN Git Service

選択領域の表示時の処理を最適化した
[fooeditengine/FooEditEngine.git] / Core / ITextRender.cs
index 78754d4..0271ecb 100644 (file)
@@ -13,10 +13,24 @@ using System.Collections.Generic;
 
 namespace FooEditEngine
 {
-    struct Point
+    /// <summary>
+    /// 点を表す構造体
+    /// </summary>
+    public struct Point
     {
+        /// <summary>
+        /// X座標
+        /// </summary>
         public double X;
+        /// <summary>
+        /// Y座標
+        /// </summary>
         public double Y;
+        /// <summary>
+        /// コンストラクター
+        /// </summary>
+        /// <param name="x">X座標</param>
+        /// <param name="y">Y座標</param>
         public Point(double x, double y)
         {
             this.X = x;
@@ -66,12 +80,30 @@ namespace FooEditEngine
             return result;
         }
 
+        /// <summary>
+        /// 一定の倍率で拡大する
+        /// </summary>
+        /// <param name="scale">倍率</param>
+        /// <returns></returns>
         public Point Scale(double scale)
         {
             this.X *= scale;
             this.Y *= scale;
             return this;
         }
+
+        /// <summary>
+        /// 一定方向に移動する
+        /// </summary>
+        /// <param name="x_offset">移動量X</param>
+        /// <param name="y_offset">移動量Y</param>
+        /// <returns></returns>
+        public Point Offset(double x_offset, double y_offset)
+        {
+            this.X += x_offset;
+            this.Y += y_offset;
+            return this;
+        }
 #if WINFORM
         public static implicit operator Point(System.Drawing.Point p)
         {
@@ -81,9 +113,9 @@ namespace FooEditEngine
         {
             return new System.Drawing.Point((int)p.X, (int)p.Y);
         }
-        public static implicit operator SharpDX.Vector2(Point p)
+        public static implicit operator SharpDX.Mathematics.Interop.RawVector2(Point p)
         {
-            return new SharpDX.Vector2((float)p.X, (float)p.Y);
+            return new SharpDX.Mathematics.Interop.RawVector2((float)p.X, (float)p.Y);
         }
 #endif
 #if WPF
@@ -95,12 +127,12 @@ namespace FooEditEngine
         {
             return new System.Windows.Point(p.X, p.Y);
         }
-        public static implicit operator SharpDX.Vector2(Point p)
+        public static implicit operator SharpDX.Mathematics.Interop.RawVector2(Point p)
         {
-            return new SharpDX.Vector2((float)p.X, (float)p.Y);
+            return new SharpDX.Mathematics.Interop.RawVector2((float)p.X, (float)p.Y);
         }
 #endif
-#if METRO
+#if METRO || WINDOWS_UWP
         public static implicit operator Point(Windows.Foundation.Point p)
         {
             return new Point(p.X, p.Y);
@@ -109,9 +141,9 @@ namespace FooEditEngine
         {
             return new Windows.Foundation.Point(p.X, p.Y);
         }
-        public static implicit operator SharpDX.Vector2(Point p)
+        public static implicit operator SharpDX.Mathematics.Interop.RawVector2(Point p)
         {
-            return new SharpDX.Vector2((float)p.X, (float)p.Y);
+            return new SharpDX.Mathematics.Interop.RawVector2((float)p.X, (float)p.Y);
         }
 #endif
     }
@@ -188,7 +220,7 @@ namespace FooEditEngine
             return new System.Windows.Size(p.Width, p.Height);
         }
 #endif
-#if METRO
+#if METRO || WINDOWS_UWP
         public static implicit operator Size(Windows.Foundation.Size p)
         {
             return new Size(p.Width, p.Height);
@@ -328,9 +360,9 @@ namespace FooEditEngine
         {
             return new System.Drawing.Rectangle((int)p.X, (int)p.Y, (int)p.Width, (int)p.Height);
         }
-        public static implicit operator SharpDX.RectangleF(Rectangle p)
+        public static implicit operator SharpDX.Mathematics.Interop.RawRectangleF(Rectangle p)
         {
-            return new SharpDX.RectangleF((float)p.X, (float)p.Y, (float)p.Width, (float)p.Height);
+            return new SharpDX.Mathematics.Interop.RawRectangleF((float)p.X, (float)p.Y, (float)p.BottomRight.X, (float)p.BottomRight.Y);
         }
 #endif
 #if WPF
@@ -342,12 +374,12 @@ namespace FooEditEngine
         {
             return new System.Windows.Rect(p.X, p.Y, p.Width, p.Height);
         }
-        public static implicit operator SharpDX.RectangleF(Rectangle p)
+        public static implicit operator SharpDX.Mathematics.Interop.RawRectangleF(Rectangle p)
         {
-            return new SharpDX.RectangleF((float)p.X, (float)p.Y, (float)p.Width, (float)p.Height);
+            return new SharpDX.Mathematics.Interop.RawRectangleF((float)p.X, (float)p.Y, (float)p.BottomRight.X, (float)p.BottomRight.Y);
         }
 #endif
-#if METRO
+#if METRO || WINDOWS_UWP
         public static implicit operator Rectangle(Windows.Foundation.Rect p)
         {
             return new Rectangle(p.X, p.Y, p.Width, p.Height);
@@ -356,9 +388,10 @@ namespace FooEditEngine
         {
             return new Windows.Foundation.Rect(p.X, p.Y, p.Width, p.Height);
         }
-        public static implicit operator SharpDX.RectangleF(Rectangle p)
+
+        public static implicit operator SharpDX.Mathematics.Interop.RawRectangleF(Rectangle p)
         {
-            return new SharpDX.RectangleF((float)p.X, (float)p.Y, (float)p.Width, (float)p.Height);
+            return new SharpDX.Mathematics.Interop.RawRectangleF((float)p.X, (float)p.Y, (float)p.BottomRight.X, (float)p.BottomRight.Y);
         }
 #endif
     }
@@ -497,6 +530,26 @@ namespace FooEditEngine
         int TabWidthChar { get; set; }
 
         /// <summary>
+        /// 全角スペースを表示するかどうか
+        /// </summary>
+        bool ShowFullSpace { get; set; }
+
+        /// <summary>
+        /// 半角スペースを表示するかどうか
+        /// </summary>
+        bool ShowHalfSpace { get; set; }
+
+        /// <summary>
+        /// TABを表示するかどうか
+        /// </summary>
+        bool ShowTab { get; set; }
+
+        /// <summary>
+        /// 改行を表示するかどうか
+        /// </summary>
+        bool ShowLineBreak { get; set; }
+
+        /// <summary>
         /// 1文字当たりの高さと幅
         /// </summary>
         Size emSize { get; }
@@ -519,17 +572,18 @@ namespace FooEditEngine
         /// <param name="y">y座標</param>
         /// <param name="align">書式方向</param>
         /// <param name="layoutRect">レイアウト領域</param>
+        /// <param name="colorType">色</param>
         void DrawString(string str, double x, double y, StringAlignment align, Size layoutRect,StringColorType colorType = StringColorType.Forground);
 
         /// <summary>
         /// 行を表示する
         /// </summary>
+        /// <param name="doc">ドキュメントオブジェクト</param>
         /// <param name="lti">LineToIndexオブジェクト</param>
         /// <param name="row">行</param>
         /// <param name="x">行の左上を表すX座標</param>
         /// <param name="y">行の左上を表すY座標</param>
-        /// <param name="SelectRanges">選択領域を保持しているコレクション。選択領域の開始位置は行の先頭を0とする相対位置としてください(位置が-1の場合表示されません)</param>
-        void DrawOneLine(LineToIndexTable lti, int row, double x, double y, IEnumerable<Selection> SelectRanges);
+        void DrawOneLine(Document doc,LineToIndexTable lti, int row, double x, double y);
 
         /// <summary>
         /// 行を折り返す
@@ -549,7 +603,8 @@ namespace FooEditEngine
         /// <returns>ITextLayoutオブジェクト</returns>
         /// <param name="syntaxCollection">ハイライト関連の情報を保持しているコレクション</param>
         /// <param name="MarkerRanges">マーカーを保持しているコレクション。マーカーの開始位置は行の先頭を0とする相対位置としてください(位置が-1の場合表示しないこと)</param>
-        ITextLayout CreateLaytout(string str, SyntaxInfo[] syntaxCollection, IEnumerable<Marker> MarkerRanges);
+        /// <param name="Selections">選択領域を保持しているコレクション。マーカーの開始位置は行の先頭を0とする相対位置としてください(位置が-1の場合表示しないこと)</param>
+        ITextLayout CreateLaytout(string str, SyntaxInfo[] syntaxCollection, IEnumerable<Marker> MarkerRanges, IEnumerable<Selection> Selections);
 
         /// <summary>
         /// グリッパーを描く
@@ -557,6 +612,17 @@ namespace FooEditEngine
         /// <param name="p">中心点</param>
         /// <param name="radius">半径</param>
         void DrawGripper(Point p, double radius);
+
+        /// <summary>
+        /// クリッピングを開始します
+        /// </summary>
+        /// <param name="rect">クリッピングする範囲</param>
+        void BeginClipRect(Rectangle rect);
+
+        /// <summary>
+        /// クリッピングを終了します
+        /// </summary>
+        void EndClipRect();
     }
     interface IEditorRender : ITextRender
     {