<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" />
-/*
- * 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
{
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;
}
public Point AdjustPoint(Point p)
{
Rectangle gripperRect = this.GetGripperRect(type, HitAreaWidth, HitAreaWidth);
-
+
if (gripperRect.IsHit(p))
p.Y = gripperRect.Y - 1;
else
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;
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;
}
/// <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
{
<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" />
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;
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 |
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;
return layout;
}
+ public void DrawGripper(Point p, double radius)
+ {
+ //タッチには対応していないので実装する必要はない
+ throw new NotImplementedException();
+ }
+
public void Dispose()
{
this.Pens = null;
return output;
}
+ public void DrawGripper(Point p, double radius)
+ {
+ //タッチには対応していないので実装する必要はない
+ throw new NotImplementedException();
+ }
+
public System.Drawing.Color Foreground
{
get;