impr: Handle provider opening more centrally, switch to existing provider if same file is being opened again

(cherry picked from commit 89004574d3)
This commit is contained in:
WerWolv
2025-12-17 12:55:24 +01:00
parent cae063985a
commit 51d773cf14
46 changed files with 208 additions and 155 deletions

View File

@@ -524,7 +524,6 @@ namespace hex::plugin::builtin {
flags |= ImGuiTabItemFlags_UnsavedDocument;
if (i64(i) == selectedProviderIndex && providerJustChanged) {
flags |= ImGuiTabItemFlags_SetSelected;
providerJustChanged = false;
}
static size_t lastSelectedProvider = 0;
@@ -535,7 +534,7 @@ namespace hex::plugin::builtin {
ImGui::EndTabItem();
}
if (isSelected && lastSelectedProvider != i) {
if (isSelected && lastSelectedProvider != i && !providerJustChanged) {
ImHexApi::Provider::setCurrentProvider(i);
lastSelectedProvider = i;
}
@@ -555,6 +554,8 @@ namespace hex::plugin::builtin {
}
}
ImGui::EndTabBar();
providerJustChanged = false;
}
}
ImGui::EndDisabled();