public PinnedWatchWidget (TextEditorContainer container, PinnedWatch watch)
		{
			this.container = container;
			this.watch = watch;
			this.objectValue = watch.Value;
			valueTree = new ObjectValueTreeView ();
			valueTree.AllowAdding = false;
			valueTree.AllowEditing = true;
			valueTree.AllowPinning = true;
			valueTree.HeadersVisible = false;
			valueTree.CompactView = true;
			valueTree.PinnedWatch = watch;
			if (watch.Value != null)
				valueTree.AddValue (watch.Value);
			
			valueTree.ButtonPressEvent += HandleValueTreeButtonPressEvent;
			valueTree.ButtonReleaseEvent += HandleValueTreeButtonReleaseEvent;
			valueTree.MotionNotifyEvent += HandleValueTreeMotionNotifyEvent;
			
			Gtk.Frame fr = new Gtk.Frame ();
			fr.ShadowType = Gtk.ShadowType.Out;
			fr.Add (valueTree);
			Add (fr);
			HandleEditorOptionsChanged (null, null);
			ShowAll ();
			//unpin.Hide ();
			Editor.EditorOptionsChanged += HandleEditorOptionsChanged;
			
			DebuggingService.PausedEvent += HandleDebuggingServicePausedEvent;
			DebuggingService.ResumedEvent += HandleDebuggingServiceResumedEvent;
		}
Beispiel #2
0
		public void Split (bool vSplit)
		{
			double vadjustment = this.mainsw.Vadjustment.Value;
			double hadjustment = this.mainsw.Hadjustment.Value;
			
			if (splitContainer != null)
				Unsplit ();
			vbox.Remove (this.mainsw);
			
			RecreateMainSw ();

			this.splitContainer = vSplit ? (Gtk.Paned)new VPaned () : (Gtk.Paned)new HPaned ();

			splitContainer.Add1 (mainsw);

			this.splitContainer.ButtonPressEvent += delegate(object sender, ButtonPressEventArgs args) {
				if (args.Event.Type == Gdk.EventType.TwoButtonPress && args.RetVal == null) {
					Unsplit ();
				}
			};
			secondsw = new DecoratedScrolledWindow (this);
			this.splittedTextEditor = new MonoDevelop.SourceEditor.ExtensibleTextEditor (view, this.textEditor.Options, textEditor.Document);
			this.splittedTextEditor.Extension = textEditor.Extension;
			
			this.splittedTextEditorContainer = new TextEditorContainer (this.splittedTextEditor);
			secondsw.SetTextEditor (this.splittedTextEditorContainer);
			splitContainer.Add2 (secondsw);
			
			vbox.PackStart (splitContainer, true, true, 0);
			this.splitContainer.Position = (vSplit ? vbox.Allocation.Height : vbox.Allocation.Width) / 2 - 1;
			
			vbox.ShowAll ();
			secondsw.Vadjustment.Value = mainsw.Vadjustment.Value = vadjustment; 
			secondsw.Hadjustment.Value = mainsw.Hadjustment.Value = hadjustment;
		}
Beispiel #3
0
		public SourceEditorWidget (SourceEditorView view)
		{
			this.view = view;
			vbox.SetSizeRequest (32, 32);
			this.lastActiveEditor = this.textEditor = new MonoDevelop.SourceEditor.ExtensibleTextEditor (view);
			mainsw = new DecoratedScrolledWindow (this);
			this.textEditorContainer = new TextEditorContainer (textEditor);
			mainsw.SetTextEditor (textEditorContainer);
			
			vbox.PackStart (mainsw, true, true, 0);
			this.textEditor.Errors = errors;
			options = this.textEditor.Options;
			
			textEditorData = textEditor.GetTextEditorData ();
			ResetFocusChain ();
			
			UpdateLineCol ();
			//			this.IsClassBrowserVisible = this.widget.TextEditor.Options.EnableQuickFinder;
			vbox.BorderWidth = 0;
			vbox.Spacing = 0;
			vbox.Focused += delegate {
				UpdateLineCol ();
			};
			vbox.Destroyed += delegate {
				isDisposed = true;
				StopParseInfoThread ();
				KillWidgets ();
				
				this.textEditor = null;
				this.lastActiveEditor = null;
				this.splittedTextEditor = null;
				view = null;
				
				IdeApp.Workbench.StatusBar.ClearCaretState ();
				if (parseInformationUpdaterWorkerThread != null) {
					parseInformationUpdaterWorkerThread.Dispose ();
					parseInformationUpdaterWorkerThread = null;
				}
			};
			vbox.ShowAll ();
			parseInformationUpdaterWorkerThread = new BackgroundWorker ();
			parseInformationUpdaterWorkerThread.WorkerSupportsCancellation = true;
			parseInformationUpdaterWorkerThread.DoWork += HandleParseInformationUpdaterWorkerThreadDoWork;
		}
