示例#1
0
        private void IndentMove(RulerIndent Indent, Point Pt)
        {
            int num1 = this.vertical ? Pt.Y : Pt.X;

            if (Indent.Orientation == IndentOrientation.Near)
            {
                num1            = Math.Min(num1, (int)((this.pageStart + this.pageWidth) - EditConsts.DefaultRulerMinWidth));
                num1            = Math.Max((int)(num1 - this.rulerStart), EditConsts.DefaultRulerIndentSize);
                Indent.Indent   = this.GetDiscreteInterval(num1, Indent.Indent);
                this.pageWidth += ((this.pageStart - this.rulerStart) - Indent.Indent);
                this.pageStart  = this.rulerStart + Indent.Indent;
            }
            else
            {
                num1           = Math.Max(num1, (int)(this.pageStart + EditConsts.DefaultRulerMinWidth));
                num1           = Math.Max((int)((this.rulerStart + this.rulerWidth) - num1), EditConsts.DefaultRulerIndentSize);
                Indent.Indent  = this.GetDiscreteInterval(num1, Indent.Indent);
                this.pageWidth = (this.rulerWidth - Indent.Indent) - (this.pageStart - this.rulerStart);
            }
            num1 = this.GetIndentPos(Indent);
            if (this.drawX != num1)
            {
                if (this.drawX != -1)
                {
                    this.DrawLine(this.drawX, true);
                }
                this.DrawLine(num1, false);
            }
            base.Invalidate();
        }
示例#2
0
 private void IndentUp(RulerIndent Indent)
 {
     Indent.Dragging = false;
     if (this.drawX != -1)
     {
         this.DrawLine(this.drawX, true);
     }
 }
示例#3
0
 private int GetIndentPos(RulerIndent Ind)
 {
     if (Ind.Orientation == IndentOrientation.Near)
     {
         return(this.rulerStart + Ind.Indent);
     }
     return((this.rulerStart + this.rulerWidth) - Ind.Indent);
 }
示例#4
0
 protected virtual void RulerChanged(object sender, EventArgs e)
 {
     if ((this.owner != null) && (sender is IEditRuler))
     {
         int num1;
         int num2;
         if (this.owner.Selection.IsEmpty())
         {
             num1 = this.GetPageIndexAt(this.owner.DisplayLines.PointToDisplayPoint(this.owner.Position));
             num2 = num1;
         }
         else
         {
             Rectangle rectangle1 = this.owner.Selection.SelectionRect;
             num1 = this.GetPageIndexAt(this.owner.DisplayLines.PointToDisplayPoint(rectangle1.Location));
             num2 = this.GetPageIndexAt(this.owner.DisplayLines.PointToDisplayPoint(rectangle1.Right, rectangle1.Bottom));
         }
         this.BeginUpdate();
         try
         {
             IEditRuler  ruler1  = (IEditRuler)sender;
             RulerIndent indent1 = ((RulerEventArgs)e).Object as RulerIndent;
             for (int num3 = Math.Max(num1, 0); num3 <= num2; num3++)
             {
                 EditPage page1 = this[num3] as EditPage;
                 if (ruler1.Vertical)
                 {
                     if (indent1.Orientation == IndentOrientation.Near)
                     {
                         page1.TopIndent = indent1.Indent;
                     }
                     else
                     {
                         page1.BottomIndent = indent1.Indent;
                     }
                 }
                 else if (indent1.Orientation == IndentOrientation.Near)
                 {
                     page1.LeftIndent = indent1.Indent;
                 }
                 else
                 {
                     page1.RightIndent = indent1.Indent;
                 }
             }
         }
         finally
         {
             this.EndUpdate();
         }
     }
 }
示例#5
0
        private Rectangle GetIndentRect(RulerIndent Indent)
        {
            Rectangle rectangle1 = Rectangle.Empty;

            if (this.vertical)
            {
                if (Indent.Orientation == IndentOrientation.Near)
                {
                    return(new Rectangle(6, this.rulerStart, 0x10, Indent.Indent));
                }
                return(new Rectangle(6, this.pageWidth + this.pageStart, 0x10, Indent.Indent));
            }
            if (Indent.Orientation == IndentOrientation.Near)
            {
                return(new Rectangle(this.rulerStart, 6, Indent.Indent, 0x10));
            }
            return(new Rectangle(this.pageWidth + this.pageStart, 6, Indent.Indent, 0x10));
        }
示例#6
0
        private Rectangle GetIndentHitRect(RulerIndent Indent)
        {
            Rectangle rectangle1 = Rectangle.Empty;

            if (this.vertical)
            {
                if (Indent.Orientation == IndentOrientation.Near)
                {
                    return(new Rectangle(6, (this.rulerStart + Indent.Indent) - EditConsts.DefaultRulerHitWidth, 0x10, EditConsts.DefaultRulerHitWidth * 2));
                }
                return(new Rectangle(6, (this.pageStart + this.pageWidth) - EditConsts.DefaultRulerHitWidth, 0x10, EditConsts.DefaultRulerHitWidth * 2));
            }
            if (Indent.Orientation == IndentOrientation.Near)
            {
                return(new Rectangle((this.rulerStart + Indent.Indent) - EditConsts.DefaultRulerHitWidth, 6, EditConsts.DefaultRulerHitWidth * 2, 0x10));
            }
            return(new Rectangle((this.pageStart + this.pageWidth) - EditConsts.DefaultRulerHitWidth, 6, EditConsts.DefaultRulerHitWidth * 2, 0x10));
        }
示例#7
0
 private void IndentDown(RulerIndent Indent)
 {
     Indent.Dragging = true;
 }