예제 #1
0
파일: Gutter.cs 프로젝트: stevencohn/Orqa
        private void DrawRectangle(ITextPainter Painter, Rectangle Rect, bool DrawPlus)
        {
            Rectangle rectangle1 = new Rectangle(Rect.Left + 1, Rect.Top + 1, Rect.Width - 1, Rect.Height - 1);

            if (!this.Transparent)
            {
                Color color1 = Painter.BkColor;
                try
                {
                    Painter.BkColor = (this.visible && ((this.owner.Outlining.OutlineOptions & OutlineOptions.DrawOnGutter) != OutlineOptions.None)) ? this.BrushColor : this.owner.BackColor;
                    Painter.FillRectangle(rectangle1);
                }
                finally
                {
                    Painter.BkColor = color1;
                }
            }
            int num1 = EditConsts.DefaultCollasedImageWidth;

            Painter.DrawRectangle(Rect.Left, Rect.Top, Rect.Width + 1, Rect.Height + 1);
            Painter.DrawLine(Rect.Left + 2, Rect.Top + (num1 >> 1), (Rect.Left + num1) - 1, Rect.Top + (num1 >> 1));
            if (DrawPlus)
            {
                Painter.DrawLine(Rect.Left + (num1 >> 1), Rect.Top + 2, Rect.Left + (num1 >> 1), (Rect.Top + num1) - 1);
            }
            if (!this.Transparent)
            {
                Painter.ExcludeClipRect(Rect.Left, Rect.Top, Rect.Width + 1, Rect.Height + 1);
            }
        }
예제 #2
0
파일: Margin.cs 프로젝트: stevencohn/Orqa
 public void Paint(ITextPainter Painter, Rectangle Rect)
 {
     if ((this.owner != null) && !this.isDragging)
     {
         Painter.DrawLine(Rect.Left, 0, Rect.Left, Rect.Bottom, this.pen.Color, (int)this.pen.Width, this.pen.DashStyle);
     }
 }
예제 #3
0
파일: Gutter.cs 프로젝트: stevencohn/Orqa
        private void DrawOutline(ITextPainter Painter, int Line, int L, int T, int W, bool AEnd)
        {
            int num1 = EditConsts.DefaultCollasedImageWidth;
            int num2 = T;

            this.CenterOutlineRect(ref L, ref T, W);
            Rectangle rectangle1 = new Rectangle(L, T, num1, W);

            this.drawInfo.Init();
            this.drawInfo.Line = Line;
            Color color1 = Painter.PenColor;

            try
            {
                Painter.PenColor = this.owner.Outlining.OutlineColor;
                if (!this.owner.OnCustomDraw(Painter, rectangle1, DrawStage.Before, DrawState.OutlineArea | DrawState.Gutter, this.drawInfo))
                {
                    this.DrawLine(Painter, L + (num1 >> 1), num2, L + (num1 >> 1), num2 + W);
                    if (AEnd)
                    {
                        this.DrawLine(Painter, L + (num1 >> 1), (num2 + W) - 1, (L + num1) + 1, (num2 + W) - 1);
                    }
                }
            }
            finally
            {
                Painter.PenColor = color1;
            }
            this.owner.OnCustomDraw(Painter, rectangle1, DrawStage.After, DrawState.OutlineArea | DrawState.Gutter, this.drawInfo);
        }
예제 #4
0
파일: Gutter.cs 프로젝트: stevencohn/Orqa
 private int DrawImage(ITextPainter Painter, int ImageIndex, int Line, int Left, int Top, int Right, bool NeedDraw, bool Transparent)
 {
     if (!this.CanDrawImage(ImageIndex, Left, Right))
     {
         return(0);
     }
     if (NeedDraw)
     {
         this.drawInfo.Init();
         this.drawInfo.Line        = Line;
         this.drawInfo.GutterImage = ImageIndex;
         Rectangle rectangle1 = new Rectangle(Left, Top, this.Images.ImageSize.Width, this.Images.ImageSize.Height);
         if (!this.owner.OnCustomDraw(Painter, rectangle1, DrawStage.Before, DrawState.GutterImage | DrawState.Gutter, this.drawInfo))
         {
             if (!Transparent)
             {
                 Painter.FillRectangle(rectangle1);
             }
             Painter.DrawImage(this.Images, ImageIndex, rectangle1);
             if (!Transparent)
             {
                 Painter.ExcludeClipRect(rectangle1.Left, rectangle1.Top, rectangle1.Width, rectangle1.Height);
             }
         }
         this.owner.OnCustomDraw(Painter, rectangle1, DrawStage.After, DrawState.GutterImage | DrawState.Gutter, this.drawInfo);
     }
     return(this.Images.ImageSize.Width);
 }
