コード例 #1
0
        private void treeListBox_MouseDown(object s, MouseEventArgs e)
        {
            int index = treeListBox.IndexFromPoint(e.X, e.Y);

            if (index == ListBox.NoMatches)
            {
                return;
            }

            TreeNodeBase node = (TreeNodeBase)Items[index];

            if (e.Button == MouseButtons.Left)
            {
                int offset = node.depth * (treeListBox.ItemHeight - 1) - leftEdge;
                if (offset <= e.X && e.X < offset + (treeListBox.ItemHeight - 1))
                {
                    ToggleBranch(index);
                }
            }
            else
            {
                //  Customize the context menu
                ContextMenu       contextMenu = this.ContextMenu;
                ColumnInformation ci          = ((DiffColumn)columns[0]).ColumnInformation;
                string            fnName      = treeOwner.GetInfo(TokenObject, node, ci).ToString();



                ContextSelection = index;
                EventHandler eventHandler = new EventHandler(this.ContextMenu_Selection);
                contextMenu.MenuItems.Clear();
                contextMenu.MenuItems.Add(new MenuItem("Save to...", eventHandler));
            }
        }
コード例 #2
0
		internal DiffColumn(ColumnInformation in_ci, DiffResizeBarCapture in_resizeBar,  ArrayList in_columnsRef) : base()
		{
			pressed = false;

			ci = in_ci;
			resizeBar = in_resizeBar;
			columnsRef = in_columnsRef;

			Text = ci.Text;

			SetStyle(ControlStyles.Selectable, false);
		}
コード例 #3
0
        internal DiffColumn(ColumnInformation in_ci, DiffResizeBarCapture in_resizeBar, ArrayList in_columnsRef) : base()
        {
            pressed = false;

            ci         = in_ci;
            resizeBar  = in_resizeBar;
            columnsRef = in_columnsRef;

            Text = ci.Text;

            SetStyle(ControlStyles.Selectable, false);
        }
コード例 #4
0
        internal Column([NotNull] ColumnInformation in_ci, [NotNull] ResizeBarCapture in_resizeBar, [NotNull] List <Column> in_columnsRef) : base()
        {
            pressed = false;

            ColumnInformation = in_ci;
            resizeBar         = in_resizeBar;
            columnsRef        = in_columnsRef;

            Text = ColumnInformation.Text;

            SetStyle(ControlStyles.Selectable, false);
        }
コード例 #5
0
        private void SortOn(object obj, EventArgs e)
        {
            ColumnInformation ci = ((DiffColumn)obj).ColumnInformation;

            if (viewState.sort.counterId == (int)ci.Token)
            {
                viewState.sort.sortingOrder *= -1;
            }
            else
            {
                viewState.sort.counterId    = (int)ci.Token;
                viewState.sort.sortingOrder = (viewState.sort.counterId == -1 ? -1 : 1);
            }
            diffCallTreeView.Resort();
        }
コード例 #6
0
        internal DiffColumn AddColumn(ColumnInformation ci, int defaultWidth)
        {
            DiffColumn c = new DiffColumn(ci, resizeBar, columns);

            c.Width     = defaultWidth;
            c.Parent    = this;
            c.TextAlign = ContentAlignment.MiddleLeft;
            c.Click    += new EventHandler(DiffColumn_Click);
            c.Font      = Font;
            columns.Add(c);

            RedoColumnLayout();

            treeListBox.SuspendLayout();
            treeListBox.Location = new Point(0, c.Height);
            treeListBox.Size     = new Size(ClientSize.Width, ClientSize.Height - c.Height);
            treeListBox.ResumeLayout();

            return(c);
        }
コード例 #7
0
		/* returns data about the item for a given counter.
		 * object's ToString() is used to display that data */
		public object GetInfo(object obj, TreeNodeBase node, ColumnInformation info)
		{
			return GetInfo(obj, node, info == null ? -1 : (int)info.Token);
		}
コード例 #8
0
 /* returns data about the item for a given counter.
  * object's ToString() is used to display that data */
 public object GetInfo(object obj, TreeNodeBase node, ColumnInformation info)
 {
     return(GetInfo(obj, node, info == null ? -1 : (int)info.Token));
 }
