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; }
public override IProjectFile Open() { if (_textEditor == null) { _textEditor = new TextEditorContainer(FileSystemPath); if (_tabItem != null) { _tabItem.Close(); } _tabItem = TabStripItemFactory.CreateTabStripItem(_textEditor, this); _tabItem.Closed += TabItemClosed; } return(this); }
public override void Close() { try { _closing = true; if (_tabItem != null) { _tabItem.Close(); _tabItem = null; } if (_textEditor != null) { _textEditor.Dispose(); _textEditor = null; } } finally { _closing = false; } }
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"); buttonSearchBackward.TooltipText = GettextCatalog.GetString("Find previous"); 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; } }