示例#1
0
        public Widget GetOutlineWidget()
        {
            if (TreeView != null)
            {
                return(TreeView);
            }

            TreeStore = new TreeStore(typeof(object));

            /*
             * settings = ClassOutlineSettings.Load();
             * comparer = new ClassOutlineNodeComparer(GetAmbience(), settings, outlineTreeModelSort);
             *
             * outlineTreeModelSort.SetSortFunc(0, comparer.CompareNodes);
             * outlineTreeModelSort.SetSortColumnId(0, SortType.Ascending);
             */
            TreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView(TreeStore);

            var pixRenderer = new CellRendererPixbuf();

            pixRenderer.Xpad = 0;
            pixRenderer.Ypad = 0;

            TreeView.TextRenderer.Xpad = 0;
            TreeView.TextRenderer.Ypad = 0;

            TreeViewColumn treeCol = new TreeViewColumn();

            treeCol.PackStart(pixRenderer, false);

            treeCol.SetCellDataFunc(pixRenderer, new TreeCellDataFunc(OutlineTreeIconFunc));
            treeCol.PackStart(TreeView.TextRenderer, true);

            treeCol.SetCellDataFunc(TreeView.TextRenderer, new TreeCellDataFunc(OutlineTreeTextFunc));
            TreeView.AppendColumn(treeCol);

            TreeView.TextRenderer.Editable = false;

            TreeView.HeadersVisible = false;

            TreeView.Selection.Changed += delegate {
                if (dontJumpToDeclaration || !outlineReady)
                {
                    return;
                }

                clickedOnOutlineItem = true;
                JumpToDeclaration(true);
                clickedOnOutlineItem = false;
            };

            TreeView.Realized += delegate { RefillOutlineStore(); };
            //UpdateSorting();

            var sw = new CompactScrolledWindow();

            sw.Add(TreeView);
            sw.ShowAll();
            return(sw);
        }
		Widget IOutlinedDocument.GetOutlineWidget ()
		{
			if (outlineTreeView != null)
				return outlineTreeView;
			
			outlineTreeStore = new TreeStore (typeof (object));
			outlineTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView (outlineTreeStore);
			
			System.Reflection.PropertyInfo prop = typeof (TreeView).GetProperty ("EnableTreeLines");
			if (prop != null)
				prop.SetValue (outlineTreeView, true, null);
			
			outlineTreeView.Realized += delegate { refillOutlineStore (); };
			
			InitializeOutlineColumns (outlineTreeView);
			
			outlineTreeView.HeadersVisible = false;
			
			outlineTreeView.Selection.Changed += delegate {
				TreeIter iter;
				if (!outlineTreeView.Selection.GetSelected (out iter))
					return;
				OutlineSelectionChanged (outlineTreeStore.GetValue (iter, 0));
			};
			
			refillOutlineStore ();
			
			var sw = new CompactScrolledWindow ();
			sw.Add (outlineTreeView);
			sw.ShowAll ();
			return sw;
		}
        Widget MonoDevelop.DesignerSupport.IOutlinedDocument.GetOutlineWidget()
        {
            if (outlineTreeView != null)
            {
                return(outlineTreeView);
            }

            outlineTreeStore     = new TreeStore(typeof(object));
            outlineTreeModelSort = new TreeModelSort(outlineTreeStore);

            settings = ClassOutlineSettings.Load();
            comparer = new ClassOutlineNodeComparer(GetAmbience(), settings, outlineTreeModelSort);

            outlineTreeModelSort.SetSortFunc(0, comparer.CompareNodes);
            outlineTreeModelSort.SetSortColumnId(0, SortType.Ascending);

            outlineTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView(outlineTreeStore);

            var pixRenderer = new CellRendererImage();

            pixRenderer.Xpad = 0;
            pixRenderer.Ypad = 0;

            outlineTreeView.TextRenderer.Xpad = 0;
            outlineTreeView.TextRenderer.Ypad = 0;

            TreeViewColumn treeCol = new TreeViewColumn();

            treeCol.PackStart(pixRenderer, false);

            treeCol.SetCellDataFunc(pixRenderer, new TreeCellDataFunc(OutlineTreeIconFunc));
            treeCol.PackStart(outlineTreeView.TextRenderer, true);

            treeCol.SetCellDataFunc(outlineTreeView.TextRenderer, new TreeCellDataFunc(OutlineTreeTextFunc));
            outlineTreeView.AppendColumn(treeCol);

            outlineTreeView.HeadersVisible = false;

            outlineTreeView.Selection.Changed += delegate {
                JumpToDeclaration(false);
            };

            outlineTreeView.RowActivated += delegate {
                JumpToDeclaration(true);
            };

            this.lastCU = Document.ParsedDocument;

            outlineTreeView.Realized += delegate { RefillOutlineStore(); };
            UpdateSorting();

            var sw = new CompactScrolledWindow();

            sw.Add(outlineTreeView);
            sw.ShowAll();
            return(sw);
        }
