feat: Implement better and more complete undo/redo stack (#1433)

This PR aims to implement a more complete undo/redo stack that, unlike
the old one, also supports undoing insertions, deletions and resize
operations
This commit is contained in:
Nik
2023-11-25 12:43:48 +01:00
committed by GitHub
parent e5f36ca08d
commit 7e660450ed
36 changed files with 904 additions and 325 deletions

View File

@@ -243,6 +243,10 @@ namespace hex {
EVENT_DEF(EventAchievementUnlocked, const Achievement&);
EVENT_DEF(EventSearchBoxClicked);
EVENT_DEF(EventProviderDataModified, prv::Provider *, u64, u64, const u8*);
EVENT_DEF(EventProviderDataInserted, prv::Provider *, u64, u64);
EVENT_DEF(EventProviderDataRemoved, prv::Provider *, u64, u64);
/**
* @brief Called when a project has been loaded
*/
@@ -254,7 +258,8 @@ namespace hex {
EVENT_DEF(RequestOpenWindow, std::string);
EVENT_DEF(RequestSelectionChange, Region);
EVENT_DEF(RequestAddBookmark, Region, std::string, std::string, color_t);
EVENT_DEF(RequestAddBookmark, Region, std::string, std::string, color_t, u64*);
EVENT_DEF(RequestRemoveBookmark, u64);
EVENT_DEF(RequestSetPatternLanguageCode, std::string);
EVENT_DEF(RequestLoadPatternLanguageFile, std::fs::path);
EVENT_DEF(RequestSavePatternLanguageFile, std::fs::path);

View File

@@ -211,6 +211,7 @@ namespace hex {
std::string comment;
u32 color;
bool locked;
u64 id;
};
/**
@@ -220,8 +221,25 @@ namespace hex {
* @param name The name of the bookmark
* @param comment The comment of the bookmark
* @param color The color of the bookmark or 0x00 for the default color
* @return Bookmark ID
*/
void add(u64 address, size_t size, const std::string &name, const std::string &comment, color_t color = 0x00000000);
u64 add(u64 address, size_t size, const std::string &name, const std::string &comment, color_t color = 0x00000000);
/**
* @brief Adds a new bookmark
* @param region The region of the bookmark
* @param name The name of the bookmark
* @param comment The comment of the bookmark
* @param color The color of the bookmark or 0x00 for the default color
* @return Bookmark ID
*/
u64 add(Region region, const std::string &name, const std::string &comment, color_t color = 0x00000000);
/**
* @brief Removes a bookmark
* @param id The ID of the bookmark to remove
*/
void remove(u64 id);
}