Skip to content

Commit 627a910

Browse files
committed
Merge pull request #673 from Neverbirth/debugtree_copy
Debugtree copy
2 parents 895c48b + 293d502 commit 627a910

File tree

15 files changed

+1099
-170
lines changed

15 files changed

+1099
-170
lines changed

External/Plugins/FlashDebugger/Controls/DataTipForm.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ public void SetVariable(Variable variable, String path)
4545
public void SetVariable(Variable variable)
4646
{
4747
DataTree.Nodes.Clear();
48-
DataTree.AddNode(new VariableNode(variable));
48+
DataTree.AddNode(new VariableNode(variable)
49+
{
50+
HideClassId = PluginMain.settingObject.HideClassIds,
51+
HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
52+
});
4953
DoResize();
5054
}
5155

External/Plugins/FlashDebugger/Controls/DataTree/ValueNode.cs

Lines changed: 133 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ public int ChildrenShowLimit
1212
set { m_ChildrenShowLimit = value; }
1313
}
1414

15+
public bool HideFullClasspath { get; set; }
16+
public bool HideClassId { get; set; }
17+
1518
protected Value m_Value;
1619
private bool m_bEditing = false;
1720

21+
/// <summary>
22+
/// Get the display value based on user's preferences
23+
/// </summary>
1824
public override string Value
1925
{
2026
get
@@ -27,7 +33,38 @@ public override string Value
2733
string temp = null;
2834
if (type == VariableType_.MOVIECLIP || type == VariableType_.OBJECT)
2935
{
30-
return m_Value.getTypeName();
36+
string typeStr = "";
37+
if (HideFullClasspath)
38+
{
39+
// return class type without classpath
40+
string typeName = m_Value.getTypeName().ToString();
41+
if (typeName.StartsWith("__AS3__.vec::Vector.<") || typeName.StartsWith("Vector.<"))
42+
typeStr = "Vector.<" + typeName.AfterLast("::", true);
43+
else
44+
typeStr = typeName.After("::", 0, true).Replace("::", ".");
45+
}
46+
else
47+
{
48+
// return class type with classpath
49+
typeStr = m_Value.getTypeName().ToString().Replace("::", ".");
50+
}
51+
52+
// show / hide IDs
53+
typeStr = HideClassId ? typeStr.Before("@") : typeStr.Replace("@", " @");
54+
55+
// rename array
56+
if (typeStr.StartsWith("[]"))
57+
{
58+
typeStr = typeStr.Replace("[]", "Array");
59+
}
60+
61+
// rename vector
62+
else if (typeStr.StartsWith("__AS3__.vec.Vector.<"))
63+
{
64+
typeStr = typeStr.Replace("__AS3__.vec.Vector.<", "Vector.<");
65+
}
66+
67+
return typeStr;
3168
}
3269
else if (type == VariableType_.NUMBER)
3370
{
@@ -56,22 +93,21 @@ public override string Value
5693
{
5794
if (m_Value.getValueAsObject() != null)
5895
{
59-
return "\"" + escape(m_Value.ToString()) + "\"";
96+
return "\"" + Escape(m_Value.ToString()) + "\"";
6097
}
6198
}
6299
else if (type == VariableType_.NULL)
63100
{
64101
return "null";
65102
}
66-
/*else if (type == VariableType_.FUNCTION)
103+
else if (type == VariableType_.FUNCTION)
67104
{
68-
m_Value.ToString();
69-
//return "<setter>";
70-
}*/
105+
return "Function @" + m_Value.ToString();
106+
}
71107
temp = m_Value.ToString();
72108
if (!m_bEditing)
73109
{
74-
temp = escape(temp);
110+
temp = Escape(temp);
75111
}
76112
return temp;
77113
}
@@ -81,7 +117,96 @@ public override string Value
81117
}
82118
}
83119

84-
private string escape(string text)
120+
/// <summary>
121+
/// Get the full classpath of the value, eg: "flash.display.MovieClip"
122+
/// </summary>
123+
public string ClassPath
124+
{
125+
get
126+
{
127+
128+
if (m_Value == null)
129+
{
130+
return null;
131+
}
132+
int type = m_Value.getType();
133+
if (type == VariableType_.MOVIECLIP || type == VariableType_.OBJECT)
134+
{
135+
string typeStr = m_Value.getTypeName().replaceAll("::", ".").ToString().Before("@");
136+
137+
if (typeStr == "[]")
138+
{
139+
return "Array";
140+
}
141+
return typeStr;
142+
143+
}
144+
else if (type == VariableType_.NUMBER)
145+
{
146+
return "Number";
147+
}
148+
else if (type == VariableType_.BOOLEAN)
149+
{
150+
return "Boolean";
151+
}
152+
else if (type == VariableType_.STRING)
153+
{
154+
return "String";
155+
}
156+
else if (type == VariableType_.NULL)
157+
{
158+
return "null";
159+
}
160+
else if (type == VariableType_.FUNCTION)
161+
{
162+
return "Function";
163+
}
164+
return null;
165+
}
166+
}
167+
168+
/// <summary>
169+
/// Get the object ID with the class name
170+
/// </summary>
171+
public string Id
172+
{
173+
get
174+
{
175+
if (m_Value != null)
176+
{
177+
int type = m_Value.getType();
178+
if (type == VariableType_.MOVIECLIP || type == VariableType_.OBJECT)
179+
{
180+
return m_Value.getTypeName().replaceAll("::", ".").replaceAll("@", " - ").ToString();
181+
}
182+
else if (type == VariableType_.FUNCTION)
183+
{
184+
return "Function - " + m_Value.ToString();
185+
}
186+
}
187+
return "";
188+
}
189+
}
190+
191+
/// <summary>
192+
/// Check if the value is a primitive type (int, Number, String, Boolean)
193+
/// </summary>
194+
public bool IsPrimitive
195+
{
196+
get
197+
{
198+
if (m_Value == null)
199+
{
200+
return false;
201+
}
202+
int type = m_Value.getType();
203+
return type == VariableType_.NUMBER || type == VariableType_.BOOLEAN ||
204+
type == VariableType_.STRING || type == VariableType_.NULL;
205+
}
206+
}
207+
208+
209+
private string Escape(string text)
85210
{
86211
text = text.Replace("\\", "\\\\");
87212
text = text.Replace("\"", "\\\"");

0 commit comments

Comments
 (0)