示例#4
0
        Widget MonoDevelop.DesignerSupport.IOutlinedDocument.GetOutlineWidget()
        {
            if (outlineTreeView != null)
            {
                return(outlineTreeView);
            }

            outlineTreeStore = new TreeStore(typeof(object));
            outlineTreeView  = new MonoDevelop.Ide.Gui.Components.PadTreeView(outlineTreeStore);

            var pixRenderer = new CellRendererPixbuf();

            pixRenderer.Xpad = 0;
            pixRenderer.Ypad = 0;

            outlineTreeView.TextRenderer.Xpad = 0;
            outlineTreeView.TextRenderer.Ypad = 0;

            TreeViewColumn treeCol = new TreeViewColumn();

            treeCol.PackStart(pixRenderer, false);

            treeCol.SetCellDataFunc(pixRenderer, new TreeCellDataFunc(OutlineTreeIconFunc));
            treeCol.PackStart(outlineTreeView.TextRenderer, true);

            treeCol.SetCellDataFunc(outlineTreeView.TextRenderer, new TreeCellDataFunc(OutlineTreeTextFunc));
            outlineTreeView.AppendColumn(treeCol);

            outlineTreeView.HeadersVisible = false;

            outlineTreeView.Selection.Changed += delegate {
                TreeIter iter;
                if (!outlineTreeView.Selection.GetSelected(out iter))
                {
                    return;
                }
                object o = outlineTreeStore.GetValue(iter, 0);

                IdeApp.ProjectOperations.JumpToDeclaration(o as INode);
            };

            this.lastCU = Document.ParsedDocument;

            outlineTreeView.Realized += delegate { RefillOutlineStore(); };

            var sw = new CompactScrolledWindow();

            sw.Add(outlineTreeView);
            sw.ShowAll();
            return(sw);
        }
        Widget IOutlinedDocument.GetOutlineWidget()
        {
            if (outlineTreeView != null)
            {
                return(outlineTreeView);
            }

            outlineTreeStore = new TreeStore(typeof(object));

            outlineTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView(outlineTreeStore);

            var pixRenderer = new CellRendererImage();

            pixRenderer.Xpad = 0;
            pixRenderer.Ypad = 0;

            outlineTreeView.TextRenderer.Xpad = 0;
            outlineTreeView.TextRenderer.Ypad = 0;

            TreeViewColumn treeCol = new TreeViewColumn();

            treeCol.PackStart(pixRenderer, false);

            treeCol.SetCellDataFunc(pixRenderer, new TreeCellDataFunc(OutlineTreeIconFunc));
            treeCol.PackStart(outlineTreeView.TextRenderer, true);

            treeCol.SetCellDataFunc(outlineTreeView.TextRenderer, new TreeCellDataFunc(OutlineTreeTextFunc));
            outlineTreeView.AppendColumn(treeCol);

            outlineTreeView.HeadersVisible = false;

            outlineTreeView.Selection.Changed += delegate {
                JumpToDeclaration(false);
            };

            outlineTreeView.RowActivated += delegate {
                JumpToDeclaration(true);
            };

            this.lastCU = Document.ParsedDocument;

            outlineTreeView.Realized += delegate { RefillOutlineStore(); };
            UpdateSorting();

            var sw = new CompactScrolledWindow();

            sw.Add(outlineTreeView);
            sw.ShowAll();
            return(sw);
        }
