Ejemplo n.º 1
0
 /// <summary>
 /// Removes all grid columns, and cleans up any associated event handlers
 /// </summary>
 private void ClearGridColumns()
 {
     while (gridview.Columns.Length > 0)
     {
         TreeViewColumn col = gridview.GetColumn(0);
         foreach (CellRenderer render in col.CellRenderers)
         {
             if (render is CellRendererText)
             {
                 CellRendererText textRender = render as CellRendererText;
                 col.SetCellDataFunc(textRender, (CellLayoutDataFunc)null);
             }
             else if (render is CellRendererPixbuf)
             {
                 CellRendererPixbuf pixRender = render as CellRendererPixbuf;
                 col.SetCellDataFunc(pixRender, (CellLayoutDataFunc)null);
             }
             render.Destroy();
         }
         gridview.RemoveColumn(gridview.GetColumn(0));
     }
     while (fixedcolview.Columns.Length > 0)
     {
         TreeViewColumn col = fixedcolview.GetColumn(0);
         foreach (CellRenderer render in col.CellRenderers)
         {
             if (render is CellRendererText)
             {
                 CellRendererText textRender = render as CellRendererText;
                 col.SetCellDataFunc(textRender, (CellLayoutDataFunc)null);
             }
         }
         fixedcolview.RemoveColumn(fixedcolview.GetColumn(0));
     }
 }
Ejemplo n.º 2
0
        /// <summary>Puts the current node into edit mode so user can rename it.</summary>
        public void BeginRenamingCurrentNode()
        {
            textRender.Editable = true;
            TreePath       selPath;
            TreeViewColumn selCol;

            treeview1.GetCursor(out selPath, out selCol);
            treeview1.GrabFocus();
            treeview1.SetCursor(selPath, treeview1.GetColumn(0), true);
        }
Ejemplo n.º 3
0
        public void SetupHeights(DateTime[] dates, double[] heights, double[] NDemands, double[] CanopyWidths, double[] TreeLeafAreas)
        {
            while (treeview1.Columns.Length > 0)
            {
                TreeViewColumn col = treeview1.GetColumn(0);
                foreach (CellRenderer render in col.CellRenderers)
                {
                    if (render is CellRendererText)
                    {
                        CellRendererText textRender = render as CellRendererText;
                        textRender.Edited -= HeightCellEdited;
                    }
                }
                treeview1.RemoveColumn(treeview1.GetColumn(0));
            }
            string[] colLabels = new string[] { "Date", "Height (m)", "N Demands (g/m2)", "Canopy Width (m)", "Tree Leaf Area (m2)" };
            // Begin by creating a new ListStore with the appropriate number of
            // columns. Use the string column type for everything.
            Type[] colTypes = new Type[5];
            for (int i = 0; i < 5; i++)
            {
                colTypes[i] = typeof(string);
                CellRendererText textRender = new Gtk.CellRendererText();

                textRender.Editable = true;
                textRender.Edited  += HeightCellEdited;
                textRender.Xalign   = i == 0 ? 0.0f : 1.0f; // For right alignment of text cell contents; left align the first column

                TreeViewColumn column = new TreeViewColumn(colLabels[i], textRender, "text", i);
                column.Sizing    = TreeViewColumnSizing.Autosize;
                column.Resizable = true;
                column.Alignment = 0.5f; // For centered alignment of the column header
                treeview1.AppendColumn(column);
            }
            // Add an empty column at the end; auto-sizing will give this any "leftover" space
            TreeViewColumn fillColumn = new TreeViewColumn();

            fillColumn.Sizing = TreeViewColumnSizing.Autosize;
            treeview1.AppendColumn(fillColumn);

            heightModel = new ListStore(colTypes);

            for (int i = 0; i < dates.Count(); i++)
            {
                heightModel.AppendValues(dates[i].ToShortDateString(), (heights[i] / 1000).ToString(), NDemands[i].ToString(), CanopyWidths[i].ToString(), TreeLeafAreas[i].ToString());
            }
            // Add an empty row to allow for adding new values
            heightModel.Append();
            treeview1.Model = heightModel;
        }
Ejemplo n.º 4
0
        // FIXME: When the scrollbars of the directory list
        // are shown, and we perform a new dir action
        // the column is never edited, but Populate is called
        private void OnNewDir(object o, EventArgs args)
        {
            TreeIter       iter;
            TreePath       treepath;
            TreeViewColumn column;

            performingtask       = PerformingTask.CreatingNew;
            text_render.Editable = true;

            iter     = store.AppendValues(DesktopService.GetPixbufForFile(CurrentDir, Gtk.IconSize.Menu), "folder name");
            treepath = tv.Model.GetPath(iter);

            column = tv.GetColumn(0);
            tv.SetCursor(treepath, column, true);
        }
