public static void MouseMoveHelper( IPresentationDataAccess presentationDataAccess, DrawContext drawContext, Rectangle clientRectangle, IViewEvents viewEvents, Point pt, bool isLeftDrag, out CursorType newCursor ) { newCursor = CursorType.Arrow; if (presentationDataAccess != null) { foreach (var i in DrawingUtils.GetVisibleMessagesIterator(drawContext, presentationDataAccess, clientRectangle)) { DrawingUtils.Metrics mtx = DrawingUtils.GetMetrics(i, drawContext); if (pt.Y >= mtx.MessageRect.Top && pt.Y < mtx.MessageRect.Bottom) { if (isLeftDrag) { var hitTester = new HitTestingVisitor(drawContext, mtx, pt.X, i.TextLineIndex); i.Message.Visit(hitTester); MessageMouseEventFlag flags = MessageMouseEventFlag.ShiftIsHeld | MessageMouseEventFlag.CapturedMouseMove; if (pt.X < drawContext.CollapseBoxesAreaSize) { flags |= MessageMouseEventFlag.OulineBoxesArea; } viewEvents.OnMessageMouseEvent(i, hitTester.LineTextPosition, flags, pt); } if (i.Message.IsStartFrame() && mtx.OulineBox.Contains(pt)) { newCursor = CursorType.Arrow; } else if (pt.X < drawContext.CollapseBoxesAreaSize) { newCursor = CursorType.RightToLeftArrow; } else if (pt.X >= drawContext.GetTextOffset(0, 0).X) { newCursor = CursorType.IBeam; } else { newCursor = CursorType.Arrow; } } } } }
public static Metrics GetMetrics(ViewLine line, DrawContext dc) { Point offset = dc.GetTextOffset(line.Message.Level, line.LineIndex); Metrics m; m.MessageRect = new Rectangle( 0, offset.Y, dc.ViewWidth, dc.LineHeight ); m.TimePos = new Point( dc.CollapseBoxesAreaSize - dc.ScrollPos.X, m.MessageRect.Y ); int charCount = dc.GetTextToDisplay(line.Message).GetNthTextLine(line.TextLineIndex).Length; m.OffsetTextRect = new Rectangle( offset.X, m.MessageRect.Y, (int)((double)charCount * dc.CharWidthDblPrecision), m.MessageRect.Height ); m.OulineBoxCenter = new Point( line.IsBookmarked ? dc.OutlineBoxSize / 2 + 1 : dc.CollapseBoxesAreaSize / 2, m.MessageRect.Y + dc.LineHeight / 2 ); m.OulineBox = new Rectangle( m.OulineBoxCenter.X - dc.OutlineBoxSize / 2, m.OulineBoxCenter.Y - dc.OutlineBoxSize / 2, dc.OutlineBoxSize, dc.OutlineBoxSize ); return(m); }