impr: Added various new events

This commit is contained in:
WerWolv
2023-04-06 17:36:28 +02:00
parent 7c18ad49ae
commit c73f33aac2
8 changed files with 28 additions and 4 deletions

View File

@@ -52,7 +52,7 @@ namespace hex::plugin::builtin {
});
}
};
if (provider == nullptr) {
success = false;
continue;

View File

@@ -83,6 +83,7 @@ namespace hex::plugin::builtin {
void FileProvider::save() {
this->applyPatches();
Provider::save();
}
void FileProvider::saveAs(const std::fs::path &path) {

View File

@@ -219,6 +219,7 @@ namespace hex::plugin::builtin {
void GDBProvider::save() {
this->applyPatches();
Provider::save();
}
size_t GDBProvider::getActualSize() const {

View File

@@ -36,6 +36,8 @@ namespace hex::plugin::builtin {
});
ImHexApi::Provider::markDirty();
EventManager::post<EventBookmarkCreated>(ProviderExtraData::getCurrent().bookmarks.back());
});
ImHexApi::HexEditor::addBackgroundHighlightingProvider([](u64 address, const u8* data, size_t size, bool) -> std::optional<color_t> {

View File

@@ -181,8 +181,10 @@ namespace hex::plugin::builtin {
if (this->m_hasUnevaluatedChanges && this->m_runningEvaluators == 0 && this->m_runningParsers == 0) {
this->m_hasUnevaluatedChanges = false;
auto code = this->m_textEditor.GetText();
EventManager::post<EventPatternEditorChanged>(code);
TaskManager::createBackgroundTask("Pattern Parsing", [this, code = this->m_textEditor.GetText(), provider](auto &){
TaskManager::createBackgroundTask("Pattern Parsing", [this, code, provider](auto &){
this->parsePattern(code, provider);
if (this->m_runAutomatically)
@@ -697,6 +699,7 @@ namespace hex::plugin::builtin {
ContentRegistry::PatternLanguage::configureRuntime(*patternLanguage.runtime, provider);
EventManager::post<EventHighlightingChanged>();
EventManager::post<EventPatternExecuted>(code);
TaskManager::createTask("hex.builtin.view.pattern_editor.evaluating", TaskManager::NoProgress, [this, &patternLanguage, code](auto &task) {
std::scoped_lock lock(patternLanguage.runtimeMutex);

View File

@@ -99,6 +99,9 @@ namespace hex::plugin::builtin {
if (entry.isFolder) {
Tar tar(this->m_downloadPath, Tar::Mode::Read);
tar.extractAll(this->m_downloadPath.parent_path() / this->m_downloadPath.stem());
EventManager::post<EventStoreContentDownloaded>(this->m_downloadPath.parent_path() / this->m_downloadPath.stem());
} else {
EventManager::post<EventStoreContentDownloaded>(this->m_downloadPath);
}
downloadDoneCallback();
@@ -286,6 +289,7 @@ namespace hex::plugin::builtin {
wolv::io::fs::removeAll(folderPath);
removed = removed && !wolv::io::fs::exists(filePath) && !wolv::io::fs::exists(folderPath);
EventManager::post<EventStoreContentRemoved>(filePath);
}
return removed;