Example #1
0
        private bool checkBehaviorModification(string referenceFilename, bool undo)
        {
            UndoQueue queue = UndoManager.GetUndoQueue(referenceFilename);

            if (queue != null)
            {
                int index = -1;
                if (undo)
                {
                    if (queue.CanUndo())
                    {
                        index = queue._index;
                    }
                }
                else
                {
                    if (queue.CanRedo())
                    {
                        index = queue._index + 1;
                    }
                }

                if (index >= 0 && queue._undoDataArray[index].RootBehavior != _behavior)
                {
                    string filename      = FileManagers.FileManager.GetRelativePath(_behavior.Filename);
                    string referenceFile = FileManagers.FileManager.GetRelativePath(referenceFilename);
                    string info          = string.Format(Resources.UndoWarningInfo, referenceFile, filename);
                    return(DialogResult.OK == MessageBox.Show(info, Resources.Warning, MessageBoxButtons.OKCancel));
                }
            }

            return(true);
        }
Example #2
0
 public static void Redo(string behaviorFilename, bool reference = false)
 {
     if (_undoDataDict.ContainsKey(behaviorFilename))
     {
         UndoQueue undoQueue = _undoDataDict[behaviorFilename];
         undoQueue.Redo(reference);
     }
 }
Example #3
0
 public static void Reset(string behaviorFilename)
 {
     if (_undoDataDict.ContainsKey(behaviorFilename))
     {
         UndoQueue undoQueue = _undoDataDict[behaviorFilename];
         undoQueue.Reset();
     }
 }
Example #4
0
        public static bool CanRedo(string behaviorFilename)
        {
            if (_undoDataDict.ContainsKey(behaviorFilename))
            {
                UndoQueue undoQueue = _undoDataDict[behaviorFilename];
                return(undoQueue.CanRedo());
            }

            return(false);
        }
Example #5
0
        public static void Clear(string behaviorFilename)
        {
            if (!string.IsNullOrEmpty(behaviorFilename) && _undoDataDict.ContainsKey(behaviorFilename))
            {
                UndoQueue undoQueue = _undoDataDict[behaviorFilename];
                undoQueue.Clear();

                _undoDataDict.Remove(behaviorFilename);
            }
        }
Example #6
0
        public static void OnBehaviorSaved(Nodes.BehaviorNode behavior)
        {
            Debug.Check(behavior != null);

            string behaviorFilename = behavior.Filename;

            if (!string.IsNullOrEmpty(behaviorFilename) && _undoDataDict.ContainsKey(behaviorFilename))
            {
                UndoQueue undoQueue = _undoDataDict[behaviorFilename];
                undoQueue.OnBehaviorSaved();
            }
        }
Example #7
0
        private static void saveBehavior(Nodes.BehaviorNode behavior, Nodes.BehaviorNode rootBehavior, Nodes.BehaviorNode referencedBehavior1, Nodes.BehaviorNode referencedBehavior2)
        {
            string behaviorFilename = behavior.Filename;

            if (!string.IsNullOrEmpty(behaviorFilename))
            {
                if (!_undoDataDict.ContainsKey(behaviorFilename))
                {
                    _undoDataDict[behaviorFilename] = new UndoQueue(behavior);
                }

                UndoQueue undoQueue = _undoDataDict[behaviorFilename];
                undoQueue.Save(behavior, rootBehavior, referencedBehavior1, referencedBehavior2);
            }
        }
Example #8
0
        private static void saveBehavior(Nodes.BehaviorNode behavior, Nodes.BehaviorNode rootBehavior, Nodes.BehaviorNode referencedBehavior1, Nodes.BehaviorNode referencedBehavior2)
        {
            string behaviorFilename = behavior.Filename;
            if (!string.IsNullOrEmpty(behaviorFilename))
            {
                if (!_undoDataDict.ContainsKey(behaviorFilename))
                    _undoDataDict[behaviorFilename] = new UndoQueue(behavior);

                UndoQueue undoQueue = _undoDataDict[behaviorFilename];
                undoQueue.Save(behavior, rootBehavior, referencedBehavior1, referencedBehavior2);
            }
        }
Example #9
0
        private static void saveBehavior(Nodes.BehaviorNode behavior) {
            string behaviorFilename = behavior.Filename;

            if (!string.IsNullOrEmpty(behaviorFilename)) {
                if (!_undoDataDict.ContainsKey(behaviorFilename))
                { _undoDataDict[behaviorFilename] = new UndoQueue(behavior); }

                UndoQueue undoQueue = _undoDataDict[behaviorFilename];
                undoQueue.Save(behavior);
            }
        }