public async Task AddOverload(CompletionData data, CancellationToken cancelToken) { var tooltipInformation = await data.CreateTooltipInformation(false, cancelToken); if (tooltipInformation == null || tooltipInformation.IsEmpty || cancelToken.IsCancellationRequested) { return; } using (var layout = new Pango.Layout(PangoContext)) { layout.FontDescription = FontService.GetFontDescription("Editor"); layout.SetMarkup(tooltipInformation.SignatureMarkup); int w, h; layout.GetPixelSize(out w, out h); if (w >= Allocation.Width - 10) { tooltipInformation = await data.CreateTooltipInformation(true, cancelToken); } } if (cancelToken.IsCancellationRequested) { return; } AddOverload(tooltipInformation); }
VBox CreateCategory(string categoryName, string categoryContentMarkup) { var vbox = new VBox(); vbox.Spacing = 2; var catLabel = new MonoDevelop.Components.FixedWidthWrapLabel(); catLabel.Text = categoryName; catLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); catLabel.FontDescription = FontService.GetFontDescription("Editor"); vbox.PackStart(catLabel, false, true, 0); var contentLabel = new MonoDevelop.Components.FixedWidthWrapLabel(); contentLabel.MaxWidth = Math.Max(440, this.Allocation.Width); contentLabel.Wrap = Pango.WrapMode.WordChar; contentLabel.BreakOnCamelCasing = true; contentLabel.BreakOnPunctuation = true; contentLabel.Markup = categoryContentMarkup.Trim(); contentLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); contentLabel.FontDescription = FontService.GetFontDescription("Editor"); vbox.PackStart(contentLabel, true, true, 0); return(vbox); }
internal static VBox CreateCategory(string categoryName, string categoryContentMarkup, Cairo.Color foreColor) { var vbox = new VBox(); vbox.Spacing = 8; if (categoryName != null) { var catLabel = new FixedWidthWrapLabel(); catLabel.Markup = categoryName; catLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); catLabel.FontDescription = FontService.GetFontDescription("Editor"); vbox.PackStart(catLabel, false, true, 0); } var contentLabel = new FixedWidthWrapLabel(); HBox hbox = new HBox(); // hbox.PackStart (new Label(), false, true, 10); contentLabel.Wrap = Pango.WrapMode.WordChar; contentLabel.BreakOnCamelCasing = false; contentLabel.BreakOnPunctuation = false; contentLabel.MaxWidth = 400; contentLabel.Markup = categoryContentMarkup.Trim(); contentLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); contentLabel.FontDescription = FontService.GetFontDescription("Editor"); hbox.PackStart(contentLabel, true, true, 0); vbox.PackStart(hbox, true, true, 0); return(vbox); }
public ParameterInformationWindow() { TypeHint = Gdk.WindowTypeHint.Tooltip; this.SkipTaskbarHint = true; this.SkipPagerHint = true; this.AllowShrink = false; this.AllowGrow = false; this.CanFocus = false; this.CanDefault = false; WindowTransparencyDecorator.Attach(this); headlabel = new MonoDevelop.Components.FixedWidthWrapLabel(); headlabel.Indent = -20; headlabel.FontDescription = FontService.GetFontDescription("Editor").CopyModified(1.1); headlabel.Wrap = Pango.WrapMode.WordChar; headlabel.BreakOnCamelCasing = false; headlabel.BreakOnPunctuation = false; descriptionBox.Spacing = 4; VBox vb = new VBox(false, 0); vb.PackStart(headlabel, true, true, 0); vb.PackStart(descriptionBox, true, true, 0); HBox hb = new HBox(false, 0); hb.PackStart(vb, true, true, 0); vb2.Spacing = 4; vb2.PackStart(hb, true, true, 0); ContentBox.Add(vb2); ShowAll(); DesktopService.RemoveWindowShadow(this); }
internal void EnsureLayoutCreated(TextEditor editor) { if (colorMatrix == null && editor.ColorStyle != null) { bool isError = errors.Any(e => e.IsError); if (errorMatrix == null) { errorGc = (HslColor)(editor.ColorStyle.GetChunkStyle("bubble.error.text").Color); warningGc = (HslColor)(editor.ColorStyle.GetChunkStyle("bubble.warning.text").Color); errorMatrix = CreateColorMatrix(editor, true); warningMatrix = CreateColorMatrix(editor, false); } colorMatrix = isError ? errorMatrix : warningMatrix; gc = isError ? errorGc : warningGc; gcSelected = (HslColor)editor.ColorStyle.Selection.Color; gcLight = new Cairo.Color(1, 1, 1); } if (layouts != null) { return; } layouts = new List <LayoutDescriptor> (); fontDescription = FontService.GetFontDescription("MessageBubbles"); if (fontDescription != null) { fontDescription.Size = (int)(fontDescription.Size * editor.Options.Zoom); } foreach (ErrorText errorText in errors) { Pango.Layout layout = new Pango.Layout(editor.PangoContext); layout.FontDescription = fontDescription; string firstLine = errorText.ErrorMessage ?? ""; int idx = firstLine.IndexOfAny(new [] { '\n', '\r' }); if (idx > 0) { firstLine = firstLine.Substring(0, idx); } layout.SetText(firstLine); KeyValuePair <int, int> textSize; if (!textWidthDictionary.TryGetValue(errorText.ErrorMessage, out textSize)) { int w, h; layout.GetPixelSize(out w, out h); textSize = new KeyValuePair <int, int> (w, h); textWidthDictionary [errorText.ErrorMessage] = textSize; } layouts.Add(new LayoutDescriptor(layout, textSize.Key, textSize.Value)); } if (errorCountLayout == null && errors.Count > 1) { errorCountLayout = new Pango.Layout(editor.PangoContext); errorCountLayout.FontDescription = fontDescription; errorCountLayout.SetText(errors.Count.ToString()); } }
void UpdateFont(MonoDevelop.Components.FixedWidthWrapLabel label) { if (label == null) { return; } label.FontDescription = FontService.GetFontDescription("Pad"); }
void ShowOverload() { ClearDescriptions(); if (current_overload >= 0 && current_overload < overloads.Count) { var o = overloads[current_overload]; headLabel.Markup = o.SignatureMarkup; headLabel.Visible = !string.IsNullOrEmpty(o.SignatureMarkup); int x, y; GetPosition(out x, out y); var geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtPoint(x, y)); headLabel.MaxWidth = Math.Max(geometry.Width / 5, 480); if (Theme.DrawPager && overloads.Count > 1) { headLabel.WidthRequest = headLabel.RealWidth + 70; } else { headLabel.WidthRequest = -1; } foreach (var cat in o.Categories) { descriptionBox.PackStart(CreateCategory(GetHeaderMarkup(cat.Item1), cat.Item2, foreColor), true, true, 4); } if (!string.IsNullOrEmpty(o.SummaryMarkup)) { descriptionBox.PackStart(CreateCategory(GetHeaderMarkup(GettextCatalog.GetString("Summary")), o.SummaryMarkup, foreColor), true, true, 4); } if (!string.IsNullOrEmpty(o.FooterMarkup)) { var contentLabel = new FixedWidthWrapLabel(); contentLabel.Wrap = Pango.WrapMode.WordChar; contentLabel.BreakOnCamelCasing = false; contentLabel.BreakOnPunctuation = false; contentLabel.MaxWidth = 400; contentLabel.Markup = o.FooterMarkup.Trim(); contentLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); contentLabel.FontDescription = FontService.GetFontDescription("Editor"); descriptionBox.PackEnd(contentLabel, true, true, 4); } if (string.IsNullOrEmpty(o.SummaryMarkup) && string.IsNullOrEmpty(o.FooterMarkup) && !o.Categories.Any()) { descriptionBox.Hide(); } else { descriptionBox.ShowAll(); } Theme.CurrentPage = current_overload; QueueResize(); } }
public MessageBubbleCache(TextEditor editor) { this.editor = editor; errorPixbuf = ImageService.GetPixbuf(MonoDevelop.Ide.Gui.Stock.Error, Gtk.IconSize.Menu); warningPixbuf = ImageService.GetPixbuf(MonoDevelop.Ide.Gui.Stock.Warning, Gtk.IconSize.Menu); editor.EditorOptionsChanged += HandleEditorEditorOptionsChanged; fontDescription = FontService.GetFontDescription("MessageBubbles"); }
public MessageBubbleCache(TextEditor editor) { this.editor = editor; errorPixbuf = ImageService.GetPixbuf("md-bubble-error", Gtk.IconSize.Menu); warningPixbuf = ImageService.GetPixbuf("md-bubble-warning", Gtk.IconSize.Menu); editor.EditorOptionsChanged += HandleEditorEditorOptionsChanged; editor.LeaveNotifyEvent += HandleLeaveNotifyEvent; editor.MotionNotifyEvent += HandleMotionNotifyEvent; editor.TextArea.BeginHover += HandleBeginHover; fontDescription = FontService.GetFontDescription("MessageBubbles"); }
public MessageBubbleCache(MonoTextEditor editor) { this.editor = editor; editor.EditorOptionsChanged += HandleEditorEditorOptionsChanged; editor.TextArea.LeaveNotifyEvent += HandleLeaveNotifyEvent; editor.TextArea.MotionNotifyEvent += HandleMotionNotifyEvent; editor.TextArea.BeginHover += HandleBeginHover; editor.VAdjustment.ValueChanged += HandleValueChanged; editor.HAdjustment.ValueChanged += HandleValueChanged; fontDescription = FontService.GetFontDescription("Pad"); tooltipFontDescription = FontService.GetFontDescription("Pad").CopyModified(weight: Pango.Weight.Bold); errorCountFontDescription = FontService.GetFontDescription("Pad").CopyModified(weight: Pango.Weight.Bold); }
public MessageBubbleCache(TextEditor editor) { this.editor = editor; errorPixbuf = Xwt.Drawing.Image.FromResource("gutter-error-light-15.png"); warningPixbuf = Xwt.Drawing.Image.FromResource("gutter-warning-light-15.png"); editor.EditorOptionsChanged += HandleEditorEditorOptionsChanged; editor.TextArea.LeaveNotifyEvent += HandleLeaveNotifyEvent; editor.TextArea.MotionNotifyEvent += HandleMotionNotifyEvent; editor.TextArea.BeginHover += HandleBeginHover; editor.VAdjustment.ValueChanged += HandleValueChanged; editor.HAdjustment.ValueChanged += HandleValueChanged; fontDescription = FontService.GetFontDescription("MessageBubbles"); tooltipFontDescription = FontService.GetFontDescription("MessageBubbleTooltip"); errorCountFontDescription = FontService.GetFontDescription("MessageBubbleCounter"); }
public MessageBubbleCache(MonoTextEditor editor) { this.editor = editor; errorPixbuf = Xwt.Drawing.Image.FromResource("gutter-error-15.png"); warningPixbuf = Xwt.Drawing.Image.FromResource("gutter-warning-15.png"); editor.EditorOptionsChanged += HandleEditorEditorOptionsChanged; editor.TextArea.LeaveNotifyEvent += HandleLeaveNotifyEvent; editor.TextArea.MotionNotifyEvent += HandleMotionNotifyEvent; editor.TextArea.BeginHover += HandleBeginHover; editor.VAdjustment.ValueChanged += HandleValueChanged; editor.HAdjustment.ValueChanged += HandleValueChanged; fontDescription = FontService.GetFontDescription("Pad"); tooltipFontDescription = FontService.GetFontDescription("Pad").CopyModified(weight: Pango.Weight.Bold); errorCountFontDescription = FontService.GetFontDescription("Pad").CopyModified(weight: Pango.Weight.Bold); }
public TooltipInformationWindow() : base() { TypeHint = Gdk.WindowTypeHint.Tooltip; this.SkipTaskbarHint = true; this.SkipPagerHint = true; if (IdeApp.Workbench != null) { this.TransientFor = IdeApp.Workbench.RootWindow; } this.AllowShrink = false; this.AllowGrow = false; this.CanFocus = false; this.CanDefault = false; this.Events |= Gdk.EventMask.EnterNotifyMask; headlabel = new FixedWidthWrapLabel(); headlabel.Indent = -20; var des = FontService.GetFontDescription("Editor").Copy(); des.Size = des.Size * 9 / 10; headlabel.FontDescription = des; // headlabel.MaxWidth = 400; headlabel.Wrap = Pango.WrapMode.WordChar; headlabel.BreakOnCamelCasing = false; headlabel.BreakOnPunctuation = false; descriptionBox.Spacing = 4; VBox vb = new VBox(false, 8); vb.PackStart(headlabel, true, true, 0); vb.PackStart(descriptionBox, true, true, 0); HBox hb = new HBox(false, 0); hb.PackStart(vb, true, true, 0); WindowTransparencyDecorator.Attach(this); vb2.Spacing = 4; vb2.PackStart(hb, true, true, 0); ContentBox.Add(vb2); var scheme = Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme); Theme.SetSchemeColors(scheme); foreColor = scheme.PlainText.Foreground; headlabel.ModifyFg(StateType.Normal, (HslColor)foreColor); ShowAll(); DesktopService.RemoveWindowShadow(this); }
public TooltipInformationWindow() : base() { TypeHint = Gdk.WindowTypeHint.Tooltip; this.SkipTaskbarHint = true; this.SkipPagerHint = true; if (IdeApp.Workbench != null) { this.TransientFor = IdeApp.Workbench.RootWindow; } this.AllowShrink = false; this.AllowGrow = false; this.CanFocus = false; this.CanDefault = false; this.Events |= Gdk.EventMask.EnterNotifyMask; headLabel = new FixedWidthWrapLabel(); headLabel.Indent = -20; headLabel.FontDescription = FontService.GetFontDescription("Editor(TooltipSource)");; headLabel.Wrap = Pango.WrapMode.WordChar; headLabel.BreakOnCamelCasing = false; headLabel.BreakOnPunctuation = false; descriptionBox.Spacing = 4; VBox vb = new VBox(false, 8); vb.PackStart(headLabel, true, true, 4); vb.PackStart(descriptionBox, true, true, 4); HBox hb = new HBox(false, 4); hb.PackStart(vb, true, true, 6); WindowTransparencyDecorator.Attach(this); vb2.Spacing = 4; vb2.PackStart(hb, true, true, 0); ContentBox.Add(vb2); SetDefaultScheme(); ShowAll(); DesktopService.RemoveWindowShadow(this); }
public ParameterInformationWindow() { TypeHint = Gdk.WindowTypeHint.Tooltip; this.SkipTaskbarHint = true; this.SkipPagerHint = true; this.AllowShrink = false; this.AllowGrow = false; this.CanFocus = false; this.CanDefault = false; Mono.TextEditor.PopupWindow.WindowTransparencyDecorator.Attach(this); headlabel = new MonoDevelop.Components.FixedWidthWrapLabel(); headlabel.Indent = -20; headlabel.FontDescription = FontService.GetFontDescription("Editor").CopyModified(1.1); headlabel.Wrap = Pango.WrapMode.WordChar; headlabel.BreakOnCamelCasing = false; headlabel.BreakOnPunctuation = false; descriptionBox.Spacing = 4; VBox vb = new VBox(false, 0); vb.PackStart(headlabel, true, true, 0); vb.PackStart(descriptionBox, true, true, 0); HBox hb = new HBox(false, 0); hb.PackStart(vb, true, true, 0); vb2.Spacing = 4; vb2.PackStart(hb, true, true, 0); ContentBox.Add(vb2); var scheme = Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme); Theme.SetSchemeColors(scheme); foreColor = scheme.PlainText.Foreground; headlabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); ShowAll(); DesktopService.RemoveWindowShadow(this); }
void UpdateStyle() { var scheme = SyntaxHighlightingService.GetEditorTheme(IdeApp.Preferences.ColorScheme); if (!scheme.FitsIdeTheme(IdeApp.Preferences.UserInterfaceTheme)) { scheme = SyntaxHighlightingService.GetDefaultColorStyle(IdeApp.Preferences.UserInterfaceTheme); } Theme.SetSchemeColors(scheme); Theme.Font = FontService.SansFont.CopyModified(Styles.FontScale11).ToXwtFont(); Theme.ShadowColor = Styles.PopoverWindow.ShadowColor; foreColor = Styles.PopoverWindow.DefaultTextColor.ToCairoColor(); headlabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); headlabel.FontDescription = FontService.GetFontDescription("Editor").CopyModified(Styles.FontScale11); //if (this.Visible) // QueueDraw (); }
void SetFont() { // TODO: Add font property to ICompletionWidget; if (itemFont != null) { itemFont.Dispose(); } itemFont = FontService.GetFontDescription("Editor").Copy(); var provider = CompletionWidget as ITextEditorDataProvider; if (provider != null) { var newSize = (itemFont.Size * provider.GetTextEditorData().Options.Zoom); if (newSize > 0) { itemFont.Size = (int)newSize; layout.FontDescription = itemFont; } } }
internal void EnsureLayoutCreated(TextEditor editor) { if (layouts != null) { return; } layouts = new List <MessageBubbleCache.LayoutDescriptor> (); foreach (ErrorText errorText in errors) { layouts.Add(cache.CreateLayoutDescriptor(errorText)); } if (errorCountLayout == null && errors.Count > 1) { errorCountLayout = new Pango.Layout(editor.PangoContext); errorCountLayout.FontDescription = FontService.GetFontDescription("MessageBubbles"); errorCountLayout.SetText(errors.Count.ToString()); } }
internal void SetDefaultScheme() { var scheme = SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme); if (!scheme.FitsIdeSkin(IdeApp.Preferences.UserInterfaceSkin)) { scheme = SyntaxModeService.GetDefaultColorStyle(IdeApp.Preferences.UserInterfaceSkin); } Theme.SetSchemeColors(scheme); foreColor = Styles.PopoverWindow.DefaultTextColor.ToCairoColor(); headLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); headLabel.FontDescription = FontService.GetFontDescription("Editor").CopyModified(Styles.FontScale11); Theme.Font = FontService.SansFont.CopyModified(Styles.FontScale11); Theme.ShadowColor = Styles.PopoverWindow.ShadowColor.ToCairoColor(); if (this.Visible) { ShowOverload(); } }
public void AddOverload(CompletionData data) { var tooltipInformation = data.CreateTooltipInformation(false); if (tooltipInformation.IsEmpty) { return; } using (var layout = new Pango.Layout(PangoContext)) { layout.FontDescription = FontService.GetFontDescription("Editor"); layout.SetMarkup(tooltipInformation.SignatureMarkup); int w, h; layout.GetPixelSize(out w, out h); if (w >= Allocation.Width - 10) { tooltipInformation = data.CreateTooltipInformation(true); } } AddOverload(tooltipInformation); }