示例#6
0
        public SearchResultWidget()
        {
            var vbox    = new VBox();
            var toolbar = new Toolbar()
            {
                Orientation  = Orientation.Vertical,
                IconSize     = IconSize.Menu,
                ToolbarStyle = ToolbarStyle.Icons,
            };

            this.PackStart(vbox, true, true, 0);
            this.PackStart(toolbar, false, false, 0);
            labelStatus = new Label()
            {
                Xalign  = 0,
                Justify = Justification.Left,
            };
            var hpaned = new HPaned();

            vbox.PackStart(hpaned, true, true, 0);
            vbox.PackStart(labelStatus, false, false, 0);
            var resultsScroll = new CompactScrolledWindow();

            hpaned.Pack1(resultsScroll, true, true);
            scrolledwindowLogView = new CompactScrolledWindow();
            hpaned.Pack2(scrolledwindowLogView, true, true);
            textviewLog = new TextView()
            {
                Editable = false,
            };
            scrolledwindowLogView.Add(textviewLog);

            store = new ListStore(typeof(SearchResult),
                                  typeof(bool) // didRead
                                  );

            treeviewSearchResults = new PadTreeView()
            {
                Model            = store,
                HeadersClickable = true,
                RulesHint        = true,
            };
            treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple;
            resultsScroll.Add(treeviewSearchResults);

            this.ShowAll();

            var fileNameColumn = new TreeViewColumn {
                Resizable    = false,
                SortColumnId = 0,
                Title        = GettextCatalog.GetString("File")
            };

            fileNameColumn.FixedWidth = 200;

            var fileNamePixbufRenderer = new CellRendererPixbuf();

            fileNameColumn.PackStart(fileNamePixbufRenderer, false);
            fileNameColumn.SetCellDataFunc(fileNamePixbufRenderer, FileIconDataFunc);

            fileNameColumn.PackStart(treeviewSearchResults.TextRenderer, true);
            fileNameColumn.SetCellDataFunc(treeviewSearchResults.TextRenderer, FileNameDataFunc);
            treeviewSearchResults.AppendColumn(fileNameColumn);

//			TreeViewColumn lineColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Line"), new CellRendererText (), ResultLineDataFunc);
//			lineColumn.SortColumnId = 1;
//			lineColumn.FixedWidth = 50;
//

            TreeViewColumn textColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Text"),
                                                                           treeviewSearchResults.TextRenderer, ResultTextDataFunc);

            textColumn.SortColumnId = 2;
            textColumn.Resizable    = false;
            textColumn.FixedWidth   = 300;


            TreeViewColumn pathColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Path"),
                                                                           treeviewSearchResults.TextRenderer, ResultPathDataFunc);

            pathColumn.SortColumnId = 3;
            pathColumn.Resizable    = false;
            pathColumn.FixedWidth   = 500;


            store.SetSortFunc(0, CompareFileNames);
