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 override void onInspectorFieldModified(string objectx, string fieldName, string arrayIndex, string oldValue, string newValue) { SimObject obj = objectx; GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; GuiEditorProfilesTree GuiEditorProfilesTree = "GuiEditorProfilesTree"; GuiEditorProfileChangeManager GuiEditorProfileChangeManager = "GuiEditorProfileChangeManager"; ProfilePane ProfilePane = "ProfilePane"; GuiEditor.setProfileDirty(obj, true, false); // If it's the name field, make sure to sync up the treeview. if (fieldName == "name") { GuiEditorProfilesTree.onProfileRenamed(obj, newValue); } // Add change record. //GuiEditorProfileChangeManager.registerEdit(obj, fieldName, oldValue); GuiEditorProfileChangeManager.registerEdit(obj, fieldName, arrayIndex, oldValue); // Add undo. Util.pushInstantGroup(); 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"] = oldValue; oc["arrayIndex"] = arrayIndex; oc["inspectorGui"] = this; InspectorFieldUndoAction action = oc.Create(); Util.popInstantGroup(); action.addToManager(ProfilePane.getUndoManager()); //GuiEditor.updateUndoMenu(); }
public override void onFieldRenamed(string objectx, string oldFieldName, string newFieldName) { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; GuiEditor.setProfileDirty(objectx, true, false); }