예제 #1
0
        //
        //  Popup a dialog to let the user select a function name from
        //  the list of all functions in the current view.
        //
        //  Returns:
        //     -1:  Dialog cancelled
        //	   >=0: Fn id.
        //

        private CallTreeForm.FnViewFilter FindFunction(TextBox tb)
        {
            int id = -2;

            TreeNode.NodeType nodetype = TreeNode.NodeType.Call;
            var functionFind           = new FunctionFind(m_treeOwner, tb.Text);
            var viewFilter             = new CallTreeForm.FnViewFilter();

            if (functionFind.ShowDialog() == DialogResult.OK)
            {
                id = functionFind.SelectedFunctionId;
                if (id >= 0)
                {
                    nodetype = functionFind.SelectedNodeType;
                    tb.Text  = GetName(nodetype, id);
                }
            }

            viewFilter.functionId = id;
            viewFilter.nodetype   = nodetype;

            return(viewFilter);
        }
예제 #2
0
		//
		//  Popup a dialog to let the user select a function name from 
		//  the list of all functions in the current view.
		//
		//  Returns:
		//     -1:  Dialog cancelled
		//	   >=0: Fn id.
		//

		private CallTreeForm.FnViewFilter FindFunction( TextBox tb )
		{
			int id = -2;
			TreeNode.NodeType nodetype = TreeNode.NodeType.Call;
			FunctionFind functionFind = new FunctionFind( m_treeOwner, tb.Text );
			CallTreeForm.FnViewFilter viewFilter = new CallTreeForm.FnViewFilter();

			if (functionFind.ShowDialog() == DialogResult.OK)
			{
				id = functionFind.SelectedFunctionId;
				if (id >= 0)
				{
					nodetype = functionFind.SelectedNodeType;
					tb.Text = GetName( nodetype, id );
				}
			}

			viewFilter.functionId = id;
			viewFilter.nodetype = nodetype;

			return viewFilter;
		}
예제 #3
0
        private void ContextMenu_Selection(object sender, System.EventArgs e)
        {
            MenuItem miClicked = (MenuItem)sender;

            switch (miClicked.Index)
            {
            case 0:
                // Find ...
                int          findId;
                FunctionFind dlgFnFind = new FunctionFind(treeOwner, "");
                if (dlgFnFind.ShowDialog() == DialogResult.OK)
                {
                    // Find dlgFn
                    findId = dlgFnFind.SelectedFunctionId;
                    FindNode(ContextSelection, TreeNode.NodeType.Call, findId, Direction.Forward);
                }
                break;

            case 1:
            case 2:
                // Find selection forward (1) or backward (2)
                TreeNodeBase      node;
                TreeNode.NodeType nodeType;
                int idCurrent;

                node      = (TreeNodeBase)treeListBox.Items[ContextSelection];
                nodeType  = ((TreeNode)node).nodetype;
                idCurrent = treeOwner.GetNodeId(node);
                FindNode(ContextSelection, nodeType, idCurrent, miClicked.Index == 1 ? Direction.Forward : Direction.Backward);
                break;


            case 3:
            case 4:
            case 5:
            case 6:
                // Add function to filters
                CallTreeForm.FnViewFilter [] filters;

                // include or exclude filters?
                bool fIncludes = miClicked.Index == 3 || miClicked.Index == 4;
                int  filterId  = (miClicked.Index - 3) & 1;                        // 0 or 1

                node     = (TreeNodeBase)treeListBox.Items[ContextSelection];
                nodeType = ((TreeNode)node).nodetype;
                if (nodeType == TreeNode.NodeType.Call || nodeType == TreeNode.NodeType.Allocation)
                {
                    idCurrent = treeOwner.GetNodeId(node);

                    filters = fIncludes ? treeOwner.GetIncludeFilters() : treeOwner.GetExcludeFilters();
                    filters[filterId].nodetype   = nodeType;
                    filters[filterId].functionId = idCurrent;
                }
                else
                {
                    MessageBox.Show("Can only filter calls or allocations.  Please select a function.");
                }
                break;

            case 7:
                //  Reset filters
                filters = treeOwner.GetIncludeFilters();
                filters[0].functionId = -1;
                filters[1].functionId = -1;

                filters = treeOwner.GetExcludeFilters();
                filters[0].functionId = -1;
                filters[1].functionId = -1;
                break;

            case 8:
                //  Regenerate tree
                treeOwner.RegenerateTree();
                break;
            }
        }
예제 #4
0
		private void ContextMenu_Selection(object sender, System.EventArgs e) 
		{
			MenuItem miClicked = (MenuItem)sender;

			switch (miClicked.Index)
			{

				case 0:
					// Find ...
					int findId;
					FunctionFind dlgFnFind = new FunctionFind( treeOwner, "" );
					if (dlgFnFind.ShowDialog() == DialogResult.OK)
					{
						// Find dlgFn
						findId = dlgFnFind.SelectedFunctionId;
						FindNode( ContextSelection, TreeNode.NodeType.Call, findId, Direction.Forward );	
					}
					break;

				case 1:
				case 2:
					// Find selection forward (1) or backward (2)
					TreeNodeBase node;
					TreeNode.NodeType nodeType;
					int idCurrent;

					node = (TreeNodeBase)treeListBox.Items[ ContextSelection ];
					nodeType = ((TreeNode)node).nodetype;
					idCurrent = treeOwner.GetNodeId( node );
					FindNode( ContextSelection, nodeType, idCurrent, miClicked.Index == 1 ? Direction.Forward : Direction.Backward );
					break;


				case 3:
				case 4:
				case 5:
				case 6:
					// Add function to filters
					CallTreeForm.FnViewFilter [] filters;

					// include or exclude filters?
					bool fIncludes = miClicked.Index == 3 || miClicked.Index == 4;
					int filterId = (miClicked.Index - 3) & 1;  // 0 or 1

					node = (TreeNodeBase)treeListBox.Items[ ContextSelection ];
					nodeType = ((TreeNode)node).nodetype;
					if (nodeType == TreeNode.NodeType.Call || nodeType == TreeNode.NodeType.Allocation)
					{
						idCurrent = treeOwner.GetNodeId( node );

						filters = fIncludes ? treeOwner.GetIncludeFilters() : treeOwner.GetExcludeFilters();
						filters[ filterId ].nodetype = nodeType;
						filters[ filterId ].functionId = idCurrent;
					}
					else
					{
						MessageBox.Show("Can only filter calls or allocations.  Please select a function.");
					}
					break;

				case 7:
					//  Reset filters
					filters = treeOwner.GetIncludeFilters();
					filters[0].functionId = -1;
					filters[1].functionId = -1;

					filters = treeOwner.GetExcludeFilters();
					filters[0].functionId = -1;
					filters[1].functionId = -1;
					break;

				case 8:
					//  Regenerate tree
					treeOwner.RegenerateTree();
					break;
			}


		}