Exemplo n.º 1
0
        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 + "'");
        }