Exemple #1
0
 protected internal bool IsMouseOnOutlineImage(int X, int Y)
 {
     if (this.AllowOutlining())
     {
         DisplayStrings strings1 = (DisplayStrings)this.owner.DisplayLines;
         Point          point1   = this.owner.ScreenToDisplay(X, Y);
         int            num1     = point1.Y;
         point1 = strings1.DisplayPointToPoint(point1);
         this.owner.Outlining.GetOutlineRanges(this.ranges, point1.Y);
         Point point2 = strings1.DisplayPointToPoint(0x7fffffff, num1, true, false, false);
         bool  flag1  = false;
         foreach (IOutlineRange range1 in this.ranges)
         {
             if (this.CompareRange(range1.StartPoint, point1, point2) == 0)
             {
                 flag1 = true;
                 break;
             }
         }
         if (flag1)
         {
             int num2 = this.GetOutlineLeft() + this.Rect.Left;
             int num3 = this.owner.Painter.FontHeight;
             point1 = this.ScreenToClient(X, Y);
             int num4 = this.Rect.Top;
             int num5 = (num3 == 0) ? point1.Y : (num4 + (((point1.Y - num4) / num3) * num3));
             int num6 = EditConsts.DefaultCollasedImageWidth;
             this.CenterOutlineRect(ref num2, ref num5, num3);
             if (((point1.X >= (num2 - 1)) && (point1.X <= ((num2 + num6) + 1))) && (point1.Y >= (num5 - 1)))
             {
                 return(point1.Y <= ((num5 + num6) + 1));
             }
             return(false);
         }
     }
     return(false);
 }
Exemple #2
0
        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);
            }
        }