Browse Source

Made tooltip static so only one tooltip can be displayed at one time.

Tooltip now shows current value of local variables/parameters when debugging.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@101 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
8b3d5f9b89
  1. 22
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  2. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
  3. 18
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs
  4. 2
      src/Main/Base/Project/Src/Internal/Auswerter/IsProcessRunningAuswerter.cs
  5. 23
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
  6. 8
      src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
  7. 5
      src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

22
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -342,5 +342,27 @@ namespace ICSharpCode.SharpDevelop.Services @@ -342,5 +342,27 @@ namespace ICSharpCode.SharpDevelop.Services
// WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent.RedrawContent();
//}
}
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.
/// </summary>
public string GetValueAsString(string variableName)
{
VariableCollection collection = NDebugger.LocalVariables;
if (collection == null)
return null;
foreach (Variable v in collection) {
if (v.Name == variableName) {
object val = v.Value;
if (val == null)
return "<null>";
else if (val is string)
return "\"" + val.ToString() + "\"";
else
return val.ToString();
}
}
return null;
}
}
}

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
// <file>
// <owner name="David Srbecký" email="dsrbecky@post.cz"/>
// <owner name="David Srbeck" email="dsrbecky@post.cz"/>
// </file>
using System;
@ -308,6 +308,7 @@ namespace DebuggerLibrary @@ -308,6 +308,7 @@ namespace DebuggerLibrary
static public Thread CurrentThread {
get {
if (!IsDebugging) return null;
return CurrentProcess.CurrentThread;
}
set {
@ -317,6 +318,7 @@ namespace DebuggerLibrary @@ -317,6 +318,7 @@ namespace DebuggerLibrary
static public Thread MainThread {
get {
if (!IsDebugging) return null;
return CurrentProcess.MainThread;
}
set {
@ -326,12 +328,14 @@ namespace DebuggerLibrary @@ -326,12 +328,14 @@ namespace DebuggerLibrary
static public SourcecodeSegment NextStatement {
get {
if (!IsDebugging) return null;
return CurrentProcess.NextStatement;
}
}
static public VariableCollection LocalVariables {
get {
if (!IsDebugging) return null;
return CurrentProcess.LocalVariables;
}
}

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

@ -55,9 +55,6 @@ namespace ICSharpCode.TextEditor @@ -55,9 +55,6 @@ namespace ICSharpCode.TextEditor
SelectionManager selectionManager;
Caret caret;
ToolTip toolTip = new ToolTip();
bool toolTipSet = false;
public TextEditorControl MotherTextEditorControl {
get {
return motherTextEditorControl;
@ -296,18 +293,22 @@ namespace ICSharpCode.TextEditor @@ -296,18 +293,22 @@ namespace ICSharpCode.TextEditor
}
}
string oldToolTip;
// static because the mouse can only be in one text area and we don't want to have
// tooltips of text areas from inactive tabs floating around.
static ToolTip toolTip;
static string oldToolTip;
bool toolTipSet;
public void SetToolTip(string text)
{
if (toolTip == null) toolTip = new ToolTip();
toolTipSet = (text != null);
if (oldToolTip == text)
return;
ToolTip toolTip = this.toolTip;
if (text == null) {
//Console.WriteLine("Tooltip disabled");
toolTip.Hide(this.FindForm());
toolTip.Hide(this);
} else {
//Console.WriteLine("Tooltip set to " + text);
Point p = PointToClient(Control.MousePosition);
p.Offset(3, 3);
toolTip.Show(text, this, p);
@ -696,7 +697,6 @@ namespace ICSharpCode.TextEditor @@ -696,7 +697,6 @@ namespace ICSharpCode.TextEditor
base.Dispose(disposing);
if (disposing) {
Caret.Dispose();
toolTip.Dispose();
}
}

2
src/Main/Base/Project/Src/Internal/Auswerter/IsProcessRunningAuswerter.cs

@ -19,7 +19,7 @@ namespace ICSharpCode.Core @@ -19,7 +19,7 @@ namespace ICSharpCode.Core
bool isprocessrunning = Boolean.Parse(condition.Properties["isprocessrunning"]);
string isDebugging = condition.Properties.Get("isdebugging", String.Empty);
IDebugger debugger = DebuggerService.CurrentDebugger;
return isprocessrunning == DebuggerService.IsProcessRuning &&
return isprocessrunning == DebuggerService.IsProcessRunning &&
(isDebugging == String.Empty ||
DebuggerService.IsDebugging == Boolean.Parse(isDebugging)
);

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

@ -66,7 +66,7 @@ namespace ICSharpCode.Core @@ -66,7 +66,7 @@ namespace ICSharpCode.Core
}
}
public static bool IsProcessRuning {
public static bool IsProcessRunning {
get {
if (standardProcess != null) {
return isRunning;
@ -175,7 +175,7 @@ namespace ICSharpCode.Core @@ -175,7 +175,7 @@ namespace ICSharpCode.Core
public static void StartWithoutDebugging(System.Diagnostics.ProcessStartInfo psi)
{
if (IsProcessRuning) {
if (IsProcessRunning) {
return;
}
try {
@ -200,7 +200,7 @@ namespace ICSharpCode.Core @@ -200,7 +200,7 @@ namespace ICSharpCode.Core
public static void Start(string fileName, string workingDirectory, string arguments)
{
if (IsProcessRuning) {
if (IsProcessRunning) {
return;
}
oldLayoutConfiguration = LayoutConfiguration.CurrentLayoutName;
@ -548,7 +548,9 @@ namespace ICSharpCode.Core @@ -548,7 +548,9 @@ namespace ICSharpCode.Core
if (expression != null && expression.Length > 0) {
if (expression == oldExpression && oldLine == logicPos.Y) {
// same expression in same line -> reuse old tooltip
if (oldToolTip != null) {
textArea.SetToolTip(oldToolTip);
}
// SetToolTip must be called in every mousemove event,
// otherwise textArea will close the tooltip.
} else {
@ -586,10 +588,21 @@ namespace ICSharpCode.Core @@ -586,10 +588,21 @@ namespace ICSharpCode.Core
ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedNames
| ConversionFlags.ShowReturnType
| ConversionFlags.QualifiedNamesOnlyForReturnTypes;
StringBuilder b = new StringBuilder();
if (rr.IsParameter)
return "parameter " + ambience.Convert(rr.Field);
b.Append("parameter ");
else
return "local variable " + ambience.Convert(rr.Field);
b.Append("local variable ");
b.Append(ambience.Convert(rr.Field));
IDebugger debugger = CurrentDebugger;
if (debugger != null) {
string currentValue = debugger.GetValueAsString(rr.Field.Name);
if (currentValue != null) {
b.Append(" = ");
b.Append(currentValue);
}
}
return b.ToString();
} else if (result is NamespaceResolveResult) {
return "namespace " + ((NamespaceResolveResult)result).Name;
} else if (result is TypeResolveResult) {

8
src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs

@ -134,5 +134,13 @@ namespace ICSharpCode.Core @@ -134,5 +134,13 @@ namespace ICSharpCode.Core
}
public event EventHandler DebugStopped;
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.
/// </summary>
public string GetValueAsString(string variable)
{
return null;
}
}
}

5
src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

@ -66,5 +66,10 @@ namespace ICSharpCode.Core @@ -66,5 +66,10 @@ namespace ICSharpCode.Core
void StepOut();
event EventHandler DebugStopped;
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.
/// </summary>
string GetValueAsString(string variable);
}
}

Loading…
Cancel
Save