示例#1
0
 public static void CollapseTLVI(TreeListView TLV)
 {
     TLV.CollapseAll();
 }
示例#2
0
        private void CreateToolStrip(string declarationFilter)
        {
            // Syntax and trivia toggles
            _syntaxTokenCheckBox = new CheckBox()
            {
                BackColor = Color.Transparent,
                Checked   = true,
            };
            _syntaxTriviaCheckBox = new CheckBox()
            {
                BackColor = Color.Transparent,
                Checked   = true,
            };

            bool handleChecked = true;  // Prevent double handling from adjustments during another handler

            _syntaxTokenCheckBox.CheckedChanged += (x, e) =>
            {
                if (handleChecked)
                {
                    if (!_syntaxTokenCheckBox.Checked)
                    {
                        handleChecked = false;
                        _syntaxTriviaCheckBox.Checked = false;
                        handleChecked = true;
                    }
                    if (_syntaxTokenCheckBox.Checked && _syntaxTriviaCheckBox.Checked)
                    {
                        _treeList.ModelFilter = null;
                    }
                    _treeList.ModelFilter = new SyntaxFilter(_syntaxTokenCheckBox.Checked, _syntaxTriviaCheckBox.Checked);
                    PopulateGraph();
                }
            };
            _syntaxTriviaCheckBox.CheckedChanged += (x, e) =>
            {
                if (handleChecked)
                {
                    if (!_syntaxTokenCheckBox.Checked)
                    {
                        handleChecked = false;
                        _syntaxTokenCheckBox.Checked = true;
                        handleChecked = true;
                    }
                    if (_syntaxTokenCheckBox.Checked && _syntaxTriviaCheckBox.Checked)
                    {
                        _treeList.ModelFilter = null;
                    }
                    _treeList.ModelFilter = new SyntaxFilter(_syntaxTokenCheckBox.Checked, _syntaxTriviaCheckBox.Checked);
                    PopulateGraph();
                }
            };

            // Semantics toggle and diagnostics button
            _semanticsCheckBox = new CheckBox()
            {
                BackColor = Color.Transparent
            };
            _semanticsCheckBox.CheckedChanged += (x, e) =>
            {
                GetSemanticModel();
            };
            _diagnosticsButton = new ToolStripButton("Dump Diagnostics", null, (x, e) =>
            {
                SemanticModel semanticModel = GetSemanticModel();
                if (semanticModel != null)
                {
                    // Exclude duplicate mscorlib reference warnings (referenced in LINQPad.Codeanalysis because ObjectListView is .NET 2.0)
                    semanticModel.GetDiagnostics()
                    .Where(y => y.Id != "CS1701" && !y.Descriptor.Description.ToString().Contains("mscorlib"))
                    .Dump();
                }
            });

            // Declaration filter
            ToolStripTextBox declarationFilterTextBox = new ToolStripTextBox();

            if (!string.IsNullOrWhiteSpace(declarationFilter))
            {
                declarationFilterTextBox.Text = declarationFilter;
            }
            declarationFilterTextBox.KeyDown += (x, e) =>
            {
                if (e.KeyCode == Keys.Enter)
                {
                    SetRoots(declarationFilterTextBox.Text);
                }
            };
            declarationFilterTextBox.LostFocus += (x, e) =>
            {
                SetRoots(declarationFilterTextBox.Text);
            };

            // Layout
            _toolStrip = new ToolStrip(
                new ToolStripButton("Expand All", null, (x, e) => _treeList.ExpandAll()),
                new ToolStripButton("Collapse All", null, (x, e) => _treeList.CollapseAll()),
                new ToolStripSeparator(),
                new ToolStripLabel("SyntaxNode  ")
            {
                ForeColor = Color.Blue
            },
                new ToolStripControlHost(_syntaxTokenCheckBox),
                new ToolStripLabel("SyntaxToken  ")
            {
                ForeColor = Color.Green
            },
                new ToolStripControlHost(_syntaxTriviaCheckBox),
                new ToolStripLabel("SyntaxTrivia  ")
            {
                ForeColor = Color.Maroon
            },
                new ToolStripSeparator(),
                new ToolStripLabel("Declaration Filter"),
                declarationFilterTextBox,
                new ToolStripSeparator(),
                new ToolStripLabel(" "),
                new ToolStripControlHost(_semanticsCheckBox),
                new ToolStripLabel("Semantics  "),
                _diagnosticsButton)
            {
                GripStyle = ToolStripGripStyle.Hidden,
                Renderer  = new BorderlessToolStripRenderer(),
                Padding   = new Padding(4)
            };
            _toolStrip.Layout += (x, e) => _toolStrip.Width = _toolStrip.Parent.Width;
        }
示例#3
0
 public void CollapseAll()
 {
     _internalList.CollapseAll();
 }
示例#4
0
文件: Editors.cs 项目: zparr/ATF
        private void BtnClick(object sender, EventArgs e)
        {
            var btn   = (Button)sender;
            var flags = (Buttons)btn.Tag;

            switch (flags)
            {
            case Buttons.AddFlat:
                DataContainer.GenerateFlat(
                    View,
                    (TreeListView.TheStyle != TreeListView.Style.TreeList) &&
                    (TreeListView.TheStyle != TreeListView.Style.CheckedTreeList)
                            ? null
                            : TreeListViewAdapter.LastHit);
                break;

            case Buttons.AddHierarchical:
                DataContainer.GenerateHierarchical(
                    View,
                    TreeListViewAdapter.LastHit);
                break;

            case Buttons.AddVirtual:
                DataContainer.GenerateVirtual(View);
                break;

            case Buttons.Reload:
                DataContainer.Reload(View);
                break;

            case Buttons.ExpandAll:
                TreeListView.ExpandAll();
                break;

            case Buttons.CollapseAll:
                TreeListView.CollapseAll();
                break;

            case Buttons.RemoveItem:
                DataContainer.RemoveItem(View, TreeListViewAdapter.LastHit);
                break;

            case Buttons.ModifySelected:
                DataContainer.ModifySelected(View, TreeListViewAdapter.Selection);
                break;

            case Buttons.SelectAll:
            {
                TreeListView.BeginUpdate();
                foreach (var node in TreeListView.Nodes)
                {
                    node.Selected = true;
                }
                TreeListView.EndUpdate();
            }
            break;

            case Buttons.RecursiveCheckBoxes:
            {
                TreeListView.RecursiveCheckBoxes = !TreeListView.RecursiveCheckBoxes;
                btn.Text = TreeListView.RecursiveCheckBoxes ? RecursiveCheckBoxesOnText : RecursiveCheckBoxesOffText;
            }
            break;
            }
        }