예제 #5
0
파일: Gutter.cs 프로젝트: stevencohn/Orqa
 public void Paint(ITextPainter Painter, Rectangle Rect, Point Location, int StartLine)
 {
     if (this.NeedPaint(ref Rect))
     {
         Color color1 = Painter.BkColor;
         try
         {
             if (Painter.FontHeight > 0)
             {
                 StartLine += (Rect.Top / Painter.FontHeight);
             }
             Painter.BkColor = (this.brush is SolidBrush) ? ((SolidBrush)this.brush).Color : EditConsts.DefaultGutterBackColor;
             this.drawInfo.Init();
             if (this.owner.OnCustomDraw(Painter, Rect, DrawStage.Before, DrawState.Gutter, this.drawInfo))
             {
                 return;
             }
             this.DrawGutter(Painter, new Rectangle(Rect.Left, Rect.Top, Rect.Width, Rect.Height), StartLine);
             int num1 = this.GetPaintWidth();
             if (this.Visible && (num1 != 0))
             {
                 if (!this.Transparent)
                 {
                     Painter.FillRectangle(0, Rect.Top, num1 - 1, Rect.Height);
                 }
                 Painter.DrawLine(num1 - 1, 0, num1 - 1, Rect.Bottom, this.Pen.Color, (int)this.Pen.Width, this.Pen.DashStyle);
             }
             if (((this.options & GutterOptions.PaintLineNumbers) != GutterOptions.None) && (((this.options & GutterOptions.PaintLinesOnGutter) == GutterOptions.None) || !this.Visible))
             {
                 int num2 = this.GetLineNumbersLeft(false);
                 int num3 = this.GetLineNumbersRight(false);
                 if (num2 < num3)
                 {
                     if (!this.Transparent)
                     {
                         Painter.BkColor = this.lineNumbersBackColor;
                         Painter.FillRectangle(num2, Rect.Top, num3 - num2, Rect.Height);
                     }
                     Painter.DrawDotLine(num3 - 1, 0, num3 - 1, Rect.Bottom, this.lineNumbersForeColor);
                 }
             }
             if (!this.Transparent && (((this.owner.Outlining.OutlineOptions & OutlineOptions.DrawOnGutter) == OutlineOptions.None) || !this.Visible))
             {
                 num1 = this.GetOutlineWidth();
                 if (num1 != 0)
                 {
                     Painter.BkColor = this.owner.BackColor;
                     Painter.FillRectangle(this.GetOutlineLeft(), Rect.Top, num1, Rect.Height);
                 }
             }
             this.owner.OnCustomDraw(Painter, Rect, DrawStage.After, DrawState.Gutter, this.drawInfo);
         }
         finally
         {
             Painter.BkColor = color1;
         }
     }
 }
예제 #6
0
        private void FillRect(ITextPainter Painter, Rectangle R1, Rectangle R2)
        {
            Rectangle rectangle1 = Rectangle.Intersect(R1, R2);

            if (!rectangle1.IsEmpty)
            {
                Painter.FillRectangle(rectangle1);
            }
        }