Ejemplo n.º 5
0
        public void SetupGrid(List <List <string> > data)
        {
            while (treeview2.Columns.Length > 0)
            {
                TreeViewColumn col = treeview2.GetColumn(0);
                foreach (CellRenderer render in col.CellRenderers)
                {
                    if (render is CellRendererText)
                    {
                        CellRendererText textRender = render as CellRendererText;
                        textRender.Edited -= GridCellEdited;
                        col.SetCellDataFunc(textRender, (CellLayoutDataFunc)null);
                    }
                }
                treeview2.RemoveColumn(treeview2.GetColumn(0));
            }

            int nCols = data[0].Count;

            Type[] colTypes = new Type[nCols];
            for (int i = 0; i < nCols; i++)
            {
                colTypes[i] = typeof(string);
                CellRendererText textRender = new Gtk.CellRendererText();

                textRender.Editable = i > 0;
                textRender.Edited  += GridCellEdited;
                textRender.Xalign   = i == 0 ? 0.0f : 1.0f; // For right alignment of text cell contents; left align the first column

                TreeViewColumn column = new TreeViewColumn(data[0][i], textRender, "text", i);
                column.Sizing = TreeViewColumnSizing.Autosize;

                column.Resizable = true;
                column.Alignment = 0.5f; // For centered alignment of the column header
                column.SetCellDataFunc(textRender, OnSetGridData);
                treeview2.AppendColumn(column);
            }

            // Add an empty column at the end; auto-sizing will give this any "leftover" space
            TreeViewColumn fillColumn = new TreeViewColumn();

            fillColumn.Sizing = TreeViewColumnSizing.Autosize;
            treeview2.AppendColumn(fillColumn);

            // Now let's add some padding to the column headers, to avoid having very narrow columns
            for (int i = 0; i < nCols; i++)
            {
                Label label = GetColumnHeaderLabel(i, treeview2);
                label.Justify = Justification.Center;
                label.SetPadding(10, 0);
            }

            gridModel = new ListStore(colTypes);

            for (int i = 0; i < data[1].Count; i++)
            {
                string[] row = new string[nCols];
                for (int j = 1; j <= nCols; j++)
                {
                    row[j - 1] = data[j][i];
                }

                gridModel.AppendValues(row);
            }
            treeview2.Model = gridModel;

            table = new DataTable();

            // data[0] holds the column names
            foreach (string s in data[0])
            {
                table.Columns.Add(new DataColumn(s, typeof(string)));
            }

            for (int i = 0; i < data[1].Count; i++)
            {
                string[] row = new string[table.Columns.Count];
                for (int j = 1; j < table.Columns.Count + 1; j++)
                {
                    row[j - 1] = data[j][i];
                }
                table.Rows.Add(row);
            }
            SetupGraphs();
        }
Ejemplo n.º 6
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 ();
	}
