Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Adds Undo/Redo to ReClass.NET #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: master
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
05c13a1
Added alt-shortcuts to main context menu
FransBouma Jul 3, 2023
e3660a7
Defined various shortcut keys on the node type menu items. Changed to…
FransBouma Jul 3, 2023
4d3ac22
Moved ReadFromBuffer to MemoryBuffer where it belongs, and it's now u…
FransBouma Jul 3, 2023
4d2f079
Redefined some kb shortcuts, as ctrl-shift-c/v aren't used elsewhere
FransBouma Jul 3, 2023
208454e
Added a way to name a class after RTTI information associated with th…
FransBouma Jul 3, 2023
b61edca
Changed 'Auto-name' into 'Init from RTTI' and it now also inits the v…
FransBouma Jul 3, 2023
68b44d5
Removed alt-key shortcuts from context menu as they can't be viewed a…
FransBouma Jul 3, 2023
c831f9b
Added a toolstrip button for Init class from RTTI so the shortcut wor…
FransBouma Jul 4, 2023
5931050
Initial packages update
FransBouma Jul 4, 2023
dc5225e
Marked Init class from RTTI toolbar button as 'Overflow as needed' so…
FransBouma Jul 4, 2023
7bc89c7
Merge branch 'master' into UndoRedo
FransBouma Jul 4, 2023
35afcee
Defined some node type toolbar buttons as 'As Needed' for overflow if…
FransBouma Jul 4, 2023
fb7b4d6
Initial undo/redo system in place. Class name is now undo/redo aware
FransBouma Jul 4, 2023
aa8a857
Removed 2nd empty lines when introduced, added 32bit version of ReadF…
FransBouma Jul 4, 2023
a01ba4c
Merge branch 'master' into UndoRedo
FransBouma Jul 4, 2023
528708d
Added undo/redo for Class AddressFormula. Wired up auto-exception han…
FransBouma Jul 4, 2023
69790cd
Implemented class list undo/redo, and further class node undo/redo. M…
FransBouma Jul 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Defined various shortcut keys on the node type menu items. Changed to…
…olbar button to toolbar menu item so it can have a shortcut too.
  • Loading branch information
FransBouma committed Jul 3, 2023
commit e3660a7ab11dd9c203c39b62ef42b3a5c93883ca
1 change: 1 addition & 0 deletions 1 ReClass.NET/Forms/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 35 additions & 1 deletion 36 ReClass.NET/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
using System.Drawing;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ReClassNET.Nodes;
using ReClassNET.Util;

namespace ReClassNET
{
public class Settings
{
private readonly Dictionary<Type, Keys> _shortcutKeyPerNode;

public Settings()
{
_shortcutKeyPerNode = new Dictionary<Type, Keys>
{
{ typeof(Hex64Node), Keys.Control | Keys.Shift | Keys.D6 },
{ typeof(ClassInstanceNode), Keys.Control | Keys.Shift | Keys.I },
{ typeof(FloatNode), Keys.Control | Keys.Shift | Keys.F },
{ typeof(Hex8Node), Keys.Control | Keys.Shift | Keys.B },
{ typeof(PointerNode), Keys.Control | Keys.Shift | Keys.P },
{ typeof(Vector2Node), Keys.Control | Keys.Shift | Keys.D2 },
{ typeof(Vector3Node), Keys.Control | Keys.Shift | Keys.D3 },
{ typeof(Vector4Node), Keys.Control | Keys.Shift | Keys.D4 },
{ typeof(VirtualMethodTableNode), Keys.Control | Keys.Shift | Keys.T },
{ typeof(BoolNode), Keys.Control | Keys.Shift | Keys.O },
{ typeof(EnumNode), Keys.Control | Keys.Shift | Keys.E },
{ typeof(Int32Node), Keys.Control | Keys.Shift | Keys.N }
};

// Define more here.
}


// Application Settings

public string LastProcess { get; set; } = string.Empty;
Expand Down Expand Up @@ -76,6 +104,12 @@ public class Settings

public CustomDataMap CustomData { get; } = new CustomDataMap();


public Keys GetShortcutKeyForNodeType(Type nodeType)
{
return !_shortcutKeyPerNode.TryGetValue(nodeType, out var shortcutKeys) ? Keys.None : shortcutKeys;
}

public Settings Clone() => MemberwiseClone() as Settings;
}
}
18 changes: 11 additions & 7 deletions 18 ReClass.NET/UI/NodeTypesBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ public static IEnumerable<ToolStripItem> CreateToolStripButtons(Action<Type> han

return CreateToolStripItems(t =>
{
GetNodeInfoFromType(t, out var label, out var icon);
GetNodeInfoFromType(t, out var label, out var icon, out var shortcutKeys);

var item = new TypeToolStripButton
var item = new TypeToolStripMenuItem
{
Value = t,
ToolTipText = label,
DisplayStyle = ToolStripItemDisplayStyle.Image,
Image = icon
Image = icon,
ShortcutKeys = shortcutKeys,
};
item.Click += clickHandler;
return item;
Expand All @@ -74,7 +75,7 @@ public static IEnumerable<ToolStripItem> CreateToolStripButtons(Action<Type> han
Image = p.Icon
}, t =>
{
GetNodeInfoFromType(t, out var label, out var icon);
GetNodeInfoFromType(t, out var label, out var icon, out var shortcutKeys);

var item = new TypeToolStripMenuItem
{
Expand All @@ -95,13 +96,14 @@ public static IEnumerable<ToolStripItem> CreateToolStripMenuItems(Action<Type> h

var items = CreateToolStripItems(t =>
{
GetNodeInfoFromType(t, out var label, out var icon);
GetNodeInfoFromType(t, out var label, out var icon, out var shortcutKeys);

var item = new TypeToolStripMenuItem
{
Value = t,
Text = label,
Image = icon
Image = icon,
ShortcutKeys = shortcutKeys,
};
item.Click += clickHandler;
return item;
Expand Down Expand Up @@ -166,10 +168,12 @@ private static IEnumerable<ToolStripItem> CreateToolStripItems(Func<Type, ToolSt
return items;
}

private static void GetNodeInfoFromType(Type nodeType, out string label, out Image icon)
private static void GetNodeInfoFromType(Type nodeType, out string label, out Image icon, out Keys shortcutKeys)
{
Contract.Requires(nodeType != null);

shortcutKeys = Program.Settings.GetShortcutKeyForNodeType(nodeType);

var node = BaseNode.CreateInstanceFromType(nodeType, false);
if (node == null)
{
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.