예제 #7
0
        public void Paint(ITextPainter Painter, Rectangle Rect, int PageIndex, int PageCount, bool PageNumbers)
        {
            System.Drawing.Font font1 = Painter.Font;
            Color color1 = Painter.Color;

            Painter.BkMode = 1;
            try
            {
                DrawInfo info1;
                Painter.Font  = this.Font;
                Painter.Color = this.fontColor;
                EditPages pages1 = this.GetPages();
                info1 = new DrawInfo();
                info1.Init();
                info1.Page = (this.page != null) ? this.page.Index : -1;
                SyntaxEdit edit1 = ((pages1 != null) && (pages1.Owner != null)) ? ((SyntaxEdit)pages1.Owner) : null;
                if ((edit1 == null) || !edit1.OnCustomDraw(Painter, Rect, DrawStage.Before, DrawState.PageHeader, info1))
                {
                    bool   flag1 = ((pages1 != null) && this.reverseOnEvenPages) && (((PageIndex + 1) % 2) == 0);
                    string text2 = PageNumbers ? ((PageIndex + 1)).ToString() : this.RightText;
                    string text1 = flag1 ? text2 : this.LeftText;
                    if ((text1 != null) && (text1 != string.Empty))
                    {
                        Painter.TextOut(this.GetTextToPaint(text1, PageIndex, PageCount), -1, Rect);
                    }
                    text1 = this.CenterText;
                    if ((text1 != null) && (text1 != string.Empty))
                    {
                        text1 = this.GetTextToPaint(text1, PageIndex, PageCount);
                        int num1 = Painter.StringWidth(text1);
                        Painter.TextOut(text1, -1, (int)(((Rect.Left + Rect.Right) - num1) >> 1), Rect.Top);
                    }
                    text1 = flag1 ? this.LeftText : text2;
                    if ((text1 != null) && (text1 != string.Empty))
                    {
                        text1 = this.GetTextToPaint(text1, PageIndex, PageCount);
                        int num2 = Painter.StringWidth(text1);
                        Painter.TextOut(text1, -1, (int)(Rect.Right - num2), Rect.Top);
                    }
                }
                if (edit1 != null)
                {
                    edit1.OnCustomDraw(Painter, Rect, DrawStage.After, DrawState.PageHeader, info1);
                }
            }
            finally
            {
                Painter.BkMode = 2;
                Painter.Font   = font1;
                Painter.Color  = color1;
            }
        }
예제 #8
0
파일: Gutter.cs 프로젝트: stevencohn/Orqa
 private void DrawLine(ITextPainter Painter, int x1, int y1, int x2, int y2)
 {
     Painter.DrawLine(x1, y1, x2, y2);
     if (!this.Transparent)
     {
         if (x1 == x2)
         {
             Painter.ExcludeClipRect(x1, y1, 1, y2 - y1);
         }
         else
         {
             Painter.ExcludeClipRect(x1, y1, x2 - x1, 1);
         }
     }
 }
예제 #9
0
        private void FrameRect(ITextPainter Painter, ref Rectangle Rect, Color Color, Color BackColor, bool DrawBorder)
        {
            Color color1 = Painter.BkColor;
            Color color2 = Painter.PenColor;

            Painter.BkColor  = Color;
            Painter.PenColor = Color;
            try
            {
                Painter.DrawRectangle(Rect);
                Painter.DrawLine(Rect.Right, Rect.Top + 1, Rect.Right, Rect.Bottom + 1);
                Painter.PenColor = BackColor;
                Painter.DrawLine(Rect.Right, Rect.Top, Rect.Right, Rect.Top + 1);
                if (DrawBorder || this.IsLastPage)
                {
                    Painter.PenColor = Color;
                    Painter.DrawLine(Rect.Left + 1, Rect.Bottom, Rect.Right, Rect.Bottom);
                    Painter.PenColor = BackColor;
                    Painter.DrawLine(Rect.Left, Rect.Bottom, Rect.Left + 1, Rect.Bottom);
                }
                if (DrawBorder)
                {
                    Painter.PenColor = Color;
                    Painter.DrawLine(Rect.Right + 1, Rect.Top + 1, Rect.Right + 1, Rect.Bottom + 2);
                    Painter.DrawLine(Rect.Left + 1, Rect.Bottom + 1, Rect.Right + 1, Rect.Bottom + 1);
                    Painter.PenColor = BackColor;
                    Painter.DrawLine(Rect.Right + 1, Rect.Top, Rect.Right + 1, Rect.Top + 1);
                    Painter.DrawLine(Rect.Left, Rect.Bottom + 1, Rect.Left, Rect.Bottom + 2);
                }
                Rect.Width++;
                if (DrawBorder || this.IsLastPage)
                {
                    Rect.Height++;
                }
                if (DrawBorder)
                {
                    Rect.Width++;
                    Rect.Height++;
                }
            }
            finally
            {
                Painter.PenColor = color2;
                Painter.BkColor  = color1;
            }
        }
예제 #10
0
 protected internal void FillBoundsRect(ITextPainter Painter, Rectangle OuterRect, Rectangle InnerRect, Color Color, bool Transparent)
 {
     if (((!Transparent && !InnerRect.IsEmpty) && !OuterRect.IsEmpty) && !InnerRect.IsEmpty)
     {
         Color color1 = Painter.BkColor;
         Painter.BkColor = Color;
         try
         {
             this.FillRect(Painter, OuterRect, new Rectangle(OuterRect.Left, OuterRect.Top, InnerRect.Left - OuterRect.Left, OuterRect.Height));
             this.FillRect(Painter, OuterRect, new Rectangle(InnerRect.Right, OuterRect.Top, OuterRect.Right - InnerRect.Right, OuterRect.Height));
             this.FillRect(Painter, OuterRect, new Rectangle(InnerRect.Left, OuterRect.Top, InnerRect.Width, InnerRect.Top - OuterRect.Top));
             this.FillRect(Painter, OuterRect, new Rectangle(InnerRect.Left, InnerRect.Bottom, InnerRect.Width, OuterRect.Bottom - InnerRect.Bottom));
         }
         finally
         {
             Painter.BkColor = color1;
         }
     }
 }
예제 #11
0
파일: Gutter.cs 프로젝트: stevencohn/Orqa
        private void DrawOutlineButton(ITextPainter Painter, int Line, int L, int T, int W, bool DrawLines, bool AVisible, bool ABefore, bool AAfter)
        {
            int num1 = EditConsts.DefaultCollasedImageWidth;
            int num2 = T;

            this.CenterOutlineRect(ref L, ref T, W);
            Rectangle rectangle1 = new Rectangle(L, T, num1, num1);

            this.drawInfo.Init();
            this.drawInfo.Line = Line;
            IOutlining outlining1 = this.owner.Outlining;
            Color      color1     = Painter.BkColor;
            Color      color2     = Painter.PenColor;

            try
            {
                Painter.BkColor  = outlining1.OutlineColor;
                Painter.PenColor = outlining1.OutlineColor;
                if (!this.owner.OnCustomDraw(Painter, rectangle1, DrawStage.Before, DrawState.OutlineButton | DrawState.Gutter, this.drawInfo))
                {
                    this.DrawRectangle(Painter, rectangle1, !AVisible);
                    if (DrawLines)
                    {
                        if (ABefore)
                        {
                            this.DrawLine(Painter, L + (num1 >> 1), num2, L + (num1 >> 1), T + 1);
                        }
                        if (AAfter)
                        {
                            this.DrawLine(Painter, L + (num1 >> 1), T + num1, L + (num1 >> 1), (num2 + W) + 1);
                        }
                    }
                }
                this.owner.OnCustomDraw(Painter, rectangle1, DrawStage.After, DrawState.OutlineButton | DrawState.Gutter, this.drawInfo);
            }
            finally
            {
                Painter.BkColor  = color1;
                Painter.PenColor = color2;
            }
        }
예제 #12
0
 public void Paint(ITextPainter Painter, Rectangle Rect)
 {
     if (this.Count != 0)
     {
         int num1 = 0;
         this.transparent = (this.owner != null) && this.owner.Transparent;
         for (int num2 = Math.Max(this.GetPageIndexAtPoint(Rect.Location), 0); num2 < this.Count; num2++)
         {
             IEditPage page1 = this[num2];
             page1.Paint(Painter);
             num1 = page1.BoundsRect.Bottom + 1;
             if (this.displayWhiteSpace)
             {
                 num1 += 2;
             }
             if (num1 >= Rect.Bottom)
             {
                 return;
             }
         }
         if ((this.pageType == River.Orqa.Editor.PageType.PageLayout) && (num1 < Rect.Bottom))
         {
             Rectangle rectangle1 = new Rectangle(Rect.Left, num1, Rect.Width, Rect.Bottom - num1);
             Color     color1     = Painter.BkColor;
             Painter.BkColor = this.BackColor;
             try
             {
                 Painter.FillRectangle(rectangle1);
             }
             finally
             {
                 Painter.BkColor = color1;
             }
         }
     }
 }