//			store.SetSortFunc (1, CompareLineNumbers);
            store.SetSortFunc(3, CompareFilePaths);

            treeviewSearchResults.RowActivated += TreeviewSearchResultsRowActivated;

            buttonStop = new ToolButton(Stock.Stop)
            {
                Sensitive = false
            };

            buttonStop.Clicked += ButtonStopClicked;

            buttonStop.TooltipText = GettextCatalog.GetString("Stop");
            toolbar.Insert(buttonStop, -1);

            var buttonClear = new ToolButton(Gtk.Stock.Clear);

            buttonClear.Clicked    += ButtonClearClicked;
            buttonClear.TooltipText = GettextCatalog.GetString("Clear results");
            toolbar.Insert(buttonClear, -1);

            var buttonOutput = new ToggleToolButton(Gui.Stock.OutputIcon);

            buttonOutput.Clicked    += ButtonOutputClicked;
            buttonOutput.TooltipText = GettextCatalog.GetString("Show output");
            toolbar.Insert(buttonOutput, -1);

            buttonPin             = new ToggleToolButton(Gui.Stock.PinUp);
            buttonPin.Clicked    += ButtonPinClicked;
            buttonPin.TooltipText = GettextCatalog.GetString("Pin results pad");
            toolbar.Insert(buttonPin, -1);

            store.SetSortColumnId(3, SortType.Ascending);
            ShowAll();

            scrolledwindowLogView.Hide();
        }
        public SearchResultWidget()
        {
            var vbox    = new VBox();
            var toolbar = new Toolbar()
            {
                Orientation  = Orientation.Vertical,
                IconSize     = IconSize.Menu,
                ToolbarStyle = ToolbarStyle.Icons,
            };

            this.PackStart(vbox, true, true, 0);
            this.PackStart(toolbar, false, false, 0);
            labelStatus = new Label()
            {
                Xalign  = 0,
                Justify = Justification.Left,
            };
            var hpaned = new HPaned();

            vbox.PackStart(hpaned, true, true, 0);
            vbox.PackStart(labelStatus, false, false, 0);
            var resultsScroll = new CompactScrolledWindow();

            hpaned.Pack1(resultsScroll, true, true);
            scrolledwindowLogView = new CompactScrolledWindow();
            hpaned.Pack2(scrolledwindowLogView, true, true);
            textviewLog = new TextView()
            {
                Editable = false,
            };
            scrolledwindowLogView.Add(textviewLog);

            store = new ListStore(typeof(SearchResult),
                                  typeof(bool) // didRead
                                  );

            treeviewSearchResults = new PadTreeView()
            {
                Model            = store,
                HeadersClickable = true,
                RulesHint        = true,
            };

            treeviewSearchResults.Selection.Mode = Gtk.SelectionMode.Multiple;
            resultsScroll.Add(treeviewSearchResults);

            var projectColumn = new TreeViewColumn {
                Resizable    = true,
                SortColumnId = 1,
                Title        = GettextCatalog.GetString("Project"),
                Sizing       = TreeViewColumnSizing.Fixed,
                FixedWidth   = 100
            };

            var projectPixbufRenderer = new CellRendererImage();

            projectColumn.PackStart(projectPixbufRenderer, false);
            projectColumn.SetCellDataFunc(projectPixbufRenderer, ResultProjectIconDataFunc);

            var renderer = treeviewSearchResults.TextRenderer;

            renderer.Ellipsize = Pango.EllipsizeMode.End;
            projectColumn.PackStart(renderer, true);
            projectColumn.SetCellDataFunc(renderer, ResultProjectDataFunc);
            treeviewSearchResults.AppendColumn(projectColumn);

            var fileNameColumn = new TreeViewColumn {
                Resizable    = true,
                SortColumnId = 2,
                Title        = GettextCatalog.GetString("File"),
                Sizing       = TreeViewColumnSizing.Fixed,
                FixedWidth   = 200
            };

            var fileNamePixbufRenderer = new CellRendererImage();

            fileNameColumn.PackStart(fileNamePixbufRenderer, false);
            fileNameColumn.SetCellDataFunc(fileNamePixbufRenderer, FileIconDataFunc);

            fileNameColumn.PackStart(renderer, true);
            fileNameColumn.SetCellDataFunc(renderer, FileNameDataFunc);
            treeviewSearchResults.AppendColumn(fileNameColumn);


            TreeViewColumn textColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Text"),
                                                                           renderer, ResultTextDataFunc);

            textColumn.Resizable  = true;
            textColumn.Sizing     = TreeViewColumnSizing.Fixed;
            textColumn.FixedWidth = 300;

            pathColumn = treeviewSearchResults.AppendColumn(GettextCatalog.GetString("Path"),
                                                            renderer, ResultPathDataFunc);
            pathColumn.SortColumnId = 3;
            pathColumn.Resizable    = true;
            pathColumn.Sizing       = TreeViewColumnSizing.Fixed;
            pathColumn.FixedWidth   = 500;

            store.DefaultSortFunc = DefaultSortFunc;
            store.SetSortFunc(1, CompareProjectFileNames);
            store.SetSortFunc(2, CompareFileNames);
            store.SetSortFunc(3, CompareFilePaths);

            treeviewSearchResults.RowActivated += TreeviewSearchResultsRowActivated;

            buttonStop = new ToolButton(new ImageView(Gui.Stock.Stop, Gtk.IconSize.Menu), null)
            {
                Sensitive = false
            };
            buttonStop.Clicked    += ButtonStopClicked;
            buttonStop.TooltipText = GettextCatalog.GetString("Stop");
            toolbar.Insert(buttonStop, -1);

            var buttonClear = new ToolButton(new ImageView(Gui.Stock.Clear, Gtk.IconSize.Menu), null);

            buttonClear.Clicked    += ButtonClearClicked;
            buttonClear.TooltipText = GettextCatalog.GetString("Clear results");
            toolbar.Insert(buttonClear, -1);

            var buttonOutput = new ToggleToolButton();

            buttonOutput.IconWidget  = new ImageView(Gui.Stock.OutputIcon, Gtk.IconSize.Menu);
            buttonOutput.Clicked    += ButtonOutputClicked;
            buttonOutput.TooltipText = GettextCatalog.GetString("Show output");
            toolbar.Insert(buttonOutput, -1);

            buttonPin             = new ToggleToolButton();
            buttonPin.IconWidget  = new ImageView(Gui.Stock.PinUp, Gtk.IconSize.Menu);
            buttonPin.Clicked    += ButtonPinClicked;
            buttonPin.TooltipText = GettextCatalog.GetString("Pin results pad");
            toolbar.Insert(buttonPin, -1);

            // store.SetSortColumnId (3, SortType.Ascending);
            ShowAll();

            scrolledwindowLogView.Hide();
            treeviewSearchResults.FixedHeightMode = true;

            UpdateStyles();
            IdeApp.Preferences.ColorScheme.Changed += UpdateStyles;
        }
