OSDN Git Service

グリッパーのビュークラスをCoreに移動させた
authorgdkhd812 <test@nnn.co.jp>
Fri, 23 Oct 2015 12:01:37 +0000 (17:31 +0530)
committergdkhd812 <test@nnn.co.jp>
Fri, 23 Oct 2015 12:01:37 +0000 (17:31 +0530)
Core/Core.projitems
Core/GripperView.cs [moved from Metro/FooEditEngine/GripperManager.cs with 68% similarity]
Core/ITextRender.cs
Metro/FooEditEngine/FooEditEngine.csproj
Metro/FooEditEngine/FooTextBox.cs
WPF/FooEditEngine/WPF/WPFRender.cs
Windows/FooEditEngine/PrintableTextRender.cs

index a0ef5a2..d299725 100644 (file)
@@ -25,6 +25,7 @@
     <Compile Include="$(MSBuildThisFileDirectory)FoldingCollection.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)GapBuffer+Enumerator.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)GapBuffer.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)GripperView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)IFoldingStrategy.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)IHilighter.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)ITextRender.cs" />
similarity index 68%
rename from Metro/FooEditEngine/GripperManager.cs
rename to Core/GripperView.cs
index ca5440c..1e26ed6 100644 (file)
@@ -1,14 +1,6 @@
-/*
- * Copyright (C) 2013 FooProject
- * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-using System;
+using System;
+using System.Collections.Generic;
+using System.Text;
 
 namespace FooEditEngine
 {
@@ -17,20 +9,20 @@ namespace FooEditEngine
         BottomLeft,
         BottomRight,
     }
-    class Gripper : IEquatable<Gripper>
+    class GripperView
     {
         public const int GripperWidth = 10;
         public const int HitAreaWidth = 48;
 
         Controller Controller;
         EditView View;
-        D2DRender Render;
+        ITextRender Render;
         GripperPostion type;
-        public Gripper(Controller controller, EditView view,D2DRender render,GripperPostion type)
+        public GripperView(Controller controller, EditView view, GripperPostion type)
         {
             this.Controller = controller;
             this.View = view;
-            this.Render = render;
+            this.Render = view.render;
             this.Enabled = false;
             this.type = type;
         }
@@ -55,7 +47,7 @@ namespace FooEditEngine
         public Point AdjustPoint(Point p)
         {
             Rectangle gripperRect = this.GetGripperRect(type, HitAreaWidth, HitAreaWidth);
-            
+
             if (gripperRect.IsHit(p))
                 p.Y = gripperRect.Y - 1;
             else
@@ -68,20 +60,20 @@ namespace FooEditEngine
 
         public void Draw()
         {
-            if(this.Enabled)
+            if (this.Enabled)
                 this.DrawGripper(this.type);
         }
 
         void DrawGripper(GripperPostion type)
         {
-            Rectangle gripperRect = GetGripperRect(type,GripperWidth,GripperWidth);
+            Rectangle gripperRect = GetGripperRect(type, GripperWidth, GripperWidth);
             double radius = gripperRect.Width / 2;
             Point point;
             point = new Point(gripperRect.X + radius, gripperRect.Y + radius);
             this.Render.DrawGripper(point, radius);
         }
 
-        Rectangle GetGripperRect(GripperPostion type,int width,int height)
+        Rectangle GetGripperRect(GripperPostion type, int width, int height)
         {
             TextPoint tp;
             Point point;
@@ -95,11 +87,11 @@ namespace FooEditEngine
 
             point = this.View.GetPostionFromTextPoint(tp);
             double lineHeight = this.View.LayoutLines.GetLayout(tp.row).Height;
-            
+
             return new Rectangle(point.X - radius, point.Y + lineHeight, width, height);
         }
 
-        public bool Equals(Gripper other)
+        public bool Equals(GripperView other)
         {
             return this.Rectangle == other.Rectangle;
         }
index 2c48f5c..78754d4 100644 (file)
@@ -550,6 +550,13 @@ namespace FooEditEngine
         /// <param name="syntaxCollection">ハイライト関連の情報を保持しているコレクション</param>
         /// <param name="MarkerRanges">マーカーを保持しているコレクション。マーカーの開始位置は行の先頭を0とする相対位置としてください(位置が-1の場合表示しないこと)</param>
         ITextLayout CreateLaytout(string str, SyntaxInfo[] syntaxCollection, IEnumerable<Marker> MarkerRanges);
+
+        /// <summary>
+        /// グリッパーを描く
+        /// </summary>
+        /// <param name="p">中心点</param>
+        /// <param name="radius">半径</param>
+        void DrawGripper(Point p, double radius);
     }
     interface IEditorRender : ITextRender
     {
index 56ce474..de179eb 100644 (file)
     <Compile Include="Direct2D\D2DRenderBase.cs" />
     <Compile Include="FooPrintText.cs" />
     <Compile Include="FooTextBox.cs" />
-    <Compile Include="GripperManager.cs" />
     <Compile Include="Print\ComInterface.cs" />
     <Compile Include="Print\D2DPrintRender.cs" />
     <Compile Include="Print\DocumentSource.cs" />
index 96a2a29..5d506a1 100644 (file)
@@ -79,7 +79,7 @@ namespace FooEditEngine.Metro
             this.Document = new Document();
             this.Document.LayoutLines.Render = this.Render;
 
-            this.View = new EditView(this.Document, this.Render, new Padding(5, Gripper.HitAreaWidth, Gripper.HitAreaWidth / 2, Gripper.HitAreaWidth));
+            this.View = new EditView(this.Document, this.Render, new Padding(5, GripperView.HitAreaWidth, GripperView.HitAreaWidth / 2, GripperView.HitAreaWidth));
             this.View.SrcChanged += View_SrcChanged;
             this.View.InsertMode = this.InsertMode;
             this.View.DrawLineNumber = this.DrawLineNumber;
@@ -92,8 +92,8 @@ namespace FooEditEngine.Metro
             this._Controller = new Controller(this.Document, this.View);
             this._Controller.SelectionChanged += Controller_SelectionChanged;
 
-            this.FirstGripper = new Gripper(this._Controller, this.View, this.Render, GripperPostion.BottomLeft);
-            this.SecondGripper = new Gripper(this._Controller, this.View, this.Render, GripperPostion.BottomRight);
+            this.FirstGripper = new GripperView(this._Controller, this.View, GripperPostion.BottomLeft);
+            this.SecondGripper = new GripperView(this._Controller, this.View, GripperPostion.BottomRight);
 
             this.gestureRecongnizer.GestureSettings = GestureSettings.Drag | 
                 GestureSettings.RightTap | 
@@ -781,9 +781,9 @@ namespace FooEditEngine.Metro
                 this.textStore.NotifySelectionChanged();
         }
 
-        Gripper FirstGripper, SecondGripper;
+        GripperView FirstGripper, SecondGripper;
         bool HittedCaret;
-        Gripper hittedGripper;
+        GripperView hittedGripper;
         private void gestureRecongnizer_ManipulationInertiaStarting(GestureRecognizer sender, ManipulationInertiaStartingEventArgs e)
         {
             //sender.InertiaTranslationDeceleration = 0.001f;
index 04f417a..c2ddbb7 100644 (file)
@@ -590,6 +590,12 @@ namespace FooEditEngine.WPF
             return layout;
         }
 
+        public void DrawGripper(Point p, double radius)
+        {
+            //タッチには対応していないので実装する必要はない
+            throw new NotImplementedException();
+        }
+
         public void Dispose()
         {
             this.Pens = null;
index 0acd1a4..f2d58ec 100644 (file)
@@ -238,6 +238,12 @@ namespace FooEditEngine.Windows
             return output;
         }
 
+        public void DrawGripper(Point p, double radius)
+        {
+            //タッチには対応していないので実装する必要はない
+            throw new NotImplementedException();
+        }
+
         public System.Drawing.Color Foreground
         {
             get;