Esempio n. 1
0
        public TestResultsPad()
        {
            testService.TestSuiteChanged         += new EventHandler(OnTestSuiteChanged);
            IdeApp.Workspace.WorkspaceItemClosed += OnWorkspaceItemClosed;

            panel = new VBox();

            // Results notebook

            book = new HPaned();
            panel.PackStart(book, true, true, 0);
            panel.FocusChain = new Gtk.Widget [] { book };

            // Failures tree
            failuresTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView();
            failuresTreeView.HeadersVisible = false;
            failuresStore = new TreeStore(typeof(Xwt.Drawing.Image), typeof(string), typeof(object), typeof(string), typeof(int), typeof(int));
            var pr = new CellRendererImage();
            CellRendererText tr  = new CellRendererText();
            TreeViewColumn   col = new TreeViewColumn();

            col.PackStart(pr, false);
            col.AddAttribute(pr, "image", 0);
            col.PackStart(tr, false);
            col.AddAttribute(tr, "markup", 1);
            failuresTreeView.AppendColumn(col);
            failuresTreeView.Model = failuresStore;

            var sw = new MonoDevelop.Components.CompactScrolledWindow();

            sw.ShadowType = ShadowType.None;
            sw.Add(failuresTreeView);
            book.Pack1(sw, true, true);

            outputView = new MonoDevelop.Ide.Gui.Components.LogView.LogTextView();
            outputView.ModifyFont(FontService.MonospaceFont);
            outputView.Editable = false;
            bold        = new TextTag("bold");
            bold.Weight = Pango.Weight.Bold;
            outputView.Buffer.TagTable.Add(bold);
            sw            = new MonoDevelop.Components.CompactScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(outputView);
            book.Pack2(sw, true, true);
            outputViewScrolled = sw;

            failuresTreeView.RowActivated      += OnRowActivated;
            failuresTreeView.Selection.Changed += OnRowSelected;
            failuresTreeView.DoPopupMenu        = delegate(EventButton evt) {
                IdeApp.CommandService.ShowContextMenu(failuresTreeView, evt,
                                                      "/MonoDevelop/NUnit/ContextMenu/TestResultsPad");
            };

            Control.ShowAll();

            outputViewScrolled.Hide();
        }
		public AddAddinReferenceDialog (Addin[] allAddins)
		{
			if (allAddins == null || allAddins.Length == 0)
				throw new ArgumentException ();

			Title = GettextCatalog.GetString ("Add Addin Reference");
			DestroyWithParent = true;
			Modal = true;
			HasSeparator = false;
			WidthRequest = 400;
			HeightRequest = 400;
			AllowShrink = false;
			Resizable = true;

			AddActionWidget (new Button (Stock.Cancel), ResponseType.Cancel);
			AddActionWidget (addButton, ResponseType.Ok);

			treeView.HeadersVisible = false;
			treeView.Model = store;

			var column = new TreeViewColumn ();
			var toggleRenderer = new CellRendererToggle ();
			column.PackStart (toggleRenderer, false);
			column.SetCellDataFunc (toggleRenderer, ToggleCellDataFunc);

			toggleRenderer.Toggled += HandleToggled;

			var textRenderer = new CellRendererText ();
			column.PackStart (textRenderer, true);
			column.SetCellDataFunc (textRenderer, TextCellDataFunc);

			treeView.AppendColumn (column);
			var sw = new CompactScrolledWindow {
				Child = treeView
			};
			VBox.PackStart (sw);

			foreach (var addin in allAddins.OrderBy (a => a.Id)) {
				store.AppendValues (addin, false);
			}

			addButton.Sensitive = false;

			ShowAll ();
		}
Esempio n. 3
0
        Gtk.Widget IOutlinedDocument.GetOutlineWidget()
        {
            if (outlineTreeView != null)
            {
                return(outlineTreeView);
            }

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

            System.Reflection.PropertyInfo prop = typeof(Gtk.TreeView).GetProperty("EnableTreeLines");
            if (prop != null)
            {
                prop.SetValue(outlineTreeView, true, null);
            }

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

            InitializeOutlineColumns(outlineTreeView);

            outlineTreeView.HeadersVisible = false;

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

            refillOutlineStore();

            var sw = new MonoDevelop.Components.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);
			
			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;
		}