예제 #13
0
 public void Paint(ITextPainter Painter)
 {
     if ((this.pages != null) && (this.pages.PageType != PageType.Normal))
     {
         DrawInfo   info1;
         SyntaxEdit edit1      = (SyntaxEdit)this.pages.Owner;
         Rectangle  rectangle1 = this.ClientRect;
         info1 = new DrawInfo();
         if (this.pages.PageType == PageType.PageBreaks)
         {
             Rectangle rectangle2 = edit1.ClientRect;
             rectangle1.X     = rectangle2.Left + ((Gutter)edit1.Gutter).GetWidth();
             rectangle1.Width = rectangle2.Right - rectangle1.Left;
             if (!this.IsLastPage)
             {
                 info1.Init();
                 info1.Page = this.Index;
                 if (edit1.OnCustomDraw(Painter, rectangle1, DrawStage.Before, DrawState.PageBorder, info1))
                 {
                     return;
                 }
                 Painter.DrawLine(rectangle1.Left, rectangle1.Bottom - 1, rectangle1.Right, rectangle1.Bottom - 1, this.pages.BorderColor, 1, DashStyle.Dot);
                 edit1.OnCustomDraw(Painter, rectangle1, DrawStage.After, DrawState.PageBorder, info1);
             }
         }
         else
         {
             Rectangle rectangle3 = this.BoundsRect;
             info1.Init();
             info1.Page = this.Index;
             if (!edit1.OnCustomDraw(Painter, rectangle3, DrawStage.Before, DrawState.PageBorder, info1))
             {
                 bool flag1 = this.pages.DisplayWhiteSpace;
                 int  num1  = edit1.Painter.FontHeight;
                 if (num1 != 0)
                 {
                     rectangle1.Height = (rectangle1.Height / num1) * num1;
                 }
                 Rectangle rectangle4 = this.PaintRect;
                 rectangle3.Inflate(1, 1);
                 this.FrameRect(Painter, ref rectangle3, this.pages.BorderColor, this.pages.BackColor, flag1);
                 this.FillBoundsRect(Painter, rectangle4, rectangle3, this.pages.BackColor, false);
                 rectangle3 = this.BoundsRect;
                 this.FillBoundsRect(Painter, rectangle3, rectangle1, edit1.BackColor, this.pages.Transparent);
                 if ((this.pages == null) || this.pages.DisplayWhiteSpace)
                 {
                     int       num2       = Math.Max((int)(rectangle1.Left - this.header.Offset.X), rectangle3.Left);
                     int       num3       = Math.Min((int)((rectangle1.Left + rectangle1.Width) + this.header.Offset.X), rectangle3.Right);
                     Rectangle rectangle5 = new Rectangle(num2, Math.Max((int)(rectangle1.Top - (this.header.Offset.Y + this.header.Font.Height)), this.BoundsRect.Top), num3 - num2, this.header.Font.Height);
                     this.header.Paint(Painter, rectangle5, this.Index, this.pages.Count, false);
                     num2       = Math.Max((int)(rectangle1.Left - this.footer.Offset.X), rectangle3.Left);
                     num3       = Math.Min((int)((rectangle1.Left + rectangle1.Width) + this.footer.Offset.X), rectangle3.Right);
                     rectangle5 = new Rectangle(num2, Math.Min((int)(rectangle1.Bottom + this.footer.Offset.Y), (int)(rectangle3.Bottom - this.footer.Font.Height)), num3 - num2, this.footer.Font.Height);
                     this.footer.Paint(Painter, rectangle5, this.Index, this.pages.Count, this.paintNumber);
                 }
                 edit1.OnCustomDraw(Painter, rectangle3, DrawStage.After, DrawState.PageBorder, info1);
             }
             edit1.PaintWindow(Painter, this.startLine, new Rectangle(0, 0, rectangle1.Width, rectangle1.Height), rectangle1.Location, 1f, 1f, true);
         }
     }
 }
예제 #14
0
파일: Gutter.cs 프로젝트: stevencohn/Orqa
 public void Paint(ITextPainter Painter, Rectangle Rect)
 {
     this.Paint(Painter, Rect, new Point(0, 0), (this.owner != null) ? this.owner.Scrolling.WindowOriginY : 0);
 }
