Adds Undo/Redo to ReClass.NET#263
Conversation
…olbar button to toolbar menu item so it can have a shortcut too.
…sable from different nodes. Changed VTable node so it always displays the RTTI information if available.
…e class. This required some hairy work in a lot of places as the context menu wasn't usable on nested classes. It now is
…table pointer automatically.
…ks without opening the menu. Made the window a bit wider (was too small already) so all toolbar buttons are visible
… it gets removed when the window is too narrow
… the window is too narrow to make room for undo/redo buttons
…romBuffer to MemoryBuffer, have refactored Hex32Node to use this method instead, have removed unnecessary braces and brackets.
…dlers to the ShowException method in Program so it always catches all exceptions thrown
…ost elements are now undo/redo aware
|
Status on this? |
Sorry, something went wrong.
|
I think @KN4CK3R has to find some time to handle this, and perhaps is currently busy with other things. If you want to use it, you can pull this PR's code and build it yourself. |
Sorry, something went wrong.
|
It would be great if it were possible to view and go back to any point in the history, and if that history was saved directly in the structure (project) file itself. |
Sorry, something went wrong.
|
I am just testing and it's pretty buggy overall. |
Sorry, something went wrong.
What does 'buggy' mean in this case? |
Sorry, something went wrong.
|
When you play around adding removing stuff undo / redo does not properly bring back previous state of the offset. |
Sorry, something went wrong.
|
Hmm, strange, it worked fine when I wrote it. It's been a very long time I looked at it tho |
Sorry, something went wrong.
|
It mostly is :) Thank you |
Sorry, something went wrong.
I've implemented this in a separate branch (with the changes from my previous PR #262 already merged).
What's changed?
I didn't implement undo/redo for enums as the enum functionality is a bit broken I think (there's an add event but not a remove event for instance. I had it working more or less but didn't want to add it just yet) so I left it as-is.
I added this using Algorithmia's command system. This is a library I wrote a long time ago and maintain since, and it's very stable. It comes with 2 nuget packages (algorithmia and bcl extensions).
The system basically tracks commands executed through the command queue manager and records every command in the 'active' queue on top of the stack. So when a command A changes something that executes a command B, B will end up in A's command queue and B's command queue is then put on top of the stack. This way you can track multiple commands within the scope of a single command and undo/redo them in 1 go. A command is an object with a lambda that makes a change and it has optional lambda's to obtain the pre-change state and the post-change state. Algorithmia has several datastructures that mimic BCL classes (like list) and wrappers (to wrap members to make them undo/redo aware) and they take care of change checking and event raising as well.
I have tested it with several class hierarchies and I think it works ok, but I know from experience that Undo/Redo code can get hairy at times especially in edge cases, e.g. multiple undo/redo sequences work ok but perhaps I missed an edge case and an event handler creates duplicate elements when redoing the whole tree of commands.
Let me know if you need additional info, or if I have to make additional changes :)
NOTE the commits in this PR are apparently also the ones in #262 :( Which sucks, and might be complicate file reviewing. If you want to wait reviewing this because of that, that's fine. I'm sorry this happened, I honestly don't know how to avoid that.