示例#1
0
        /// <summary>
        /// Performs changes for undo and redo.
        /// </summary>
        /// <seealso cref="M:Northwoods.Go.GoObject.ChangeValue(Northwoods.Go.GoChangedEventArgs,System.Boolean)" />
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 1001:
            {
                base.ChangeValue(e, undo);
                RectangleF rect  = e.GetRect(!undo);
                RectangleF rect2 = e.GetRect(undo);
                if (rect.Width == rect2.Width && rect.Height == rect2.Height)
                {
                    float dx = rect2.X - rect.X;
                    float dy = rect2.Y - rect.Y;
                    GoStroke.TranslatePoints(myPoints, dx, dy);
                }
                break;
            }

            case 1460:
                A = e.GetPoint(undo);
                break;

            case 1461:
                B = e.GetPoint(undo);
                break;

            case 1462:
                C = e.GetPoint(undo);
                break;

            case 1463:
                D = e.GetPoint(undo);
                break;

            case 1464:
            {
                PointF[] array = (PointF[])e.GetValue(undo);
                if (array != null)
                {
                    SetPoints(array);
                }
                break;
            }

            case 1465:
                Orientation = (Orientation)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
示例#2
0
        /// <summary>
        /// Performs changes for undo and redo.
        /// </summary>
        /// <seealso cref="M:Northwoods.Go.GoObject.ChangeValue(Northwoods.Go.GoChangedEventArgs,System.Boolean)" />
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 1001:
            {
                base.ChangeValue(e, undo);
                RectangleF rect  = e.GetRect(!undo);
                RectangleF rect2 = e.GetRect(undo);
                if (rect.Width == rect2.Width && rect.Height == rect2.Height)
                {
                    float dx = rect2.X - rect.X;
                    float dy = rect2.Y - rect.Y;
                    GoStroke.TranslatePoints(myPoints, dx, dy);
                }
                break;
            }

            case 1431:
                A = e.GetPoint(undo);
                break;

            case 1432:
                B = e.GetPoint(undo);
                break;

            case 1433:
                C = e.GetPoint(undo);
                break;

            case 1434:
            {
                PointF[] array = (PointF[])e.GetValue(undo);
                if (array != null)
                {
                    ResetPath();
                    myPoints = array;
                }
                break;
            }

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
示例#3
0
        /// <summary>
        /// When the bounds change, update the points appropriately.
        /// </summary>
        /// <param name="old"></param>
        protected override void OnBoundsChanged(RectangleF old)
        {
            base.OnBoundsChanged(old);
            RectangleF bounds = Bounds;

            if (old.Width == bounds.Width && old.Height == bounds.Height)
            {
                float num  = bounds.X - old.X;
                float num2 = bounds.Y - old.Y;
                if (num != 0f || num2 != 0f)
                {
                    GoStroke.TranslatePoints(myPoints, num, num2);
                    base.InvalidBounds = false;
                }
            }
            else
            {
                Changing(1434);
                GoStroke.RescalePoints(myPoints, old, bounds);
                base.InvalidBounds = false;
                Changed(1434, 0, null, old, 0, null, bounds);
            }
        }
示例#4
0
        /// <summary>
        /// Performs changes for undo and redo.
        /// </summary>
        /// <seealso cref="M:Northwoods.Go.GoObject.ChangeValue(Northwoods.Go.GoChangedEventArgs,System.Boolean)" />
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 1001:
            {
                base.ChangeValue(e, undo);
                RectangleF rect  = e.GetRect(!undo);
                RectangleF rect2 = e.GetRect(undo);
                if (rect.Width == rect2.Width && rect.Height == rect2.Height)
                {
                    float dx = rect2.X - rect.X;
                    float dy = rect2.Y - rect.Y;
                    GoStroke.TranslatePoints(myPoints, dx, dy);
                }
                break;
            }

            case 1401:
                if (undo)
                {
                    InternalRemovePoint(e.OldInt);
                }
                else
                {
                    InternalInsertPoint(e.OldInt, new PointF(e.NewRect.X, e.NewRect.Y));
                }
                break;

            case 1402:
                if (undo)
                {
                    InternalInsertPoint(e.OldInt, new PointF(e.OldRect.X, e.OldRect.Y));
                }
                else
                {
                    InternalRemovePoint(e.OldInt);
                }
                break;

            case 1403:
                if (undo)
                {
                    InternalSetPoint(e.OldInt, new PointF(e.OldRect.X, e.OldRect.Y));
                }
                else
                {
                    InternalSetPoint(e.OldInt, new PointF(e.NewRect.X, e.NewRect.Y));
                }
                break;

            case 1412:
            {
                PointF[] points = (PointF[])e.GetValue(undo);
                SetPoints(points);
                break;
            }

            case 1414:
                Style = (GoPolygonStyle)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }