Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@235 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
16 changed files with 329 additions and 89 deletions
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using DebuggerLibrary; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.Pads |
||||
{ |
||||
class BaseClassItem: VariableListItem |
||||
{ |
||||
ObjectVariable variable; |
||||
|
||||
public override bool IsValid { |
||||
get { |
||||
return variable != null && |
||||
variable.HasBaseClass && |
||||
variable.BaseClass.Type != "System.Object"; |
||||
} |
||||
} |
||||
|
||||
public BaseClassItem(Variable baseClassOfVariable): base() |
||||
{ |
||||
this.variable = baseClassOfVariable as ObjectVariable; |
||||
Refresh(); |
||||
} |
||||
|
||||
public override void Refresh() |
||||
{ |
||||
if (!IsValid) { |
||||
return; |
||||
} |
||||
|
||||
SetTexts("<Base class>", |
||||
variable.BaseClass.Value.ToString(), |
||||
variable.BaseClass.Type); |
||||
|
||||
ImageIndex = 0; // Class
|
||||
|
||||
if (variable.BaseClass.MayHaveSubVariables) { // Always true
|
||||
Items.Add(new PlaceHolderItem()); // Show plus icon
|
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.Pads |
||||
{ |
||||
class PlaceHolderItem: VariableListItem |
||||
{ |
||||
public override bool IsValid { |
||||
get { |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,79 @@
@@ -0,0 +1,79 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using DebuggerLibrary; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.Pads |
||||
{ |
||||
class VariableItem: VariableListItem |
||||
{ |
||||
Variable variable; |
||||
|
||||
bool baseClassItemAdded = false; |
||||
|
||||
public Variable Variable { |
||||
get { |
||||
return variable; |
||||
} |
||||
set { |
||||
variable = value; |
||||
} |
||||
} |
||||
|
||||
public override bool IsValid { |
||||
get { |
||||
return variable != null && |
||||
!variable.Name.StartsWith("CS$"); |
||||
} |
||||
} |
||||
|
||||
public VariableItem(Variable variable): base() |
||||
{ |
||||
this.variable = variable; |
||||
Refresh(); |
||||
} |
||||
|
||||
public override void PrepareForExpansion() |
||||
{ |
||||
UpdateSubVariables(); |
||||
} |
||||
|
||||
public override void Refresh() |
||||
{ |
||||
if (!IsValid) { |
||||
return; |
||||
} |
||||
|
||||
SetTexts(variable.Name, |
||||
variable.Value.ToString(), |
||||
variable.Type); |
||||
|
||||
if (variable is ObjectVariable) { |
||||
ImageIndex = 0; // Class
|
||||
} else if (variable is PropertyVariable){ |
||||
ImageIndex = 2; // Property
|
||||
} else { |
||||
ImageIndex = 1; // Field
|
||||
} |
||||
|
||||
if (variable.MayHaveSubVariables && !IsExpanded) { |
||||
Items.Add(new PlaceHolderItem()); // Show plus icon
|
||||
} |
||||
|
||||
if (IsExpanded) { |
||||
UpdateSubVariables(); |
||||
} |
||||
} |
||||
|
||||
void UpdateSubVariables() { |
||||
if (!baseClassItemAdded) { |
||||
VariableListItem baseClassItem = new BaseClassItem(variable); |
||||
if (baseClassItem.IsValid) { |
||||
this.Items.Add(baseClassItem); |
||||
} |
||||
baseClassItemAdded = true; |
||||
} |
||||
LocalVarPad.UpdateVariables(this.Items, Variable.SubVariables); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using System.Windows.Forms; |
||||
using System.Drawing; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.Pads |
||||
{ |
||||
abstract class VariableListItem: TreeListViewItem |
||||
{ |
||||
bool textsInitialized; |
||||
|
||||
public abstract bool IsValid { |
||||
get; |
||||
} |
||||
|
||||
public VariableListItem() |
||||
{ |
||||
Reset(); |
||||
} |
||||
|
||||
public virtual void PrepareForExpansion() |
||||
{ |
||||
|
||||
} |
||||
|
||||
public virtual void Reset() |
||||
{ |
||||
SubItems.Clear(); |
||||
Text = ""; |
||||
SubItems.Add(""); |
||||
SubItems.Add(""); |
||||
} |
||||
|
||||
public virtual void Refresh() |
||||
{ |
||||
|
||||
} |
||||
|
||||
protected void SetTexts(string name, string value, string type) |
||||
{ |
||||
if (value == SubItems[1].Text || !textsInitialized) { |
||||
// Value has not changed since last setting
|
||||
if (SubItems[1].ForeColor != Color.Black) { |
||||
SubItems[1].ForeColor = Color.Black; |
||||
SubItems[1].Font = new Font(SubItems[1].Font, FontStyle.Regular); |
||||
} |
||||
} else { |
||||
// Value has changed since last setting
|
||||
if (SubItems[1].ForeColor != Color.Blue) { |
||||
SubItems[1].ForeColor = Color.Blue; |
||||
SubItems[1].Font = new Font(SubItems[1].Font, FontStyle.Bold); |
||||
} |
||||
} |
||||
|
||||
if (SubItems[0].Text != name) { |
||||
SubItems[0].Text = name; |
||||
} |
||||
if (SubItems[1].Text != value) { |
||||
SubItems[1].Text = value; |
||||
} |
||||
if (SubItems[2].Text != type) { |
||||
SubItems[2].Text = type; |
||||
} |
||||
|
||||
textsInitialized = true; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue