impr: Added various new events
This commit is contained in:
parent
7c18ad49ae
commit
c73f33aac2
@ -156,10 +156,17 @@ namespace hex {
|
|||||||
EVENT_DEF(EventProviderClosing, prv::Provider *, bool *);
|
EVENT_DEF(EventProviderClosing, prv::Provider *, bool *);
|
||||||
EVENT_DEF(EventProviderClosed, prv::Provider *);
|
EVENT_DEF(EventProviderClosed, prv::Provider *);
|
||||||
EVENT_DEF(EventProviderDeleted, prv::Provider *);
|
EVENT_DEF(EventProviderDeleted, prv::Provider *);
|
||||||
|
EVENT_DEF(EventProviderSaved, prv::Provider *);
|
||||||
EVENT_DEF(EventFrameBegin);
|
EVENT_DEF(EventFrameBegin);
|
||||||
EVENT_DEF(EventFrameEnd);
|
EVENT_DEF(EventFrameEnd);
|
||||||
EVENT_DEF(EventWindowInitialized);
|
EVENT_DEF(EventWindowInitialized);
|
||||||
EVENT_DEF(EventSetTaskBarIconState, u32, u32, u32);
|
EVENT_DEF(EventSetTaskBarIconState, u32, u32, u32);
|
||||||
|
EVENT_DEF(EventBookmarkCreated, ImHexApi::Bookmarks::Entry&);
|
||||||
|
EVENT_DEF(EventPatchCreated, u64, u8, u8);
|
||||||
|
EVENT_DEF(EventPatternExecuted, const std::string&);
|
||||||
|
EVENT_DEF(EventPatternEditorChanged, const std::string&);
|
||||||
|
EVENT_DEF(EventStoreContentDownloaded, const std::fs::path&);
|
||||||
|
EVENT_DEF(EventStoreContentRemoved, const std::fs::path&);
|
||||||
|
|
||||||
EVENT_DEF(RequestOpenWindow, std::string);
|
EVENT_DEF(RequestOpenWindow, std::string);
|
||||||
EVENT_DEF(RequestSelectionChange, Region);
|
EVENT_DEF(RequestSelectionChange, Region);
|
||||||
|
@ -35,7 +35,9 @@ namespace hex::prv {
|
|||||||
this->markDirty();
|
this->markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Provider::save() { }
|
void Provider::save() {
|
||||||
|
EventManager::post<EventProviderSaved>(this);
|
||||||
|
}
|
||||||
void Provider::saveAs(const std::fs::path &path) {
|
void Provider::saveAs(const std::fs::path &path) {
|
||||||
wolv::io::File file(path, wolv::io::File::Mode::Create);
|
wolv::io::File file(path, wolv::io::File::Mode::Create);
|
||||||
|
|
||||||
@ -56,8 +58,9 @@ namespace hex::prv {
|
|||||||
|
|
||||||
this->read(offset + this->getBaseAddress(), buffer.data(), bufferSize, true);
|
this->read(offset + this->getBaseAddress(), buffer.data(), bufferSize, true);
|
||||||
file.writeBuffer(buffer.data(), bufferSize);
|
file.writeBuffer(buffer.data(), bufferSize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EventManager::post<EventProviderSaved>(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,9 +225,12 @@ namespace hex::prv {
|
|||||||
getPatches().erase(offset + i);
|
getPatches().erase(offset + i);
|
||||||
else
|
else
|
||||||
getPatches()[offset + i] = patch;
|
getPatches()[offset + i] = patch;
|
||||||
|
|
||||||
|
EventManager::post<EventPatchCreated>(offset, originalValue, patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->markDirty();
|
this->markDirty();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Provider::createUndoPoint() {
|
void Provider::createUndoPoint() {
|
||||||
|
@ -52,7 +52,7 @@ namespace hex::plugin::builtin {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (provider == nullptr) {
|
if (provider == nullptr) {
|
||||||
success = false;
|
success = false;
|
||||||
continue;
|
continue;
|
||||||
|
@ -83,6 +83,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
void FileProvider::save() {
|
void FileProvider::save() {
|
||||||
this->applyPatches();
|
this->applyPatches();
|
||||||
|
Provider::save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileProvider::saveAs(const std::fs::path &path) {
|
void FileProvider::saveAs(const std::fs::path &path) {
|
||||||
|
@ -219,6 +219,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
void GDBProvider::save() {
|
void GDBProvider::save() {
|
||||||
this->applyPatches();
|
this->applyPatches();
|
||||||
|
Provider::save();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t GDBProvider::getActualSize() const {
|
size_t GDBProvider::getActualSize() const {
|
||||||
|
@ -36,6 +36,8 @@ namespace hex::plugin::builtin {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ImHexApi::Provider::markDirty();
|
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> {
|
ImHexApi::HexEditor::addBackgroundHighlightingProvider([](u64 address, const u8* data, size_t size, bool) -> std::optional<color_t> {
|
||||||
|
@ -181,8 +181,10 @@ namespace hex::plugin::builtin {
|
|||||||
if (this->m_hasUnevaluatedChanges && this->m_runningEvaluators == 0 && this->m_runningParsers == 0) {
|
if (this->m_hasUnevaluatedChanges && this->m_runningEvaluators == 0 && this->m_runningParsers == 0) {
|
||||||
this->m_hasUnevaluatedChanges = false;
|
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);
|
this->parsePattern(code, provider);
|
||||||
|
|
||||||
if (this->m_runAutomatically)
|
if (this->m_runAutomatically)
|
||||||
@ -697,6 +699,7 @@ namespace hex::plugin::builtin {
|
|||||||
ContentRegistry::PatternLanguage::configureRuntime(*patternLanguage.runtime, provider);
|
ContentRegistry::PatternLanguage::configureRuntime(*patternLanguage.runtime, provider);
|
||||||
|
|
||||||
EventManager::post<EventHighlightingChanged>();
|
EventManager::post<EventHighlightingChanged>();
|
||||||
|
EventManager::post<EventPatternExecuted>(code);
|
||||||
|
|
||||||
TaskManager::createTask("hex.builtin.view.pattern_editor.evaluating", TaskManager::NoProgress, [this, &patternLanguage, code](auto &task) {
|
TaskManager::createTask("hex.builtin.view.pattern_editor.evaluating", TaskManager::NoProgress, [this, &patternLanguage, code](auto &task) {
|
||||||
std::scoped_lock lock(patternLanguage.runtimeMutex);
|
std::scoped_lock lock(patternLanguage.runtimeMutex);
|
||||||
|
@ -99,6 +99,9 @@ namespace hex::plugin::builtin {
|
|||||||
if (entry.isFolder) {
|
if (entry.isFolder) {
|
||||||
Tar tar(this->m_downloadPath, Tar::Mode::Read);
|
Tar tar(this->m_downloadPath, Tar::Mode::Read);
|
||||||
tar.extractAll(this->m_downloadPath.parent_path() / this->m_downloadPath.stem());
|
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();
|
downloadDoneCallback();
|
||||||
@ -286,6 +289,7 @@ namespace hex::plugin::builtin {
|
|||||||
wolv::io::fs::removeAll(folderPath);
|
wolv::io::fs::removeAll(folderPath);
|
||||||
|
|
||||||
removed = removed && !wolv::io::fs::exists(filePath) && !wolv::io::fs::exists(folderPath);
|
removed = removed && !wolv::io::fs::exists(filePath) && !wolv::io::fs::exists(folderPath);
|
||||||
|
EventManager::post<EventStoreContentRemoved>(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return removed;
|
return removed;
|
||||||
|
Loading…
Reference in New Issue
Block a user