예제 #15
0
        protected override void OnPrintPage(PrintPageEventArgs ev)
        {
            int num1;

            base.OnPrintPage(ev);
            Rectangle rectangle1 = ev.MarginBounds;

            if (this.startPrinting)
            {
                this.syntaxEdit.Bounds = ev.MarginBounds;
                ((DisplayStrings)this.syntaxEdit.DisplayLines).ScanToEnd(true);
                int num2 = this.syntaxEdit.DisplayLines.GetCount() - 1;
                num1       = Math.Max(this.syntaxEdit.LinesInHeight(), 1);
                this.pages = num2 / num1;
                if ((num2 % num1) != 0)
                {
                    this.pages++;
                }
                this.pageCount = Math.Max(this.pages, 1);
                if (base.PrinterSettings.PrintRange == PrintRange.SomePages)
                {
                    this.pages      = Math.Min(this.pages, (int)((base.PrinterSettings.ToPage - base.PrinterSettings.FromPage) + 1));
                    this.pageIndex  = base.PrinterSettings.FromPage - 1;
                    this.startLine += (num1 * this.pageIndex);
                }
                this.pages         = Math.Max(this.pages, 1);
                this.startPrinting = false;
            }
            Rectangle rectangle2 = rectangle1;

            num1 = this.syntaxEdit.Painter.FontHeight;
            if (num1 != 0)
            {
                rectangle2.Height = (rectangle2.Height / num1) * num1;
            }
            float        single1  = ev.Graphics.DpiX / 100f;
            float        single2  = ev.Graphics.DpiY / 100f;
            ITextPainter painter1 = this.syntaxEdit.Painter;

            painter1.BeginPaint(ev.Graphics);
            try
            {
                painter1.Transform(0, 0, single1, single2);
                try
                {
                    if ((this.printing.Options & PrintOptions.UseHeader) != PrintOptions.None)
                    {
                        Rectangle rectangle3 = new Rectangle(rectangle1.Left - this.printing.Header.Offset.X, rectangle1.Top - (this.printing.Header.Font.Height + this.printing.Header.Offset.Y), rectangle1.Width + (this.printing.Header.Offset.X * 2), this.printing.Header.Font.Height);
                        this.printing.Header.Paint(painter1, rectangle3, this.pageIndex, this.pageCount, false);
                    }
                    if (((this.printing.Options & PrintOptions.UseFooter) != PrintOptions.None) || ((this.printing.Options & PrintOptions.PageNumbers) != PrintOptions.None))
                    {
                        Rectangle rectangle4 = new Rectangle(rectangle1.Left - this.printing.Footer.Offset.X, rectangle1.Bottom + this.printing.Footer.Offset.Y, rectangle1.Width + (this.printing.Footer.Offset.X * 2), this.printing.Footer.Font.Height);
                        this.printing.Footer.Paint(painter1, rectangle4, this.pageIndex, this.pageCount, (this.printing.Options & PrintOptions.PageNumbers) != PrintOptions.None);
                    }
                }
                finally
                {
                    painter1.EndTransform();
                }
                ((SyntaxEdit)this.syntaxEdit).PaintWindow(painter1, this.startLine, new Rectangle(new Point(0, 0), rectangle2.Size), rectangle1.Location, single1, single2, true);
                this.startLine += Math.Max(this.syntaxEdit.LinesInHeight(), 1);
                this.page++;
                this.pageIndex++;
                ev.HasMorePages = this.page < this.pages;
            }
            finally
            {
                painter1.EndPaint(ev.Graphics);
            }
        }
예제 #16
0
파일: Gutter.cs 프로젝트: stevencohn/Orqa
        private void DrawLineNumber(ITextPainter Painter, int Line, int Left, int Top, bool DrawOnGutter)
        {
            if (this.owner != null)
            {
                Rectangle rectangle1 = new Rectangle(Left, Top, this.lineNumberWidth - (this.lineNumbersLeftIndent + this.lineNumbersRightIndent), this.owner.Painter.FontHeight);
                this.drawInfo.Init();
                this.drawInfo.Line = Line;
                Color color1 = Painter.Color;
                Color color2 = Painter.BkColor;
                bool  flag1  = this.Transparent;
                try
                {
                    string text1;
                    int    num1;
                    int    num3;
                    Painter.Color   = this.lineNumbersForeColor;
                    Painter.BkColor = DrawOnGutter ? this.BrushColor : this.lineNumbersBackColor;
                    if (flag1)
                    {
                        Painter.BkMode = 1;
                    }
                    if (!this.owner.OnCustomDraw(Painter, rectangle1, DrawStage.Before, DrawState.LineNumber | DrawState.Gutter, this.drawInfo))
                    {
                        int num4 = Line + this.lineNumbersStart;
                        text1 = num4.ToString();
                        num1  = flag1 ? 0 : 2;
                        switch (this.lineNumbersAlignment)
                        {
                        case StringAlignment.Near:
                        {
                            Painter.TextOut(text1, -1, rectangle1, num1);
                            goto Label_015A;
                        }

                        case StringAlignment.Center:
                        {
                            goto Label_0129;
                        }

                        case StringAlignment.Far:
                        {
                            int num2 = Painter.StringWidth(text1);
                            Painter.TextOut(text1, -1, rectangle1, (rectangle1.Left + rectangle1.Width) - num2, rectangle1.Top, num1);
                            goto Label_015A;
                        }
                        }
                    }
                    goto Label_015A;
Label_0129:
                    num3 = Painter.StringWidth(text1);
                    Painter.TextOut(text1, -1, rectangle1, rectangle1.Left + ((rectangle1.Width - num3) / 2), rectangle1.Top, num1);
Label_015A:
                    this.owner.OnCustomDraw(Painter, rectangle1, DrawStage.After, DrawState.LineNumber | DrawState.Gutter, this.drawInfo);
                }
                finally
                {
                    if (flag1)
                    {
                        Painter.BkMode = 2;
                    }
                    Painter.Color   = color1;
                    Painter.BkColor = color2;
                }
            }
        }