Beispiel #4
0
			public void SetTextEditor (TextEditorContainer container)
			{
				scrolledWindow.Child = container;
//				container.TextEditorWidget.EditorOptionsChanged += OptionsChanged;
				container.TextEditorWidget.Caret.ModeChanged += parent.UpdateLineColOnEventHandler;
				container.TextEditorWidget.Caret.PositionChanged += parent.CaretPositionChanged;
				container.TextEditorWidget.SelectionChanged += parent.UpdateLineColOnEventHandler;
			}
		public SearchAndReplaceWidget (TextEditor textEditor, Widget frame)
		{
			this.textEditor = textEditor;
			textEditorContainer = textEditor.Parent as TextEditorContainer;
			this.frame = frame;
			textEditorContainer.SizeAllocated += HandleViewTextEditorhandleSizeAllocated;
			textEditor.TextViewMargin.SearchRegionsUpdated += HandleWidgetTextEditorTextViewMarginSearchRegionsUpdated;
			textEditor.Caret.PositionChanged += HandleWidgetTextEditorCaretPositionChanged;
			SizeAllocated += HandleViewTextEditorhandleSizeAllocated;
			Name = "SearchAndReplaceWidget";
			Events = Gdk.EventMask.AllEventsMask;
			DisableAutomaticSearchPatternCaseMatch = false;
			Build ();
			buttonReplace.TooltipText = GettextCatalog.GetString ("Replace");
			buttonSearchForward.TooltipText = GettextCatalog.GetString ("Find next {0}", GetShortcut (SearchCommands.FindNext));
			buttonSearchBackward.TooltipText = GettextCatalog.GetString ("Find previous {0}", GetShortcut (SearchCommands.FindPrevious));
			buttonSearchMode.TooltipText = GettextCatalog.GetString ("Toggle between search and replace mode");
			searchEntry.Ready = true;
			searchEntry.Visible = true;
			searchEntry.WidthRequest = textEditor.Allocation.Width / 3;
			searchEntry.ForceFilterButtonVisible = true;
			replaceWidgets = new Widget [] {
			//		labelReplace,
				entryReplace,
				buttonReplace,
				buttonReplaceAll
			};
			
			FocusChain = new Widget [] {
				searchEntry,
				buttonSearchForward,
				buttonSearchBackward,
				entryReplace,
				buttonReplace,
				buttonReplaceAll
			};
			FilterHistory (seachHistoryProperty);
			FilterHistory (replaceHistoryProperty);
			//HACK: GTK rendering issue on Mac, images don't repaint unless we put them in visible eventboxes
			if (Platform.IsMac) {
				foreach (var eb in new [] { eventbox2, eventbox3, eventbox4, eventbox5, eventbox6 }) {
					eb.VisibleWindow = true;
					eb.ModifyBg (StateType.Normal, new Gdk.Color (230, 230, 230));
				}
			}

			if (String.IsNullOrEmpty (textEditor.SearchPattern)) {
				textEditor.SearchPattern = searchPattern;
			} else if (textEditor.SearchPattern != searchPattern) {
				searchPattern = textEditor.SearchPattern;
				//FireSearchPatternChanged ();
			}
			UpdateSearchPattern ();
			
			//searchEntry.Model = searchHistory;
			
			searchEntry.Entry.KeyReleaseEvent += delegate {
				CheckSearchPatternCasing (SearchPattern);
/*				widget.SetSearchPattern (SearchPattern);
				searchPattern = SearchPattern;
				UpdateSearchEntry ();*/
			};
			
			searchEntry.Entry.Changed += delegate {
				SetSearchPattern (SearchPattern);
				string oldPattern = searchPattern;
				searchPattern = SearchPattern;
				if (oldPattern != searchPattern)
					UpdateSearchEntry ();
				var history = GetHistory (seachHistoryProperty);
				if (history.Count > 0 && history [0] == oldPattern) {
					ChangeHistory (seachHistoryProperty, searchPattern);
				} else {
					UpdateSearchHistory (searchPattern);
				}
			};
			
			entryReplace.Text = replacePattern;
//			entryReplace.Model = replaceHistory;
//			RestoreReplaceHistory ();
			
			foreach (Gtk.Widget child in Children) {
				child.KeyPressEvent += delegate (object sender, Gtk.KeyPressEventArgs args) {
					if (args.Event.Key == Gdk.Key.Escape)
						RemoveSearchWidget ();
				};
			}
			
			closeButton.Clicked += delegate {
				RemoveSearchWidget ();
			};
			
			buttonSearchMode.Clicked += delegate {
				IsReplaceMode = !IsReplaceMode;
			};
			
			// comboboxSearchAs.AppendText (GettextCatalog.GetString ("Text"));
			// comboboxSearchAs.AppendText (GettextCatalog.GetString ("Regular Expressions"));
			// comboboxSearchAs.Active = 0;
			// ReplacePatternChanged += UpdateReplacePattern;
			
			//SearchPatternChanged += UpdateSearchPattern;
			FocusChildSet += delegate {
				StoreWidgetState ();
			};
			
			searchEntry.Entry.Activated += delegate {
				UpdateSearchHistory (SearchPattern);
				FindNext (textEditor);
			};
			
			buttonSearchForward.Clicked += delegate {
				UpdateSearchHistory (SearchPattern);
				FindNext (textEditor);
			};
			
			buttonSearchBackward.Clicked += delegate {
				UpdateSearchHistory (SearchPattern);
				FindPrevious (textEditor);
			};
			
//			optionsButton.Label = MonoDevelop.Core.GettextCatalog.GetString ("Options");
			
			this.searchEntry.RequestMenu += HandleSearchEntryhandleRequestMenu;
			
			entryReplace.Changed += delegate {
				replacePattern = ReplacePattern;
				if (!inReplaceUpdate) 
					FireReplacePatternChanged ();
			};
			
			entryReplace.Activated += delegate {
				UpdateSearchHistory (SearchPattern);
				UpdateReplaceHistory (ReplacePattern);
				Replace ();
				entryReplace.GrabFocus ();
			};
			
			buttonReplace.Clicked += delegate {
				UpdateSearchHistory (SearchPattern);
				UpdateReplaceHistory (ReplacePattern);
				Replace ();
			};
			
			buttonReplaceAll.Clicked += delegate {
				UpdateSearchHistory (SearchPattern);
				UpdateReplaceHistory (ReplacePattern);
				ReplaceAll ();
			};
			
			buttonSearchForward.KeyPressEvent += OnNavigateKeyPressEvent;
			buttonSearchBackward.KeyPressEvent += OnNavigateKeyPressEvent;
			searchEntry.Entry.KeyPressEvent += OnNavigateKeyPressEvent;
			entryReplace.KeyPressEvent += OnNavigateKeyPressEvent;
			buttonReplace.KeyPressEvent += OnNavigateKeyPressEvent;
			buttonReplaceAll.KeyPressEvent += OnNavigateKeyPressEvent;
			
			resultInformLabelEventBox = this.searchEntry.AddLabelWidget (resultInformLabel);
			resultInformLabelEventBox.BorderWidth = 2;
			resultInformLabel.Xpad = 2;
			resultInformLabel.Show ();
			searchEntry.FilterButtonPixbuf = new Gdk.Pixbuf (typeof(SearchAndReplaceWidget).Assembly, "searchoptions.png");

			if (textEditor.IsSomethingSelected) {
				if (textEditor.MainSelection.MinLine == textEditor.MainSelection.MaxLine) {
					SetSearchPattern ();
				} else {
					IsInSelectionSearchMode = true;
					SelectionSegment = textEditor.SelectionRange;
				}
			}
			SetSearchPattern (searchPattern);
			textEditor.HighlightSearchPattern = true;
			textEditor.TextViewMargin.RefreshSearchMarker ();
			if (textEditor.Document.ReadOnly) {
				buttonSearchMode.Visible = false;
				IsReplaceMode = false;
			}
			
		}
		public AssemblyBrowserWidget ()
		{
			this.Build ();
			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 = true;
			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,
				ShowInvalidLines = false,
				ShowLineNumberMargin = false,
				ShowSpaces = false,
				ShowTabs = 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 SmartScrolledWindow ();
			scrolledWindow.Show ();
			textEditorContainer = new TextEditorContainer (inspectEditor);
			scrolledWindow.Child = textEditorContainer;
			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;
/*			this.notebook1.SwitchPage += delegate {
				// Hack for the switch page select all bug.
//				this.inspectLabel.Selectable = false;
			};*/

			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;
			searchentry1.Ready = 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 ();
				}
			};
			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 ();
			};
			/*
			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.searchentry1.ShowAll ();
			this.buttonBack.Clicked += this.OnNavigateBackwardActionActivated;
			this.buttonForeward.Clicked += this.OnNavigateForwardActionActivated;
			this.notebook1.ShowTabs = false;
			this.notebookInspection.ShowTabs = false;
			this.ShowAll ();
		}
Beispiel #7
0
        public SearchAndReplaceWidget(SourceEditorWidget widget, Widget container)
        {
            this.container           = container;
            this.textEditor          = widget.TextEditor;
            this.textEditorContainer = widget.TextEditorContainer;

            textEditorContainer.SizeAllocated += HandleViewTextEditorhandleSizeAllocated;
            textEditor.TextViewMargin.SearchRegionsUpdated += HandleWidgetTextEditorTextViewMarginSearchRegionsUpdated;
            textEditor.Caret.PositionChanged += HandleWidgetTextEditorCaretPositionChanged;
            this.SizeAllocated += HandleViewTextEditorhandleSizeAllocated;
            this.Name           = "SearchAndReplaceWidget";
            this.Events         = Gdk.EventMask.AllEventsMask;
            widget.DisableAutomaticSearchPatternCaseMatch = false;
            Build();
            this.buttonReplace.TooltipText        = GettextCatalog.GetString("Replace");
            this.buttonSearchForward.TooltipText  = GettextCatalog.GetString("Find next");
            this.buttonSearchBackward.TooltipText = GettextCatalog.GetString("Find previous");
            this.buttonSearchMode.TooltipText     = GettextCatalog.GetString("Toggle between search and replace mode");
            this.searchEntry.Ready                    = true;
            this.searchEntry.Visible                  = true;
            this.searchEntry.WidthRequest             = widget.Vbox.Allocation.Width / 3;
            this.searchEntry.ForceFilterButtonVisible = true;
            replaceWidgets = new Widget [] {
                //		labelReplace,
                entryReplace,
                buttonReplace,
                buttonReplaceAll
            };

            this.FocusChain = new Widget [] {
                this.searchEntry,
                this.buttonSearchForward,
                this.buttonSearchBackward,
                entryReplace,
                buttonReplace,
                buttonReplaceAll
            };

            this.widget = widget;
            FilterHistory(seachHistoryProperty);
            FilterHistory(replaceHistoryProperty);
            //HACK: GTK rendering issue on Mac, images don't repaint unless we put them in visible eventboxes
            if (Platform.IsMac)
            {
                foreach (var eb in new [] { eventbox2, eventbox3, eventbox4, eventbox5, eventbox6 })
                {
                    eb.VisibleWindow = true;
                    eb.ModifyBg(StateType.Normal, new Gdk.Color(230, 230, 230));
                }
            }

            if (String.IsNullOrEmpty(textEditor.SearchPattern))
            {
                textEditor.SearchPattern = searchPattern;
            }
            else if (textEditor.SearchPattern != searchPattern)
            {
                searchPattern = textEditor.SearchPattern;
                //FireSearchPatternChanged ();
            }
            UpdateSearchPattern();

            //searchEntry.Model = searchHistory;

            searchEntry.Entry.KeyReleaseEvent += delegate {
                widget.CheckSearchPatternCasing(SearchPattern);

/*				widget.SetSearchPattern (SearchPattern);
 *                              searchPattern = SearchPattern;
 *                              UpdateSearchEntry ();*/
            };

            searchEntry.Entry.Changed += delegate {
                widget.SetSearchPattern(SearchPattern);
                string oldPattern = searchPattern;
                searchPattern = SearchPattern;
                if (oldPattern != searchPattern)
                {
                    UpdateSearchEntry();
                }
                var history = GetHistory(seachHistoryProperty);
                if (history.Count > 0 && history[0] == oldPattern)
                {
                    ChangeHistory(seachHistoryProperty, searchPattern);
                }
                else
                {
                    UpdateSearchHistory(searchPattern);
                }
            };

            entryReplace.Text = replacePattern;
//			entryReplace.Model = replaceHistory;
//			RestoreReplaceHistory ();

            foreach (Gtk.Widget child in Children)
            {
                child.KeyPressEvent += delegate(object sender, Gtk.KeyPressEventArgs args) {
                    if (args.Event.Key == Gdk.Key.Escape)
                    {
                        widget.RemoveSearchWidget();
                    }
                };
            }

            closeButton.Clicked += delegate {
                widget.RemoveSearchWidget();
            };

            buttonSearchMode.Clicked += delegate {
                IsReplaceMode = !IsReplaceMode;
            };

            // comboboxSearchAs.AppendText (GettextCatalog.GetString ("Text"));
            // comboboxSearchAs.AppendText (GettextCatalog.GetString ("Regular Expressions"));
            // comboboxSearchAs.Active = 0;
            // ReplacePatternChanged += UpdateReplacePattern;

            //SearchPatternChanged += UpdateSearchPattern;
            FocusChildSet += delegate {
                StoreWidgetState();
            };

            searchEntry.Entry.Activated += delegate {
                UpdateSearchHistory(SearchPattern);
                widget.SetLastActiveEditor(textEditor);
                widget.FindNext(false);
            };

            buttonSearchForward.Clicked += delegate {
                UpdateSearchHistory(SearchPattern);
                widget.SetLastActiveEditor(textEditor);
                widget.FindNext(false);
            };

            buttonSearchBackward.Clicked += delegate {
                UpdateSearchHistory(SearchPattern);
                widget.SetLastActiveEditor(textEditor);
                widget.FindPrevious(false);
            };

//			optionsButton.Label = MonoDevelop.Core.GettextCatalog.GetString ("Options");

            this.searchEntry.RequestMenu += HandleSearchEntryhandleRequestMenu;

            entryReplace.Changed += delegate {
                replacePattern = ReplacePattern;
                if (!inReplaceUpdate)
                {
                    FireReplacePatternChanged();
                }
            };

            entryReplace.Activated += delegate {
                UpdateSearchHistory(SearchPattern);
                UpdateReplaceHistory(ReplacePattern);
                widget.SetLastActiveEditor(textEditor);
                widget.Replace();
                entryReplace.GrabFocus();
            };

            buttonReplace.Clicked += delegate {
                UpdateSearchHistory(SearchPattern);
                UpdateReplaceHistory(ReplacePattern);
                widget.SetLastActiveEditor(textEditor);
                widget.Replace();
            };

            buttonReplaceAll.Clicked += delegate {
                UpdateSearchHistory(SearchPattern);
                UpdateReplaceHistory(ReplacePattern);
                widget.SetLastActiveEditor(textEditor);
                widget.ReplaceAll();
            };

            buttonSearchForward.KeyPressEvent  += OnNavigateKeyPressEvent;
            buttonSearchBackward.KeyPressEvent += OnNavigateKeyPressEvent;
            searchEntry.Entry.KeyPressEvent    += OnNavigateKeyPressEvent;
            entryReplace.KeyPressEvent         += OnNavigateKeyPressEvent;
            buttonReplace.KeyPressEvent        += OnNavigateKeyPressEvent;
            buttonReplaceAll.KeyPressEvent     += OnNavigateKeyPressEvent;

            resultInformLabelEventBox             = this.searchEntry.AddLabelWidget(resultInformLabel);
            resultInformLabelEventBox.BorderWidth = 2;
            resultInformLabel.Xpad = 2;
            resultInformLabel.Show();
            searchEntry.FilterButtonPixbuf = new Gdk.Pixbuf(typeof(SearchAndReplaceWidget).Assembly, "searchoptions.png");
        }
		public SourceEditorWidget (SourceEditorView view)
		{
			this.view = view;
			vbox.SetSizeRequest (32, 32);
			this.lastActiveEditor = this.textEditor = new MonoDevelop.SourceEditor.ExtensibleTextEditor (view);
			mainsw = new DecoratedScrolledWindow (this);
			this.textEditorContainer = new TextEditorContainer (textEditor);
			mainsw.SetTextEditor (textEditorContainer);
			
			vbox.PackStart (mainsw, true, true, 0);
			this.textEditor.Errors = errors;
			options = this.textEditor.Options;
			
			textEditorData = textEditor.GetTextEditorData ();
			ResetFocusChain ();
			
			UpdateLineCol ();
			ProjectDomService.ParsedDocumentUpdated += OnParseInformationChanged;
			//			this.IsClassBrowserVisible = this.widget.TextEditor.Options.EnableQuickFinder;
			vbox.BorderWidth = 0;
			vbox.Spacing = 0;
			vbox.Focused += delegate {
				UpdateLineCol ();
			};
			vbox.Destroyed += delegate {
				isDisposed = true;
				StopParseInfoThread ();
				KillWidgets ();
				
				this.textEditor = null;
				this.lastActiveEditor = null;
				this.splittedTextEditor = null;
				view = null;
				
				ProjectDomService.ParsedDocumentUpdated -= OnParseInformationChanged;
				IdeApp.Workbench.StatusBar.ClearCaretState ();
			};
			vbox.ShowAll ();
		}