コード例 #9
0
		internal DiffColumn AddColumn(ColumnInformation ci, int defaultWidth)
		{
			DiffColumn c = new DiffColumn(ci, resizeBar, columns);

			c.Width = defaultWidth;
			c.Parent = this;
			c.TextAlign = ContentAlignment.MiddleLeft;
			c.Click += new EventHandler(DiffColumn_Click);
			c.Font = Font;
			columns.Add(c);

			RedoColumnLayout();

			treeListBox.SuspendLayout();
			treeListBox.Location = new Point(0, c.Height);
			treeListBox.Size = new Size(ClientSize.Width, ClientSize.Height - c.Height);
			treeListBox.ResumeLayout();

			return c;
		}
コード例 #10
0
        private void treeListBox_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
            /* 0 stands for SB_HORZ */
            int leftEdge = GetScrollPos(treeListBox.Handle, 0);

            if (leftEdge != this.leftEdge)
            {
                this.leftEdge = leftEdge;
                RedoColumnLayout();
            }

            int position = 0;

            Graphics g        = e.Graphics;
            ListBox  treeView = treeListBox;

            if (e.Index < 0 || e.Index >= treeView.Items.Count)
            {
                return;
            }

            StringFormat sf = new StringFormat(StringFormatFlags.NoWrap);

            sf.Trimming = StringTrimming.EllipsisCharacter;

            TreeNodeBase node = (TreeNodeBase)Items[e.Index];

            int crossover = (treeListBox.ItemHeight - 1) * (1 + node.depth);

            g.FillRectangle(new SolidBrush(Color.White), position, e.Bounds.Top, crossover, e.Bounds.Height);

            Rectangle itemRect = new Rectangle(crossover, e.Bounds.Top, e.Bounds.Right - crossover, e.Bounds.Height);

            g.FillRectangle(new SolidBrush(e.BackColor), itemRect);

            if (e.State == DrawItemState.Focus)
            {
                ControlPaint.DrawFocusRectangle(g, itemRect, e.ForeColor, e.BackColor);
            }

            Pen grayPen = new Pen(Color.LightGray);

            g.DrawLine(grayPen, 0, e.Bounds.Bottom - 1, e.Bounds.Right, e.Bounds.Bottom - 1);

            Font fontToUse = treeOwner.GetFont(TokenObject, node);


            Color color = treeOwner.GetColor(TokenObject, node, (e.State & DrawItemState.Selected) != DrawItemState.Selected);

            Brush brush = new SolidBrush(color);

            Region oldClip = g.Clip;

            foreach (DiffColumn c in columns)
            {
                ColumnInformation current = c.ColumnInformation;
                Rectangle         rect    = new Rectangle(position, e.Bounds.Top, c.Width, e.Bounds.Height);
                g.Clip = new Region(rect);

                string res = treeOwner.GetInfo(TokenObject, node, current).ToString();

                if (current.ColumnType == ColumnInformation.ColumnTypes.Tree)
                {
                    rect.Offset((1 + node.depth) * (treeListBox.ItemHeight - 1), 0);
                    rect.Width -= (1 + node.depth) * (treeListBox.ItemHeight - 1);

                    if (node.HasKids)
                    {
                        Pen p  = new Pen(Color.Gray);
                        int y0 = e.Bounds.Top;
                        int x0 = position + node.depth * (treeListBox.ItemHeight - 1);
                        g.DrawRectangle(p, x0 + 3, y0 + 3, (treeListBox.ItemHeight - 9), (treeListBox.ItemHeight - 9));
                        g.DrawLine(p, x0 + 5, y0 + (treeListBox.ItemHeight - 3) / 2, x0 + (treeListBox.ItemHeight - 8), y0 + (treeListBox.ItemHeight - 3) / 2);
                        if (!node.IsExpanded)
                        {
                            g.DrawLine(p, x0 + (treeListBox.ItemHeight - 3) / 2, y0 + 5, x0 + (treeListBox.ItemHeight - 3) / 2, y0 + (treeListBox.ItemHeight - 8));
                        }
                    }
                }

                if (res != null)
                {
                    int characters, lines;

                    SizeF layoutArea = new SizeF(rect.Width, rect.Height);
                    SizeF stringSize = g.MeasureString(res, fontToUse, layoutArea, sf, out characters, out lines);

                    g.DrawString(res.Substring(0, characters) + (characters < res.Length ? "..." : ""), fontToUse, brush, rect.Location, sf);
                    g.DrawLine(grayPen, rect.Right - 1, e.Bounds.Top, rect.Right - 1, e.Bounds.Bottom - 1);
                }

                position += c.Width;
            }
            g.Clip = oldClip;
        }
