impr: Various small fixes and improvements

This commit is contained in:
WerWolv
2025-01-31 19:43:39 +01:00
parent e603c75bd3
commit e6ab2c3b7e
30 changed files with 132 additions and 83 deletions

View File

@@ -78,7 +78,7 @@ namespace hex::plugin::builtin {
void importIPSPatch() {
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [path](auto &task) {
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &task) {
auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
auto patch = Patches::fromIPSPatch(patchData);
if (!patch.has_value()) {
@@ -102,7 +102,7 @@ namespace hex::plugin::builtin {
void importIPS32Patch() {
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [path](auto &task) {
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &task) {
auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
auto patch = Patches::fromIPS32Patch(patchData);
if (!patch.has_value()) {
@@ -126,7 +126,7 @@ namespace hex::plugin::builtin {
void importModifiedFile() {
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [path](auto &task) {
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &task) {
auto provider = ImHexApi::Provider::get();
auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
@@ -165,7 +165,7 @@ namespace hex::plugin::builtin {
void exportBase64() {
fs::openFileBrowser(fs::DialogMode::Save, {}, [](const auto &path) {
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [path](auto &) {
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &) {
wolv::io::File outputFile(path, wolv::io::File::Mode::Create);
if (!outputFile.isValid()) {
TaskManager::doLater([] {
@@ -188,7 +188,7 @@ namespace hex::plugin::builtin {
void exportSelectionToFile() {
fs::openFileBrowser(fs::DialogMode::Save, {}, [](const auto &path) {
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [path](auto &task) {
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &task) {
wolv::io::File outputFile(path, wolv::io::File::Mode::Create);
if (!outputFile.isValid()) {
TaskManager::doLater([] {
@@ -216,7 +216,7 @@ namespace hex::plugin::builtin {
for (const auto &formatter : ContentRegistry::DataFormatter::impl::getExportMenuEntries()) {
if (menu::menuItem(Lang(formatter.unlocalizedName), Shortcut::None, false, ImHexApi::Provider::isValid() && ImHexApi::Provider::get()->getActualSize() > 0)) {
fs::openFileBrowser(fs::DialogMode::Save, {}, [&formatter](const auto &path) {
TaskManager::createTask("hex.builtin.task.exporting_data"_lang, TaskManager::NoProgress, [&formatter, path](auto&){
TaskManager::createTask("hex.builtin.task.exporting_data", TaskManager::NoProgress, [&formatter, path](auto&){
auto provider = ImHexApi::Provider::get();
auto selection = ImHexApi::HexEditor::getSelection()
.value_or(
@@ -243,7 +243,7 @@ namespace hex::plugin::builtin {
}
void exportReport() {
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [](auto &) {
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [](auto &) {
std::string data;
for (const auto &provider : ImHexApi::Provider::getProviders()) {
@@ -287,7 +287,7 @@ namespace hex::plugin::builtin {
patches->get().at(0x00454F45) = value;
}
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [patches](auto &) {
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [patches](auto &) {
auto data = patches->toIPSPatch();
TaskManager::doLater([data] {
@@ -326,7 +326,7 @@ namespace hex::plugin::builtin {
patches->get().at(0x45454F45) = value;
}
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [patches](auto &) {
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [patches](auto &) {
auto data = patches->toIPS32Patch();
TaskManager::doLater([data] {

View File

@@ -63,7 +63,7 @@ namespace hex::plugin::builtin {
if (!view->shouldStoreWindowState())
continue;
buffer->appendf("%s=%d\n", name.c_str(), view->getWindowOpenState());
buffer->appendf("%s=%d\n", name.get().c_str(), view->getWindowOpenState());
}
});
}

View File

@@ -90,8 +90,9 @@ namespace hex::plugin::builtin {
m_dragStartIterator = tools.end();
// Attach the newly created window to the cursor, so it gets dragged around
GImGui->MovingWindow = ImGui::GetCurrentWindowRead();
GImGui->ActiveId = GImGui->MovingWindow->MoveId;
auto& g = *ImGui::GetCurrentContext();
g.MovingWindow = ImGui::GetCurrentWindowRead();
g.ActiveId = g.MovingWindow->MoveId;
}
const auto window = ImGui::GetCurrentWindowRead();