Skip to content

Commit 35afcee

Browse files
committed
Defined some node type toolbar buttons as 'As Needed' for overflow if the window is too narrow to make room for undo/redo buttons
1 parent 7bc89c7 commit 35afcee

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

ReClass.NET/Forms/MainForm.Designer.cs

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ReClass.NET/UI/NodeTypesBuilder.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ internal static class NodeTypesBuilder
1414
{
1515
private static readonly List<Type[]> defaultNodeTypeGroupList = new List<Type[]>();
1616
private static readonly Dictionary<Plugin, IReadOnlyList<Type>> pluginNodeTypes = new Dictionary<Plugin, IReadOnlyList<Type>>();
17+
private static readonly HashSet<Type> nodeTypesWhichCanOverflowInToolbar;
1718

1819
static NodeTypesBuilder()
1920
{
@@ -27,6 +28,9 @@ static NodeTypesBuilder()
2728
defaultNodeTypeGroupList.Add(new[] { typeof(PointerNode), typeof(ArrayNode), typeof(UnionNode) });
2829
defaultNodeTypeGroupList.Add(new[] { typeof(ClassInstanceNode) });
2930
defaultNodeTypeGroupList.Add(new[] { typeof(VirtualMethodTableNode), typeof(FunctionNode), typeof(FunctionPtrNode) });
31+
32+
// define the node types which can overflow in the toolbar if the window is too narrow. Add types here which aren't used that much
33+
nodeTypesWhichCanOverflowInToolbar = new HashSet<Type> { typeof(NIntNode), typeof(NUIntNode), typeof(BitFieldNode), typeof(Utf16TextNode), typeof(Utf16TextPtrNode) } ;
3034
}
3135

3236
public static void AddPluginNodeGroup(Plugin plugin, IReadOnlyList<Type> nodeTypes)
@@ -66,6 +70,7 @@ public static IEnumerable<ToolStripItem> CreateToolStripButtons(Action<Type> han
6670
DisplayStyle = ToolStripItemDisplayStyle.Image,
6771
Image = icon,
6872
ShortcutKeys = shortcutKeys,
73+
Overflow = nodeTypesWhichCanOverflowInToolbar.Contains(t) ? ToolStripItemOverflow.AsNeeded : ToolStripItemOverflow.Never,
6974
};
7075
item.Click += clickHandler;
7176
return item;

0 commit comments

Comments
 (0)