protected override void OnMouseMove(MouseEventArgs e)
{
MouseX = e.X;
MouseY = e.Y;
TextPoint pos = Painter.CharFromPixel(e.X, e.Y);
Row row = null;
if (pos.Y >= 0 && pos.Y < Document.Count)
row = Document[pos.Y];
#region RowEvent
var rea = new RowMouseEventArgs {Row = row, Button = e.Button, MouseX = MouseX, MouseY = MouseY};
if (e.X >= View.TextMargin - 7)
{
rea.Area = RowArea.TextArea;
}
else if (e.X < View.GutterMarginWidth)
{
rea.Area = RowArea.GutterArea;
}
else if (e.X < View.LineNumberMarginWidth +
View.GutterMarginWidth)
{
rea.Area = RowArea.LineNumberArea;
}
else if (e.X < View.TextMargin - 7)
{
rea.Area = RowArea.FoldingArea;
}
OnRowMouseMove(rea);
#endregion
try
{
if (Document != null)
{
if (e.Button == MouseButtons.Left)
{
if (View.Action == EditAction.SelectText)
{
//Selection ACTIONS!!!!!!!!!!!!!!
Caret.Blink = true;
Caret.SetPos(pos);
if (e.X <= View.TotalMarginWidth)
Caret.MoveDown(true);
Caret.CropPosition();
Selection.MakeSelection();
ScrollIntoView();
Redraw();
}
else if (View.Action == EditAction.None)
{
if (IsOverSelection(e.X, e.Y))
{
BeginDragDrop();
}
}
else if (View.Action == EditAction.DragText) {}
}
else
{
TextPoint p = pos;
Row r = Document[p.Y];
bool DidShow = false;
if (r != null)
{
if (e.X >= r.Expansion_PixelEnd && r.IsCollapsed)
{
// ROB: Added check for Collapsed tooltips.
if (CollapsedBlockTooltipsEnabled)
{
if (r.expansion_StartSpan != null)
{
if (r.expansion_StartSpan.StartRow != null &&
r.expansion_StartSpan.EndRow != null &&
r.expansion_StartSpan.Expanded == false)
{
string t = "";
int j = 0;
for (int i = r.expansion_StartSpan.StartRow.Index;
i <=
r.expansion_StartSpan.EndRow.Index;
i++)
{
if (j > 0)
t += "\n";
Row tmp = Document[i];
string tmpstr = tmp.Text.Replace("\t", " ");
t += tmpstr;
if (j > 20)
{
t += "...";
break;
}
j++;
}
//tooltip.res
tooltip.InitialDelay = TooltipDelay;
if (tooltip.GetToolTip(this) != t)
tooltip.SetToolTip(this, t);
tooltip.Active = true;
DidShow = true;
}
}
}
}
else
{
Word w = Document.GetFormatWordFromPos(p);
if (w != null)
{
if (w.InfoTip != null)
{
tooltip.InitialDelay = TooltipDelay;
if (tooltip.GetToolTip(this) != w.InfoTip)
tooltip.SetToolTip(this, w.InfoTip);
tooltip.Active = true;
DidShow = true;
}
}
}
}
if (tooltip != null)
{
if (!DidShow)
tooltip.SetToolTip(this, "");
}
}
SetMouseCursor(e.X, e.Y);
base.OnMouseMove(e);
}
}
catch {}
}