Esempio n. 5
0
		public TestResultsPad ()
		{
			testService.TestSuiteChanged += new EventHandler (OnTestSuiteChanged);
			
			panel = new VBox ();
			
			// Results notebook
			
			book = new HPaned ();
			panel.PackStart (book, true, true, 0);
			panel.FocusChain = new Gtk.Widget [] { book };
			
			// Failures tree
			failuresTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView ();
			failuresTreeView.HeadersVisible = false;
			failuresStore = new TreeStore (typeof(Xwt.Drawing.Image), typeof(string), typeof(object), typeof(string), typeof(int));
			var pr = new CellRendererImage ();
			CellRendererText tr = new CellRendererText ();
			TreeViewColumn col = new TreeViewColumn ();
			col.PackStart (pr, false);
			col.AddAttribute (pr, "image", 0);
			col.PackStart (tr, false);
			col.AddAttribute (tr, "markup", 1);
			failuresTreeView.AppendColumn (col);
			failuresTreeView.Model = failuresStore;
		
			var sw = new MonoDevelop.Components.CompactScrolledWindow ();
			sw.ShadowType = ShadowType.None;
			sw.Add (failuresTreeView);
			book.Pack1 (sw, true, true);
			
			outputView = new MonoDevelop.Ide.Gui.Components.LogView.LogTextView ();
			outputView.Editable = false;
			bold = new TextTag ("bold");
			bold.Weight = Pango.Weight.Bold;
			outputView.Buffer.TagTable.Add (bold);
			sw = new MonoDevelop.Components.CompactScrolledWindow ();
			sw.ShadowType = ShadowType.None;
			sw.Add (outputView);
			book.Pack2 (sw, true, true);
			outputViewScrolled = sw;
			
			failuresTreeView.RowActivated += OnRowActivated;
			failuresTreeView.Selection.Changed += OnRowSelected;
			failuresTreeView.DoPopupMenu = delegate (EventButton evt) {
				IdeApp.CommandService.ShowContextMenu (failuresTreeView, evt,
					"/MonoDevelop/NUnit/ContextMenu/TestResultsPad");
			};
			
			Control.ShowAll ();
			
			outputViewScrolled.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;
		}
		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 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 {
				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;
		}
		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;
		}
		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 = true,
				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 = true;
			textColumn.FixedWidth = 300;

			
			TreeViewColumn pathColumn = treeviewSearchResults.AppendColumn (GettextCatalog.GetString ("Path"),
				treeviewSearchResults.TextRenderer, ResultPathDataFunc);
			pathColumn.SortColumnId = 3;
			pathColumn.Resizable = true;
			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 ();
		}
		Widget IOutlinedDocument.GetOutlineWidget ()
		{
			if (outlineTreeView != null)
				return outlineTreeView;

			outlineTreeStore = new TreeStore (typeof(object));
			outlineTreeModelSort = new TreeModelSort (outlineTreeStore);
			
			settings = OutlineSettings.Load ();
			comparer = new OutlineNodeComparer (new AstAmbience (TypeSystemService.Workspace.Options), 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);
			};

			var analysisDocument = DocumentContext.ParsedDocument;
			if (analysisDocument != null)
				lastCU = analysisDocument.GetAst<SemanticModel> ();

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

			var sw = new CompactScrolledWindow ();
			sw.Add (outlineTreeView);
			sw.ShowAll ();
			return sw;
		}
Esempio n. 11
0
		public TestResultsPad ()
		{
			UnitTestService.TestSuiteChanged += new EventHandler (OnTestSuiteChanged);
			IdeApp.Workspace.WorkspaceItemClosed += OnWorkspaceItemClosed;

			panel = new VBox { Name = "testResultBox" };
			
			// Results notebook
			
			book = new HPaned ();
			panel.PackStart (book, true, true, 0);
			panel.FocusChain = new Gtk.Widget [] { book };

			// Failures tree
			failuresTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView { Name = "testResultsTree" };
			failuresTreeView.HeadersVisible = false;
			failuresStore = new TreeStore (typeof(Xwt.Drawing.Image), typeof(string), typeof(object), typeof(string), typeof(int), typeof(int));
			SemanticModelAttribute modelAttr = new SemanticModelAttribute ("store__Image", "store__Message","store__RootTest",
				"store__FileName", "store__FileNumber", "store__ErrorOrStackTrace");
			TypeDescriptor.AddAttributes (failuresStore, modelAttr);
			
			var pr = new CellRendererImage ();
			CellRendererText tr = new CellRendererText ();
			TreeViewColumn col = new TreeViewColumn ();
			col.PackStart (pr, false);
			col.AddAttribute (pr, "image", 0);
			col.PackStart (tr, false);
			col.AddAttribute (tr, "markup", 1);
			failuresTreeView.AppendColumn (col);
			failuresTreeView.Model = failuresStore;
		
			var sw = new MonoDevelop.Components.CompactScrolledWindow ();
			sw.ShadowType = ShadowType.None;
			sw.Add (failuresTreeView);
			book.Pack1 (sw, true, true);

			outputView = new MonoDevelop.Ide.Gui.Components.LogView.LogTextView { Name = "testResultOutput" };
			outputView.ModifyFont (FontService.MonospaceFont);
			outputView.Editable = false;
			bold = new TextTag ("bold");
			bold.Weight = Pango.Weight.Bold;
			outputView.Buffer.TagTable.Add (bold);
			sw = new MonoDevelop.Components.CompactScrolledWindow ();
			sw.ShadowType = ShadowType.None;
			sw.Add (outputView);
			book.Pack2 (sw, true, true);
			outputViewScrolled = sw;
			
			failuresTreeView.RowActivated += OnRowActivated;
			failuresTreeView.Selection.Changed += OnRowSelected;
			failuresTreeView.DoPopupMenu = delegate (EventButton evt) {
				IdeApp.CommandService.ShowContextMenu (failuresTreeView, evt,
					"/MonoDevelop/UnitTesting/ContextMenu/TestResultsPad");
			};
			
			panel.ShowAll ();
			
			outputViewScrolled.Hide ();
		}
