Skip to content

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
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
Added undo/redo for Class AddressFormula. Wired up auto-exception han…
…dlers to the ShowException method in Program so it always catches all exceptions thrown
  • Loading branch information
FransBouma committed Jul 4, 2023
commit 528708debe6a5a506c9174549c372f698d2345d6
1 change: 0 additions & 1 deletion ReClass.NET/Nodes/BaseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public abstract class BaseNode

private static int nodeIndex = 0;

//private string name = string.Empty;
private CommandifiedMember<string, Constants.GeneralPurposeChangeType> name;
private string comment = string.Empty;

Expand Down
10 changes: 9 additions & 1 deletion ReClass.NET/Nodes/ClassNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using System.Linq;
using ReClassNET.Controls;
using ReClassNET.UI;
using SD.Tools.Algorithmia.GeneralDataStructures;
using SD.Tools.Algorithmia.GeneralDataStructures.EventArguments;

namespace ReClassNET.Nodes
{
Expand All @@ -28,14 +30,20 @@ public class ClassNode : BaseContainerNode

public Guid Uuid { get; set; }

public string AddressFormula { get; set; } = DefaultAddressFormula;
private CommandifiedMember<string, Constants.GeneralPurposeChangeType> addressFormula;
public string AddressFormula
{
get => addressFormula.MemberValue;
set => addressFormula.MemberValue = value;
}

public event NodeEventHandler NodesChanged;

internal ClassNode(bool notifyClassCreated)
{
Contract.Ensures(AddressFormula != null);

addressFormula = new CommandifiedMember<string, Constants.GeneralPurposeChangeType>("AddressFormula", Constants.GeneralPurposeChangeType.None, DefaultAddressFormula);
LevelsOpen.DefaultValue = true;

Uuid = Guid.NewGuid();
Expand Down
18 changes: 17 additions & 1 deletion ReClass.NET/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.Threading;
using System.Windows.Forms;
using Microsoft.SqlServer.MessageBox;
using ReClassNET.Core;
Expand Down Expand Up @@ -43,6 +44,11 @@ static void Main(string[] args)
DesignMode = false; // The designer doesn't call Main()
CommandQueueID = Guid.NewGuid();

// wire event handlers for unhandled exceptions, so these will be shown using our own method.
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic, true);
Application.ThreadException += new ThreadExceptionEventHandler(Program.Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException+=new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

CommandLineArgs = new CommandLineArgs(args);

try
Expand Down Expand Up @@ -107,7 +113,17 @@ static void Main(string[] args)

SettingsSerializer.Save(Settings);
}


private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
ShowException(e.Exception);
}

private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
ShowException(e.ExceptionObject as Exception);
}

/// <summary>Shows the exception in a special form.</summary>
/// <param name="ex">The exception.</param>
public static void ShowException(Exception ex)
Expand Down