diff --git a/ReClass.NET/Controls/DrawContextRequestEventArgs.cs b/ReClass.NET/Controls/DrawContextRequestEventArgs.cs index 2f57a36f..13c04d03 100644 --- a/ReClass.NET/Controls/DrawContextRequestEventArgs.cs +++ b/ReClass.NET/Controls/DrawContextRequestEventArgs.cs @@ -1,6 +1,7 @@ using System; using ReClassNET.Memory; using ReClassNET.Nodes; +using ReClassNET.UI; namespace ReClassNET.Controls { @@ -10,6 +11,8 @@ public class DrawContextRequestEventArgs : EventArgs public Settings Settings { get; set; } + public IconProvider IconProvider { get; set; } + public RemoteProcess Process { get; set; } public MemoryBuffer Memory { get; set; } diff --git a/ReClass.NET/Controls/MemoryViewControl.cs b/ReClass.NET/Controls/MemoryViewControl.cs index c6d2742c..34d8741c 100644 --- a/ReClass.NET/Controls/MemoryViewControl.cs +++ b/ReClass.NET/Controls/MemoryViewControl.cs @@ -126,6 +126,7 @@ protected override void OnPaint(PaintEventArgs e) Settings = args.Settings, Context = e.Graphics, Font = font, + IconProvider = args.IconProvider, Process = args.Process, Memory = args.Memory, CurrentTime = args.CurrentTime, diff --git a/ReClass.NET/Controls/ViewInfo.cs b/ReClass.NET/Controls/ViewInfo.cs index 7f0028e5..84b5fb91 100644 --- a/ReClass.NET/Controls/ViewInfo.cs +++ b/ReClass.NET/Controls/ViewInfo.cs @@ -12,6 +12,7 @@ public class ViewInfo public Graphics Context { get; set; } public FontEx Font { get; set; } + public IconProvider IconProvider { get; set; } public RemoteProcess Process { get; set; } public MemoryBuffer Memory { get; set; } @@ -31,6 +32,7 @@ public ViewInfo Clone() Settings = Settings, Context = Context, Font = Font, + IconProvider = IconProvider, Process = Process, Memory = Memory, CurrentTime = CurrentTime, diff --git a/ReClass.NET/Forms/MainForm.cs b/ReClass.NET/Forms/MainForm.cs index 32526168..9b6aa9bb 100644 --- a/ReClass.NET/Forms/MainForm.cs +++ b/ReClass.NET/Forms/MainForm.cs @@ -27,6 +27,7 @@ namespace ReClassNET.Forms public partial class MainForm : IconForm { private readonly PluginManager pluginManager; + private readonly IconProvider iconProvider = new IconProvider(); private ReClassNetProject currentProject; public ReClassNetProject CurrentProject => currentProject; @@ -1011,6 +1012,7 @@ private void memoryViewControl_DrawContextRequested(object sender, DrawContextRe memoryViewBuffer.UpdateFrom(process, address); args.Settings = Program.Settings; + args.IconProvider = iconProvider; args.Process = process; args.Memory = memoryViewBuffer; args.Node = classNode; diff --git a/ReClass.NET/Nodes/BaseFunctionPtrNode.cs b/ReClass.NET/Nodes/BaseFunctionPtrNode.cs index 476fff1c..0a4d4a9f 100644 --- a/ReClass.NET/Nodes/BaseFunctionPtrNode.cs +++ b/ReClass.NET/Nodes/BaseFunctionPtrNode.cs @@ -37,9 +37,9 @@ protected Size Draw(ViewInfo view, int x, int y, string type, string name) AddSelection(view, x, y, view.Font.Height); - x += TextPadding; + x = AddIconPadding(view, x); - x = AddIcon(view, x, y, Icons.Function, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.Function, HotSpot.NoneId, HotSpotType.None); var tx = x; diff --git a/ReClass.NET/Nodes/BaseHexNode.cs b/ReClass.NET/Nodes/BaseHexNode.cs index b32f745a..cce27cab 100644 --- a/ReClass.NET/Nodes/BaseHexNode.cs +++ b/ReClass.NET/Nodes/BaseHexNode.cs @@ -45,7 +45,9 @@ protected Size Draw(ViewInfo view, int x, int y, string text, int length) AddSelection(view, x, y, view.Font.Height); - x += TextPadding + 16; + x = AddIconPadding(view, x); + x = AddIconPadding(view, x); + x = AddAddressOffset(view, x, y); if (!string.IsNullOrEmpty(text)) diff --git a/ReClass.NET/Nodes/BaseMatrixNode.cs b/ReClass.NET/Nodes/BaseMatrixNode.cs index 55057e0a..7a1927d0 100644 --- a/ReClass.NET/Nodes/BaseMatrixNode.cs +++ b/ReClass.NET/Nodes/BaseMatrixNode.cs @@ -33,9 +33,9 @@ protected Size DrawMatrixType(ViewInfo view, int x, int y, string type, DrawMatr AddSelection(view, x, y, view.Font.Height); - x += TextPadding; + x = AddIconPadding(view, x); - x = AddIcon(view, x, y, Icons.Matrix, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.Matrix, HotSpot.NoneId, HotSpotType.None); var tx = x; @@ -83,9 +83,9 @@ protected Size DrawVectorType(ViewInfo view, int x, int y, string type, DrawVect AddSelection(view, x, y, view.Font.Height); - x += TextPadding; + x = AddIconPadding(view, x); - x = AddIcon(view, x, y, Icons.Vector, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.Vector, HotSpot.NoneId, HotSpotType.None); x = AddAddressOffset(view, x, y); x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; diff --git a/ReClass.NET/Nodes/BaseNode.cs b/ReClass.NET/Nodes/BaseNode.cs index 05e21eb9..953f2db9 100644 --- a/ReClass.NET/Nodes/BaseNode.cs +++ b/ReClass.NET/Nodes/BaseNode.cs @@ -20,7 +20,6 @@ public abstract class BaseNode internal static readonly List NodeInfoReader = new List(); - protected static readonly int TextPadding = Icons.Dimensions; protected static readonly int HiddenHeight = 0; private static int nodeIndex = 0; @@ -383,6 +382,11 @@ protected void AddSelection(ViewInfo view, int x, int y, int height) AddHotSpot(view, new Rectangle(0, y, view.ClientArea.Right - (IsSelected ? 16 : 0), height), string.Empty, HotSpot.NoneId, HotSpotType.Select); } + protected int AddIconPadding(ViewInfo view, int x) + { + return x + view.IconProvider.Dimensions; + } + /// Draws an icon and adds a if is not . /// The view information. /// The x coordinate. @@ -397,19 +401,21 @@ protected int AddIcon(ViewInfo view, int x, int y, Image icon, int id, HotSpotTy Contract.Requires(view.Context != null); Contract.Requires(icon != null); - if (y > view.ClientArea.Bottom || y + Icons.Dimensions < 0) + var size = view.IconProvider.Dimensions; + + if (y > view.ClientArea.Bottom || y + size < 0) { - return x + Icons.Dimensions; + return x + size; } - view.Context.DrawImage(icon, x + 2, y, Icons.Dimensions, Icons.Dimensions); + view.Context.DrawImage(icon, x + 2, y, size, size); if (id != HotSpot.NoneId) { - AddHotSpot(view, new Rectangle(x, y, Icons.Dimensions, Icons.Dimensions), string.Empty, id, type); + AddHotSpot(view, new Rectangle(x, y, size, size), string.Empty, id, type); } - return x + Icons.Dimensions; + return x + size; } /// Adds a togglable Open/Close icon. @@ -422,12 +428,13 @@ protected int AddOpenCloseIcon(ViewInfo view, int x, int y) Contract.Requires(view != null); Contract.Requires(view.Context != null); - if (y > view.ClientArea.Bottom || y + Icons.Dimensions < 0) + if (y > view.ClientArea.Bottom || y + view.IconProvider.Dimensions < 0) { - return x + Icons.Dimensions; + return x + view.IconProvider.Dimensions; } - return AddIcon(view, x, y, LevelsOpen[view.Level] ? Icons.OpenCloseOpen : Icons.OpenCloseClosed, 0, HotSpotType.OpenClose); + var icon = LevelsOpen[view.Level] ? view.IconProvider.OpenCloseOpen : view.IconProvider.OpenCloseClosed; + return AddIcon(view, x, y, icon, 0, HotSpotType.OpenClose); } /// Draws a context drop icon if the node is selected. @@ -438,14 +445,14 @@ protected void AddContextDropDownIcon(ViewInfo view, int y) Contract.Requires(view != null); Contract.Requires(view.Context != null); - if (view.MultipleNodesSelected || y > view.ClientArea.Bottom || y + Icons.Dimensions < 0 || IsWrapped) + if (view.MultipleNodesSelected || y > view.ClientArea.Bottom || y + view.IconProvider.Dimensions < 0 || IsWrapped) { return; } if (IsSelected) { - AddIcon(view, 0, y, Icons.DropArrow, 0, HotSpotType.Context); + AddIcon(view, 0, y, view.IconProvider.DropArrow, 0, HotSpotType.Context); } } @@ -457,14 +464,14 @@ protected void AddDeleteIcon(ViewInfo view, int y) Contract.Requires(view != null); Contract.Requires(view.Context != null); - if (y > view.ClientArea.Bottom || y + Icons.Dimensions < 0 || IsWrapped) + if (y > view.ClientArea.Bottom || y + view.IconProvider.Dimensions < 0 || IsWrapped) { return; } if (IsSelected) { - AddIcon(view, view.ClientArea.Right - Icons.Dimensions, y, Icons.Delete, 0, HotSpotType.Delete); + AddIcon(view, view.ClientArea.Right - view.IconProvider.Dimensions, y, view.IconProvider.Delete, 0, HotSpotType.Delete); } } diff --git a/ReClass.NET/Nodes/BaseNumericNode.cs b/ReClass.NET/Nodes/BaseNumericNode.cs index 5714b9f0..c0a540fc 100644 --- a/ReClass.NET/Nodes/BaseNumericNode.cs +++ b/ReClass.NET/Nodes/BaseNumericNode.cs @@ -32,7 +32,7 @@ protected Size DrawNumeric(ViewInfo view, int x, int y, Image icon, string type, AddSelection(view, x, y, view.Font.Height); - x += TextPadding; + x = AddIconPadding(view, x); x = AddIcon(view, x, y, icon, HotSpot.NoneId, HotSpotType.None); x = AddAddressOffset(view, x, y); diff --git a/ReClass.NET/Nodes/BaseTextNode.cs b/ReClass.NET/Nodes/BaseTextNode.cs index e35fd6b7..70b52dda 100644 --- a/ReClass.NET/Nodes/BaseTextNode.cs +++ b/ReClass.NET/Nodes/BaseTextNode.cs @@ -42,8 +42,9 @@ protected Size DrawText(ViewInfo view, int x, int y, string type) AddSelection(view, x, y, view.Font.Height); - x += TextPadding; - x = AddIcon(view, x, y, Icons.Text, HotSpot.NoneId, HotSpotType.None); + x = AddIconPadding(view, x); + + x = AddIcon(view, x, y, view.IconProvider.Text, HotSpot.NoneId, HotSpotType.None); x = AddAddressOffset(view, x, y); x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; diff --git a/ReClass.NET/Nodes/BaseTextPtrNode.cs b/ReClass.NET/Nodes/BaseTextPtrNode.cs index ea32e11b..df0f6ee2 100644 --- a/ReClass.NET/Nodes/BaseTextPtrNode.cs +++ b/ReClass.NET/Nodes/BaseTextPtrNode.cs @@ -39,8 +39,9 @@ public Size DrawText(ViewInfo view, int x, int y, string type) AddSelection(view, x, y, view.Font.Height); - x += TextPadding; - x = AddIcon(view, x, y, Icons.Text, HotSpot.NoneId, HotSpotType.None); + x = AddIconPadding(view, x); + + x = AddIcon(view, x, y, view.IconProvider.Text, HotSpot.NoneId, HotSpotType.None); x = AddAddressOffset(view, x, y); x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; diff --git a/ReClass.NET/Nodes/BaseWrapperArrayNode.cs b/ReClass.NET/Nodes/BaseWrapperArrayNode.cs index 5ec12c14..6694ba6f 100644 --- a/ReClass.NET/Nodes/BaseWrapperArrayNode.cs +++ b/ReClass.NET/Nodes/BaseWrapperArrayNode.cs @@ -40,7 +40,7 @@ protected Size Draw(ViewInfo view, int x, int y, string type) AddSelection(view, x, y, view.Font.Height); x = AddOpenCloseIcon(view, x, y); - x = AddIcon(view, x, y, Icons.Array, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.Array, HotSpot.NoneId, HotSpotType.None); var tx = x; x = AddAddressOffset(view, x, y); @@ -54,14 +54,14 @@ protected Size Draw(ViewInfo view, int x, int y, string type) x = AddText(view, x, y, view.Settings.IndexColor, IsReadOnly ? HotSpot.NoneId : 0, Count.ToString()); x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "]"); - x = AddIcon(view, x, y, Icons.LeftArrow, 2, HotSpotType.Click); + x = AddIcon(view, x, y, view.IconProvider.LeftArrow, 2, HotSpotType.Click); x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "("); x = AddText(view, x, y, view.Settings.IndexColor, 1, CurrentIndex.ToString()); x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, ")"); - x = AddIcon(view, x, y, Icons.RightArrow, 3, HotSpotType.Click) + view.Font.Width; + x = AddIcon(view, x, y, view.IconProvider.RightArrow, 3, HotSpotType.Click) + view.Font.Width; x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"") + view.Font.Width; - x = AddIcon(view, x + 2, y, Icons.Change, 4, HotSpotType.ChangeWrappedType); + x = AddIcon(view, x + 2, y, view.IconProvider.Change, 4, HotSpotType.ChangeWrappedType); x += view.Font.Width; x = AddComment(view, x, y); diff --git a/ReClass.NET/Nodes/BitFieldNode.cs b/ReClass.NET/Nodes/BitFieldNode.cs index 733d4f8f..f12b4f0b 100644 --- a/ReClass.NET/Nodes/BitFieldNode.cs +++ b/ReClass.NET/Nodes/BitFieldNode.cs @@ -122,7 +122,8 @@ public override Size Draw(ViewInfo view, int x, int y) AddSelection(view, x, y, view.Font.Height); - x += TextPadding + Icons.Dimensions; + x = AddIconPadding(view, x); + x = AddIconPadding(view, x); x = AddAddressOffset(view, x, y); diff --git a/ReClass.NET/Nodes/BoolNode.cs b/ReClass.NET/Nodes/BoolNode.cs index b5f12f5a..e448b8f4 100644 --- a/ReClass.NET/Nodes/BoolNode.cs +++ b/ReClass.NET/Nodes/BoolNode.cs @@ -25,7 +25,8 @@ public override Size Draw(ViewInfo view, int x, int y) AddSelection(view, x, y, view.Font.Height); - x += TextPadding + Icons.Dimensions; + x = AddIconPadding(view, x); + x = AddIconPadding(view, x); x = AddAddressOffset(view, x, y); diff --git a/ReClass.NET/Nodes/ClassInstanceNode.cs b/ReClass.NET/Nodes/ClassInstanceNode.cs index d5c36a54..a6395c6b 100644 --- a/ReClass.NET/Nodes/ClassInstanceNode.cs +++ b/ReClass.NET/Nodes/ClassInstanceNode.cs @@ -30,7 +30,7 @@ public override Size Draw(ViewInfo view, int x, int y) AddSelection(view, x, y, view.Font.Height); x = AddOpenCloseIcon(view, x, y); - x = AddIcon(view, x, y, Icons.Class, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.Class, HotSpot.NoneId, HotSpotType.None); var tx = x; x = AddAddressOffset(view, x, y); @@ -41,7 +41,7 @@ public override Size Draw(ViewInfo view, int x, int y) x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; } x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>") + view.Font.Width; - x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeClassType) + view.Font.Width; + x = AddIcon(view, x, y, view.IconProvider.Change, 4, HotSpotType.ChangeClassType) + view.Font.Width; x = AddComment(view, x, y); diff --git a/ReClass.NET/Nodes/ClassNode.cs b/ReClass.NET/Nodes/ClassNode.cs index 7ce6a53f..3c4897a3 100644 --- a/ReClass.NET/Nodes/ClassNode.cs +++ b/ReClass.NET/Nodes/ClassNode.cs @@ -96,7 +96,7 @@ public override Size Draw(ViewInfo view, int x, int y) var tx = x; - x = AddIcon(view, x, y, Icons.Class, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.Class, HotSpot.NoneId, HotSpotType.None); x = AddText(view, x, y, view.Settings.OffsetColor, 0, AddressFormula) + view.Font.Width; x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Class") + view.Font.Width; diff --git a/ReClass.NET/Nodes/DoubleNode.cs b/ReClass.NET/Nodes/DoubleNode.cs index 7c0deda8..f37e4c08 100644 --- a/ReClass.NET/Nodes/DoubleNode.cs +++ b/ReClass.NET/Nodes/DoubleNode.cs @@ -17,7 +17,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override Size Draw(ViewInfo view, int x, int y) { - return DrawNumeric(view, x, y, Icons.Double, "Double", ReadValueFromMemory(view.Memory).ToString("0.000"), null); + return DrawNumeric(view, x, y, view.IconProvider.Double, "Double", ReadValueFromMemory(view.Memory).ToString("0.000"), null); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/EnumNode.cs b/ReClass.NET/Nodes/EnumNode.cs index f4b16ca7..cc6f25df 100644 --- a/ReClass.NET/Nodes/EnumNode.cs +++ b/ReClass.NET/Nodes/EnumNode.cs @@ -146,9 +146,9 @@ public override Size Draw(ViewInfo view, int x, int y) AddSelection(view, x, y, view.Font.Height); - x += TextPadding; + x = AddIconPadding(view, x); - x = AddIcon(view, x, y, Icons.Enum, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.Enum, HotSpot.NoneId, HotSpotType.None); x = AddAddressOffset(view, x, y); @@ -158,7 +158,7 @@ public override Size Draw(ViewInfo view, int x, int y) x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; } x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"<{Enum.Name}>") + view.Font.Width; - x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeEnumType) + view.Font.Width; + x = AddIcon(view, x, y, view.IconProvider.Change, 4, HotSpotType.ChangeEnumType) + view.Font.Width; x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, "=") + view.Font.Width; diff --git a/ReClass.NET/Nodes/FloatNode.cs b/ReClass.NET/Nodes/FloatNode.cs index 4fe0072b..73e47e7a 100644 --- a/ReClass.NET/Nodes/FloatNode.cs +++ b/ReClass.NET/Nodes/FloatNode.cs @@ -17,7 +17,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override Size Draw(ViewInfo view, int x, int y) { - return DrawNumeric(view, x, y, Icons.Float, "Float", ReadValueFromMemory(view.Memory).ToString("0.000"), null); + return DrawNumeric(view, x, y, view.IconProvider.Float, "Float", ReadValueFromMemory(view.Memory).ToString("0.000"), null); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/FunctionNode.cs b/ReClass.NET/Nodes/FunctionNode.cs index 0f5311cb..75dd6d2b 100644 --- a/ReClass.NET/Nodes/FunctionNode.cs +++ b/ReClass.NET/Nodes/FunctionNode.cs @@ -44,9 +44,9 @@ public override Size Draw(ViewInfo view, int x, int y) AddSelection(view, x, y, view.Font.Height); - x += TextPadding; + x = AddIconPadding(view, x); - x = AddIcon(view, x, y, Icons.Function, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.Function, HotSpot.NoneId, HotSpotType.None); var tx = x; @@ -82,7 +82,7 @@ public override Size Draw(ViewInfo view, int x, int y) y += view.Font.Height; x = AddText(view, tx, y, view.Settings.TextColor, HotSpot.NoneId, "Belongs to: "); x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, BelongsToClass == null ? "" : $"<{BelongsToClass.Name}>") + view.Font.Width; - x = AddIcon(view, x, y, Icons.Change, 1, HotSpotType.ChangeClassType); + x = AddIcon(view, x, y, view.IconProvider.Change, 1, HotSpotType.ChangeClassType); size.Width = Math.Max(size.Width, x - origX); size.Height += view.Font.Height; diff --git a/ReClass.NET/Nodes/Int16Node.cs b/ReClass.NET/Nodes/Int16Node.cs index 7d4c7e1e..cba270a4 100644 --- a/ReClass.NET/Nodes/Int16Node.cs +++ b/ReClass.NET/Nodes/Int16Node.cs @@ -20,7 +20,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override Size Draw(ViewInfo view, int x, int y) { var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Signed, "Int16", value.ToString(), $"0x{value:X}"); + return DrawNumeric(view, x, y, view.IconProvider.Signed, "Int16", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/Int32Node.cs b/ReClass.NET/Nodes/Int32Node.cs index c495e9e0..28518e87 100644 --- a/ReClass.NET/Nodes/Int32Node.cs +++ b/ReClass.NET/Nodes/Int32Node.cs @@ -20,7 +20,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override Size Draw(ViewInfo view, int x, int y) { var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Signed, "Int32", value.ToString(), $"0x{value:X}"); + return DrawNumeric(view, x, y, view.IconProvider.Signed, "Int32", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/Int64Node.cs b/ReClass.NET/Nodes/Int64Node.cs index cd750b94..3cb9e8a5 100644 --- a/ReClass.NET/Nodes/Int64Node.cs +++ b/ReClass.NET/Nodes/Int64Node.cs @@ -20,7 +20,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override Size Draw(ViewInfo view, int x, int y) { var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Signed, "Int64", value.ToString(), $"0x{value:X}"); + return DrawNumeric(view, x, y, view.IconProvider.Signed, "Int64", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/Int8Node.cs b/ReClass.NET/Nodes/Int8Node.cs index bd09480f..4690a69b 100644 --- a/ReClass.NET/Nodes/Int8Node.cs +++ b/ReClass.NET/Nodes/Int8Node.cs @@ -20,7 +20,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override Size Draw(ViewInfo view, int x, int y) { var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Signed, "Int8", value.ToString(), $"0x{value:X}"); + return DrawNumeric(view, x, y, view.IconProvider.Signed, "Int8", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/PointerNode.cs b/ReClass.NET/Nodes/PointerNode.cs index 358c48a3..0c7b5139 100644 --- a/ReClass.NET/Nodes/PointerNode.cs +++ b/ReClass.NET/Nodes/PointerNode.cs @@ -73,9 +73,9 @@ public override Size Draw(ViewInfo view, int x, int y) } else { - x += TextPadding; + x = AddIconPadding(view, x); } - x = AddIcon(view, x, y, Icons.Pointer, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.Pointer, HotSpot.NoneId, HotSpotType.None); var tx = x; x = AddAddressOffset(view, x, y); @@ -89,7 +89,7 @@ public override Size Draw(ViewInfo view, int x, int y) { x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, "") + view.Font.Width; } - x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeWrappedType) + view.Font.Width; + x = AddIcon(view, x, y, view.IconProvider.Change, 4, HotSpotType.ChangeWrappedType) + view.Font.Width; var ptr = view.Memory.ReadIntPtr(Offset); diff --git a/ReClass.NET/Nodes/UInt16Node.cs b/ReClass.NET/Nodes/UInt16Node.cs index 81fb9bc8..32177b36 100644 --- a/ReClass.NET/Nodes/UInt16Node.cs +++ b/ReClass.NET/Nodes/UInt16Node.cs @@ -20,7 +20,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override Size Draw(ViewInfo view, int x, int y) { var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt16", value.ToString(), $"0x{value:X}"); + return DrawNumeric(view, x, y, view.IconProvider.Unsigned, "UInt16", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/UInt32Node.cs b/ReClass.NET/Nodes/UInt32Node.cs index 081b574f..625f58a3 100644 --- a/ReClass.NET/Nodes/UInt32Node.cs +++ b/ReClass.NET/Nodes/UInt32Node.cs @@ -20,7 +20,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override Size Draw(ViewInfo view, int x, int y) { var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt32", value.ToString(), $"0x{value:X}"); + return DrawNumeric(view, x, y, view.IconProvider.Unsigned, "UInt32", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/UInt64Node.cs b/ReClass.NET/Nodes/UInt64Node.cs index 20464b9b..903a8bae 100644 --- a/ReClass.NET/Nodes/UInt64Node.cs +++ b/ReClass.NET/Nodes/UInt64Node.cs @@ -20,7 +20,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override Size Draw(ViewInfo view, int x, int y) { var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt64", value.ToString(), $"0x{value:X}"); + return DrawNumeric(view, x, y, view.IconProvider.Unsigned, "UInt64", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/UInt8Node.cs b/ReClass.NET/Nodes/UInt8Node.cs index a5dec2c9..da5be305 100644 --- a/ReClass.NET/Nodes/UInt8Node.cs +++ b/ReClass.NET/Nodes/UInt8Node.cs @@ -20,7 +20,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override Size Draw(ViewInfo view, int x, int y) { var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt8", value.ToString(), $"0x{value:X}"); + return DrawNumeric(view, x, y, view.IconProvider.Unsigned, "UInt8", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/UnionNode.cs b/ReClass.NET/Nodes/UnionNode.cs index 5506e8f9..e30eb3cb 100644 --- a/ReClass.NET/Nodes/UnionNode.cs +++ b/ReClass.NET/Nodes/UnionNode.cs @@ -57,7 +57,7 @@ public override Size Draw(ViewInfo view, int x, int y) AddSelection(view, x, y, view.Font.Height); x = AddOpenCloseIcon(view, x, y); - x = AddIcon(view, x, y, Icons.Union, -1, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.Union, -1, HotSpotType.None); var tx = x; x = AddAddressOffset(view, x, y); diff --git a/ReClass.NET/Nodes/VirtualMethodTableNode.cs b/ReClass.NET/Nodes/VirtualMethodTableNode.cs index 08d8fc65..64b10a65 100644 --- a/ReClass.NET/Nodes/VirtualMethodTableNode.cs +++ b/ReClass.NET/Nodes/VirtualMethodTableNode.cs @@ -47,7 +47,7 @@ public override Size Draw(ViewInfo view, int x, int y) AddSelection(view, x, y, view.Font.Height); x = AddOpenCloseIcon(view, x, y); - x = AddIcon(view, x, y, Icons.VTable, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(view, x, y, view.IconProvider.VirtualTable, HotSpot.NoneId, HotSpotType.None); var tx = x; x = AddAddressOffset(view, x, y); diff --git a/ReClass.NET/ReClass.NET.csproj b/ReClass.NET/ReClass.NET.csproj index 736b0388..c16db79d 100644 --- a/ReClass.NET/ReClass.NET.csproj +++ b/ReClass.NET/ReClass.NET.csproj @@ -371,6 +371,7 @@ Component + Component @@ -423,7 +424,6 @@ Component - Form diff --git a/ReClass.NET/UI/IconProvider.cs b/ReClass.NET/UI/IconProvider.cs new file mode 100644 index 00000000..f60bce26 --- /dev/null +++ b/ReClass.NET/UI/IconProvider.cs @@ -0,0 +1,31 @@ +using System.Drawing; + +namespace ReClassNET.UI +{ + public class IconProvider + { + public int Dimensions { get; } = DpiUtil.ScaleIntX(16); + + public Image OpenCloseOpen { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Open_Icon); + public Image OpenCloseClosed { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Closed_Icon); + public Image Delete { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Button_Delete); + public Image DropArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Button_Drop_Down); + public Image Class { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Class_Type); + public Image Enum { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Enum_Type); + public Image Array { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Array_Type); + public Image Union => Array; + public Image LeftArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Left_Button); + public Image RightArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Right_Button); + public Image Change { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Exchange_Button); + public Image Unsigned { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Unsigned_Type); + public Image Signed { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Signed_Type); + public Image Float { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Float_Type); + public Image Double { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Double_Type); + public Image Vector { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Vector_Type); + public Image Matrix { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Matrix_Type); + public Image Text { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Text_Type); + public Image Pointer { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Pointer_Type); + public Image Function { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Function_Type); + public Image VirtualTable { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Interface_Type); + } +} diff --git a/ReClass.NET/UI/Icons.cs b/ReClass.NET/UI/Icons.cs deleted file mode 100644 index 0ae65d0e..00000000 --- a/ReClass.NET/UI/Icons.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Drawing; - -namespace ReClassNET.UI -{ - public class Icons - { - public static int Dimensions { get; } = DpiUtil.ScaleIntX(16); - - public static Image OpenCloseOpen { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Open_Icon); - public static Image OpenCloseClosed { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Closed_Icon); - public static Image Delete { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Button_Delete); - public static Image DropArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Button_Drop_Down); - public static Image Class { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Class_Type); - public static Image Enum { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Enum_Type); - public static Image Array { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Array_Type); - public static Image Union => Array; - public static Image LeftArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Left_Button); - public static Image RightArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Right_Button); - public static Image Change { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Exchange_Button); - public static Image Unsigned { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Unsigned_Type); - public static Image Signed { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Signed_Type); - public static Image Float { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Float_Type); - public static Image Double { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Double_Type); - public static Image Vector { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Vector_Type); - public static Image Matrix { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Matrix_Type); - public static Image Text { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Text_Type); - public static Image Pointer { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Pointer_Type); - public static Image Function { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Function_Type); - public static Image VTable { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Interface_Type); - } -}