Beispiel #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;
            }
        }
Beispiel #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;
            }
        }
Beispiel #3
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;
            }
        }