Example #1
0
        protected override void Render(Gdk.Drawable drawable, Widget widget,
                                       Gdk.Rectangle background_area, Gdk.Rectangle cell_area,
                                       Gdk.Rectangle expose_area, CellRendererState flags)
        {
            Pango.Layout layout = GetLayout(widget);

            // FIXME: If this code is ever built into its own library,
            // the call to Tomboy will definitely have to change
            layout.SetText(Tomboy.GuiUtils.GetPrettyPrintDate(date, show_time));

            int x, y, w, h;

            CalculateSize(layout, out x, out y, out w, out h);

            StateType state = RendererStateToWidgetState(flags);

            Gdk.GC gc;
            if (state.Equals(StateType.Selected))
            {
                // Use the proper Gtk.StateType so text appears properly when selected
                gc = new Gdk.GC(drawable);
                gc.Copy(widget.Style.TextGC(state));
                gc.RgbFgColor = widget.Style.Foreground(state);
            }
            else
            {
                gc = widget.Style.TextGC(Gtk.StateType.Normal);
            }

            drawable.DrawLayout(
                gc,
                cell_area.X + (int)Xalign + (int)Xpad,
                cell_area.Y + ((cell_area.Height - h) / 2),
                layout);
        }
Example #2
0
 protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
 {
     //this seems to be the minimum to render text
     GC gc = widget.Style.TextGC(StateType.Normal);
     Pango.Layout layout = new Pango.Layout(widget.PangoContext);
     layout.SetText(text);//add the text to thelayout.
     //this is the actuall rendering
     window.DrawLayout(gc, expose_area.X, expose_area.Y, layout);
 }
Example #3
0
        internal protected override void Draw(Gdk.Drawable drawable, Gdk.Rectangle area, long line, int x, int y)
        {
            drawable.DrawRectangle(GetGC(Style.HexOffsetBg), true, x, y, Width, Editor.LineHeight);
            LayoutWrapper layout = GetLayout(line);
            int           w, h;

            layout.Layout.GetPixelSize(out w, out h);
            drawable.DrawLayout(GetGC(line != Caret.Line ? Style.HexOffset : Style.HexOffsetHighlighted), x + Width - w - 4, y, layout.Layout);
            if (layout.IsUncached)
            {
                layout.Dispose();
            }
        }
        internal protected override void Draw(Gdk.Drawable drawable, Gdk.Rectangle area, long line, int x, int y)
        {
            drawable.DrawRectangle(bgGC, true, x, y, Width, Editor.LineHeight);
            LayoutWrapper layout = GetLayout(line);

            if (!Data.IsSomethingSelected && Caret.InTextEditor && line == Data.Caret.Line)
            {
                drawable.DrawRectangle(GetGC(Style.HighlightOffset), true, CalculateCaretXPos(false), y, byteWidth, Editor.LineHeight);
            }

            drawable.DrawLayout(fgGC, x, y, layout.Layout);
            if (layout.IsUncached)
            {
                layout.Dispose();
            }
        }
        internal protected override void Draw(Gdk.Drawable drawable, Gdk.Rectangle area, long line, int x, int y)
        {
            drawable.DrawRectangle(bgGC, true, x, y, Width, Editor.LineHeight);
            LayoutWrapper layout = GetLayout(line);

            if (!Data.IsSomethingSelected && !Caret.InTextEditor && line == Data.Caret.Line)
            {
                int column  = (int)(Caret.Offset % BytesInRow);
                int xOffset = charWidth * column;
                drawable.DrawRectangle(GetGC(Style.HighlightOffset), true, x + xOffset, y, charWidth, Editor.LineHeight);
            }
            drawable.DrawLayout(fgGC, x, y, layout.Layout);
            if (layout.IsUncached)
            {
                layout.Dispose();
            }
        }
