bool ShowTooltipEvent() { tipShowTimeoutId = 0; if (!mouseOver) { return(false); } int remainingMs = (int)(scheduledTipTime - DateTime.Now).TotalMilliseconds; if (remainingMs > 50) { // Still some significant time left. Re-schedule the timer tipShowTimeoutId = GLib.Timeout.Add((uint)remainingMs, ShowTooltipEvent); return(false); } if (!string.IsNullOrEmpty(tip)) { HideTooltip(); tooltipWindow = new TooltipPopoverWindow(); tooltipWindow.ShowArrow = true; tooltipWindow.Text = tip; tooltipWindow.ShowPopup(box, PopupPosition.Top); } return(false); }
protected override void Run() { var editor = IdeApp.Workbench.ActiveDocument?.Editor; if (editor == null) { return; } var scopeStack = editor.GetScopeStackAsync(editor.CaretOffset, CancellationToken.None).WaitAndGetResult(CancellationToken.None); var sb = new StringBuilder(); sb.AppendLine(); foreach (var scope in scopeStack.Reverse()) { sb.AppendLine(Ambience.EscapeText(scope)); } var window = new TooltipPopoverWindow(); window.Markup = "<span font='" + FontService.MonospaceFontName + "'>" + sb.ToString() + "</span>"; editor.ShowTooltipWindow(window); }
void ShowTooltipWindow(int x, int y) { tooltipTimeout = 0; int dx = (int)((double)Allocation.Width * dividerPosition); if (x >= dx) { return; } var row = GetAllRows(true).FirstOrDefault(r => !r.IsCategory && y >= r.EditorBounds.Y && y <= r.EditorBounds.Bottom); if (row != null) { tooltipWindow = new TooltipPopoverWindow(); tooltipWindow.ShowArrow = true; var s = new System.Text.StringBuilder("<b>" + row.Property.DisplayName + "</b>"); s.AppendLine(); s.AppendLine(); s.Append(GLib.Markup.EscapeText(row.Property.Description)); if (row.Property.Converter.CanConvertTo(typeof(string))) { var value = Convert.ToString(row.Property.GetValue(row.Instace)); if (!string.IsNullOrEmpty(value)) { const int chunkLength = 200; var multiLineValue = string.Join(Environment.NewLine, Enumerable.Range(0, (int)Math.Ceiling((double)value.Length / chunkLength)).Select(n => string.Concat(value.Skip(n * chunkLength).Take(chunkLength)))); s.AppendLine(); s.AppendLine(); s.Append("Value: " + multiLineValue); } } tooltipWindow.Markup = s.ToString(); tooltipWindow.ShowPopup(this, new Gdk.Rectangle(0, row.EditorBounds.Y, Allocation.Width, row.EditorBounds.Height), PopupPosition.Right); } }
void HideTooltip() { if (tooltipWindow != null) { tooltipWindow.Destroy(); tooltipWindow = null; } }
void ShowTooltip() { if (!string.IsNullOrEmpty(tip)) { HideTooltip(); tooltipWindow = new TooltipPopoverWindow(); tooltipWindow.ShowArrow = true; tooltipWindow.Text = tip; tooltipWindow.ShowPopup(box, PopupPosition.Top); } }
void HideTooltip() { if (tooltipTimeout != 0) { GLib.Source.Remove(tooltipTimeout); tooltipTimeout = 0; } if (tooltipWindow != null) { tooltipWindow.Destroy(); tooltipWindow = null; } }
void ShowTooltipWindow(int x, int y) { tooltipTimeout = 0; int dx = (int)((double)Allocation.Width * dividerPosition); if (x >= dx) { return; } var row = GetAllRows(true).FirstOrDefault(r => !r.IsCategory && y >= r.EditorBounds.Y && y <= r.EditorBounds.Bottom); if (row != null) { tooltipWindow = new TooltipPopoverWindow(); tooltipWindow.ShowArrow = true; var s = "<b>" + row.Property.DisplayName + "</b>\n\n"; s += GLib.Markup.EscapeText(row.Property.Description); tooltipWindow.Markup = s; tooltipWindow.ShowPopup(this, new Gdk.Rectangle(0, row.EditorBounds.Y, Allocation.Width, row.EditorBounds.Height), PopupPosition.Right); } }
void HandleKeyTreeMotion(double mouseX, double mouseY) { if (keyBindingsPanel.duplicates?.Count <= 0) { return; } var hit = HitTest(mouseX, mouseY); if (hit.ButtonBounds.IsEmpty) { HideConflictTooltip(); return; } if (hit.AllKeys.Count == 0) { return; } HashSet <Command> keyDuplicates = null; if (keyBindingsPanel.duplicates.TryGetValue(hit.AllKeys [hit.SelectedKey], out keyDuplicates)) { var cmdDuplicates = keyDuplicates.Where(cmd => cmd != hit.Command); if (tooltipWindow == null) { tooltipWindow = TooltipPopoverWindow.Create(); tooltipWindow.ShowArrow = true; //tooltipWindow.LeaveNotifyEvent += delegate { HideConflictTooltip (); }; } var text = string.Empty; HashSet <Command> cmdConflicts = null; bool hasConflict = false; if (keyBindingsPanel.conflicts != null && keyBindingsPanel.conflicts.TryGetValue(hit.AllKeys [hit.SelectedKey], out cmdConflicts)) { hasConflict = cmdConflicts.Contains(hit.Command); } if (hasConflict) { var acmdConflicts = cmdConflicts.Where(cmd => cmd != hit.Command).ToArray(); text += GettextCatalog.GetPluralString( "This shortcut is assigned to another command that is available\nin the same context. Please set a different shortcut.", "This shortcut is assigned to other commands that are available\nin the same context. Please set a different shortcut.", acmdConflicts.Length) + "\n\n"; text += GettextCatalog.GetString("Conflicts:"); foreach (var conflict in acmdConflicts) { text += "\n\u2022 " + conflict.Category + " \u2013 " + conflict.DisplayName; } cmdDuplicates = cmdDuplicates.Except(acmdConflicts); } if (cmdDuplicates.Count() > 0) { if (hasConflict) { text += "\n\n"; } text += GettextCatalog.GetString("Duplicates:"); foreach (var cmd in cmdDuplicates) { text += "\n\u2022 " + cmd.Category + " \u2013 " + cmd.DisplayName; } } tooltipWindow.Markup = text; tooltipWindow.Severity = hasConflict ? Tasks.TaskSeverity.Error : Tasks.TaskSeverity.Warning; tooltipWindow.ShowPopup(keyBindingsTree, hit.ButtonBounds, PopupPosition.Top); } else { HideConflictTooltip(); } }
void ShowTooltipWindow(int x, int y) { tooltipTimeout = 0; int dx = (int)((double)Allocation.Width * dividerPosition); if (x >= dx) return; var row = GetAllRows (true).FirstOrDefault (r => !r.IsCategory && y >= r.EditorBounds.Y && y <= r.EditorBounds.Bottom); if (row != null) { tooltipWindow = new TooltipPopoverWindow (); tooltipWindow.ShowArrow = true; var s = new System.Text.StringBuilder ("<b>" + row.Property.DisplayName + "</b>"); s.AppendLine (); s.AppendLine (); s.Append (GLib.Markup.EscapeText (row.Property.Description)); if (row.Property.Converter.CanConvertTo (typeof(string))) { var value = Convert.ToString (row.Property.GetValue (row.Instace)); if (!string.IsNullOrEmpty (value)) { const int chunkLength = 200; var multiLineValue = string.Join (Environment.NewLine, Enumerable.Range (0, (int)Math.Ceiling ((double)value.Length / chunkLength)).Select (n => string.Concat (value.Skip (n * chunkLength).Take (chunkLength)))); s.AppendLine (); s.AppendLine (); s.Append ("Value: " + multiLineValue); } } tooltipWindow.Markup = s.ToString (); tooltipWindow.ShowPopup (this, new Gdk.Rectangle (0, row.EditorBounds.Y, Allocation.Width, row.EditorBounds.Height), PopupPosition.Right); } }
void HideTooltip() { if (tooltipTimeout != 0) { GLib.Source.Remove (tooltipTimeout); tooltipTimeout = 0; } if (tooltipWindow != null) { tooltipWindow.Destroy (); tooltipWindow = null; } }
void ShowTooltipWindow (int x, int y) { tooltipTimeout = 0; int dx = (int)((double)Allocation.Width * dividerPosition); if (x >= dx) return; var row = GetAllRows (true).FirstOrDefault (r => !r.IsCategory && y >= r.EditorBounds.Y && y <= r.EditorBounds.Bottom); if (row != null) { tooltipWindow = new TooltipPopoverWindow (); tooltipWindow.ShowArrow = true; var s = "<b>" + row.Property.DisplayName + "</b>\n\n"; s += GLib.Markup.EscapeText (row.Property.Description); tooltipWindow.Markup = s; tooltipWindow.ShowPopup (this, new Gdk.Rectangle (0, row.EditorBounds.Y, Allocation.Width, row.EditorBounds.Height), PopupPosition.Right); } }