Esempio n. 1
0
        private void DrawMarker(Graphics g, TextMarker marker, RectangleF drawingRect)
        {
            float num = drawingRect.Bottom - 1f;

            switch (marker.TextMarkerType)
            {
            case TextMarkerType.SolidBlock:
                g.FillRectangle(BrushRegistry.GetBrush(marker.Color), drawingRect);
                return;

            case TextMarkerType.Underlined:
                g.DrawLine(BrushRegistry.GetPen(marker.Color), drawingRect.X, num, drawingRect.Right, num);
                return;

            case TextMarkerType.WaveLine:
            {
                int num2 = (int)drawingRect.X % 6;
                for (float num3 = drawingRect.X - (float)num2; num3 < drawingRect.Right + (float)num2; num3 += 6f)
                {
                    g.DrawLine(BrushRegistry.GetPen(marker.Color), num3, num + 3f - 4f, num3 + 3f, num + 1f - 4f);
                    g.DrawLine(BrushRegistry.GetPen(marker.Color), num3 + 3f, num + 1f - 4f, num3 + 6f, num + 3f - 4f);
                }
                return;
            }

            default:
                return;
            }
        }
Esempio n. 2
0
        private void DrawVerticalRuler(Graphics g, Rectangle lineRectangle)
        {
            if (base.TextEditorProperties.VerticalRulerRow < this.textArea.VirtualTop.X)
            {
                return;
            }
            HighlightColor colorFor = this.textArea.Document.HighlightingStrategy.GetColorFor("VRuler");
            int            num      = (int)((float)this.drawingPosition.Left + this.GetWidth(g, ' ') * (float)(base.TextEditorProperties.VerticalRulerRow - this.textArea.VirtualTop.X));

            g.DrawLine(BrushRegistry.GetPen(colorFor.Color), num, lineRectangle.Top, num, lineRectangle.Bottom);
        }
Esempio n. 3
0
        private void DrawFoldMarker(Graphics g, RectangleF rectangle, bool isOpened, bool isSelected)
        {
            HighlightColor colorFor  = this.textArea.Document.HighlightingStrategy.GetColorFor("FoldMarker");
            HighlightColor colorFor2 = this.textArea.Document.HighlightingStrategy.GetColorFor("FoldLine");
            HighlightColor colorFor3 = this.textArea.Document.HighlightingStrategy.GetColorFor("SelectedFoldLine");
            Rectangle      rect      = new Rectangle((int)rectangle.X, (int)rectangle.Y, (int)rectangle.Width, (int)rectangle.Height);

            g.FillRectangle(BrushRegistry.GetBrush(colorFor.BackgroundColor), rect);
            g.DrawRectangle(BrushRegistry.GetPen(isSelected ? colorFor3.Color : colorFor.Color), rect);
            int num  = (int)Math.Round((double)rectangle.Height / 8.0) + 1;
            int num2 = rect.Height / 2 + rect.Height % 2;

            g.DrawLine(BrushRegistry.GetPen(colorFor2.BackgroundColor), rectangle.X + (float)num, rectangle.Y + (float)num2, rectangle.X + rectangle.Width - (float)num, rectangle.Y + (float)num2);
            if (!isOpened)
            {
                g.DrawLine(BrushRegistry.GetPen(colorFor2.BackgroundColor), rectangle.X + (float)num2, rectangle.Y + (float)num, rectangle.X + (float)num2, rectangle.Y + rectangle.Height - (float)num);
            }
        }
Esempio n. 4
0
        private float PaintFoldingText(Graphics g, int lineNumber, float physicalXPos, Rectangle lineRectangle, string text, bool drawSelected)
        {
            HighlightColor colorFor   = this.textArea.Document.HighlightingStrategy.GetColorFor("Selection");
            Brush          brush      = drawSelected ? BrushRegistry.GetBrush(colorFor.BackgroundColor) : this.GetBgColorBrush(lineNumber);
            Brush          brush2     = this.textArea.Enabled ? brush : SystemBrushes.InactiveBorder;
            float          width      = g.MeasureString(text, this.textArea.Font, 2147483647, this.measureStringFormat).Width;
            RectangleF     rectangleF = new RectangleF(physicalXPos, (float)lineRectangle.Y, width, (float)(lineRectangle.Height - 1));

            g.FillRectangle(brush2, rectangleF);
            this.physicalColumn += text.Length;
            g.DrawString(text, this.textArea.Font, BrushRegistry.GetBrush(drawSelected ? colorFor.Color : Color.Gray), rectangleF, this.measureStringFormat);
            g.DrawRectangle(BrushRegistry.GetPen(drawSelected ? Color.DarkGray : Color.Gray), rectangleF.X, rectangleF.Y, rectangleF.Width, rectangleF.Height);
            float num = (float)Math.Ceiling((double)(physicalXPos + width));

            if ((double)(num - (physicalXPos + width)) < 0.5)
            {
                num += 1f;
            }
            return(num);
        }
