void TextAreaMouseMove(object sender, MouseEventArgs e)
{
textArea.mousepos = e.Location;
// honour the starting selection strategy
switch (textArea.SelectionManager.selectFrom.where)
{
case WhereFrom.Gutter:
ExtendSelectionToMouse();
return;
case WhereFrom.TArea:
break;
}
textArea.ShowHiddenCursor(false);
if (dodragdrop) {
dodragdrop = false;
return;
}
doubleclick = false;
textArea.mousepos = new Point(e.X, e.Y);
if (clickedOnSelectedText) {
if (Math.Abs(mousedownpos.X - e.X) >= SystemInformation.DragSize.Width / 2 ||
Math.Abs(mousedownpos.Y - e.Y) >= SystemInformation.DragSize.Height / 2)
{
clickedOnSelectedText = false;
ISelection selection = textArea.SelectionManager.GetSelectionAt(textArea.Caret.Offset);
if (selection != null) {
string text = selection.SelectedText;
bool isReadOnly = SelectionManager.SelectionIsReadOnly(textArea.Document, selection);
if (text != null && text.Length > 0) {
DataObject dataObject = new DataObject ();
dataObject.SetData(DataFormats.UnicodeText, true, text);
dataObject.SetData(selection);
dodragdrop = true;
textArea.DoDragDrop(dataObject, isReadOnly ? DragDropEffects.All & ~DragDropEffects.Move : DragDropEffects.All);
}
}
}
return;
}
if (e.Button == MouseButtons.Left) {
if (gotmousedown && textArea.SelectionManager.selectFrom.where == WhereFrom.TArea)
{
ExtendSelectionToMouse();
}
}
}