예제 #17
0
파일: Gutter.cs 프로젝트: stevencohn/Orqa
        private void DrawGutter(ITextPainter Painter, Rectangle Rect, bool CalcIndex, int Line, int ImageX, ref int ImageIndex)
        {
            int       num1  = Rect.Top;
            int       num2  = this.owner.Painter.FontHeight;
            bool      flag1 = (this.owner.Outlining.OutlineOptions & OutlineOptions.DrawLines) != OutlineOptions.None;
            bool      flag2 = this.owner.Outlining.AllowOutlining;
            bool      flag3 = (this.options & GutterOptions.PaintLinesBeyondEof) != GutterOptions.None;
            bool      flag4 = this.NeedLineNumbers();
            bool      flag5 = (this.options & GutterOptions.PaintBookMarks) != GutterOptions.None;
            bool      flag6 = flag4 && (this.visible & ((this.options & GutterOptions.PaintLinesOnGutter) != GutterOptions.None));
            int       num3  = this.GetLineNumbersLeft(true);
            int       num4  = this.GetLineNumbersRight(true);
            int       num5  = this.GetOutlineLeft();
            int       num6  = Rect.Left + this.GetPaintWidth(false);
            int       num7  = this.owner.DisplayLines.GetCount();
            ArrayList list1 = new ArrayList();

            while ((num1 < Rect.Bottom) || CalcIndex)
            {
                Point point1 = this.owner.DisplayLines.DisplayPointToPoint(0, Line);
                if ((Line >= num7) && (!flag4 || !flag3))
                {
                    break;
                }
                if (flag4 && !CalcIndex)
                {
                    if (point1.X == 0)
                    {
                        this.DrawLineNumber(Painter, point1.Y, num3, num1, flag6);
                    }
                    else if (!this.Transparent)
                    {
                        Color color1 = Painter.BkColor;
                        try
                        {
                            Painter.BkColor = flag6 ? this.BrushColor : this.lineNumbersBackColor;
                            Painter.FillRectangle(num3, num1, num4 - num3, num2);
                        }
                        finally
                        {
                            Painter.BkColor = color1;
                        }
                    }
                }
                if (Line < num7)
                {
                    int num8 = 0;
                    if (this.Visible)
                    {
                        if ((this.owner.WordWrap && (point1.X != 0)) && ((this.wrapImageIndex >= 0) && this.CanDrawImage(this.wrapImageIndex, num8, num6)))
                        {
                            if ((CalcIndex && (ImageX >= num8)) && (ImageX < (num8 + this.Images.ImageSize.Width)))
                            {
                                ImageIndex = this.wrapImageIndex;
                                return;
                            }
                            num8 = this.DrawImage(Painter, this.wrapImageIndex, point1.Y, num8, num1, num6, !CalcIndex, this.Transparent || ((num8 >= num3) && ((num8 + this.Images.ImageSize.Width) <= num4)));
                        }
                        if (num1 >= (Rect.Top - this.Images.ImageSize.Height))
                        {
                            if (point1.X == 0)
                            {
                                int num9 = ((LineStyles)this.owner.Source.LineStyles).GetLineStyle(point1.Y);
                                if (((num9 >= 0) && (num9 < this.owner.LineStyles.Count)) && (!this.owner.Outlining.AllowOutlining || this.owner.Outlining.IsVisible(point1.Y)))
                                {
                                    num9 = ((LineStylesEx)this.owner.LineStyles).GetStyle(num9).ImageIndex;
                                    if (this.CanDrawImage(num9, num8, num6))
                                    {
                                        if ((CalcIndex && (ImageX >= num8)) && (ImageX < (num8 + this.Images.ImageSize.Width)))
                                        {
                                            ImageIndex = num9;
                                            return;
                                        }
                                        num8 += this.DrawImage(Painter, num9, point1.Y, num8, num1, num6, !CalcIndex, this.Transparent || ((num8 >= num3) && ((num8 + this.Images.ImageSize.Width) <= num4)));
                                    }
                                }
                            }
                            if (flag5)
                            {
                                Point point2 = ((DisplayStrings)this.owner.DisplayLines).DisplayPointToPoint(0x7fffffff, Line, true, false, false);
                                this.owner.Source.BookMarks.GetBookMarks(point1, point2, list1);
                                foreach (IBookMark mark1 in list1)
                                {
                                    if (this.owner.Outlining.AllowOutlining && !this.owner.Outlining.IsVisible(new Point(mark1.Char, mark1.Line)))
                                    {
                                        continue;
                                    }
                                    int num10 = mark1.Index;
                                    if (num10 == 0x7fffffff)
                                    {
                                        num10 = this.bookMarkImageIndex;
                                    }
                                    if (this.CanDrawImage(num10, num8, num6))
                                    {
                                        if ((CalcIndex && (ImageX >= num8)) && (ImageX < (num8 + this.Images.ImageSize.Width)))
                                        {
                                            ImageIndex = num10;
                                            return;
                                        }
                                        this.DrawImage(Painter, num10, point1.Y, num8, num1, num6, !CalcIndex, this.Transparent || ((num8 >= num3) && ((num8 + this.Images.ImageSize.Width) <= num4)));
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (flag2 && !CalcIndex)
                    {
                        this.owner.Outlining.GetOutlineRanges(this.ranges, point1.Y);
                        DisplayStrings strings1 = (DisplayStrings)this.owner.DisplayLines;
                        Point          point3   = strings1.DisplayPointToPoint(0x7fffffff, Line, true, false, false);
                        bool           flag7    = false;
                        bool           flag8    = true;
                        foreach (IOutlineRange range1 in this.ranges)
                        {
                            if (this.CompareRange(range1.StartPoint, point1, point3) == 0)
                            {
                                flag8 &= range1.Visible;
                                flag7  = true;
                            }
                        }
                        if (flag7)
                        {
                            IRange range2 = (IRange)this.ranges[0];
                            this.DrawOutlineButton(Painter, point1.Y, num5, num1, num2, flag1, flag8, this.CompareRange(range2.StartPoint, point1, point3) > 0, this.CompareRange(range2.EndPoint, point1, point3) < 0);
                        }
                        if (!flag7 && flag1)
                        {
                            bool flag9  = false;
                            bool flag10 = false;
                            foreach (IOutlineRange range3 in this.ranges)
                            {
                                int num11 = this.CompareRange(range3.StartPoint, point1, point3);
                                int num12 = this.CompareRange(range3.EndPoint, point1, point3);
                                flag9  |= ((num11 > 0) && (num12 <= 0));
                                flag10 |= (num12 == 0);
                            }
                            if (flag9)
                            {
                                this.DrawOutline(Painter, point1.Y, num5, num1, num2, flag10);
                            }
                        }
                    }
                }
                if (CalcIndex)
                {
                    break;
                }
                num1 += num2;
                Line++;
            }
            if ((flag4 && !this.Transparent) && ((num1 > Rect.Top) && (num4 > num3)))
            {
                Painter.ExcludeClipRect(num3, Rect.Top, num4 - num3, num1 - Rect.Top);
            }
        }
예제 #18
0
파일: Gutter.cs 프로젝트: stevencohn/Orqa
        private void DrawGutter(ITextPainter Painter, Rectangle Rect, int StartLine)
        {
            int num1 = -1;

            this.DrawGutter(Painter, Rect, false, StartLine, 0, ref num1);
        }