-
Notifications
You must be signed in to change notification settings - Fork 404
Expand file tree
/
Copy pathClassInstanceNode.cs
More file actions
80 lines (65 loc) · 1.9 KB
/
Copy pathClassInstanceNode.cs
File metadata and controls
80 lines (65 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
using ReClassNET.UI;
using ReClassNET.Util;
namespace ReClassNET.Nodes
{
public class ClassInstanceNode : BaseReferenceNode
{
/// <summary>Size of the node in bytes.</summary>
public override int MemorySize => InnerNode.MemorySize;
public override bool PerformCycleCheck => true;
public override void Intialize()
{
InnerNode = ClassNode.Create();
InnerNode.Intialize();
}
/// <summary>Draws this node.</summary>
/// <param name="view">The view information.</param>
/// <param name="x">The x coordinate.</param>
/// <param name="y">The y coordinate.</param>
/// <returns>The height the node occupies.</returns>
public override int Draw(ViewInfo view, int x, int y)
{
if (IsHidden)
{
return DrawHidden(view, x, y);
}
AddSelection(view, x, y, view.Font.Height);
AddDelete(view, x, y);
AddTypeDrop(view, x, y);
x = AddOpenClose(view, x, y);
x = AddIcon(view, x, y, Icons.Class, -1, HotSpotType.None);
var tx = x;
x = AddAddressOffset(view, x, y);
x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, "Instance") + view.Font.Width;
x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name);
x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>");
x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeType);
x += view.Font.Width;
AddComment(view, x, y);
y += view.Font.Height;
if (levelsOpen[view.Level])
{
var v = view.Clone();
v.Address = view.Address.Add(Offset);
v.Memory = view.Memory.Clone();
v.Memory.Offset = Offset.ToInt32();
y = InnerNode.Draw(v, tx, y);
}
return y;
}
public override int CalculateHeight(ViewInfo view)
{
if (IsHidden)
{
return HiddenHeight;
}
var h = view.Font.Height;
if (levelsOpen[view.Level])
{
h += InnerNode.CalculateHeight(view);
}
return h;
}
}
}