Browse Source

fixed SD-1833 - Method Insight popup exceeds screen

pull/23/head
Siegfried Pammer 14 years ago
parent
commit
a2878f4015
  1. 6
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs
  2. 9
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/InsightWindow.cs
  3. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/OverloadInsightWindow.cs

6
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs

@ -308,7 +308,11 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion @@ -308,7 +308,11 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
UpdatePosition();
}
void UpdatePosition()
/// <summary>
/// Updates the position of the CompletionWindow based on the parent TextView position and the screen working area.
/// It ensures that the CompletionWindow is completely visible on the screen.
/// </summary>
protected void UpdatePosition()
{
TextView textView = this.TextArea.TextView;
// PointToScreen returns device dependent units (physical pixels)

9
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/InsightWindow.cs

@ -29,9 +29,16 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion @@ -29,9 +29,16 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
{
this.CloseAutomatically = true;
AttachEvents();
}
/// <inheritdoc/>
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
Rect caret = this.TextArea.Caret.CalculateCaretRectangle();
Rect workingArea = System.Windows.Forms.Screen.FromPoint(caret.Location.ToSystemDrawing()).WorkingArea.ToWpf();
Point pointOnScreen = this.TextArea.TextView.PointToScreen(caret.Location - this.TextArea.TextView.ScrollOffset);
Rect workingArea = System.Windows.Forms.Screen.FromPoint(pointOnScreen.ToSystemDrawing()).WorkingArea.ToWpf().TransformFromDevice(this);
MaxHeight = workingArea.Height;
MaxWidth = Math.Min(workingArea.Width, Math.Max(1000, workingArea.Width * 0.6));

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/OverloadInsightWindow.cs

@ -48,6 +48,10 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion @@ -48,6 +48,10 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
overloadViewer.ChangeIndex(+1);
break;
}
if (e.Handled) {
UpdateLayout();
UpdatePosition();
}
}
}
}

Loading…
Cancel
Save