Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="expandedNodes"></param>
 public void ExpandNodes(Utility.TreeNode[] expandedNodes)
 {
     foreach (var node in expandedNodes)
     {
         treeview1.ExpandRow(CreatePath(node), false);
     }
 }
Esempio n. 2
0
        /// <summary>Refreshes the entire tree from the specified descriptions.</summary>
        /// <param name="nodeDescriptions">The nodes descriptions.</param>
        private void Refresh(TreeViewNode nodeDescriptions)
        {
            // Record which rows are currently expanded.
            // We can't directly use a TreePath to an outdated TreeModel/TreeView, so we store the path as a string, and
            // then parse that into a new TreePath after the model is reassembled. This assumes that the structure of the
            // tree view/model does not change when RefreshNode() is called (e.g. it still has the same number of rows/columns).
            List <string> expandedRows = new List <string>();

            treeview1.MapExpandedRows(new TreeViewMappingFunc((tree, path) =>
            {
                expandedRows.Add(path.ToString());
            }));
            treemodel.Clear();
            TreeIter iter = treemodel.AppendNode();

            RefreshNode(iter, nodeDescriptions);
            treeview1.ShowAll();
            treeview1.ExpandRow(new TreePath("0"), false);
            // Expand all rows which were previously expanded by the user.
            try
            {
                expandedRows.ForEach(row => treeview1.ExpandRow(new TreePath(row), false));
            }
            catch
            {
            }

            if (ContextMenu != null)
            {
                ContextMenu.AttachToWidget(treeview1);
            }
        }
Esempio n. 3
0
        /// <summary>Refreshes the entire tree from the specified descriptions.</summary>
        /// <param name="nodeDescriptions">The nodes descriptions.</param>
        public void Refresh(TreeViewNode nodeDescriptions)
        {
            treemodel.Clear();
            TreeIter iter = treemodel.AppendNode();

            RefreshNode(iter, nodeDescriptions);
            treeview1.ShowAll();
            treeview1.ExpandRow(new TreePath("0"), false);
        }
Esempio n. 4
0
 public ObjectWindow(RuntimeThread runtimeThread, object root)
     : base(GetTitle(root))
 {
     SetDefaultSize(250, 300);
     SkipPagerHint = true;
     SkipTaskbarHint = true;
     
     scroller = new ScrolledWindow();
     scroller.BorderWidth = 5;
     scroller.ShadowType = ShadowType.In;
     Add(scroller);
     
     store = new TreeStore(typeof(string), typeof(object), typeof(bool));
     
     //TreeModelSort storeSort = new TreeModelSort(store);
     //storeSort.SetSortColumnId(0, SortType.Ascending);
     
     view = new TreeView(store);
     view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
     view.HeadersVisible = false;
     view.RowExpanded += OnTreeRowExpanded;
     view.RowCollapsed += OnTreeRowCollapsed;
     scroller.Add(view);
     
     Add(false, new TreeIter(), "", root, false, false);
     
     TreeIter first;
     store.GetIterFirst(out first);
     view.ExpandRow(store.GetPath(first), false);
 }
        public HelpTree()
            : base(GettextCatalog.GetString ("Help"), Gtk.Stock.Help)
        {
            tree_view = new TreeView ();

            tree_view.AppendColumn ("name_col", new CellRendererText (), "text", 0);
            tree_view.RowExpanded += new Gtk.RowExpandedHandler (RowExpanded);
            tree_view.Selection.Changed += new EventHandler (RowActivated);

            store = new TreeStore (typeof (string), typeof (Node));
            root_iter = store.AppendValues (GettextCatalog.GetString ("Mono Documentation"), Runtime.Documentation.HelpTree);

            PopulateNode (root_iter);

            tree_view.Model = store;
            tree_view.HeadersVisible = false;

            scroller = new ScrolledWindow ();
            scroller.ShadowType = Gtk.ShadowType.In;
            scroller.Add (tree_view);

            tree_view.ExpandRow (new TreePath ("0"), false);
            TreeIter child_iter;
            start:
            store.IterChildren (out child_iter, root_iter);
            do {
                if (!store.IterHasChild (child_iter)) {
                    store.Remove (ref child_iter);
                    goto start;
                }
            } while (store.IterNext (ref child_iter));

            Control.ShowAll ();
        }
Esempio n. 6
0
        public void RestoreStatus(object ob)
        {
            if (ob == null)
            {
                return;
            }

            // The first element is the selection
            ArrayList list    = (ArrayList)ob;
            TreePath  selpath = (TreePath)list [0];

            list.RemoveAt(0);

            foreach (TreePath path in list)
            {
                treeView.ExpandRow(path, false);
            }

            if (selpath != null)
            {
                treeView.Selection.SelectPath(selpath);
            }
        }
