Ejemplo n.º 1
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2301:
                TopLeftMargin = e.GetSize(undo);
                break;

            case 2302:
                BottomRightMargin = e.GetSize(undo);
                break;

            case 2303:
                PartID = e.GetInt(undo);
                break;

            case 2304:
                Background = (GoObject)e.GetValue(undo);
                break;

            case 2305:
                Label = (GoText)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2101:
                LabelSpot = e.GetInt(undo);
                break;

            case 2102:
                Shape = (GoShape)e.GetValue(undo);
                break;

            case 2103:
                Label = (GoText)e.GetValue(undo);
                break;

            case 2104:
                Port = (GoPort)e.GetValue(undo);
                break;

            case 2105:
                MiddleLabelMargin = e.GetSize(undo);
                break;

            case 2106:
                AutoResizes = (bool)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 1451:
                StartAngle = e.GetFloat(undo);
                break;

            case 1452:
                SweepAngle = e.GetFloat(undo);
                break;

            case 1453:
                ResizableStartAngle = (bool)e.GetValue(undo);
                break;

            case 1454:
                ResizableEndAngle = (bool)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2601:
                Text = (string)e.GetValue(undo);
                break;

            case 2602:
                Icon = (GoObject)e.GetValue(undo);
                break;

            case 2603:
                Label = (GoText)e.GetValue(undo);
                break;

            case 2604:
                InPort = (GoPort)e.GetValue(undo);
                break;

            case 2605:
                OutPort = (GoPort)e.GetValue(undo);
                break;

            case 2606:
                Orientation = (Orientation)e.GetInt(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Performs changes for undo and redo.
        /// </summary>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2000:
                UserFlags = e.GetInt(undo);
                break;

            case 2001:
                UserObject = e.GetValue(undo);
                break;

            case 2002:
                ToolTipText = (string)e.GetValue(undo);
                break;

            case 2003:
                PropertiesDelegatedToSelectionObject = (bool)e.GetValue(undo);
                break;

            case 2004:
                PartID = e.GetInt(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Perform the usual undo and redo changes.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2310:
                Anchor = (GoObject)e.GetValue(undo);
                break;

            case 2311:
                Corner = e.GetSize(undo);
                break;

            case 2312:
                BaseWidth = e.GetFloat(undo);
                break;

            case 2313:
                UnanchoredOffset = e.GetSize(undo);
                break;

            case 2314:
                Reanchorable = (bool)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2430:
                Name = (string)e.GetValue(undo);
                break;

            case 2431:
                Label = (GoGeneralNodePortLabel)e.GetValue(undo);
                break;

            case 2432:
                SideIndex = e.GetInt(undo);
                break;

            case 2433:
                LeftSide = (bool)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 1481:
                MinorRadius = e.GetFloat(undo);
                break;

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

            case 1483:
                Perspective = (GoPerspective)e.GetValue(undo);
                break;

            case 1484:
                ResizableRadius = (bool)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                ResetPath();
                break;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2651:
                DraggableLabel = (bool)e.GetValue(undo);
                break;

            case 2652:
                Icon = (GoObject)e.GetValue(undo);
                break;

            case 2653:
                Label = (GoText)e.GetValue(undo);
                break;

            case 2654:
                Port = (GoPort)e.GetValue(undo);
                break;

            case 2655:
                LabelOffset = e.GetSize(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// When an object is inserted or removed from the document, call <see cref="M:Northwoods.Go.GoPalette.LayoutItems" />.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected override void OnDocumentChanged(object sender, GoChangedEventArgs e)
 {
     base.OnDocumentChanged(sender, e);
     if (e.Hint == 902 || e.Hint == 903)
     {
         LayoutItems();
     }
 }
Ejemplo n.º 11
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;
            }
        }
Ejemplo n.º 12
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)
        {
            int subHint = e.SubHint;

            if (subHint == 1901)
            {
                ControlType = (Type)e.GetValue(undo);
            }
            else
            {
                base.ChangeValue(e, undo);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Copies state to permit an undo.
        /// </summary>
        /// <seealso cref="M:Northwoods.Go.GoObject.ChangeValue(Northwoods.Go.GoChangedEventArgs,System.Boolean)" />
        public override void CopyOldValueForUndo(GoChangedEventArgs e)
        {
            int subHint = e.SubHint;

            if (subHint == 1464)
            {
                if (e.IsBeforeChanging)
                {
                    e.OldValue = myPoints.Clone();
                }
            }
            else
            {
                base.CopyOldValueForUndo(e);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Copies state to permit a redo.
        /// </summary>
        /// <seealso cref="M:Northwoods.Go.GoObject.ChangeValue(Northwoods.Go.GoChangedEventArgs,System.Boolean)" />
        public override void CopyNewValueForRedo(GoChangedEventArgs e)
        {
            int subHint = e.SubHint;

            if (subHint == 1434)
            {
                if (!e.IsBeforeChanging)
                {
                    e.NewValue = myPoints.Clone();
                }
            }
            else
            {
                base.CopyNewValueForRedo(e);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Copies state to permit a redo.
        /// </summary>
        /// <seealso cref="M:Northwoods.Go.GoObject.ChangeValue(Northwoods.Go.GoChangedEventArgs,System.Boolean)" />
        public override void CopyNewValueForRedo(GoChangedEventArgs e)
        {
            int subHint = e.SubHint;

            if (subHint == 1412)
            {
                if (!e.IsBeforeChanging)
                {
                    PointF[] array2 = (PointF[])(e.NewValue = CopyPointsArray());
                }
            }
            else
            {
                base.CopyNewValueForRedo(e);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2050:
                MinimumIconSize = e.GetSize(undo);
                break;

            case 2051:
                MaximumIconSize = e.GetSize(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 17
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;
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Create an <see cref="T:Northwoods.Go.IGoUndoableEdit" /> for a <see cref="T:Northwoods.Go.GoDocument" /> Changed event.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// <remarks>
 /// This calls <see cref="M:Northwoods.Go.GoUndoManager.SkipEvent(Northwoods.Go.GoChangedEventArgs)" /> if for some reason we should ignore
 /// the <paramref name="e" />.
 /// This then creates a <see cref="T:Northwoods.Go.GoChangedEventArgs" /> and adds it to the
 /// <see cref="P:Northwoods.Go.GoUndoManager.CurrentEdit" />, a <see cref="T:Northwoods.Go.GoUndoManagerCompoundEdit" /> which it allocates
 /// if needed.
 /// This method always ignores all Changed events while we are performing an
 /// <see cref="M:Northwoods.Go.GoUndoManager.Undo" /> or <see cref="M:Northwoods.Go.GoUndoManager.Redo" />.
 /// </remarks>
 public virtual void DocumentChanged(object sender, GoChangedEventArgs e)
 {
     if (!IsUndoing && !IsRedoing && !SkipEvent(e))
     {
         GoUndoManagerCompoundEdit goUndoManagerCompoundEdit = CurrentEdit;
         if (goUndoManagerCompoundEdit == null || goUndoManagerCompoundEdit.IsComplete)
         {
             goUndoManagerCompoundEdit = (CurrentEdit = new GoUndoManagerCompoundEdit());
         }
         GoChangedEventArgs goChangedEventArgs = new GoChangedEventArgs(e);
         goUndoManagerCompoundEdit.AddEdit(goChangedEventArgs);
         if (ChecksTransactionLevel && TransactionLevel <= 0)
         {
             GoObject.Trace("Change not within a transaction: " + goChangedEventArgs.ToString());
         }
     }
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 1421:
                Corner = e.GetSize(undo);
                break;

            case 1422:
                RoundedCornerSpots = e.GetInt(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Performs changes for undo and redo.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2950:
                Style = (GoCollapsibleHandleStyle)e.GetInt(undo);
                break;

            case 2951:
                Bordered = (bool)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 1469:
                Corner = e.GetSize(undo);
                break;

            case 1470:
                ReshapableCorner = (bool)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2801:
                Label = (GoText)e.GetValue(undo);
                break;

            case 2802:
                Background = (GoObject)e.GetValue(undo);
                break;

            case 2803:
                TopPort = (GoPort)e.GetValue(undo);
                break;

            case 2804:
                RightPort = (GoPort)e.GetValue(undo);
                break;

            case 2805:
                BottomPort = (GoPort)e.GetValue(undo);
                break;

            case 2806:
                LeftPort = (GoPort)e.GetValue(undo);
                break;

            case 2807:
                TopLeftMargin = e.GetSize(undo);
                break;

            case 2808:
                BottomRightMargin = e.GetSize(undo);
                break;

            case 2809:
                AutoResizes = (bool)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 23
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 1601:
                Image = (Image)e.GetValue(undo);
                break;

            case 1602:
                ResourceManager = (ResourceManager)e.GetValue(undo);
                break;

            case 1603:
                Name = (string)e.GetValue(undo);
                break;

            case 1604:
                Alignment = e.GetInt(undo);
                break;

            case 1605:
                AutoResizes = (bool)e.GetValue(undo);
                break;

            case 1606:
                ImageList = (ImageList)e.GetValue(undo);
                break;

            case 1607:
                Index = e.GetInt(undo);
                break;

            case 1608:
                ThrowsExceptions = (bool)e.GetValue(undo);
                break;

            case 1609:
                NameIsUri = (bool)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 24
0
 /// <summary>
 /// This predicate is responsible for deciding if a <see cref="T:Northwoods.Go.GoChangedEventArgs" />
 /// is not interesting enough to be recorded.
 /// </summary>
 /// <param name="evt"></param>
 /// <returns></returns>
 /// <remarks>
 /// This returns true:
 /// if the <see cref="P:Northwoods.Go.GoChangedEventArgs.Document" />'s <see cref="P:Northwoods.Go.GoDocument.SkipsUndoManager" />
 /// property is true, or if the <see cref="P:Northwoods.Go.GoChangedEventArgs.Hint" /> is
 /// <see cref="F:Northwoods.Go.GoDocument.RepaintAll" />, or if it's describing a changed object, and
 /// the object's <see cref="P:Northwoods.Go.GoObject.SkipsUndoManager" /> property is true or if
 /// the <see cref="P:Northwoods.Go.GoChangedEventArgs.SubHint" /> is <see cref="F:Northwoods.Go.GoObject.RepaintAll" />.
 /// </remarks>
 public virtual bool SkipEvent(GoChangedEventArgs evt)
 {
     if (evt.Document == null || evt.Document.SkipsUndoManager || (evt.Hint >= 0 && evt.Hint < 200))
     {
         return(true);
     }
     if (evt.Hint == 901 && (evt.GoObject == null || evt.GoObject.SkipsUndoManager || evt.SubHint == 1000))
     {
         return(true);
     }
     if (evt.Hint >= 208 && evt.Hint <= 215 && evt.OldValue.GetType() == typeof(bool))
     //the change of allow move,without notification ,bylzy
     //evt.Hint < ChangedAllowMove && evt.Hint > ChangedAllowEdit
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// This copy constructor makes a copy of the argument object.
 /// </summary>
 /// <param name="e"></param>
 public GoChangedEventArgs(GoChangedEventArgs e)
 {
     myIsBeforeChanging = e.IsBeforeChanging;
     myDocument         = e.Document;
     myHint             = e.Hint;
     mySubHint          = e.SubHint;
     myObject           = e.Object;
     myOldInt           = e.OldInt;
     myOldValue         = e.OldValue;
     myOldRect          = e.OldRect;
     myNewInt           = e.NewInt;
     myNewValue         = e.NewValue;
     myNewRect          = e.NewRect;
     if (myDocument != null)
     {
         myDocument.CopyOldValueForUndo(this);
         myDocument.CopyNewValueForRedo(this);
     }
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Implement undo and redo support.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 3101:
                TopLeftMargin = e.GetSize(undo);
                break;

            case 3102:
                BottomRightMargin = e.GetSize(undo);
                break;

            case 3103:
                BackgroundImageSpot = e.GetInt(undo);
                break;

            case 3104:
                ShowsMargins = (bool)e.GetValue(undo);
                break;

            case 3105:
                MarginColor = (Color)e.GetValue(undo);
                break;

            case 3110:
                Paper = (GoGrid)e.GetValue(undo);
                break;

            case 3111:
                BackgroundImage = (GoImage)e.GetValue(undo);
                break;

            case 3112:
                Grid = (GoGrid)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 1491:
                Depth = e.GetSize(undo);
                break;

            case 1492:
                Perspective = (GoPerspective)e.GetValue(undo);
                break;

            case 1493:
                ReshapableDepth = (bool)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Perform changes to the body or port margin for undo.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2201:
                Body = (GoObject)e.GetValue(undo);
                break;

            case 2202:
                PortBorderMargin = e.GetSize(undo);
                break;

            case 2203:
                Port = (GoPort)e.GetValue(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Handle undo and redo changes.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 2211:
                LinkPointsSpread = (bool)e.GetValue(undo);
                break;

            case 2212:
                FromSides = e.GetInt(undo);
                break;

            case 2213:
                ToSides = e.GetInt(undo);
                break;

            default:
                base.ChangeValue(e, undo);
                break;
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Handle this class's property changes for undo and redo
        /// </summary>
        /// <param name="e"></param>
        /// <param name="undo"></param>
        public override void ChangeValue(GoChangedEventArgs e, bool undo)
        {
            switch (e.SubHint)
            {
            case 1466:
                Skew = e.GetSize(undo);
                break;

            case 1467:
                ReshapableSkew = (bool)e.GetValue(undo);
                break;

            case 1468:
                Direction = (bool)e.GetValue(undo);
                break;

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