public void onInspectorDiscardFieldModification() { this.currentFieldEditAction.undo(); this.currentFieldEditAction.delete(); this.currentFieldEditAction = ""; }
public void onInspectorPostFieldModification() { GuiEditorProfilesTree GuiEditorProfilesTree = "GuiEditorProfilesTree"; GuiEditorProfileChangeManager GuiEditorProfileChangeManager = "GuiEditorProfileChangeManager"; GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; ProfilePane ProfilePane = "ProfilePane"; UndoAction action = this.currentFieldEditAction; SimObject objectx = action["objectId"]; string fieldName = action["fieldName"]; string arrayIndex = action["arrayIndex"]; string oldValue = action["fieldValue"]; string newValue = objectx.getFieldValue(fieldName, arrayIndex == "(null)" ? -1 : arrayIndex.AsInt()); // If it's the name field, make sure to sync up the treeview. if (action["fieldName"] == "name") GuiEditorProfilesTree.onProfileRenamed(objectx, newValue); ProfilePane.onProfileSelected(); // Add change record. GuiEditorProfileChangeManager.registerEdit(objectx, fieldName, arrayIndex, oldValue); this.currentFieldEditAction.addToManager(ProfilePane.getUndoManager()); this.currentFieldEditAction = ""; //GuiEditor.updateUndoMenu(); GuiEditor.setProfileDirty(objectx, true, false); }
public void onInspectorPreFieldModification(string fieldName, string arrayIndex) { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; Util.pushInstantGroup(); //UndoManager undoManager = GuiEditor.getUndoManager(); SimObject objectx = this.getInspectObject(); string nameOrClass = objectx.getName(); if (nameOrClass == "") nameOrClass = objectx.getClassName(); ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction"); oc["actionName"] = nameOrClass + "." + fieldName + " Change"; oc["objectId"] = objectx.getId(); oc["fieldName"] = fieldName; oc["fieldValue"] = objectx.getFieldValue(fieldName, arrayIndex == "(null)" ? -1 : arrayIndex.AsInt()); oc["arrayIndex"] = arrayIndex; oc["inspectorGui"] = this; InspectorFieldUndoAction action = oc.Create(); this.currentFieldEditAction = action; Util.popInstantGroup(); }
public void onInspectorDiscardFieldModification() { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; this.currentFieldEditAction.undo(); if (this.currentFieldEditAction.isMemberOfClass("CompoundUndoAction")) { // Multiple field editor. Pop and discard. GuiEditor.getUndoManager().popCompound(true); } else { // Single field edit. Just kill undo action. this.currentFieldEditAction.delete(); } this.currentFieldEditAction = ""; }
public void onInspectorPostFieldModification() { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; if (this.currentFieldEditAction.isMemberOfClass("CompoundUndoAction")) { // Finish multiple field edit. GuiEditor.getUndoManager().popCompound(); } else { // Queue single field undo. this.currentFieldEditAction.addToManager(GuiEditor.getUndoManager()); } this.currentFieldEditAction = ""; GuiEditor.updateUndoMenu(); }
public void onInspectorPreFieldModification(string fieldName, string arrayIndex) { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; Util.pushInstantGroup(); UndoManager undoManager = GuiEditor.getUndoManager(); string action = ""; int numObjects = this.getNumInspectObjects(); if (numObjects > 1) action = undoManager.pushCompound("Multiple Field Edit"); for (uint i = 0; i < numObjects; i ++) { SimObject obj = this.getInspectObject(i); string nameOrClass = obj.getName(); if (nameOrClass == "") nameOrClass = obj.getClassName(); ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction"); oc["actionName"] = nameOrClass + "." + fieldName + " Change"; oc["objectId"] = obj.getId(); oc["fieldName"] = fieldName; oc["fieldValue"] = obj.getFieldValue(fieldName, arrayIndex == "(null)" ? -1 : arrayIndex.AsInt()); oc["arrayIndex"] = arrayIndex; oc["inspectorGui"] = this; InspectorFieldUndoAction undo = oc.Create(); if (numObjects > 1) undo.addToManager(undoManager); else { action = undo; break; } } this.currentFieldEditAction = action; Util.popInstantGroup(); }