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);
        }
示例#2
0
        public static void Draw(
            ViewLine msg,
            GraphicsResources ctx,
            ViewDrawing metrics,
            Graphics canvas,
            bool controlIsFocused,
            out int right,
            bool drawText,
            bool darkMode
            )
        {
            var helper = new MessageDrawing
            {
                resources   = ctx,
                msg         = msg,
                viewDrawing = metrics,
                canvas      = canvas,
                m           = metrics.GetMetrics(msg),
                darkMode    = darkMode
            };

            helper.DrawMessageBackground();

            helper.DrawTime();

            helper.DrawStringWithInplaceHightlight(drawText);

            helper.DrawCursorIfNeeded(controlIsFocused);

            helper.FillOutlineBackground();
            helper.DrawContentOutline();

            helper.DrawMessageSeparator();

            right = helper.m.OffsetTextRect.Right;
        }
        void IView.InvalidateLine(ViewLine line)
        {
            Rectangle r = DrawingUtils.GetMetrics(line, drawContext).MessageRect;

            InnerView.SetNeedsDisplayInRect(r.ToRectangleF().ToCGRect());
        }
示例#4
0
        void IView.InvalidateLine(ViewLine line)
        {
            Rectangle r = DrawingUtils.GetMetrics(line, drawContext).MessageRect;

            this.Invalidate(r);
        }