Browse Source

Adjust width of the tooltip, so signatures are displayed on one line.

pull/1654/head
Siegfried Pammer 6 years ago
parent
commit
32b52efff4
  1. 2
      ILSpy/TextView/DecompilerTextView.cs
  2. 18
      ILSpy/TextView/XmlDocRenderer.cs

2
ILSpy/TextView/DecompilerTextView.cs

@ -394,7 +394,7 @@ namespace ICSharpCode.ILSpy.TextView
public FlowDocumentTooltip(FlowDocument document) public FlowDocumentTooltip(FlowDocument document)
{ {
TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display); TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display);
viewer = new FlowDocumentScrollViewer() { HorizontalScrollBarVisibility = ScrollBarVisibility.Visible }; viewer = new FlowDocumentScrollViewer() { Width = document.MinPageWidth + 100 };
viewer.Document = document; viewer.Document = document;
Border border = new Border { Border border = new Border {
Background = SystemColors.ControlBrush, Background = SystemColors.ControlBrush,

18
ILSpy/TextView/XmlDocRenderer.cs

@ -109,6 +109,15 @@ namespace ICSharpCode.ILSpy.TextView
var document = new TextDocument(signature); var document = new TextDocument(signature);
var richText = highlighting ?? DocumentPrinter.ConvertTextDocumentToRichText(document, new DocumentHighlighter(document, highlightingDefinition)).ToRichTextModel(); var richText = highlighting ?? DocumentPrinter.ConvertTextDocumentToRichText(document, new DocumentHighlighter(document, highlightingDefinition)).ToRichTextModel();
var block = new Paragraph(); var block = new Paragraph();
// HACK: measure width of signature using a TextBlock
// Paragraph sadly does not support TextWrapping.NoWrap
var text = new TextBlock {
FontFamily = GetCodeFont(),
TextAlignment = TextAlignment.Left
};
text.Inlines.AddRange(richText.CreateRuns(document));
text.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
this.document.MinPageWidth = text.DesiredSize.Width;
block.Inlines.AddRange(richText.CreateRuns(document)); block.Inlines.AddRange(richText.CreateRuns(document));
block.FontFamily = GetCodeFont(); block.FontFamily = GetCodeFont();
block.TextAlignment = TextAlignment.Left; block.TextAlignment = TextAlignment.Left;
@ -262,11 +271,9 @@ namespace ICSharpCode.ILSpy.TextView
} }
} }
bool? ParseBool(string input) bool? ParseBool(string input)
{ {
bool result; if (bool.TryParse(input, out bool result))
if (bool.TryParse(input, out result))
return result; return result;
else else
return null; return null;
@ -356,8 +363,9 @@ namespace ICSharpCode.ILSpy.TextView
if (referencedEntity != null) { if (referencedEntity != null) {
if (element.Children.Any()) { if (element.Children.Any()) {
Hyperlink link = new Hyperlink(); Hyperlink link = new Hyperlink();
// TODO link.Click += (sender, e) => {
//link.Click += CreateNavigateOnClickHandler(referencedEntity); MainWindow.Instance.JumpToReference(referencedEntity);
};
AddSpan(link, element.Children); AddSpan(link, element.Children);
} else { } else {
AddInline(ConvertReference(referencedEntity)); AddInline(ConvertReference(referencedEntity));

Loading…
Cancel
Save