Esempio n. 5
0
        private void PaintFoldMarker(Graphics g, int lineNumber, Rectangle drawingRectangle)
        {
            HighlightColor colorFor                   = this.textArea.Document.HighlightingStrategy.GetColorFor("FoldLine");
            HighlightColor colorFor2                  = this.textArea.Document.HighlightingStrategy.GetColorFor("SelectedFoldLine");
            ArrayList      foldingsWithStart          = this.textArea.Document.FoldingManager.GetFoldingsWithStart(lineNumber);
            ArrayList      foldingsContainsLineNumber = this.textArea.Document.FoldingManager.GetFoldingsContainsLineNumber(lineNumber);
            ArrayList      foldingsWithEnd            = this.textArea.Document.FoldingManager.GetFoldingsWithEnd(lineNumber);
            bool           flag  = foldingsWithStart.Count > 0;
            bool           flag2 = foldingsContainsLineNumber.Count > 0;
            bool           flag3 = foldingsWithEnd.Count > 0;
            bool           flag4 = this.SelectedFoldingFrom(foldingsWithStart);
            bool           flag5 = this.SelectedFoldingFrom(foldingsContainsLineNumber);
            bool           flag6 = this.SelectedFoldingFrom(foldingsWithEnd);
            int            num   = (int)Math.Round((double)((float)this.textArea.TextView.FontHeight * 0.57f));

            num -= num % 2;
            int num2 = drawingRectangle.Y + (drawingRectangle.Height - num) / 2;
            int num3 = drawingRectangle.X + (drawingRectangle.Width - num) / 2 + num / 2;

            if (flag)
            {
                bool flag7 = true;
                bool flag8 = false;
                foreach (FoldMarker foldMarker in foldingsWithStart)
                {
                    if (foldMarker.IsFolded)
                    {
                        flag7 = false;
                    }
                    else
                    {
                        flag8 = (foldMarker.EndLine > foldMarker.StartLine);
                    }
                }
                bool flag9 = false;
                foreach (FoldMarker foldMarker2 in foldingsWithEnd)
                {
                    if (foldMarker2.EndLine > foldMarker2.StartLine && !foldMarker2.IsFolded)
                    {
                        flag9 = true;
                    }
                }
                this.DrawFoldMarker(g, new RectangleF((float)(drawingRectangle.X + (drawingRectangle.Width - num) / 2), (float)num2, (float)num, (float)num), flag7, flag4);
                if (flag2 || flag9)
                {
                    g.DrawLine(BrushRegistry.GetPen(flag5 ? colorFor2.Color : colorFor.Color), num3, drawingRectangle.Top, num3, num2 - 1);
                }
                if (flag2 || flag8)
                {
                    g.DrawLine(BrushRegistry.GetPen((flag6 || (flag4 && flag7) || flag5) ? colorFor2.Color : colorFor.Color), num3, num2 + num + 1, num3, drawingRectangle.Bottom);
                    return;
                }
            }
            else
            {
                if (flag3)
                {
                    int num4 = drawingRectangle.Top + drawingRectangle.Height / 2;
                    g.DrawLine(BrushRegistry.GetPen((flag5 || flag6) ? colorFor2.Color : colorFor.Color), num3, drawingRectangle.Top, num3, num4);
                    g.DrawLine(BrushRegistry.GetPen((flag5 || flag6) ? colorFor2.Color : colorFor.Color), num3, num4, num3 + num / 2, num4);
                    if (flag2)
                    {
                        g.DrawLine(BrushRegistry.GetPen(flag5 ? colorFor2.Color : colorFor.Color), num3, num4 + 1, num3, drawingRectangle.Bottom);
                        return;
                    }
                }
                else
                {
                    if (flag2)
                    {
                        g.DrawLine(BrushRegistry.GetPen(flag5 ? colorFor2.Color : colorFor.Color), num3, drawingRectangle.Top, num3, drawingRectangle.Bottom);
                    }
                }
            }
        }