Browse Source

SD2-709. The debugger tooltip will now be closed when moving the mouse away from a variable if no variables have been expanded in the tooltip.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1293 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 20 years ago
parent
commit
36eac67060
  1. 9
      src/Main/Base/Project/Src/Services/Debugger/DebuggerGridControl.cs
  2. 33
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

9
src/Main/Base/Project/Src/Services/Debugger/DebuggerGridControl.cs

@ -93,6 +93,15 @@ namespace ICSharpCode.Core @@ -93,6 +93,15 @@ namespace ICSharpCode.Core
frm.ClientSize = new Size(frm.ClientSize.Width, row.Height + 2);
}
public bool IsMouseOver {
get {
if (frm != null && !frm.IsDisposed) {
return frm.ClientRectangle.Contains(frm.PointToClient(Control.MousePosition));
}
return false;
}
}
void OnTextAreaClick(object sender, EventArgs e)
{
((ICSharpCode.TextEditor.TextArea)sender).KeyDown -= OnTextAreaClick;

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

@ -242,6 +242,7 @@ namespace ICSharpCode.Core @@ -242,6 +242,7 @@ namespace ICSharpCode.Core
textArea.IconBarMargin.MouseDown += IconBarMouseDown;
textArea.ToolTipRequest += TextAreaToolTipRequest;
textArea.MouseLeave += TextAreaMouseLeave;
}
}
@ -252,6 +253,7 @@ namespace ICSharpCode.Core @@ -252,6 +253,7 @@ namespace ICSharpCode.Core
textArea.IconBarMargin.MouseDown -= IconBarMouseDown;
textArea.ToolTipRequest -= TextAreaToolTipRequest;
textArea.MouseLeave -= TextAreaMouseLeave;
}
}
@ -286,6 +288,7 @@ namespace ICSharpCode.Core @@ -286,6 +288,7 @@ namespace ICSharpCode.Core
/// </summary>
static void TextAreaToolTipRequest(object sender, ToolTipRequestEventArgs e)
{
DebuggerGridControl toolTipControl = null;
try {
TextArea textArea = (TextArea)sender;
if (e.ToolTipShown) return;
@ -314,7 +317,6 @@ namespace ICSharpCode.Core @@ -314,7 +317,6 @@ namespace ICSharpCode.Core
ResolveResult result = ParserService.Resolve(expressionResult, logicPos.Y + 1, logicPos.X + 1, textArea.MotherTextEditorControl.FileName, textContent);
bool debuggerCanShowValue;
string toolTipText = GetText(result, expression, out debuggerCanShowValue);
DebuggerGridControl toolTipControl = null;
if (toolTipText != null) {
if (Control.ModifierKeys == Keys.Control) {
toolTipText = "expr: " + expressionResult.ToString() + "\n" + toolTipText;
@ -326,10 +328,7 @@ namespace ICSharpCode.Core @@ -326,10 +328,7 @@ namespace ICSharpCode.Core
if (toolTipText != null) {
e.ShowToolTip(toolTipText);
}
if (oldToolTipControl != null) {
Form frm = oldToolTipControl.FindForm();
if (frm != null) frm.Close();
}
CloseOldToolTip();
if (toolTipControl != null) {
toolTipControl.ShowForm(textArea, logicPos);
}
@ -338,9 +337,33 @@ namespace ICSharpCode.Core @@ -338,9 +337,33 @@ namespace ICSharpCode.Core
}
} catch (Exception ex) {
ICSharpCode.Core.MessageService.ShowError(ex);
} finally {
if (toolTipControl == null && CanCloseOldToolTip)
CloseOldToolTip();
}
}
static bool CanCloseOldToolTip {
get {
return oldToolTipControl != null && oldToolTipControl.AllowClose;
}
}
static void CloseOldToolTip()
{
if (oldToolTipControl != null) {
Form frm = oldToolTipControl.FindForm();
if (frm != null) frm.Close();
oldToolTipControl = null;
}
}
static void TextAreaMouseLeave(object source, EventArgs e)
{
if (CanCloseOldToolTip && !oldToolTipControl.IsMouseOver)
CloseOldToolTip();
}
static string GetText(ResolveResult result, string expression, out bool debuggerCanShowValue)
{
debuggerCanShowValue = false;

Loading…
Cancel
Save