/// <param name="length">長さ</param>\r
public void Select(int start, int length)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
this.Controller.Select(start, length);\r
this.HScrollBar.Value = (int)this.View.Src.X;\r
this.VScrollBar.Value = this.View.Src.Row;\r
/// </summary>\r
public void SelectAll()\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
this.Controller.Select(0, this.Document.Length - 1);\r
}\r
\r
/// </summary>\r
public void DeSelectAll()\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
this.Controller.DeSelectAll();\r
}\r
\r
/// </summary>\r
public void Copy()\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
string text = this.SelectedText;\r
if(text != null && text != string.Empty)\r
Clipboard.SetText(text);\r
/// </summary>\r
public void Cut()\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
string text = this.SelectedText;\r
if (text != null && text != string.Empty)\r
{\r
/// </summary>\r
public void Paste()\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
if (Clipboard.ContainsText() == false)\r
return;\r
this.Controller.SelectedText = Clipboard.GetText();\r
/// <remarks>このメソッドを呼び出すと選択状態は解除されます</remarks>\r
public void JumpCaret(int index)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
this.Controller.JumpCaret(index);\r
}\r
/// <summary>\r
/// <remarks>このメソッドを呼び出すと選択状態は解除されます</remarks>\r
public void JumpCaret(int row, int col)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
this.Controller.JumpCaret(row, col);\r
}\r
\r
/// </summary>\r
public new void Refresh()\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
if (this.Document.FireUpdateEvent == false)\r
throw new InvalidOperationException("");\r
if(this.View.CaretBlink)\r
/// <returns>高さ</returns>\r
public double GetLineHeight(int row)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
if (this.Document.FireUpdateEvent == false)\r
throw new InvalidOperationException("");\r
return this.View.LayoutLines.GetLayout(row).Height;\r
/// <remarks>テキストポイントがクライアント領域の原点より外にある場合、返される値は原点に丸められます</remarks>\r
public System.Drawing.Point GetPostionFromTextPoint(TextPoint tp)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
if (this.Document.FireUpdateEvent == false)\r
throw new InvalidOperationException("");\r
return this.View.GetPostionFromTextPoint(tp);\r
/// <returns>テキストポイント</returns>\r
public TextPoint GetTextPointFromPostion(System.Drawing.Point p)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
if (this.Document.FireUpdateEvent == false)\r
throw new InvalidOperationException("");\r
return this.View.GetTextPointFromPostion(p);\r
/// <returns>座標を返す</returns>\r
public System.Drawing.Point GetPostionFromIndex(int index)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
if (this.Document.FireUpdateEvent == false)\r
throw new InvalidOperationException("");\r
TextPoint tp = this.View.GetLayoutLineFromIndex(index);\r
/// <returns>インデックスを返す</returns>\r
public int GetIndexFromPostion(System.Drawing.Point p)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- throw new InvalidOperationException();\r
if (this.Document.FireUpdateEvent == false)\r
throw new InvalidOperationException("");\r
TextPoint tp = this.View.GetTextPointFromPostion(p);\r
/// <returns>文字がコントロールによって処理された場合は true。それ以外の場合は false。 </returns>\r
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return false;\r
const int WM_KEYDOWN = 0x100;\r
if (msg.Msg != WM_KEYDOWN)\r
return base.ProcessCmdKey(ref msg, keyData);\r
/// <param name="e">インベントデータ</param>\r
protected override void OnMouseDown(MouseEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
-\r
TextPoint tp = this.View.GetTextPointFromPostion(e.Location);\r
if (tp == TextPoint.Null)\r
return;\r
/// <param name="e">インベントデータ</param>\r
protected override void OnMouseClick(MouseEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
-\r
int index = this.GetIndexFromPostion(e.Location);\r
\r
FooMouseEventArgs mouseEvent = new FooMouseEventArgs(index, e.Button, e.Clicks, e.X, e.Y, e.Delta);\r
/// <param name="e">インベントデータ</param>\r
protected override void OnMouseDoubleClick(MouseEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
-\r
TextPoint tp = this.View.GetTextPointFromPostion(e.Location);\r
if (tp == TextPoint.Null)\r
return;\r
/// <param name="e">インベントデータ</param>\r
protected override void OnMouseMove(MouseEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- {\r
- this.Cursor = Cursors.WaitCursor;\r
- return;\r
- }\r
if (this.Focused == false)\r
return;\r
\r
/// <param name="e">インベントデータ</param>\r
protected override void OnMouseWheel(MouseEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
-\r
base.OnMouseWheel(e);\r
\r
ScrollDirection dir = e.Delta > 0 ? ScrollDirection.Up : ScrollDirection.Down;\r
/// <param name="e">インベントデータ</param>\r
protected override void OnPaint(PaintEventArgs e)\r
{\r
- if (DesignMode || this.Document.State == AsyncState.Loading)\r
+ if (DesignMode)\r
{\r
SolidBrush brush = new SolidBrush(this.BackColor);\r
e.Graphics.FillRectangle(brush, this.ClientRectangle);\r
/// <param name="e">インベントデータ</param>\r
protected override void OnKeyDown(KeyEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
-\r
base.OnKeyDown(e);\r
\r
if (e.Handled)\r
/// <param name="e">インベントデータ</param>\r
protected override void OnKeyPress(KeyPressEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
-\r
base.OnKeyPress(e);\r
\r
if (e.Handled)\r
\r
void VScrollBar_Scroll(object sender, ScrollEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
this.View.TryScroll(this.View.Src.X, e.NewValue);\r
this.Refresh();\r
}\r
\r
void HScrollBar_Scroll(object sender, ScrollEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
int toX;\r
if (this.RightToLeft == System.Windows.Forms.RightToLeft.Yes)\r
toX = -e.NewValue;\r
\r
void Ime_StartCompstion(object sender, StartCompstionEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
this.Ime.Font = this.Font;\r
this.Ime.Location = this.GetPostionFromIndex(this.Controller.SelectionStart);\r
this.View.HideCaret = true;\r
\r
void Ime_ImeCompstion(object sender, ImeCompstionEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
this.Controller.DoInputString(e.InputText);\r
this.Refresh();\r
}\r
\r
void Ime_ImeDocumentFeed(object sender, ImeDocumentFeedEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
TextPoint tp = this.CaretPostion;\r
e.Pragraph = this.LayoutLines[tp.row];\r
e.pos = tp.col;\r
\r
void Ime_ImeReconvert(object sender, ImeReconvertStringEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
if (this.RectSelection)\r
return;\r
if (this.Controller.SelectionLength == 0)\r
\r
void Ime_ImeQueryReconvert(object sender, ImeQueryRecovertStringEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
-\r
TextPoint tp = this.LayoutLines.GetTextPointFromIndex(this.Controller.SelectionStart);\r
tp.col = e.offset;\r
\r
\r
void Document_Progress(object sender, ProgressEventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Saving)\r
- return;\r
if (e.state == ProgressState.Complete)\r
{\r
this.initScrollBars();\r
\r
void Timer_Tick(object sender,EventArgs e)\r
{\r
- if (this.Document.State == AsyncState.Loading)\r
- return;\r
if (this.View.CaretPostion.row >= this.View.LayoutLines.Count || DesignMode)\r
return;\r
\r