コード例 #1
0
        private void addNode(TreeNode parentNode, string name, ParticleEditorPageEnum tagID, int imageIndex)
        {
            TreeNode newNode = new TreeNode(name);

            newNode.Tag                = tagID;
            newNode.ImageIndex         = imageIndex;
            newNode.SelectedImageIndex = imageIndex;

            parentNode.Nodes.Add(newNode);
        }
コード例 #2
0
        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            treeView1.SelectedNode = e.Node;
            ParticleEditorPageEnum id = (ParticleEditorPageEnum)e.Node.Tag;

            if ((e.Button == MouseButtons.Right) &&
                (id == ParticleEditorPageEnum.eParticleEffect ||
                 id == ParticleEditorPageEnum.eEmitter ||
                 id == ParticleEditorPageEnum.eMagnet))
            {
                mTreeViewContextMenuStrip.Show((Control)treeView1, e.X, e.Y);
            }
        }
コード例 #3
0
        void TreeViewContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            mTreeViewContextMenuStrip.Items.Clear();

            TreeNode node = treeView1.SelectedNode;

            if (node == null)
            {
                return;
            }

            ParticleEditorPageEnum id = (ParticleEditorPageEnum)node.Tag;

            if (id == ParticleEditorPageEnum.eParticleEffect || id == ParticleEditorPageEnum.eEmitter)
            {
                mTreeViewContextMenuStrip.Items.Add(mMenuItemAddEmitter);
            }

            if (id == ParticleEditorPageEnum.eEmitter)
            {
                mTreeViewContextMenuStrip.Items.Add(mMenuItemDeleteEmitter);
                mTreeViewContextMenuStrip.Items.Add(mMenuItemEditEmitterName);

                mTreeViewContextMenuStrip.Items.Add(mMenuItemCutEmitter);
                mTreeViewContextMenuStrip.Items.Add(mMenuItemCopyEmitter);
                mTreeViewContextMenuStrip.Items.Add(mMenuItemPasteEmitter);

                mTreeViewContextMenuStrip.Items.Add(mMenuItemAddMagnet);
            }

            if (id == ParticleEditorPageEnum.eMagnet)
            {
                mTreeViewContextMenuStrip.Items.Add(mMenuItemDeleteMagnet);
                mTreeViewContextMenuStrip.Items.Add(mMenuItemEditMagnetName);

                mTreeViewContextMenuStrip.Items.Add(mMenuItemCutMagnet);
                mTreeViewContextMenuStrip.Items.Add(mMenuItemCopyMagnet);
                mTreeViewContextMenuStrip.Items.Add(mMenuItemPasteMagnet);
            }

            e.Cancel = false;
        }
コード例 #4
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            hidePanelControls();
            ParticleEditorPageEnum pageID = (ParticleEditorPageEnum)e.Node.Tag;

            //-- if the parent of this is an emitter rebind the data
            TreeNode parentNode = e.Node.Parent;

            if (parentNode != null && ((ParticleEditorPageEnum)parentNode.Tag == ParticleEditorPageEnum.eEmitter))
            {
                if (pageID == ParticleEditorPageEnum.eMagnet)
                {
                    int magnetIndex = e.Node.Index - (int)ParticleEditorPageEnum.eEmitterPropertyTotal;
                    bindMagnetData(parentNode.Index, magnetIndex);
                }
                else
                {
                    bindData(parentNode.Index);
                }
            }

            bool bFound = false;

            for (int i = 0; i < panel1.Controls.Count && !bFound; ++i)
            {
                if (pageID == (ParticleEditorPageEnum)panel1.Controls[i].Tag)
                {
                    panel1.Controls[i].Show();
                    bFound = true;
                }
            }

            if (!bFound)
            {
                splashPage.Show();
            }
        }