From a99c5185e4df574bebfb36dc700ab7887b320495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Tue, 19 Apr 2005 18:48:00 +0000 Subject: [PATCH] * Caching of Variable.CorType * Base classes disabled in Local Variables Pad * Icons in subtrees of Local Variables Pad fixed git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@100 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Pads/LocalVarPad.cs | 28 +++++++++++++++---- .../Project/Src/Variables/BuiltInVariable.cs | 4 +-- .../Project/Src/Variables/NullRefVariable.cs | 2 +- .../Project/Src/Variables/Variable.cs | 10 +++++-- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs index 37b2fb8d7b..5515e66337 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs @@ -95,17 +95,17 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads e.Item.Items.Clear(); ObjectVariable var = e.Item.Tag as ObjectVariable; - if (var != null && var.HasBaseClass && var.BaseClass.Type != "System.Object") + /*if (var != null && var.HasBaseClass && var.BaseClass.Type != "System.Object") { TreeListViewItem newItem = new TreeListViewItem(); - newItem.Text = ""; + newItem.Text = "Base class"; newItem.SubItems.Add(var.BaseClass.Value.ToString()); newItem.SubItems.Add(var.BaseClass.Type); newItem.Tag = var.BaseClass; newItem.ImageIndex = 0; // Class newItem.Items.Add(""); // Show plus icon e.Item.Items.Add(newItem); - } + }*/ AddVariables(e.Item.Items, ((Variable)e.Item.Tag).SubVariables); localVarList.EndUpdate(); @@ -132,21 +132,37 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads { RefreshVariable((Variable)sender); } - + void RefreshVariable (Variable var) { - foreach (TreeListViewItem item in localVarList.Items) { + RefreshVariableInItemConnection(var, localVarList.Items); + } + + void RefreshVariableInItemConnection (Variable var, TreeListViewItemCollection items) + { + foreach (TreeListViewItem item in items) { + // Refresh in sub trees + RefreshVariableInItemConnection(var, item.Items); + if (item.Tag == var) { - item.SubItems[1].Text = var.Value.ToString(); + if (item.SubItems[1].Text == null) { + item.SubItems[1].Text = var.Value.ToString(); + } item.SubItems[2].Text = var.Type; item.Items.Clear(); if (var is ObjectVariable && ((ObjectVariable)var).HasBaseClass) { // It is a class item.ImageIndex = 0; // Class item.Items.Add(""); // Show plus icon + + object devNull = (var as ObjectVariable).SubVariables; // Cache variables TODO: LAME + } else if (var is PropertyVariable){ // It is a property item.ImageIndex = 2; // Property + if ((var as PropertyVariable).IsEvaluated && (var as PropertyVariable).Value is ObjectVariable) { + item.Items.Add(""); // Show plus icon + } } else { item.ImageIndex = 1; // Field } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/BuiltInVariable.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/BuiltInVariable.cs index 006489abd4..ac270a353d 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/BuiltInVariable.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/BuiltInVariable.cs @@ -15,7 +15,7 @@ namespace DebuggerLibrary { get { - if (corType == CorElementType.STRING) + if (CorType == CorElementType.STRING) { ((ICorDebugStringValue)corValue).GetString(NDebugger.pStringLen, out NDebugger.unused, @@ -26,7 +26,7 @@ namespace DebuggerLibrary object retValue; IntPtr pValue = Marshal.AllocHGlobal(8); ((ICorDebugGenericValue)corValue).GetValue(pValue); - switch(corType) + switch(CorType) { case CorElementType.BOOLEAN: retValue = *((System.Boolean*)pValue); break; case CorElementType.CHAR: retValue = *((System.Char*)pValue); break; diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/NullRefVariable.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/NullRefVariable.cs index 792240cbeb..9e6e053033 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/NullRefVariable.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/NullRefVariable.cs @@ -21,7 +21,7 @@ namespace DebuggerLibrary { get { - switch (corType) + switch (CorType) { case CorElementType.SZARRAY: case CorElementType.ARRAY: return typeof(System.Array).ToString(); diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs index 391e06f7ba..d5fd9c0002 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs @@ -15,6 +15,7 @@ namespace DebuggerLibrary readonly string name; protected ICorDebugValue corValue; VariableCollection subVariables; + CorElementType? corType; public string Name { @@ -27,15 +28,18 @@ namespace DebuggerLibrary get; } - internal CorElementType corType { + internal CorElementType CorType { get { - return GetCorType(corValue); + if (!corType.HasValue) { + corType = GetCorType(corValue); + } + return corType.Value; } } public virtual string Type { get{ - return CorTypeToString(corType); + return CorTypeToString(CorType); } }