コード例 #11
0
        private void treeListBox_MouseDown(object s, MouseEventArgs e)
        {
            int index = treeListBox.IndexFromPoint(e.X, e.Y);

            if (index == ListBox.NoMatches)
            {
                return;
            }

            TreeNodeBase node = (TreeNodeBase)Items[index];

            if (e.Button == MouseButtons.Left)
            {
                int offset = node.depth * (treeListBox.ItemHeight - 1) - leftEdge;
                if (offset <= e.X && e.X < offset + (treeListBox.ItemHeight - 1))
                {
                    ToggleBranch(index);
                }
            }
            else
            {
                //  Customize the context menu
                ContextMenu                 contextMenu = this.ContextMenu;
                ColumnInformation           ci          = ((Column)columns[0]).ColumnInformation;
                string                      fnName      = treeOwner.GetInfo(TokenObject, node, ci).ToString();
                String                      strFn;
                CallTreeForm.FnViewFilter[] filterFns;

                ContextSelection = index;
                EventHandler eventHandler = new EventHandler(this.ContextMenu_Selection);
                contextMenu.MenuItems.Clear();
                contextMenu.MenuItems.Add(new MenuItem("Find...", eventHandler));
                contextMenu.MenuItems.Add(new MenuItem("Find " + fnName + " forward", eventHandler));
                contextMenu.MenuItems.Add(new MenuItem("Find " + fnName + " backward", eventHandler));

                filterFns = treeOwner.GetIncludeFilters();
                for (int i = 0; i < 2; i++)
                {
                    if (filterFns[i].functionId > 0)
                    {
                        if (filterFns[i].nodetype == TreeNode.NodeType.Call)
                        {
                            strFn = treeOwner.MakeNameForFunction(filterFns[i].functionId);
                        }
                        else
                        {
                            strFn = treeOwner.MakeNameForAllocation(filterFns[i].functionId, 0);
                        }
                    }
                    else
                    {
                        strFn = "none";
                    }
                    contextMenu.MenuItems.Add(new MenuItem("Set Include filter " + (i + 1).ToString() + " (" + strFn + ")", eventHandler));
                }

                filterFns = treeOwner.GetExcludeFilters();
                for (int i = 0; i < 2; i++)
                {
                    if (filterFns[i].functionId > 0)
                    {
                        if (filterFns[i].nodetype == TreeNode.NodeType.Call)
                        {
                            strFn = treeOwner.MakeNameForFunction(filterFns[i].functionId);
                        }
                        else
                        {
                            strFn = treeOwner.MakeNameForAllocation(filterFns[i].functionId, 0);
                        }
                    }
                    else
                    {
                        strFn = "none";
                    }
                    contextMenu.MenuItems.Add(new MenuItem("Set Exclude filter " + (i + 1).ToString() + " (" + strFn + ")", eventHandler));
                }

                contextMenu.MenuItems.Add(new MenuItem("Clear Filters", eventHandler));
                contextMenu.MenuItems.Add(new MenuItem("Regenerate Tree", eventHandler));
            }
        }
コード例 #12
0
 /* returns data about the item for a given counter.
  * object's ToString() is used to display that data */
 public object GetInfo(TreeNodeBase node, ColumnInformation info)
 {
     return(GetInfo(node, info == null ? -1 : info.Token));
 }