Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void propertyViewToolStripMenuItem_CheckStateChanged(object sender, EventArgs e)
 {
     if (propertyViewToolStripMenuItem.Checked)
     {
         if (_nodePropertyViewer.IsHidden)
         {
             _nodePropertyViewer.Show();
         }
     }
     else
     {
         _nodePropertyViewer.Hide();
     }
 }
        /// <summary>
        /// Default class initializer.
        /// </summary>
        public ShellForm([ServiceDependency] WorkItem workItem)
        {
            InitializeComponent();

            rootWorkItem = workItem;
            mdiWorkspace = new DockContentMdiWorkspace(this.dockPanel);
            rootWorkItem.Workspaces.Add(mdiWorkspace, WorkspaceNames.SceneWorkspace);
            rootWorkItem.Items.Add(_propertyView);
            rootWorkItem.Items.Add(_objectsTreeView);
            rootWorkItem.Items.Add(_commandLineView);
            rootWorkItem.Items.Add(_helpView);

            // Load the layout from the config file
            _deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");

            // Load the layout form the config file
            if (File.Exists(configFile))
            {
                try
                {
                    dockPanel.LoadFromXml(configFile, _deserializeDockContent);
                }
                catch(Exception e)
                {
                    log.Debug("Failed at loading the DockPanel.config:" + configFile + Environment.NewLine + "Exception: " + e.Message);
                    throw;
                }
            }

            // Add the Property, the Object and the CommandLine views
            _propertyView.Show(dockPanel);
            _objectsTreeView.Show(dockPanel);
            _commandLineView.Show(dockPanel);
            _helpView.Show(dockPanel);
        }
Beispiel #3
0
        public MainForm()
        {
            InitializeComponent();

            IsMdiContainer = true;

            PluginManager.Init();
            OpenTKResources.Init();

            _nodePropertyViewer      = new PropertyView();
            _nodePropertyViewer.Dock = DockStyle.Fill;
            _nodePropertyViewer.Show(dockPanel);

            //dockPanel.ShowDocumentIcon = true;
            dockPanel.ActiveContentChanged += (sender, args) =>
            {
                if (dockPanel.ActiveContent != null)
                {
                    LastActiveContent = dockPanel.ActiveContent;
                }
            };

            Viewport      = new CommonViewport();
            Viewport.Dock = DockStyle.Fill;
            Viewport.Show(dockPanel);

            //_ScriptEditor = new SubactionEditor();
            //_ScriptEditor.Dock = DockStyle.Fill;

            ImageList myImageList = new ImageList();

            myImageList.ImageSize = new System.Drawing.Size(24, 24);
            myImageList.Images.Add("unknown", Properties.Resources.ico_unknown);
            myImageList.Images.Add("known", Properties.Resources.ico_known);
            myImageList.Images.Add("folder", Properties.Resources.ico_folder);
            myImageList.Images.Add("group", Properties.Resources.ico_group);
            myImageList.Images.Add("table", Properties.Resources.ico_table);
            myImageList.Images.Add("jobj", Properties.Resources.ico_jobj);
            myImageList.Images.Add("dobj", Properties.Resources.ico_dobj);
            myImageList.Images.Add("pobj", Properties.Resources.ico_pobj);
            myImageList.Images.Add("mobj", Properties.Resources.ico_mobj);
            myImageList.Images.Add("tobj", Properties.Resources.ico_tobj);
            myImageList.Images.Add("aobj", Properties.Resources.ico_aobj);
            myImageList.Images.Add("cobj", Properties.Resources.ico_cobj);
            myImageList.Images.Add("fobj", Properties.Resources.ico_fobj);
            myImageList.Images.Add("iobj", Properties.Resources.ico_iobj);
            myImageList.Images.Add("lobj", Properties.Resources.ico_lobj);
            myImageList.Images.Add("sobj", Properties.Resources.ico_sobj);
            myImageList.Images.Add("coll", Properties.Resources.ico_coll);
            myImageList.Images.Add("anim_texture", Properties.Resources.ico_anim_texture);
            myImageList.Images.Add("anim_material", Properties.Resources.ico_anim_material);
            myImageList.Images.Add("anim_joint", Properties.Resources.ico_anim_joint);
            myImageList.Images.Add("anim_shape", Properties.Resources.ico_anim_shape);
            myImageList.Images.Add("kabii", Properties.Resources.ico_kabii);
            myImageList.Images.Add("fuma", Properties.Resources.ico_fuma);

            treeView1.ImageList = myImageList;

            bool dc = false;

            treeView1.MouseDown += (sender, args) =>
            {
                dc = args.Clicks > 1;
            };

            treeView1.BeforeExpand += (sender, args) =>
            {
                args.Cancel = dc;

                if (args.Node is DataNode node && Instance.IsOpened(node) && !dc)
                {
                    MessageBox.Show("Error: This node is currently open in an editor\nPlease close it first to expand");
                    args.Cancel = true;
                }

                dc = false;
            };

            treeView1.AfterExpand += (sender, args) =>
            {
                args.Node.Nodes.Clear();
                treeView1.BeginUpdate();
                if (args.Node is DataNode node)
                {
                    node.ExpandData();
                }
                treeView1.EndUpdate();
            };

            treeView1.AfterCollapse += (sender, args) =>
            {
                treeView1.BeginUpdate();
                args.Node.Nodes.Clear();
                args.Node.Nodes.Add(new TreeNode());
                treeView1.EndUpdate();
            };

            treeView1.AfterSelect += (sender, args) =>
            {
                SelectNode <HSDAccessor>();
            };

            treeView1.NodeMouseClick += (sender, args) =>
            {
                treeView1.SelectedNode = treeView1.GetNodeAt(args.Location);
                if (args.Button == MouseButtons.Right && args.Node != null && args.Node is DataNode node)
                {
                    PluginManager.GetContextMenuFromType(node.Accessor.GetType()).Show(this, args.Location);
                }
                try
                {
                    var kb = OpenTK.Input.Keyboard.GetState();
                    if (kb.IsKeyDown(OpenTK.Input.Key.ShiftLeft) || kb.IsKeyDown(OpenTK.Input.Key.ShiftRight))
                    {
                        treeView1.BeginUpdate();
                        treeView1.SelectedNode.ExpandAll();
                        treeView1.EndUpdate();
                    }
                }
                catch (Exception)
                {
                }
            };
        }