Browse Source

Always show tooltips below the code line - patch by Yannick Kiekens (purplebox).

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@704 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
fb12258ca6
  1. 9
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs
  2. 4
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

9
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs

@ -310,6 +310,11 @@ namespace ICSharpCode.TextEditor
} }
public void SetToolTip(string text) public void SetToolTip(string text)
{
SetToolTip(text, -1);
}
public void SetToolTip(string text, int lineNumber)
{ {
if (toolTip == null || toolTip.IsDisposed) toolTip = new DeclarationViewWindow(this.FindForm()); if (toolTip == null || toolTip.IsDisposed) toolTip = new DeclarationViewWindow(this.FindForm());
toolTipSet = (text != null); toolTipSet = (text != null);
@ -319,6 +324,10 @@ namespace ICSharpCode.TextEditor
toolTip.Hide(); toolTip.Hide();
} else { } else {
Point p = Control.MousePosition; Point p = Control.MousePosition;
Point cp = PointToClient(p);
if (lineNumber >= 0) {
p.Y = (p.Y - cp.Y) + (lineNumber * this.TextView.FontHeight) - this.virtualTop.Y;
}
p.Offset(3, 3); p.Offset(3, 3);
toolTip.Location = p; toolTip.Location = p;
toolTip.Description = text; toolTip.Description = text;

4
src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

@ -338,7 +338,7 @@ namespace ICSharpCode.Core
if (expression == oldExpression && oldLine == logicPos.Y) { if (expression == oldExpression && oldLine == logicPos.Y) {
// same expression in same line -> reuse old tooltip // same expression in same line -> reuse old tooltip
if (oldToolTip != null) { if (oldToolTip != null) {
textArea.SetToolTip(oldToolTip); textArea.SetToolTip(oldToolTip, oldLine + 1);
} }
// SetToolTip must be called in every mousemove event, // SetToolTip must be called in every mousemove event,
// otherwise textArea will close the tooltip. // otherwise textArea will close the tooltip.
@ -357,7 +357,7 @@ namespace ICSharpCode.Core
} }
} }
if (toolTipText != null) { if (toolTipText != null) {
textArea.SetToolTip(toolTipText); textArea.SetToolTip(toolTipText, logicPos.Y + 1);
} }
if (oldToolTipControl != null) { if (oldToolTipControl != null) {
Form frm = oldToolTipControl.FindForm(); Form frm = oldToolTipControl.FindForm();

Loading…
Cancel
Save