Esempio n. 12
0
        public Gtk.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 = true;
            TreeView.TextRenderer.Edited += new EditedHandler(nameCell_Edited);

            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 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;
		}
		public AssemblyBrowserWidget ()
		{
			this.Build ();

			buttonBack = new Gtk.Button (new Gtk.Image (ImageService.GetPixbuf ("md-breadcrumb-prev")));
			buttonBack.Clicked += OnNavigateBackwardActionActivated;

			buttonForeward = new Gtk.Button (new Gtk.Image (ImageService.GetPixbuf ("md-breadcrumb-next")));
			buttonForeward.Clicked += OnNavigateForwardActionActivated;

			comboboxVisibilty = ComboBox.NewText ();
			comboboxVisibilty.InsertText (0, GettextCatalog.GetString ("Only public members"));
			comboboxVisibilty.InsertText (1, GettextCatalog.GetString ("All members"));
			comboboxVisibilty.Active = 0;
			comboboxVisibilty.Changed += delegate {
				TreeView.PublicApiOnly = comboboxVisibilty.Active == 0;
				FillInspectLabel ();
			};

			searchentry1 = new MonoDevelop.Components.SearchEntry ();
			searchentry1.Ready = true;
			searchentry1.HasFrame = true;
			searchentry1.WidthRequest = 200;
			searchentry1.Visible = true;
			searchentry1.EmptyMessage = GettextCatalog.GetString ("Search for types or members");
			searchentry1.InnerEntry.Changed += SearchEntryhandleChanged;

			CheckMenuItem checkMenuItem = this.searchentry1.AddFilterOption (0, GettextCatalog.GetString ("Types"));
			checkMenuItem.Active = true;
			checkMenuItem.Toggled += delegate {
				if (checkMenuItem.Active) {
					searchMode = AssemblyBrowserWidget.SearchMode.Type;
					CreateColumns ();
					StartSearch ();
				}
			};
			
			CheckMenuItem checkMenuItem1 = this.searchentry1.AddFilterOption (1, GettextCatalog.GetString ("Members"));
			checkMenuItem1.Toggled += delegate {
				if (checkMenuItem1.Active) {
					searchMode = AssemblyBrowserWidget.SearchMode.Member;
					CreateColumns ();
					StartSearch ();
				}
			};

			languageCombobox = Gtk.ComboBox.NewText ();
			languageCombobox.AppendText (GettextCatalog.GetString ("Summary"));
			languageCombobox.AppendText (GettextCatalog.GetString ("IL"));
			languageCombobox.AppendText (GettextCatalog.GetString ("C#"));
			languageCombobox.Active = PropertyService.Get ("AssemblyBrowser.InspectLanguage", 2);
			languageCombobox.Changed += LanguageComboboxhandleChanged;

			loader = new CecilLoader (true);
			loader.IncludeInternalMembers = true;
			TreeView = new AssemblyBrowserTreeView (new NodeBuilder[] { 
				new ErrorNodeBuilder (),
				new ProjectNodeBuilder (this),
				new AssemblyNodeBuilder (this),
				new ModuleReferenceNodeBuilder (),
				new AssemblyReferenceNodeBuilder (this),
				new AssemblyReferenceFolderNodeBuilder (this),
				new AssemblyResourceFolderNodeBuilder (),
				new ResourceNodeBuilder (),
				new NamespaceBuilder (this),
				new DomTypeNodeBuilder (this),
				new DomMethodNodeBuilder (this),
				new DomFieldNodeBuilder (this),
				new DomEventNodeBuilder (this),
				new DomPropertyNodeBuilder (this),
				new BaseTypeFolderNodeBuilder (this),
				new BaseTypeNodeBuilder (this)
				}, new TreePadOption [0]);
			TreeView.Tree.Selection.Mode = Gtk.SelectionMode.Single;
			TreeView.Tree.CursorChanged += HandleCursorChanged;
			TreeView.ShadowType = ShadowType.None;
			TreeView.BorderWidth = 1;
			TreeView.ShowBorderLine = false;
			TreeView.Zoom = 1.0;
			treeViewPlaceholder.Add (TreeView);
			treeViewPlaceholder.ShowAll ();
			
//			this.descriptionLabel.ModifyFont (Pango.FontDescription.FromString ("Sans 9"));
//			this.documentationLabel.ModifyFont (Pango.FontDescription.FromString ("Sans 12"));
//			this.documentationLabel.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255, 255, 225));
//			this.documentationLabel.Wrap = true;
			
			var options = new MonoDevelop.Ide.Gui.CommonTextEditorOptions () {
				ShowFoldMargin = false,
				ShowIconMargin = false,
				ShowLineNumberMargin = false,
				HighlightCaretLine = true,
			};
			inspectEditor = new TextEditor (new TextDocument (), options);
			inspectEditor.ButtonPressEvent += HandleInspectEditorButtonPressEvent;
			
			this.inspectEditor.Document.ReadOnly = true;
//			this.inspectEditor.Document.SyntaxMode = new Mono.TextEditor.Highlighting.MarkupSyntaxMode ();
			this.inspectEditor.TextViewMargin.GetLink = delegate(Mono.TextEditor.MarginMouseEventArgs arg) {
				var loc = inspectEditor.PointToLocation (arg.X, arg.Y);
				int offset = inspectEditor.LocationToOffset (loc);
				var referencedSegment = ReferencedSegments != null ? ReferencedSegments.FirstOrDefault (seg => seg.Segment.Contains (offset)) : null;
				if (referencedSegment == null)
					return null;
				if (referencedSegment.Reference is TypeDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((TypeDefinition)referencedSegment.Reference);
				
				if (referencedSegment.Reference is MethodDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((MethodDefinition)referencedSegment.Reference);
				
				if (referencedSegment.Reference is PropertyDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((PropertyDefinition)referencedSegment.Reference);
				
				if (referencedSegment.Reference is FieldDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((FieldDefinition)referencedSegment.Reference);
				
				if (referencedSegment.Reference is EventDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((EventDefinition)referencedSegment.Reference);
				
				if (referencedSegment.Reference is FieldDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((FieldDefinition)referencedSegment.Reference);

				if (referencedSegment.Reference is TypeReference) {
					return new XmlDocIdGenerator ().GetXmlDocPath ((TypeReference)referencedSegment.Reference);
				}
				return referencedSegment.Reference.ToString ();
			};
			this.inspectEditor.LinkRequest += InspectEditorhandleLinkRequest;
			var scrolledWindow = new CompactScrolledWindow ();
			scrolledWindow.Add (inspectEditor);
			scrolledWindow.ShowAll ();
			notebookInspection.Add (scrolledWindow);
			var notebookChild = ((Notebook.NotebookChild)(notebookInspection [scrolledWindow]));
			notebookChild.Position = 1;

//			this.inspectLabel.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255, 255, 250));
			
//			this.vpaned1.ExposeEvent += VPaneExpose;
			this.hpaned1.ExposeEvent += HPaneExpose;
			hpaned1 = hpaned1.ReplaceWithWidget (new HPanedThin (), true);
			hpaned1.Position = 271;

/*			this.notebook1.SwitchPage += delegate {
				// Hack for the switch page select all bug.
//				this.inspectLabel.Selectable = false;
			};*/

			/*
			this.searchInCombobox.Active = 0;
			this.searchInCombobox.Changed += SearchInComboboxhandleChanged;
			*/
			this.notebook1.SetTabLabel (this.documentationScrolledWindow, new Label (GettextCatalog.GetString ("Documentation")));
			this.notebook1.SetTabLabel (this.notebookInspection, new Label (GettextCatalog.GetString ("Inspect")));
			this.notebook1.SetTabLabel (this.searchWidget, new Label (GettextCatalog.GetString ("Search")));
			//this.searchWidget.Visible = false;
				
			typeListStore = new Gtk.ListStore (typeof(Gdk.Pixbuf), // type image
			                                   typeof(string), // name
			                                   typeof(string), // namespace
			                                   typeof(string), // assembly
				                               typeof(IMember)
			                                  );
			
			memberListStore = new Gtk.ListStore (typeof(Gdk.Pixbuf), // member image
			                                   typeof(string), // name
			                                   typeof(string), // Declaring type full name
			                                   typeof(string), // assembly
				                               typeof(IMember)
			                                  );
			CreateColumns ();
			SetInspectWidget ();
//			this.searchEntry.Changed += SearchEntryhandleChanged;
			this.searchTreeview.RowActivated += SearchTreeviewhandleRowActivated;
			this.notebook1.ShowTabs = false;
			this.notebookInspection.ShowTabs = false;
			this.ShowAll ();
		}
		Widget MonoDevelop.DesignerSupport.IOutlinedDocument.GetOutlineWidget ()
		{
			if (outlineTreeView != null)
				return outlineTreeView;

			outlineTreeStore = new TreeStore (typeof(object));

			// Initialize sorted tree model

			outlineTreeModelSort = new TreeModelSort (outlineTreeStore);

			sortingProperties = PropertyService.Get (
				ClassOutlineSortingProperties.SORTING_PROPERTY_NAME,
				ClassOutlineSortingProperties.GetDefaultInstance ());

			comparer = new ClassOutlineNodeComparer (GetAmbience (), sortingProperties, outlineTreeModelSort);

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

			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 {
				JumpToDeclaration (false);
			};
			
			outlineTreeView.RowActivated += delegate {
				JumpToDeclaration (true);
			};

			this.lastCU = Document.ParsedDocument;

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

			// Register for property changes (e.g. preferences dialog)

			sortingProperties.EventSortingPropertiesChanged += OnSortingPropertiesChanged;

			UpdateSorting ();

			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;
        }