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

18
ILSpy/TextView/XmlDocRenderer.cs

@ -109,6 +109,15 @@ namespace ICSharpCode.ILSpy.TextView @@ -109,6 +109,15 @@ namespace ICSharpCode.ILSpy.TextView
var document = new TextDocument(signature);
var richText = highlighting ?? DocumentPrinter.ConvertTextDocumentToRichText(document, new DocumentHighlighter(document, highlightingDefinition)).ToRichTextModel();
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.FontFamily = GetCodeFont();
block.TextAlignment = TextAlignment.Left;
@ -262,11 +271,9 @@ namespace ICSharpCode.ILSpy.TextView @@ -262,11 +271,9 @@ namespace ICSharpCode.ILSpy.TextView
}
}
bool? ParseBool(string input)
{
bool result;
if (bool.TryParse(input, out result))
if (bool.TryParse(input, out bool result))
return result;
else
return null;
@ -356,8 +363,9 @@ namespace ICSharpCode.ILSpy.TextView @@ -356,8 +363,9 @@ namespace ICSharpCode.ILSpy.TextView
if (referencedEntity != null) {
if (element.Children.Any()) {
Hyperlink link = new Hyperlink();
// TODO
//link.Click += CreateNavigateOnClickHandler(referencedEntity);
link.Click += (sender, e) => {
MainWindow.Instance.JumpToReference(referencedEntity);
};
AddSpan(link, element.Children);
} else {
AddInline(ConvertReference(referencedEntity));

Loading…
Cancel
Save