Ejemplo n.º 7
0
    // This requires that the perl program autorestart wraps this....
    public DialBOT()
        : base("DialBOT")
    {
        SetDefaultSize(800, 600);
        SetPosition(WindowPosition.Center);
        DeleteEvent += delegate { Application.Quit(); };

        // Top level container. This vertically divides the window into 3 sections:
        // Top is the 2 windows (balls-deep items and console output
        VBox topvbox = new VBox(false, 5);

        // Lets build the top 1/3rd here.
        Frame ballsdeepframe = new Frame("Balls-Deep Items");
        Frame consoleframe = new Frame("Console Output");
        // HBox mainhbox = new HBox(true,2);

        ballsdeeptree = new TreeView();

        bdstore = new TreeStore (typeof(string), typeof (string), typeof (string), typeof (string));
        LoadBalls();
        fillStore();

        // Put the TreeStore into a TreeModelSort so we can sort columns...
        // Sort by score for now
        bdsorted = new TreeModelSort(bdstore);
        bdsorted.SetSortColumnId(1,SortType.Descending);

        // Put the TreeModelSort into a TreeModelFilter so we can implement the filtering
        filterEntry = new Entry();
        // filter = new TreeModelFilter(bdsorted,null);
        // filter.VisibleFunc = FilterTreeFunc;   // Use this as the filter function.

        // And then set the visible TreeView to use the filter as it's store.
        ballsdeeptree.Model = bdsorted;

        ballsdeeptree.HeadersVisible = true;
        ballsdeeptree.HeadersClickable=true;
        ballsdeeptree.AppendColumn ("Added By", new CellRendererText (), "text", 0);
        ballsdeeptree.AppendColumn ("Score", new CellRendererText (), "text", 1);
        CellRendererText ballRenderer = new CellRendererText();
        ballsdeeptree.AppendColumn ("Text", ballRenderer, "text", 2);
        CellRendererText voteRenderer = new CellRendererText();
        voteRenderer.Editable=true;
        voteRenderer.Edited+=editVotes;
        ballsdeeptree.AppendColumn ("Votes", voteRenderer, "text", 3);

        TreeViewColumn col = ballsdeeptree.GetColumn(0);
        col.Clickable=true;
        col.Resizable = true;
        col.Clicked += new EventHandler (col_clicked0);

        col = ballsdeeptree.GetColumn(1);
        col.Resizable = true;
        col.Clickable=true;
        col.Clicked += new EventHandler (col_clicked1);

        col = ballsdeeptree.GetColumn(2);
        col.Resizable = true;
        col.Clickable=true;
        col.Clicked += new EventHandler (col_clicked2);

        col = ballsdeeptree.GetColumn(3);
        col.Clickable=true;
        col.Resizable = true;
        col.Clicked += new EventHandler (col_clicked3);

        ScrolledWindow ballsdeepscroll = new ScrolledWindow();

        ballsdeepscroll.Add(ballsdeeptree);

        Button deleteentry = new Button("Remove Entry");
        deleteentry.SetSizeRequest(70, 30);
        deleteentry.Clicked += new EventHandler(deleteBallMsg);

        ballsdeepframe.Add(ballsdeepscroll);
        ballsdeepframe.Add(deleteentry);

        // Entry box and label to filter on message as well as an HBox to put them next to each other
        filterEntry.Changed += OnFilterEntryTextChanged;
        Label filterLabel = new Label("Ball Message Search: ");
        HBox filterBox = new HBox();
        filterBox.PackStart(filterLabel,false,false,5);
        filterBox.PackStart(filterEntry,true,true,5);

        VBox ballvbox = new VBox(false,5);
        ballvbox.Add(ballsdeepframe);
        //ballvbox.PackStart(filterBox,false,false,1);

        topvbox.Add(ballvbox);

        consoleview = new TextView();
        consolebuffer=consoleview.Buffer;
        consolebuffer.Text = consoletext;

        ScrolledWindow consolescroll = new ScrolledWindow();
        consolescroll.SetPolicy(PolicyType.Automatic,PolicyType.Always);
        consolescroll.Add(consoleview);

        consoleframe.Add(consolescroll);

        followConsole = new CheckButton("Tail Console");
        followConsole.SetSizeRequest(70,30);

        VBox consolevbox = new VBox(false,5);
        consolevbox.Add(consoleframe);
        consolevbox.PackStart(followConsole,false,false,1);

        topvbox.Add(consolevbox);

        //        topvbox.PackStart(mainhbox, true,true,4);

        // Now the 2nd 3rd. This contains 2 buttons. A start/stop, and a close.
        HBox buttonhbox = new HBox(true, 3);
        startstop = new Button("Stop");
        startstop.SetSizeRequest(70, 30);
        startstop.Clicked += new EventHandler(startstopEvent);
        Button close = new Button("Close");
        close.Clicked += new EventHandler(quitEvent);

        buttonhbox.Add(startstop);
        buttonhbox.Add(close);

        Alignment halign = new Alignment(1, 0, 0, 0);
        halign.Add(buttonhbox);

        topvbox.PackStart(halign, false, false, 3);

        // Now the bottom 3rd. A status bar
        statusbar = new Statusbar();
        statusbar.Push(1,"Hey, it's a status");
        topvbox.PackStart(statusbar,false,false,0);

        // Add our top level container to the window
        Add(topvbox);

        ShowAll();
    }
Ejemplo n.º 8
0
 private void refresh(TreeView treeView,TreeViewHelper helper)
 {
     ListStore listStore=helper.ListStore;
     int fieldCountArticulo=helper.getFieldCount();
     for (int i=0;i<fieldCountArticulo;i++){//elimina columnas
         treeView.RemoveColumn(treeView.GetColumn(0));
     }
     listStore.Clear();
     listStore=helper.ListStore;
     helper.actualizar(helper.IDbCommand,listStore);
 }
Ejemplo n.º 9
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 ();
        }