Esempio n. 7
0
	public CoverageView (string fileName, ProgressBar status)
	{
		TreeStore store = new TreeStore (typeof (string), typeof (string), typeof (string), typeof (string), typeof (object));
		tree = new TreeView (store);

		CellRendererText renderer = new CellRendererText ();
		// LAME: Why is this property a float instead of a double ?
		renderer.Xalign = 0.5f;

		tree.AppendColumn ("Classes", new CellRendererText (), "text", 0);
		tree.AppendColumn ("Lines Hit", renderer, "text", 1);
		tree.AppendColumn ("Lines Missed", renderer, "text", 2);
		tree.AppendColumn ("Coverage", renderer, "text", 3);

		tree.GetColumn (0).Resizable = true;
		tree.GetColumn (1).Alignment = 0.0f;
		tree.GetColumn (1).Resizable = true;
		tree.GetColumn (2).Alignment = 0.0f;
		tree.GetColumn (2).Resizable = true;
		tree.GetColumn (3).Alignment = 0.0f;
		tree.GetColumn (3).Resizable = true;

		tree.HeadersVisible = true;

		model = new CoverageModel ();
		foreach (string filter in DEFAULT_FILTERS) {
			model.AddFilter (filter);
		}
		this.status = status;
		model.Progress += Progress;
		model.ReadFromFile (fileName);

		TreeItem root = new TreeItem (store, null, model, "PROJECT");

		Hashtable classes2 = model.Classes;

		namespaces = new Hashtable ();
		string[] sorted_names = new string [classes2.Count];
		classes2.Keys.CopyTo (sorted_names, 0);
		Array.Sort (sorted_names);
		Progress ("Building tree", 0.95);
		foreach (string name in sorted_names) {
			ClassCoverageItem klass = (ClassCoverageItem)classes2 [name];

			if (klass.filtered)
				continue;

			string namespace2 = klass.name_space;
			TreeItem nsItem = (TreeItem)namespaces [namespace2];
			if (nsItem == null) {
				nsItem = new TreeItem (store, root, (CoverageItem)model.Namespaces [namespace2], namespace2);
				//				nsItem.SetPixmap (0, namespaceOpenPixmap);
				namespaces [namespace2] = nsItem;
			}

			if (nsItem.model.filtered)
				continue;

			ClassItem classItem = new ClassItem (store, nsItem, klass, klass.name);

			// We should create the method nodes only when the class item
			// is opened
			
			foreach (MethodCoverageItem method in klass.Methods) {
				if (method.filtered)
					continue;

				string title = method.Name;
				if (title.Length > 64)
					title = title.Substring (0, 63) + "...)";

				new MethodItem (store, classItem, classItem, method, title);
			}
		}

		tree.ExpandRow (store.GetPath (root.Iter), false);

		// it becomes very hard to navigate if everything is expanded
		//foreach (string ns in namespaces.Keys)
		//	tree.ExpandRow (store.GetPath (((TreeItem)namespaces [ns]).Iter), false);

		tree.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPress);
		tree.Selection.Mode = SelectionMode.Single;

		source_views = new Hashtable ();
		window_maps = new Hashtable ();
		Progress ("Done", 1.0);
		// LAME: Why doesn't widgets visible by default ???
		tree.Show ();
	}
Esempio n. 8
0
        public CoverageView(string fileName, ProgressBar status)
        {
            store = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(string), typeof(object));
            tree = new TreeView (store);

            CellRendererText renderer = new CellRendererText ();
            CellRendererText coverageRenderer = new CellRendererText ();
            // LAME: Why is this property a float instead of a double ?
            renderer.Xalign = 0.5f;

            tree.AppendColumn ("Classes", new CellRendererText (), "text", 0);
            tree.AppendColumn ("Lines Hit", renderer, "text", 1);
            tree.AppendColumn ("Lines Missed", renderer, "text", 2);
            tree.AppendColumn ("Coverage", coverageRenderer, "text", 3);

            tree.GetColumn (0).Resizable = true;
            tree.GetColumn (1).Alignment = 0.0f;
            tree.GetColumn (1).Resizable = true;
            tree.GetColumn (2).Alignment = 0.0f;
            tree.GetColumn (2).Resizable = true;
            tree.GetColumn (3).Alignment = 0.0f;
            tree.GetColumn (3).Resizable = true;
            tree.GetColumn (3).SetCellDataFunc (coverageRenderer, new TreeCellDataFunc (RenderCoverage));

            tree.HeadersVisible = true;

            model = new CoverageModel ();
            foreach (string filter in DEFAULT_FILTERS) {
                model.AddFilter (filter);
            }
            this.status = status;
            model.Progress += Progress;
            model.ReadFromFile (fileName);

            TreeItem root = new TreeItem (store, null, model, "PROJECT");

            Hashtable classes2 = model.Classes;

            namespaces = new Hashtable ();
            string[] sorted_names = new string[classes2.Count];
            classes2.Keys.CopyTo (sorted_names, 0);
            Array.Sort (sorted_names);
            Progress ("Building tree", 0.95);
            foreach (string name in sorted_names) {
                ClassCoverageItem klass = (ClassCoverageItem)classes2[name];

                if (klass.filtered)
                    continue;

                string namespace2 = klass.name_space;
                TreeItem nsItem = (TreeItem)namespaces[namespace2];
                if (nsItem == null) {
                    nsItem = new TreeItem (store, root, (CoverageItem)model.Namespaces[namespace2], namespace2);
                    //				nsItem.SetPixmap (0, namespaceOpenPixmap);
                    namespaces[namespace2] = nsItem;
                }

                if (nsItem.model.filtered)
                    continue;

                ClassItem classItem = new ClassItem (store, nsItem, klass, klass.name);

                if (klass.ChildCount != 0) {
                    TreeIter treeIter = store.AppendNode (classItem.iter);
                    store.SetValues (treeIter, "<loading>");
                }
            }

            tree.ExpandRow (store.GetPath (root.Iter), false);

            // it becomes very hard to navigate if everything is expanded
            //foreach (string ns in namespaces.Keys)
            //	tree.ExpandRow (store.GetPath (((TreeItem)namespaces [ns]).Iter), false);

            tree.RowExpanded += new RowExpandedHandler (OnRowExpanded);
            tree.RowCollapsed += new RowCollapsedHandler (OnRowCollapsed);
            tree.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPress);
            tree.Selection.Mode = SelectionMode.Single;

            Progress ("Done", 1.0);
            // LAME: Why doesn't widgets visible by default ???
            tree.Show ();
        }