Commit Graph

18 Commits

Author SHA1 Message Date
haven1433
69ad7c6bb8 Applying patch marks the tab as needing a save
also fix issue with IPS patches
2022-09-21 16:40:13 -05:00
Haven1433
7833c7fbe5 put limits on memory usage
* don't store undo/redo for patches
* don't store more than 1000 byte changes in the model
2022-08-29 21:39:28 -05:00
Haven1433
288a37ad2c Don't clear custom-token flag if marked to continue current transaction
The current transaction can be continued through 'ChangeCompleted' operations via use of the `continueCurrentTransaction` flag. But calling `ChangeCompleted` was still clearing the `customChangeInProgress` flag, which made the ChangeHistory forget that it was in the middle of a custom change. This caused issues if the selection was automatically changed (such as clicking in the text tool) after a custom no-data change (such as from changing the anchor name in the anchor-text)
2022-08-21 20:03:03 -05:00
Haven1433
0e8ab15316 Inserting a custom change should raise CanExecuteChanged 2022-05-20 21:55:56 -05:00
Benjamin Popp
f8e24c1964 Don't generate a token for the model if we don't plan of having the model make any changes.
Also update the Undo/Redo subsystem logic to correctly clear the redo stack when inserting a custom token.
2021-11-04 15:18:22 -05:00
Benjamin Popp
409cc51c31 Undo/Redo should update correctly from Image Editor Palette change
Changing a color in the image editor's palette should enable undo
2021-08-26 16:13:02 -05:00
Benjamin Popp
24490c43e9 undo should raise when a non-data change comes through 2021-07-24 21:50:26 -05:00
Benjamin Popp
682c9963aa Inserted change tokens need callbacks
* We were not notifying on data changes from inserted tokens
* We were not raising CanExecuteChange for Undo/Redo/IsSaved from inserted tokens
2021-07-12 21:49:16 -05:00
Benjamin Popp
5bd065d768 Make sure Undo notifies when it becomes enabled.
Previously, it was notifying change, but before an actual change was made: just when the ViewPort was requesting a token so that it can change. At that point, there's no actual change yet, so CanExecuteChange was still returning false.
2021-02-13 13:12:34 -06:00
Benjamin Popp
ce4f4d0206 Improve ChangeHistory
* Don't allow inserting a custom change during a transaction
* Don't end a transaction when a Goto happens because of a paste-script directive ( @{ or @} ).
2021-02-09 22:36:57 -06:00
Benjamin Popp
32507d3222 Add Redo check after Undo 2020-05-03 22:52:42 -05:00
Benjamin Popp
e765c0f642 'Clear Format' right-click item shouldn't remove data, just false pointers
I want the change to not alter data, so use a `NoDataChangeDeltaModel`
I want the change to be tracked, so have it be part of the history.
This requires the ability to insert custom tokens into the history.
2020-04-06 08:15:06 -05:00
Benjamin Popp
d182f05123 Better Undo/Redo with tools
TextBox keeps track of its own Undo/Redo stack. Normally this is good, but it gets in the way of the `ChangeHistory` object. So disable it.

Bug: Whenever the TextBox changes the selection in the main window, that suddenly counts as a new transaction. This means that as the user is typing in changes, each character gets registered as a separate change. This isn't desirable. Instead, batch the changes together such that any caret movement in the textbox won't cause a new transaction.
2019-10-08 14:34:23 -05:00
Benjamin Popp
996957640a bugfix: undo fix
if you save, then undo, then make a change, it's impossible to be in a clean state. The code didn't handle this correctly.
2019-07-29 20:55:10 -05:00
Benjamin Popp
f9f8b28e84 run auto-formatter 2019-05-12 13:31:18 -05:00
Benjamin Popp
4fa76b1af2 Refactor ViewPort Part 4
Pull the completion code into a new type.
This is actualy way better organized now. But a lot of code had to move, so I'm not confident that I didn't introduce any bugs.
2019-05-10 23:23:28 -05:00
Benjamin Popp
695ff9cdf8 only show the '*' in the tab if there is a data change.
but allow saving even if there's only a format change.
2019-04-20 14:20:02 -05:00
Benjamin Popp
0c8633da52 rename folders / files / projects from Gen3Hex to HexManiac 2019-02-05 20:58:49 -06:00