Esempio n. 1
0
        void CustomDispose()
        {
            ChildForms.Clear();
            if (FormVar != null)
            {
                Gui.Scripting.Variables.Remove(FormVar);
                FormVar = null;
            }
            if (treeView.Nodes.Count > 0)
            {
                TreeNode firstRoot  = treeView.Nodes[0];
                TreeNode firstChild = firstRoot.Nodes[0];
                if (firstChild != null && firstChild.Tag != null && firstChild.Tag is DragSource)
                {
                    DragSource     ds             = (DragSource)firstChild.Tag;
                    ImportedEditor importedEditor = Gui.Scripting.Variables[ds.Variable] as ImportedEditor;
                    if (importedEditor != null)
                    {
                        importedEditor.Dispose();
                        Gui.Scripting.Variables.Remove(ds.Variable);
                    }
                }
            }
            if (Watcher != null)
            {
                if (Reopen)
                {
                    Gui.Scripting.RunScript("OpenFile(path=\"" + ToolTipText + "\")", false);
                }

                Watcher.EnableRaisingEvents = false;
                Watcher = null;
            }
        }
Esempio n. 2
0
 public FormWorkspace(string path, IImported importer, string editorVar, ImportedEditor editor)
     : this()
 {
     try
     {
         InitWorkspace(path, importer, editorVar, editor);
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Esempio n. 3
0
        public FormWorkspace(string path, IImported importer, string editorVar, ImportedEditor editor)
        {
            try
            {
                InitializeComponent();
                Init();

                InitWorkspace(path, importer, editorVar, editor);

                Gui.Docking.ShowDockContent(this, Gui.Docking.DockFiles, ContentCategory.Others);
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Esempio n. 4
0
        private void InitWorkspace(string path, IImported importer, string editorVar, ImportedEditor editor)
        {
            this.Text        = Path.GetFileName(path);
            this.ToolTipText = path;

            Watcher                     = new FileSystemWatcher();
            Watcher.Path                = Path.GetDirectoryName(path);
            Watcher.Filter              = Path.GetFileName(path);
            Watcher.Changed            += new FileSystemEventHandler(watcher_Changed);
            Watcher.Deleted            += new FileSystemEventHandler(watcher_Changed);
            Watcher.Renamed            += new RenamedEventHandler(watcher_Changed);
            Watcher.EnableRaisingEvents = automaticReopenToolStripMenuItem.Checked;

            if (editor.Frames != null)
            {
                TreeNode root = new TreeNode(typeof(ImportedFrame).Name);
                root.Checked = true;
                this.treeView.AddChild(root);

                for (int i = 0; i < importer.FrameList.Count; i++)
                {
                    var      frame = importer.FrameList[i];
                    TreeNode node  = new TreeNode(frame.Name);
                    node.Checked = true;
                    node.Tag     = new DragSource(editorVar, typeof(ImportedFrame), editor.Frames.IndexOf(frame));
                    this.treeView.AddChild(root, node);

                    foreach (var child in frame)
                    {
                        BuildTree(editorVar, child, node, editor);
                    }
                }
            }

            AddList(editor.Meshes, typeof(ImportedMesh).Name, editorVar);
            AddList(importer.MaterialList, typeof(ImportedMaterial).Name, editorVar);
            AddList(importer.TextureList, typeof(ImportedTexture).Name, editorVar);
            AddList(editor.Morphs, typeof(ImportedMorph).Name, editorVar);
            AddList(editor.Animations, typeof(ImportedAnimation).Name, editorVar);

            foreach (TreeNode root in this.treeView.Nodes)
            {
                root.Expand();
            }
            if (this.treeView.Nodes.Count > 0)
            {
                this.treeView.Nodes[0].EnsureVisible();
            }

            this.treeView.AfterCheck += treeView_AfterCheck;
        }
Esempio n. 5
0
        private void BuildTree(string editorVar, ImportedFrame frame, TreeNode parent, ImportedEditor editor)
        {
            TreeNode node = new TreeNode(frame.Name);

            node.Checked = true;
            node.Tag     = new DragSource(editorVar, typeof(ImportedFrame), editor.Frames.IndexOf(frame));
            this.treeView.AddChild(parent, node);

            foreach (var child in frame)
            {
                BuildTree(editorVar, child, node, editor);
            }
        }
Esempio n. 6
0
        private void InitWorkspace(string path, IImported importer, string editorVar, ImportedEditor editor)
        {
            this.Text        = Path.GetFileName(path);
            this.ToolTipText = path;

            if (editor.Frames != null)
            {
                TreeNode root = new TreeNode(typeof(ImportedFrame).Name);
                root.Checked = true;
                this.treeView.AddChild(root);

                for (int i = 0; i < importer.FrameList.Count; i++)
                {
                    var      frame = importer.FrameList[i];
                    TreeNode node  = new TreeNode(frame.Name);
                    node.Checked = true;
                    node.Tag     = new DragSource(editorVar, typeof(ImportedFrame), editor.Frames.IndexOf(frame));
                    this.treeView.AddChild(root, node);

                    foreach (var child in frame)
                    {
                        BuildTree(editorVar, child, node, editor);
                    }
                }
            }

            AddList(editor.Meshes, typeof(ImportedMesh).Name, editorVar);
            AddList(importer.MaterialList, typeof(ImportedMaterial).Name, editorVar);
            AddList(importer.TextureList, typeof(ImportedTexture).Name, editorVar);
            AddList(editor.Morphs, typeof(ImportedMorph).Name, editorVar);
            AddList(editor.Animations, typeof(ImportedAnimation).Name, editorVar);

            foreach (TreeNode root in this.treeView.Nodes)
            {
                root.Expand();
            }
            if (this.treeView.Nodes.Count > 0)
            {
                this.treeView.Nodes[0].EnsureVisible();
            }

            this.treeView.AfterCheck += treeView_AfterCheck;
        }