Esempio n. 1
0
        private static void ReactIfChangedMemberIsBaseType(object s, string changedMember, object oldValue)
        {
            if (changedMember == "Base Type")
            {
                ElementSave asElementSave = s as ElementSave;

                asElementSave.ReactToChangedBaseType(SelectedState.Self.SelectedInstance, oldValue.ToString());
            }
        }
Esempio n. 2
0
        public void PerformUndo()
        {
            Stack <ElementSave> stack = null;

            if (SelectedState.Self.SelectedElement != null && mUndos.ContainsKey(SelectedState.Self.SelectedElement))
            {
                stack = mUndos[SelectedState.Self.SelectedElement];
            }

            if (stack != null && stack.Count != 0)
            {
                ElementSave lastSelectedElementSave = SelectedState.Self.SelectedElement;

                ElementSave undoObject = stack.Pop();

                ElementSave toApplyTo = SelectedState.Self.SelectedElement;

                bool shouldRefreshWireframe = false;

                if (undoObject.DefaultState != null)
                {
                    Apply(undoObject.DefaultState, toApplyTo.DefaultState, toApplyTo);
                }
                if (undoObject.Instances != null)
                {
                    Apply(undoObject.Instances, toApplyTo.Instances, toApplyTo);
                    shouldRefreshWireframe = true;
                }
                if (undoObject.Name != null)
                {
                    string oldName = toApplyTo.Name;
                    toApplyTo.Name = undoObject.Name;
                    RenameManager.Self.HandleRename(toApplyTo, (InstanceSave)null, oldName);
                }
                if (undoObject.BaseType != null)
                {
                    string oldBaseType = toApplyTo.BaseType;
                    toApplyTo.BaseType = undoObject.BaseType;

                    toApplyTo.ReactToChangedBaseType(null, oldBaseType);
                }

                RecordState();


                GumCommands.Self.GuiCommands.RefreshElementTreeView();
                SelectedState.Self.UpdateToSelectedStateSave();

                // The instances may have changed.  We will want
                // to refresh the wireframe since the IPSOs in the
                // wireframe have tags.
                if (shouldRefreshWireframe)
                {
                    WireframeObjectManager.Self.RefreshAll(true);
                }

                PrintStatus("PerformUndo");

                // If an instance is removed
                // through an undo and if that
                // instance is the selected instance
                // then we want to refresh that.
                if (lastSelectedElementSave != null && SelectedState.Self.SelectedElement == null)
                {
                    SelectedState.Self.SelectedElement = lastSelectedElementSave;
                }

                GumCommands.Self.FileCommands.TryAutoSaveProject();
                GumCommands.Self.FileCommands.TryAutoSaveCurrentElement();

                ElementTreeViewManager.Self.VerifyComponentsAreInTreeView(ProjectManager.Self.GumProjectSave);
            }
        }