private void FindNode(int StartId, TreeNode.NodeType nodeType, int targetId, Direction direction)
        {
            int      curSel = StartId;
            TreeNode node;
            int      functionId;

            while (true)
            {
                if (direction == Direction.Forward)
                {
                    curSel++;
                    if (curSel >= treeListBox.Items.Count)
                    {
                        curSel = -1;
                    }
                    else
                    {
                        //  Expand if not already expanded
                        //  Note that we expand only on forward search
                        node = (TreeNode)Items[curSel];
                        if (node.HasKids && !node.IsExpanded)
                        {
                            ToggleBranch(curSel);
                        }
                    }
                }
                else
                {
                    curSel--;
                }

                if (curSel == -1)
                {
                    MessageBox.Show("Cannot find function");
                    break;
                }

                node       = (TreeNode)Items[curSel];
                functionId = treeOwner.GetNodeId(node);
                if (functionId == targetId && node.nodetype == nodeType)
                {
                    treeListBox.SelectedIndex = curSel;
                    break;
                }
            }
        }
 private string GetName(TreeNode.NodeType nodetype, int id)
 {
     if (id == -1)
     {
         return("");
     }
     else
     {
         if (nodetype == TreeNode.NodeType.Call)
         {
             return(m_treeOwner.MakeNameForFunction(id));
         }
         else
         {
             return(m_treeOwner.MakeNameForAllocation(id, 0));
         }
     }
 }
        private void btnOk_Click(object sender, System.EventArgs e)
        {
            if (lbFunctions.SelectedIndex < 0)
            {
                // Nothing selected
                if (lbFunctions.Items.Count == 0)
                {
                    MessageBox.Show("To populate the list box, enter a search string and click the search button.");
                }
                else
                {
                    MessageBox.Show("Please select a function from the list box.");
                }
                return;
            }

            SelectedFunctionId = ((LineItem)lbFunctions.SelectedItem).id;
            SelectedNodeType   = ((LineItem)lbFunctions.SelectedItem).nodeType;
            DialogResult       = DialogResult.OK;
            Close();
        }
        //
        //  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);
        }
 internal FnViewFilter( TreeNode.NodeType Nodetype, int FunctionId)
 {
     nodetype = Nodetype;
     functionId = FunctionId;
 }
Exemple #6
0
 internal FnViewFilter(TreeNode.NodeType Nodetype, int FunctionId)
 {
     nodetype   = Nodetype;
     functionId = FunctionId;
 }
		private void btnOk_Click(object sender, System.EventArgs e)
		{
			if (lbFunctions.SelectedIndex < 0)
			{
				// Nothing selected
				if (lbFunctions.Items.Count == 0)
				{
					MessageBox.Show( "To populate the list box, enter a search string and click the search button." );
				}
				else
				{
					MessageBox.Show( "Please select a function from the list box." );
				}
				return;
			}

			SelectedFunctionId = ((LineItem)lbFunctions.SelectedItem).id;
			SelectedNodeType = ((LineItem)lbFunctions.SelectedItem).nodeType;
			DialogResult = DialogResult.OK;
			Close();
		}
Exemple #8
0
    /* **** UTILS START **** */
    private TreeNode createNode(TreeNode.NodeType type)
    {
        TreeNode t = new TreeNode(type);

        return(t);
    }
 public LineItem(int id, [NotNull] string name, TreeNode.NodeType nodeType)
 {
     Id       = id;
     Name     = name;
     NodeType = nodeType;
 }