fix: Sub windows being used incorrectly

This commit is contained in:
WerWolv
2024-06-26 19:11:31 +02:00
parent e1a4707569
commit 95f71bcb10
11 changed files with 27 additions and 35 deletions

View File

@@ -355,9 +355,8 @@ namespace hex::plugin::builtin {
auto yEnd = ImGui::GetCursorPosY();
subWindowSize = ImGui::GetWindowSize();
subWindowSize.y = (yEnd - yBegin) + 35_scaled;
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
break;
}

View File

@@ -328,8 +328,8 @@ namespace hex::plugin::builtin::recent {
}
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
}
void addMenuItems() {

View File

@@ -553,8 +553,8 @@ namespace hex::plugin::builtin {
ImGui::EndTable();
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
// Handle dropping menu items onto the toolbar box
if (ImGui::BeginDragDropTarget()) {

View File

@@ -130,9 +130,8 @@ namespace hex::plugin::builtin {
if (ImGuiExt::BeginSubWindow("Build Information", nullptr, ImVec2(450_scaled, 0), ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY)) {
this->drawBuildInformation();
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
ImGui::EndTable();
}
@@ -266,9 +265,8 @@ namespace hex::plugin::builtin {
ImGui::EndTable();
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
}
void ViewAbout::drawContributorPage() {
@@ -371,8 +369,8 @@ namespace hex::plugin::builtin {
ImGui::PopStyleVar(2);
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
ImGui::NewLine();
};
@@ -409,8 +407,8 @@ namespace hex::plugin::builtin {
ImGui::EndTable();
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
}
void ViewAbout::drawPluginRow(const hex::Plugin& plugin) {
@@ -511,8 +509,8 @@ namespace hex::plugin::builtin {
ImGui::EndTable();
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
ImGui::PopStyleVar();
}
@@ -730,9 +728,8 @@ namespace hex::plugin::builtin {
if (result) {
this->drawCommitsTable(commits);
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
}
void ViewAbout::drawCommitsTable(const auto& commits) {

View File

@@ -297,8 +297,8 @@ namespace hex::plugin::builtin {
ImGuiExt::TextFormattedCentered("hex.builtin.view.highlight_rules.no_rule"_lang);
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
}

View File

@@ -147,8 +147,8 @@ namespace hex::plugin::builtin {
if (ImGuiExt::DimmedButton("hex.builtin.view.information.analyze"_lang, ImVec2(ImGui::GetContentRegionAvail().x - 50_scaled, 0)))
this->analyze();
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
ImGui::EndDisabled();
if (analysis.analyzedProvider != nullptr) {

View File

@@ -131,8 +131,8 @@ namespace hex::plugin::builtin {
}
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
ImGui::NewLine();
}
}

View File

@@ -57,9 +57,8 @@ namespace hex::plugin::builtin {
if (m_selectedTutorial != nullptr) {
if (ImGuiExt::BeginSubWindow("hex.builtin.view.tutorials.description"_lang, nullptr, ImGui::GetContentRegionAvail() - ImVec2(0, ImGui::GetTextLineHeightWithSpacing() + ImGui::GetStyle().ItemSpacing.y * 2))) {
ImGuiExt::TextFormattedWrapped(Lang(m_selectedTutorial->getUnlocalizedDescription()));
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
ImGui::BeginDisabled(currTutorial != tutorials.end());
if (ImGuiExt::DimmedButton("hex.builtin.view.tutorials.start"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0))) {

View File

@@ -226,9 +226,9 @@ namespace hex::plugin::builtin {
RequestOpenWindow::post("Open Project");
if (ImGuiExt::IconHyperlink(ICON_VS_TELESCOPE, "hex.builtin.welcome.start.open_other"_lang))
otherProvidersVisible = !otherProvidersVisible;
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
auto endPos = ImGui::GetCursorPos();
if (otherProvidersVisible) {
@@ -245,8 +245,8 @@ namespace hex::plugin::builtin {
}
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
}
}
@@ -262,9 +262,8 @@ namespace hex::plugin::builtin {
if (ImGuiExt::IconHyperlink(ICON_VS_GITHUB, "hex.builtin.welcome.help.repo"_lang)) hex::openWebpage("hex.builtin.welcome.help.repo.link"_lang);
if (ImGuiExt::IconHyperlink(ICON_VS_ORGANIZATION, "hex.builtin.welcome.help.gethelp"_lang)) hex::openWebpage("hex.builtin.welcome.help.gethelp.link"_lang);
if (ImGuiExt::IconHyperlink(ICON_VS_COMMENT_DISCUSSION, "hex.builtin.welcome.help.discord"_lang)) hex::openWebpage("hex.builtin.welcome.help.discord.link"_lang);
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
if (ImHexApi::System::getInitArguments().contains("update-available")) {
ImGui::TableNextRow();
@@ -286,9 +285,9 @@ namespace hex::plugin::builtin {
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.customize"_lang, nullptr, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0), ImGuiChildFlags_AutoResizeX)) {
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.customize.settings.title"_lang, "hex.builtin.welcome.customize.settings.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0)))
RequestOpenWindow::post("Settings");
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
ImGui::TableNextColumn();
@@ -315,9 +314,8 @@ namespace hex::plugin::builtin {
RequestOpenWindow::post("Achievements");
}
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
auto extraWelcomeScreenEntries = ContentRegistry::Interface::impl::getWelcomeScreenEntries();
if (!extraWelcomeScreenEntries.empty()) {
@@ -327,9 +325,8 @@ namespace hex::plugin::builtin {
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.various"_lang, nullptr, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0))) {
for (const auto &callback : extraWelcomeScreenEntries)
callback();
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
}
if (s_infoBannerTexture.isValid()) {
@@ -346,9 +343,9 @@ namespace hex::plugin::builtin {
if (ImGui::IsItemClicked()) {
hex::openWebpage(ImHexApiURL + hex::format("/info/{}/link", hex::toLower(ImHexApi::System::getOSName())));
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
ImGui::PopStyleVar();
ImGui::PopStyleColor();
@@ -411,8 +408,9 @@ namespace hex::plugin::builtin {
WorkspaceManager::switchWorkspace(s_simplifiedWelcomeScreen ? "Minimal" : "Default");
}
ImGuiExt::EndSubWindow();
}
ImGuiExt::EndSubWindow();
ImGui::PopStyleColor();
hovered = ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlappedByItem | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem);