public SelectionDrawModeInfo(SelectionDrawMode drawMode, double width, double height, MeasurementUnit units)
 {
     DrawMode = drawMode;
     Width    = width;
     Height   = height;
     Units    = units;
 }
示例#2
0
 public SelectionDrawModeInfo(SelectionDrawMode drawMode, double width, double height, MeasurementUnit units)
 {
     this.drawMode = drawMode;
     this.width    = width;
     this.height   = height;
     this.units    = units;
 }
 public SelectionDrawModeInfo CloneWithNewDrawMode(SelectionDrawMode newDrawMode)
 {
     return(new SelectionDrawModeInfo(newDrawMode, Width, Height, Units));
 }
示例#4
0
        private SelectionDrawMode CycleSelectionDrawMode(SelectionDrawMode drawMode)
        {
            SelectionDrawMode newSDM;

            switch (drawMode)
            {
                case SelectionDrawMode.Normal:
                    newSDM = SelectionDrawMode.FixedRatio;
                    break;

                case SelectionDrawMode.FixedRatio:
                    newSDM = SelectionDrawMode.FixedSize;
                    break;

                case SelectionDrawMode.FixedSize:
                    newSDM = SelectionDrawMode.Normal;
                    break;

                default:
                    throw new InvalidEnumArgumentException();
            }

            return newSDM;
        }
示例#5
0
 private Image GetSelectionDrawModeImage(SelectionDrawMode drawMode)
 {
     return PdnResources.GetImageResource("Icons.ToolConfigStrip.SelectionDrawModeSplitButton." + drawMode.ToString() + ".png").Reference;
 }
示例#6
0
 private string GetSelectionDrawModeString(SelectionDrawMode drawMode)
 {
     return PdnResources.GetString("ToolConfigStrip.SelectionDrawModeSplitButton." + drawMode.ToString() + ".Text");
 }
示例#7
0
        protected override SegmentedList <PointDouble> CreateShape(SegmentedList <PointDouble> tracePoints)
        {
            RectDouble        num3;
            double            num6;
            double            num7;
            PointDouble       a           = tracePoints[0];
            PointDouble       b           = tracePoints[tracePoints.Count - 1];
            SelectionDrawMode mode        = base.ToolSettings.Selection.DrawMode.Value;
            double            num4        = base.ToolSettings.Selection.DrawWidth.Value;
            double            num5        = base.ToolSettings.Selection.DrawHeight.Value;
            MeasurementUnit   sourceUnits = base.ToolSettings.Selection.DrawUnits.Value;

            switch (mode)
            {
            case SelectionDrawMode.FixedRatio:
            case SelectionDrawMode.FixedSize:
                num6 = Math.Abs(num4);
                num7 = Math.Abs(num5);
                break;

            default:
                num6 = num4;
                num7 = num5;
                break;
            }
            switch (mode)
            {
            case SelectionDrawMode.Normal:
                if ((base.ModifierKeys & Keys.Shift) == Keys.None)
                {
                    num3 = RectDoubleUtil.FromPixelPoints(a, b);
                    break;
                }
                num3 = RectDoubleUtil.FromPixelPointsConstrained(a, b);
                break;

            case SelectionDrawMode.FixedRatio:
                try
                {
                    double num13 = b.X - a.X;
                    double num14 = b.Y - a.Y;
                    double num15 = num13 / num6;
                    double num16 = Math.Sign(num15);
                    double num17 = num14 / num7;
                    double num18 = Math.Sign(num17);
                    double num19 = num6 / num7;
                    if (num15 < num17)
                    {
                        double x      = a.X;
                        double y      = a.Y;
                        double right  = a.X + num13;
                        double bottom = a.Y + (num18 * Math.Abs((double)(num13 / num19)));
                        num3 = RectDouble.FromEdges(x, y, right, bottom);
                    }
                    else
                    {
                        double left  = a.X;
                        double top   = a.Y;
                        double num26 = a.X + (num16 * Math.Abs((double)(num14 * num19)));
                        double num27 = a.Y + num14;
                        num3 = RectDouble.FromEdges(left, top, num26, num27);
                    }
                }
                catch (ArithmeticException)
                {
                    num3 = new RectDouble(a.X, a.Y, 0.0, 0.0);
                }
                break;

            case SelectionDrawMode.FixedSize:
            {
                double width  = Document.ConvertMeasurement(num6, sourceUnits, base.Document.DpuUnit, base.Document.DpuX, MeasurementUnit.Pixel);
                double height = Document.ConvertMeasurement(num7, sourceUnits, base.Document.DpuUnit, base.Document.DpuY, MeasurementUnit.Pixel);
                num3 = new RectDouble(b.X, b.Y, width, height);
                break;
            }

            default:
                throw ExceptionUtil.InvalidEnumArgumentException <SelectionDrawMode>(mode, "drawMode");
            }
            RectDouble num8  = RectDouble.Intersect(num3, base.Document.Bounds());
            RectDouble num10 = num8.Int32Bound;

            if (num8.HasPositiveArea)
            {
                SegmentedList <PointDouble> list = new SegmentedList <PointDouble>(5, 7)
                {
                    new PointDouble(num10.Left, num10.Top),
                    new PointDouble(num10.Right, num10.Top),
                    new PointDouble(num10.Right, num10.Bottom),
                    new PointDouble(num10.Left, num10.Bottom)
                };
                list.Add(list[0]);
                return(list);
            }
            return(new SegmentedList <PointDouble>(0, 7));
        }
示例#8
0
 public SelectionDrawModeInfo CloneWithNewDrawMode(SelectionDrawMode newDrawMode)
 {
     return(new SelectionDrawModeInfo(newDrawMode, this.width, this.height, this.units));
 }
示例#9
0
 public SelectionDrawModeInfo(SelectionDrawMode drawMode, double width, double height)
 {
     this.drawMode = drawMode;
     this.width    = width;
     this.height   = height;
 }