示例#8
0
        Widget MonoDevelop.DesignerSupport.IOutlinedDocument.GetOutlineWidget()
        {
            if (outlineTreeView != null)
            {
                return(outlineTreeView);
            }

            outlineTreeStore = new TreeStore(typeof(object));
            outlineTreeView  = new MonoDevelop.Ide.Gui.Components.PadTreeView(outlineTreeStore);

            var pixRenderer = new CellRendererPixbuf();

            pixRenderer.Xpad = 0;
            pixRenderer.Ypad = 0;

            outlineTreeView.TextRenderer.Xpad = 0;
            outlineTreeView.TextRenderer.Ypad = 0;

            TreeViewColumn treeCol = new TreeViewColumn();

            treeCol.PackStart(pixRenderer, false);

            treeCol.SetCellDataFunc(pixRenderer, new TreeCellDataFunc(OutlineTreeIconFunc));
            treeCol.PackStart(outlineTreeView.TextRenderer, true);

            treeCol.SetCellDataFunc(outlineTreeView.TextRenderer, new TreeCellDataFunc(OutlineTreeTextFunc));
            outlineTreeView.AppendColumn(treeCol);

            outlineTreeView.HeadersVisible = false;

            outlineTreeView.Selection.Changed += delegate {
                TreeIter iter;
                if (!outlineTreeView.Selection.GetSelected(out iter))
                {
                    return;
                }
                object o = outlineTreeStore.GetValue(iter, 0);
                int    line = -1, col = -1;
                if (o is IType)
                {
                    line = ((IType)o).BodyRegion.Start.Line;
                    col  = ((IType)o).BodyRegion.Start.Column;
                }
                else if (o is IMember)
                {
                    line = ((IMember)o).BodyRegion.Start.Line;
                    col  = ((IMember)o).BodyRegion.Start.Column;
                }
                if (line > -1)
                {
                    Editor.JumpTo(line, Math.Max(1, col));
                }
            };

            this.lastCU = Document.ParsedDocument;

            outlineTreeView.Realized += delegate { RefillOutlineStore(); };

            var sw = new CompactScrolledWindow();

            sw.Add(outlineTreeView);
            sw.ShowAll();
            return(sw);
        }