public void unselectDatablock(string datablock, bool dontSyncTree)
        {
            GuiTreeViewCtrl       DatablockEditorTree            = "DatablockEditorTree";
            GuiInspector          DatablockEditorInspector       = "DatablockEditorInspector";
            GuiWindowCollapseCtrl DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";

            DatablockEditorInspector.removeInspect(datablock);

            if (!dontSyncTree)
            {
                int id = DatablockEditorTree.findItemByValue(datablock.getID().AsString());
                DatablockEditorTree.selectItem(id, false);
            }

            this.syncDirtyState();

            // If we have exactly one selected datablock remaining, re-enable
            // the save-as button.

            int numSelected = this.getNumSelectedDatablocks();

            if (numSelected == 1)
            {
                ((GuiBitmapButtonCtrl)DatablockEditorInspectorWindow.findObjectByInternalName("saveAsButton", true)).setActive(true);

                GuiTextEditCtrl fileNameField = DatablockEditorInspectorWindow.findObjectByInternalName("DatablockFile", true);
                fileNameField.setText(((SimObject)this.getSelectedDatablock()).getFilename());
                fileNameField.setActive(true);
            }

            EditorGuiStatusBar.setSelection(this.getNumSelectedDatablocks() + " Datablocks Selected");
        }
예제 #2
0
            public override void onTabSelected(string text, uint index)
            {
                GuiWindowCollapseCtrl DatablockEditorTreeWindow = "DatablockEditorTreeWindow";
                GuiBitmapButtonCtrl   DeleteSelection           = DatablockEditorTreeWindow.findObjectByInternalName("DeleteSelection", true);
                GuiBitmapButtonCtrl   CreateSelection           = DatablockEditorTreeWindow.findObjectByInternalName("CreateSelection", true);

                switch (index)
                {
                case 0:
                    DeleteSelection.visible = true;
                    CreateSelection.visible = false;
                    break;

                case 1:
                    DeleteSelection.visible = false;
                    CreateSelection.visible = true;
                    break;
                }
            }
예제 #3
0
        public void selectDatablock(SimObject datablock, bool add = false, bool dontSyncTree = false)
        {
            GuiTreeViewCtrl       DatablockEditorTree            = "DatablockEditorTree";
            GuiInspector          DatablockEditorInspector       = "DatablockEditorInspector";
            GuiWindowCollapseCtrl DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";

            if (add)
            {
                DatablockEditorInspector.addInspect(datablock);
            }
            else
            {
                DatablockEditorInspector.inspect(datablock);
            }

            if (!dontSyncTree)
            {
                int id = DatablockEditorTree.findItemByValue(datablock);

                if (!add)
                {
                    DatablockEditorTree.clearSelection();
                }

                DatablockEditorTree.selectItem(id, true);
                DatablockEditorTree.scrollVisible(id);
            }

            this.syncDirtyState();

            // Update the filename text field.

            int             numSelected   = this.getNumSelectedDatablocks();
            GuiTextEditCtrl fileNameField = DatablockEditorInspectorWindow.findObjectByInternalName("DatablockFile",
                                                                                                    true);

            if (numSelected == 1)
            {
                string fileName = datablock.getFilename();
                fileNameField.setText(fileName != "" ? fileName : omni.sGlobal["$DATABLOCK_EDITOR_DEFAULT_FILENAME"]);
            }
            else
            {
                fileNameField.setText("");
            }

            EditorGuiStatusBar.setSelection(this.getNumSelectedDatablocks() + " Datablocks Selected");
        }
        public void resetSelectedDatablock()
        {
            GuiTreeViewCtrl DatablockEditorTree = "DatablockEditorTree";

            DatablockEditor.DatablockEditorInspector DatablockEditorInspector = "DatablockEditorInspector";
            GuiWindowCollapseCtrl DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";

            DatablockEditorTree.clearSelection();
            DatablockEditorInspector.inspect("0");
            ((GuiTextEditCtrl)DatablockEditorInspectorWindow.findObjectByInternalName("DatablockFile", true)).setText("");

            EditorGuiStatusBar.setSelection("");
        }
예제 #5
0
        public void saveNewFileFinish(string newFileName)
        {
            GuiWindowCollapseCtrl DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            // Clear the first responder to capture any inspector changes
            GuiControl ctrl = ((GuiCanvas)"canvas").getFirstResponder();

            if (ctrl.isObject())
            {
                ctrl.clearFirstResponder(false);
            }

            GuiTreeViewCtrl tree     = "DatablockEditorTree";
            int             count    = tree.getSelectedItemsCount();
            string          selected = tree.getSelectedItemList();

            foreach (string id in selected.Split(' '))
            {
                //TODO
                SimObject db = tree.getItemValue(id.AsInt());
                //db = this.getSelectedDatablock();

                // Remove from current file.

                string oldFileName = db.getFilename();
                if (oldFileName != "")
                {
                    this.PM.removeObjectFromFile(db, oldFileName);
                }

                // Save to new file.

                this.PM.setDirty(db, newFileName);
                if (this.PM.saveDirtyObject(db))
                {
                    // Clear dirty state.

                    this.flagDatablockAsDirty(db, false);
                }
            }

            ((GuiTextEditCtrl)DatablockEditorInspectorWindow.findObjectByInternalName("DatablockFile", true)).setText
                (newFileName);
        }