Пример #1
0
        private void LoadAdditionalMembers(int changedLine, int numNodes)
        {
            HashSet <int> updates = new HashSet <int>();

            if (changedLine >= 0)
            {
                HashSet <int> changes = FormLoadedByTypeDefinition.GetChanges(treeViewAdditionalMembers.Nodes);
                foreach (int change in changes)
                {
                    int update = change >= changedLine + numNodes ? change + numNodes : change;
                    updates.Add(update);
                }
            }

            SuspendLayout();
            treeViewAdditionalMembers.Nodes.Clear();
            line = 0;
            MonoBehaviour parser = Editor.Parser;

            for (int i = 4; i < parser.Parser.type.Members.Count; i++)
            {
                FormLoadedByTypeDefinition.CreateMember(ref line, parser.Parser.type.Members[i], -1, treeViewAdditionalMembers.Nodes);
            }
            if (updates.Count > 0)
            {
                FormLoadedByTypeDefinition.UpdateNodes(treeViewAdditionalMembers.Nodes, updates);
            }
            if (line < 15)
            {
                treeViewAdditionalMembers.ExpandAll();
            }
            ResumeLayout();

            ReselectEditedNode();
        }
Пример #2
0
        private void buttonMBContentRedo_Click(object sender, EventArgs e)
        {
            try
            {
                if (changeIndex >= 0 && changeIndex < Changes.Count)
                {
                    RepeatChange(Changes[changeIndex++]);

                    LoadContents();
                    FormLoadedByTypeDefinition.MarkEditedLines(editedLines, treeViewAdditionalMembers.Nodes);
                    ReselectLastEditedNode();
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Пример #3
0
 private void treeViewAdditionalMembers_DragDrop(object sender, DragEventArgs e)
 {
     try
     {
         TreeNode node = (TreeNode)e.Data.GetData(typeof(TreeNode));
         if (node == null)
         {
             Gui.Docking.DockDragDrop(sender, e);
         }
         else
         {
             FormLoadedByTypeDefinition.ProcessDragDropSources(node, treeViewAdditionalMembers, editTextBoxValue, Editor.Parser.file);
         }
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Пример #4
0
        private void buttonArrayElementPasteBelow_Click(object sender, EventArgs e)
        {
            try
            {
                if (treeViewAdditionalMembers.SelectedNode == null)
                {
                    ReselectEditedNode();
                }

                int line = int.Parse(treeViewAdditionalMembers.SelectedNode.Name);
                if ((bool)Gui.Scripting.RunScript(EditorVar + ".ArrayPasteBelow(line=" + line + ")"))
                {
                    Changed = Changed;

                    int linesToInsert;
                    if (treeViewAdditionalMembers.SelectedNode.Tag is Uarray)
                    {
                        Uarray arr = (Uarray)treeViewAdditionalMembers.SelectedNode.Tag;
                        linesToInsert = FormLoadedByTypeDefinition.CountMembers(arr.Members) - 1;
                    }
                    else
                    {
                        linesToInsert = FormLoadedByTypeDefinition.CountNodes(treeViewAdditionalMembers.SelectedNode);
                    }
                    AddChange(new Tuple <int, string, int>(-4, treeViewAdditionalMembers.SelectedNode.Name, linesToInsert));
                    LoadAdditionalMembers(line, linesToInsert);
                    FormLoadedByTypeDefinition.EnsureVisibleEditedNodes(treeViewAdditionalMembers.Nodes[0]);
                    if (treeViewAdditionalMembers.SelectedNode == null)
                    {
                        TreeNode[] nodes = treeViewAdditionalMembers.Nodes.Find(line.ToString(), true);
                        if (nodes.Length > 0)
                        {
                            treeViewAdditionalMembers.SelectedNode = nodes[0];
                            treeViewAdditionalMembers.SelectedNode.EnsureVisible();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Пример #5
0
        private void buttonMBContentUndo_Click(object sender, EventArgs e)
        {
            try
            {
                if (changeIndex > 0 && changeIndex <= Changes.Count)
                {
                    Editor.Restore();
                    editedLines = new bool[treeViewAdditionalMembers.GetNodeCount(true)];
                    changeIndex--;
                    for (int i = 0; i < changeIndex; i++)
                    {
                        RepeatChange(Changes[i]);
                    }

                    LoadContents();
                    FormLoadedByTypeDefinition.MarkEditedLines(editedLines, treeViewAdditionalMembers.Nodes);
                    ReselectLastEditedNode();
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }