void ShowPopup(Gdk.EventButton evt) { view.FireCompletionContextChanged(); CompletionWindowManager.HideWindow(); ParameterInformationWindowManager.HideWindow(null, view); HideTooltip(); const string menuPath = "/MonoDevelop/SourceEditor2/ContextMenu/Editor"; var ctx = ExtensionContext ?? AddinManager.AddinEngine; CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet(ctx, menuPath); Gtk.Menu menu = IdeApp.CommandService.CreateMenu(cset); var imMenu = CreateInputMethodMenuItem(GettextCatalog.GetString("_Input Methods")); if (imMenu != null) { menu.Append(new SeparatorMenuItem()); menu.Append(imMenu); } menu.Destroyed += delegate { this.QueueDraw(); }; if (evt != null) { GtkWorkarounds.ShowContextMenu(menu, this, evt); } else { var pt = LocationToPoint(this.Caret.Location); GtkWorkarounds.ShowContextMenu(menu, this, new Gdk.Rectangle(pt.X, pt.Y, 1, (int)LineHeight)); } }
void ShowPopup(Gdk.EventButton evt) { view.FireCompletionContextChanged(); CompletionWindowManager.HideWindow(); ParameterInformationWindowManager.HideWindow(null, view); HideTooltip(); if (string.IsNullOrEmpty(menuPath)) { return; } var ctx = view.WorkbenchWindow?.ExtensionContext ?? AddinManager.AddinEngine; CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet(ctx, menuPath); if (Platform.IsMac) { if (evt == null) { int x, y; var pt = LocationToPoint(this.Caret.Location); TranslateCoordinates(Toplevel, pt.X, pt.Y, out x, out y); IdeApp.CommandService.ShowContextMenu(this, x, y, cset, this); } else { IdeApp.CommandService.ShowContextMenu(this, evt, cset, this); } } else { Gtk.Menu menu = IdeApp.CommandService.CreateMenu(cset); var imMenu = CreateInputMethodMenuItem(GettextCatalog.GetString("_Input Methods")); if (imMenu != null) { menu.Append(new SeparatorMenuItem()); menu.Append(imMenu); } menu.Hidden += HandleMenuHidden; if (evt != null) { GtkWorkarounds.ShowContextMenu(menu, this, evt); } else { var pt = LocationToPoint(this.Caret.Location); GtkWorkarounds.ShowContextMenu(menu, this, (int)pt.X, (int)pt.Y); } } }
public SourceEditorWidget (SourceEditorView view) { this.view = view; vbox.SetSizeRequest (32, 32); this.lastActiveEditor = this.textEditor = new MonoDevelop.SourceEditor.ExtensibleTextEditor (view); this.textEditor.TextArea.FocusInEvent += (o, s) => { lastActiveEditor = (ExtensibleTextEditor)((TextArea)o).GetTextEditorData ().Parent; view.FireCompletionContextChanged (); }; this.textEditor.TextArea.FocusOutEvent += delegate { if (this.splittedTextEditor == null || !splittedTextEditor.TextArea.HasFocus) OnLostFocus (); }; mainsw = new DecoratedScrolledWindow (this); mainsw.SetTextEditor (textEditor); vbox.PackStart (mainsw, true, true, 0); 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; RemoveErrorUndelinesResetTimerId (); StopParseInfoThread (); KillWidgets (); foreach (var provider in quickTaskProvider.ToArray ()) { RemoveQuickTaskProvider (provider); } this.lastActiveEditor = null; this.splittedTextEditor = null; view = null; parsedDocument = null; // IdeApp.Workbench.StatusBar.ClearCaretState (); if (parseInformationUpdaterWorkerThread != null) { parseInformationUpdaterWorkerThread.Dispose (); parseInformationUpdaterWorkerThread = null; } }; vbox.ShowAll (); parseInformationUpdaterWorkerThread = new BackgroundWorker (); parseInformationUpdaterWorkerThread.WorkerSupportsCancellation = true; parseInformationUpdaterWorkerThread.DoWork += HandleParseInformationUpdaterWorkerThreadDoWork; }
public SourceEditorWidget (SourceEditorView view) { this.view = view; vbox.SetSizeRequest (32, 32); this.lastActiveEditor = this.textEditor = new MonoDevelop.SourceEditor.ExtensibleTextEditor (view); this.textEditor.TextArea.FocusInEvent += (o, s) => { lastActiveEditor = (ExtensibleTextEditor)((TextArea)o).GetTextEditorData ().Parent; view.FireCompletionContextChanged (); }; this.textEditor.TextArea.FocusOutEvent += delegate { if (this.splittedTextEditor == null || !splittedTextEditor.TextArea.HasFocus) OnLostFocus (); }; if (IdeApp.CommandService != null) IdeApp.FocusOut += IdeApp_FocusOut; mainsw = new DecoratedScrolledWindow (this); mainsw.SetTextEditor (textEditor); vbox.PackStart (mainsw, true, true, 0); textEditorData = textEditor.GetTextEditorData (); textEditorData.EditModeChanged += TextEditorData_EditModeChanged; ResetFocusChain (); UpdateLineCol (); // this.IsClassBrowserVisible = this.widget.TextEditor.Options.EnableQuickFinder; vbox.BorderWidth = 0; vbox.Spacing = 0; vbox.Focused += delegate { UpdateLineCol (); }; vbox.Destroyed += delegate { if (isDisposed) return; isDisposed = true; StopParseInfoThread (); KillWidgets (); ClearQuickTaskProvider (); ClearUsageTaskProvider (); if (textEditor != null && !textEditor.IsDestroyed) textEditor.Destroy (); if (splittedTextEditor != null && !splittedTextEditor.IsDestroyed) splittedTextEditor.Destroy (); this.lastActiveEditor = null; this.splittedTextEditor = null; this.textEditor = null; textEditorData.EditModeChanged -= TextEditorData_EditModeChanged; textEditorData = null; view = null; parsedDocument = null; // IdeApp.Workbench.StatusBar.ClearCaretState (); }; vbox.ShowAll (); }