Example #6
0
        protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
        {
            base.Render(window, widget, background_area, cell_area, expose_area, flags);
            int xPos = cell_area.X;

            if (this.Pixbuf != null)
            {
                window.DrawPixbuf(widget.Style.MidGC(StateType.Normal), this.Pixbuf, 0, 0, xPos + 1, cell_area.Y + 1, 16, 16, Gdk.RgbDither.Normal, 0, 0);
                xPos += 20;
            }
            using (var layout = new Pango.Layout(widget.PangoContext)) {
                layout.Alignment = Pango.Alignment.Left;
                layout.SetText(this.Text ?? "");

                StateType state = flags.HasFlag(CellRendererState.Selected) ?
                                  widget.IsFocus ? StateType.Selected : StateType.Active : StateType.Normal;

                window.DrawLayout(widget.Style.TextGC(state), xPos, cell_area.Y + 2, layout);
            }
        }
        protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle backgroundArea, Gdk.Rectangle cellArea, Gdk.Rectangle exposeArea, CellRendererState flags)
        {
            base.Render(window, widget, backgroundArea, cellArea, exposeArea, flags);

            var buttonRect = GetButtonRectangle(backgroundArea);
            var highlight  = buttonRect.Contains(LastMouseX, LastMouseY); // flags.HasFlag(CellRendererState.Prelit)

            Gdk.GC gcBlack = widget.Style.BlackGC;
            Gdk.GC gcBack  = widget.Style.BackgroundGC(highlight ? StateType.Selected : StateType.Normal);
            Gdk.GC gcText  = widget.Style.TextGC(highlight ? StateType.Selected : StateType.Normal);

            window.DrawRectangle(gcBack, true, buttonRect);
            window.DrawRectangle(gcBlack, false, buttonRect);

            Pango.Layout layout = new Pango.Layout(widget.PangoContext);
            layout.SetText("...");
            layout.Alignment = Pango.Alignment.Center;
            layout.Width     = buttonRect.Width;
            window.DrawLayout(gcText, buttonRect.Left + buttonRect.Width / 2, buttonRect.Top, layout);
        }
        protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
        {
            StateType st = StateType.Normal;

            if ((flags & CellRendererState.Prelit) != 0)
            {
                st = StateType.Prelight;
            }
            if ((flags & CellRendererState.Focused) != 0)
            {
                st = StateType.Normal;
            }
            if ((flags & CellRendererState.Insensitive) != 0)
            {
                st = StateType.Insensitive;
            }
            if ((flags & CellRendererState.Selected) != 0)
            {
                st = widget.HasFocus ? StateType.Selected : Gtk.StateType.Active;
            }

            SetupLayout(widget, flags);

            int w, h;

            layout.GetPixelSize(out w, out h);

            const int textXOffset = 2;             // Shift text up slightly in the row.
            int       tx          = cell_area.X + (int)Xpad;
            int       ty          = cell_area.Y + (cell_area.Height - h) / 2 - textXOffset;

            int textPixelWidth = cell_area.Width - ((int)Xpad * 2);

            layout.Width = (int)(textPixelWidth * Pango.Scale.PangoScale);

            window.DrawLayout(widget.Style.TextGC(st), tx, ty, layout);
        }
        public void Draw(TextEditor editor, Gdk.Drawable win, int lineNr, Gdk.Rectangle lineArea)
        {
            EnsureLayoutCreated(editor);
            int lineNumber        = editor.Document.OffsetToLineNumber(lineSegment.Offset);
            int errorNumber       = lineNr - lineNumber;
            int x                 = editor.TextViewMargin.XOffset;
            int y                 = lineArea.Y;
            int right             = editor.Allocation.Width;
            int errorCounterWidth = 0;

            int ew = 0, eh = 0;

            if (errors.Count > 1 && errorCountLayout != null)
            {
                errorCountLayout.GetPixelSize(out ew, out eh);
                errorCounterWidth = ew + 10;
            }

            int x2 = System.Math.Max(right - LayoutWidth - border - (ShowIconsInBubble ? errorPixbuf.Width : 0) - errorCounterWidth, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset);
//			bool isEolSelected = editor.IsSomethingSelected && editor.SelectionMode != SelectionMode.Block ? editor.SelectionRange.Contains (lineSegment.Offset  + lineSegment.EditableLength) : false;
            int              active        = editor.Document.GetTextAt(lineSegment) == initialText ? 0 : 1;
            bool             isCaretInLine = lineSegment.Offset <= editor.Caret.Offset && editor.Caret.Offset <= lineSegment.EndOffset;
            int              highlighted   = active == 0 && isCaretInLine ? 1 : 0;
            int              selected      = 0;
            LayoutDescriptor layout        = layouts[errorNumber];

            x2 = right - LayoutWidth - border - (ShowIconsInBubble ? errorPixbuf.Width : 0);

            x2 -= errorCounterWidth;
            x2  = System.Math.Max(x2, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset);

            using (var g = Gdk.CairoHelper.Create(win)) {
                g.LineWidth = Math.Max(1.0, editor.Options.Zoom);
                g.MoveTo(new Cairo.PointD(x2 + 0.5, y));
                g.LineTo(new Cairo.PointD(x2 + 0.5, y + editor.LineHeight));
                g.LineTo(new Cairo.PointD(right, y + editor.LineHeight));
                g.LineTo(new Cairo.PointD(right, y));
                g.ClosePath();
                g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, selected];
                g.Fill();

                g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected];
                g.MoveTo(new Cairo.PointD(x2 + 0.5, y));
                g.LineTo(new Cairo.PointD(x2 + 0.5, y + editor.LineHeight));
                if (errorNumber == errors.Count - 1)
                {
                    g.LineTo(new Cairo.PointD(lineArea.Right, y + editor.LineHeight));
                }
                g.Stroke();

                if (editor.Options.ShowRuler)
                {
                    int divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
                    if (divider >= x2)
                    {
                        g.MoveTo(new Cairo.PointD(divider + 0.5, y));
                        g.LineTo(new Cairo.PointD(divider + 0.5, y + editor.LineHeight));
                        g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected];
                        g.Stroke();
                    }
                }
            }
            win.DrawLayout(selected == 0 ? gc : gcSelected, x2 + (ShowIconsInBubble ? errorPixbuf.Width : 0) + border, y + (editor.LineHeight - layout.Height) / 2 + layout.Height % 2, layout.Layout);
            if (ShowIconsInBubble)
            {
                win.DrawPixbuf(editor.Style.BaseGC(Gtk.StateType.Normal), errors[errorNumber].IsError ? errorPixbuf : warningPixbuf, 0, 0, x2, y + (editor.LineHeight - errorPixbuf.Height) / 2, errorPixbuf.Width, errorPixbuf.Height, Gdk.RgbDither.None, 0, 0);
            }
        }
        public bool DrawBackground(TextEditor editor, Gdk.Drawable win, TextViewMargin.LayoutWrapper layout2, int selectionStart, int selectionEnd, int startOffset, int endOffset, int y, int startXPos, int endXPos, ref bool drawBg)
        {
            if (!IsVisible || DebuggingService.IsDebugging)
            {
                return(true);
            }
            EnsureLayoutCreated(editor);
            int  x = editor.TextViewMargin.XOffset;
            int  right = editor.Allocation.Width;
            int  errorCounterWidth = 0;
            bool isCaretInLine = startOffset <= editor.Caret.Offset && editor.Caret.Offset <= endOffset;
            int  ew = 0, eh = 0;

            if (errors.Count > 1 && errorCountLayout != null)
            {
                errorCountLayout.GetPixelSize(out ew, out eh);
                errorCounterWidth = ew + 10;
            }

            int  x2            = System.Math.Max(right - LayoutWidth - border - (ShowIconsInBubble ? errorPixbuf.Width : 0) - errorCounterWidth, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset);
            bool isEolSelected = editor.IsSomethingSelected && editor.SelectionMode != SelectionMode.Block ? editor.SelectionRange.Contains(lineSegment.Offset + lineSegment.EditableLength) : false;

            int active      = editor.Document.GetTextAt(lineSegment) == initialText ? 0 : 1;
            int highlighted = active == 0 && isCaretInLine ? 1 : 0;
            int selected    = 0;

            int topSize    = editor.LineHeight / 2;
            int bottomSize = editor.LineHeight / 2 + editor.LineHeight % 2;

            using (var g = Gdk.CairoHelper.Create(win)) {
                g.LineWidth = Math.Max(1.0, editor.Options.Zoom);
                if (!fitsInSameLine)
                {
                    if (isEolSelected)
                    {
                        x -= (int)editor.HAdjustment.Value;
                        editor.TextViewMargin.DrawRectangleWithRuler(win, x, new Gdk.Rectangle(x, y + editor.LineHeight, editor.TextViewMargin.TextStartPosition, editor.LineHeight), editor.ColorStyle.Default.BackgroundColor, true);
                        editor.TextViewMargin.DrawRectangleWithRuler(win, x + editor.TextViewMargin.TextStartPosition, new Gdk.Rectangle(x + editor.TextViewMargin.TextStartPosition, y + editor.LineHeight, editor.Allocation.Width + (int)editor.HAdjustment.Value, editor.LineHeight), editor.ColorStyle.Selection.BackgroundColor, true);
                        x += (int)editor.HAdjustment.Value;
                    }
                    else
                    {
                        editor.TextViewMargin.DrawRectangleWithRuler(win, x, new Gdk.Rectangle(x, y + editor.LineHeight, x2, editor.LineHeight), editor.ColorStyle.Default.BackgroundColor, true);
                    }
                }
                DrawRectangle(g, x, y, right, topSize);
                g.Color = colorMatrix[active, TOP, LIGHT, highlighted, selected];
                g.Fill();
                DrawRectangle(g, x, y + topSize, right, bottomSize);
                g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, selected];
                g.Fill();

                g.MoveTo(new Cairo.PointD(x, y + 0.5));
                g.LineTo(new Cairo.PointD(x + right, y + 0.5));
                g.Color = colorMatrix[active, TOP, LINE, highlighted, selected];
                g.Stroke();

                g.MoveTo(new Cairo.PointD(x, y + editor.LineHeight - 0.5));
                g.LineTo(new Cairo.PointD((fitsInSameLine ? x + right : x2 + 1), y + editor.LineHeight - 0.5));
                g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected];
                g.Stroke();
                if (editor.Options.ShowRuler)
                {
                    int divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
                    g.MoveTo(new Cairo.PointD(divider + 0.5, y));
                    g.LineTo(new Cairo.PointD(divider + 0.5, y + editor.LineHeight));
                    g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected];
                    g.Stroke();
                }

                // draw background
                if (layout2.StartSet || selectionStart == endOffset)
                {
                    int startX;
                    int endX;

                    if (selectionStart != endOffset)
                    {
                        var start = layout2.Layout.IndexToPos((int)layout2.SelectionStartIndex);
                        startX = (int)(start.X / Pango.Scale.PangoScale);
                        var end = layout2.Layout.IndexToPos((int)layout2.SelectionEndIndex);
                        endX = (int)(end.X / Pango.Scale.PangoScale);
                    }
                    else
                    {
                        startX = x2;
                        endX   = startX;
                    }

                    if (editor.MainSelection.SelectionMode == SelectionMode.Block && startX == endX)
                    {
                        endX = startX + 2;
                    }
                    startX += startXPos;
                    endX   += startXPos;
                    startX  = Math.Max(editor.TextViewMargin.XOffset, startX);
                    // clip region to textviewmargin start
                    if (isEolSelected)
                    {
                        endX = editor.Allocation.Width + (int)editor.HAdjustment.Value;
                    }
                    if (startX < endX)
                    {
                        DrawRectangle(g, startX, y, endX - startX, topSize);
                        g.Color = colorMatrix[active, TOP, LIGHT, highlighted, 1];
                        g.Fill();
                        DrawRectangle(g, startX, y + topSize, endX - startX, bottomSize);
                        g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, 1];
                        g.Fill();

                        g.MoveTo(new Cairo.PointD(startX, y + 0.5));
                        g.LineTo(new Cairo.PointD(endX, y + 0.5));
                        g.Color = colorMatrix[active, TOP, LINE, highlighted, 1];
                        g.Stroke();

                        if (startX < x2)
                        {
                            g.MoveTo(new Cairo.PointD(startX, y + editor.LineHeight - 0.5));
                            g.LineTo(new Cairo.PointD(System.Math.Min(endX, x2 + 1), y + editor.LineHeight - 0.5));
                            g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, 1];
                            g.Stroke();
                            if (x2 + 1 < endX)
                            {
                                g.MoveTo(new Cairo.PointD(x2 + 1, y + editor.LineHeight - 0.5));
                                g.LineTo(new Cairo.PointD(endX, y + editor.LineHeight - 0.5));
                                g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, 1];
                                g.Stroke();
                            }
                        }

                        if (editor.Options.ShowRuler)
                        {
                            int divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
                            g.MoveTo(new Cairo.PointD(divider + 0.5, y));
                            g.LineTo(new Cairo.PointD(divider + 0.5, y + editor.LineHeight));
                            g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, 1];
                            g.Stroke();
                        }
                    }
                }

                if (!fitsInSameLine)
                {
                    y += editor.LineHeight;
                }
                double y2       = y + 0.5;
                double y2Bottom = y2 + editor.LineHeight - 1;
                selected = isEolSelected && (CollapseExtendedErrors || errors.Count == 1) ? 1 : 0;

                // draw message text background
                if (CollapseExtendedErrors || errors.Count == 1)
                {
                    if (!fitsInSameLine)
                    {
                        // draw box below line
                        g.MoveTo(new Cairo.PointD(x2 + 0.5, y2 - 1));
                        g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom));
                        g.LineTo(new Cairo.PointD(right, y2Bottom));
                        g.LineTo(new Cairo.PointD(right, y2 - 1));
                        g.ClosePath();
                        g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, selected];
                        g.Fill();

                        g.MoveTo(new Cairo.PointD(x2 + 0.5, y2 - 1));
                        g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom));
                        g.LineTo(new Cairo.PointD(right, y2Bottom));
                        g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected];
                        g.Stroke();
                    }
                    else
                    {
                        // draw 'arrow marker' in the same line
                        g.MoveTo(new Cairo.PointD(x2 + 0.5, y2));
                        double mid = y2 + topSize;
                        g.LineTo(new Cairo.PointD(x2 - editor.LineHeight / 2 + 0.5, mid));

                        g.LineTo(new Cairo.PointD(right, mid));
                        g.LineTo(new Cairo.PointD(right, y2));
                        g.ClosePath();
                        g.Color = colorMatrix[active, TOP, DARK, highlighted, selected];
                        g.Fill();
                        g.MoveTo(new Cairo.PointD(x2 + 0.5, y2Bottom));
                        g.LineTo(new Cairo.PointD(x2 - editor.LineHeight / 2 + 0.5, mid));

                        g.LineTo(new Cairo.PointD(right, mid));
                        g.LineTo(new Cairo.PointD(right, y2Bottom));
                        g.ClosePath();

                        g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected];
                        g.Fill();

                        // draw border
                        g.MoveTo(new Cairo.PointD(x2 + 0.5, y2));
                        g.LineTo(new Cairo.PointD(x2 - editor.LineHeight / 2 + 0.5, y2 + editor.LineHeight / 2));

                        g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom));
                        g.LineTo(new Cairo.PointD(right, y2Bottom));
                        g.LineTo(new Cairo.PointD(right, y2));
                        g.ClosePath();

                        g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected];
                        g.Stroke();
                    }
                }
                else
                {
                    if (!fitsInSameLine)
                    {
                        // draw box below line
                        g.MoveTo(new Cairo.PointD(x2 + 0.5, y2 - 1));
                        g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom));
                        g.LineTo(new Cairo.PointD(right, y2Bottom));
                        g.LineTo(new Cairo.PointD(right, y2 - 1));
                        g.ClosePath();
                    }
                    else
                    {
                        // draw filled arrow box
                        g.MoveTo(new Cairo.PointD(x2 + 0.5, y2));
                        g.LineTo(new Cairo.PointD(x2 - editor.LineHeight / 2 + 0.5, y2 + editor.LineHeight / 2));
                        g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom));
                        g.LineTo(new Cairo.PointD(right, y2Bottom));
                        g.LineTo(new Cairo.PointD(right, y2));
                        g.ClosePath();
                    }
                    g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, selected];
                    g.Fill();

                    // draw light bottom line
                    g.MoveTo(new Cairo.PointD(right, y2Bottom));
                    g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom));
                    g.Stroke();

                    // stroke left line
                    if (fitsInSameLine)
                    {
                        g.MoveTo(new Cairo.PointD(x2 + 0.5, y2));
                        g.LineTo(new Cairo.PointD(x2 - editor.LineHeight / 2 + 0.5, y2 + editor.LineHeight / 2));
                        g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom));
                    }
                    else
                    {
                        g.MoveTo(new Cairo.PointD(x2 + 0.5, y2 - 1));
                        g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom + 1));
                    }

                    g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected];
                    g.Stroke();

                    // stroke top line
                    if (fitsInSameLine)
                    {
                        g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected];
                        g.MoveTo(new Cairo.PointD(right, y2));
                        g.LineTo(new Cairo.PointD(x2 + 0.5, y2));
                        g.Stroke();
                    }
                }

                if (editor.Options.ShowRuler)
                {
                    int divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
                    if (divider >= x2)
                    {
                        g.MoveTo(new Cairo.PointD(divider + 0.5, y2));
                        g.LineTo(new Cairo.PointD(divider + 0.5, y2Bottom));
                        g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected];
                        g.Stroke();
                    }
                }

                if (errors.Count > 1 && errorCountLayout != null)
                {
                    int rX = x2 + (ShowIconsInBubble ? errorPixbuf.Width : 0) + border + LayoutWidth;
                    int rY = y + editor.LineHeight / 6;
                    int rW = errorCounterWidth - 2;
                    int rH = editor.LineHeight * 3 / 4;
                    BookmarkMarker.DrawRoundRectangle(g, rX, rY, 8, rW, rH);

                    g.Color = oldIsOver ? new Cairo.Color(0.3, 0.3, 0.3) : new Cairo.Color(0.5, 0.5, 0.5);
                    g.Fill();
                    if (CollapseExtendedErrors)
                    {
                        win.DrawLayout(gcLight, x2 + (ShowIconsInBubble ? errorPixbuf.Width : 0) + border + LayoutWidth + 4, y + (editor.LineHeight - eh) / 2 + eh % 2, errorCountLayout);
                    }
                    else
                    {
                        g.MoveTo(rX + rW / 2 - rW / 4, rY + rH - rH / 4);
                        g.LineTo(rX + rW / 2 + rW / 4, rY + rH - rH / 4);
                        g.LineTo(rX + rW / 2, rY + rH / 4);
                        g.ClosePath();

                        g.Color = new Cairo.Color(1, 1, 1);
                        g.Fill();
                    }
                }

                for (int i = 0; i < layouts.Count; i++)
                {
                    LayoutDescriptor layout = layouts[i];
                    x2 = right - layout.Width - border - errorPixbuf.Width;
                    if (i == 0)
                    {
                        x2 -= errorCounterWidth;
                    }
                    x2 = System.Math.Max(x2, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset);
                    if (i > 0)
                    {
                        editor.TextViewMargin.DrawRectangleWithRuler(win, x, new Gdk.Rectangle(x, y, right, editor.LineHeight), isEolSelected ? editor.ColorStyle.Selection.BackgroundColor : editor.ColorStyle.Default.BackgroundColor, true);
                        g.MoveTo(new Cairo.PointD(x2 + 0.5, y));
                        g.LineTo(new Cairo.PointD(x2 + 0.5, y + editor.LineHeight));
                        g.LineTo(new Cairo.PointD(right, y + editor.LineHeight));
                        g.LineTo(new Cairo.PointD(right, y));
                        g.ClosePath();

                        if (CollapseExtendedErrors)
                        {
                            Cairo.Gradient pat = new Cairo.LinearGradient(x2, y, x2, y + editor.LineHeight);
                            pat.AddColorStop(0, colorMatrix[active, TOP, LIGHT, highlighted, selected]);
                            pat.AddColorStop(1, colorMatrix[active, BOTTOM, LIGHT, highlighted, selected]);
                            g.Pattern = pat;
                        }
                        else
                        {
                            g.Color = colorMatrix[active, TOP, LIGHT, highlighted, selected];
                        }
                        g.Fill();
                        if (editor.Options.ShowRuler)
                        {
                            int divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
                            if (divider >= x2)
                            {
                                g.MoveTo(new Cairo.PointD(divider + 0.5, y));
                                g.LineTo(new Cairo.PointD(divider + 0.5, y + editor.LineHeight));
                                g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected];
                                g.Stroke();
                            }
                        }
                    }
                    int lw, lh;
                    layout.Layout.GetPixelSize(out lw, out lh);
                    win.DrawLayout(selected == 0 ? gc : gcSelected, x2 + errorPixbuf.Width + border, y + (editor.LineHeight - layout.Height) / 2 + layout.Height % 2, layout.Layout);
                    if (ShowIconsInBubble)
                    {
                        win.DrawPixbuf(editor.Style.BaseGC(Gtk.StateType.Normal), errors[i].IsError ? errorPixbuf : warningPixbuf, 0, 0, x2, y + (editor.LineHeight - errorPixbuf.Height) / 2, errorPixbuf.Width, errorPixbuf.Height, Gdk.RgbDither.None, 0, 0);
                    }
                    y += editor.LineHeight;
                    if (!UseVirtualLines)
                    {
                        break;
                    }
                }
            }
            return(true);
        }