public void append() { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; GuiControl GuiEditorContent = "GuiEditorContent"; GuiEditorStatusBar GuiEditorStatusBar = "GuiEditorStatusBar"; // Get filename. string openFileName = console.Call_Classname("GuiBuilder", "getOpenName"); if (openFileName == "" || (!Util.isFile(openFileName) && !Util.isFile(openFileName + ".dso"))) { return; } // Exec file. string oldRedefineBehavior = sGlobal["$Con::redefineBehavior"]; sGlobal["$Con::redefineBehavior"] = "renameNew"; //TODO GuiControl guiContent = Util.eval(openFileName); sGlobal["$Con::redefineBehavior"] = oldRedefineBehavior; // Find guiContent. if (!guiContent.isObject()) { Util.messageBox("Error loading GUI file", "The GUI content controls could not be found. This function can only be used with files saved by the GUI editor.", "Ok", "Error"); return; } if (GuiEditorContent.getCount() == 0) { GuiEditor.openForEditing(guiContent); } else { ((SimSet)GuiEditor.getCurrentAddSet()).add(guiContent); GuiEditor.readGuides(guiContent); GuiEditor.onAddNewCtrl(guiContent); GuiEditor.onHierarchyChanged(); } GuiEditorStatusBar.print("Appended controls from '" + openFileName + "'"); }
public void load(string filename) { GuiEditorStatusBar GuiEditorStatusBar = "GuiEditorStatusBar"; GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; string newRedefineBehavior = "replaceExisting"; if (Util.isDefined("$GuiEditor::loadRedefineBehavior")) { // This trick allows to choose different redefineBehaviors when loading // GUIs. This is useful, for example, when loading GUIs that would lead to // problems when loading with their correct names because script behavior // would immediately attach. // // This allows to also edit the GUI editor's own GUI inside itself. newRedefineBehavior = sGlobal["$GuiEditor::loadRedefineBehavior"]; } // Allow stomping objects while exec'ing the GUI file as we want to // pull the file's objects even if we have another version of the GUI // already loaded. string oldRedefineBehavior = sGlobal["$Con::redefineBehavior"]; sGlobal["$Con::redefineBehavior"] = newRedefineBehavior; // Load up the gui. Util.exec(filename); GuiControl guiContent = Util.eval("return %guiContent;"); //GuiControl guiContent = Util.eval(filename); sGlobal["$Con::redefineBehavior"] = oldRedefineBehavior; // The GUI file should have contained a GUIControl which should now be in the instant // group. And, it should be the only thing in the group. //TODO if (!guiContent.isObject()) { Util.messageBox(Util.getEngineName(), "You have loaded a Gui file that was created before this version. It has been loaded but you must open it manually from the content list dropdown", "Ok", "Information"); return; } GuiEditor.openForEditing(guiContent); GuiEditorStatusBar.print("Loaded '" + filename + "'"); }
public override void onSelect(string ctrl, string text) { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; GuiEditor.openForEditing(ctrl); }