1
0
mirror of synced 2024-11-12 02:00:52 +01:00

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

@ -1189,7 +1189,6 @@ namespace ImGuiExt {
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - (ImGui::GetStyle().FramePadding.y * 2)); ImGui::SetCursorPosY(ImGui::GetCursorPosY() - (ImGui::GetStyle().FramePadding.y * 2));
ImGui::TextDisabled("..."); ImGui::TextDisabled("...");
result = false; result = false;
ImGui::EndChild();
} }
} }
ImGui::PopStyleVar(); ImGui::PopStyleVar();

View File

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

View File

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

View File

@ -553,8 +553,8 @@ namespace hex::plugin::builtin {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
// Handle dropping menu items onto the toolbar box // Handle dropping menu items onto the toolbar box
if (ImGui::BeginDragDropTarget()) { 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)) { if (ImGuiExt::BeginSubWindow("Build Information", nullptr, ImVec2(450_scaled, 0), ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY)) {
this->drawBuildInformation(); this->drawBuildInformation();
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
ImGui::EndTable(); ImGui::EndTable();
} }
@ -266,9 +265,8 @@ namespace hex::plugin::builtin {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
} }
void ViewAbout::drawContributorPage() { void ViewAbout::drawContributorPage() {
@ -371,8 +369,8 @@ namespace hex::plugin::builtin {
ImGui::PopStyleVar(2); ImGui::PopStyleVar(2);
} }
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
ImGui::NewLine(); ImGui::NewLine();
}; };
@ -409,8 +407,8 @@ namespace hex::plugin::builtin {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
} }
void ViewAbout::drawPluginRow(const hex::Plugin& plugin) { void ViewAbout::drawPluginRow(const hex::Plugin& plugin) {
@ -511,8 +509,8 @@ namespace hex::plugin::builtin {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
ImGui::PopStyleVar(); ImGui::PopStyleVar();
} }
@ -730,9 +728,8 @@ namespace hex::plugin::builtin {
if (result) { if (result) {
this->drawCommitsTable(commits); this->drawCommitsTable(commits);
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
} }
void ViewAbout::drawCommitsTable(const auto& commits) { 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::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))) if (ImGuiExt::DimmedButton("hex.builtin.view.information.analyze"_lang, ImVec2(ImGui::GetContentRegionAvail().x - 50_scaled, 0)))
this->analyze(); this->analyze();
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
ImGui::EndDisabled(); ImGui::EndDisabled();
if (analysis.analyzedProvider != nullptr) { if (analysis.analyzedProvider != nullptr) {

View File

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

View File

@ -57,9 +57,8 @@ namespace hex::plugin::builtin {
if (m_selectedTutorial != nullptr) { 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))) { 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::TextFormattedWrapped(Lang(m_selectedTutorial->getUnlocalizedDescription()));
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
ImGui::BeginDisabled(currTutorial != tutorials.end()); ImGui::BeginDisabled(currTutorial != tutorials.end());
if (ImGuiExt::DimmedButton("hex.builtin.view.tutorials.start"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0))) { 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"); RequestOpenWindow::post("Open Project");
if (ImGuiExt::IconHyperlink(ICON_VS_TELESCOPE, "hex.builtin.welcome.start.open_other"_lang)) if (ImGuiExt::IconHyperlink(ICON_VS_TELESCOPE, "hex.builtin.welcome.start.open_other"_lang))
otherProvidersVisible = !otherProvidersVisible; otherProvidersVisible = !otherProvidersVisible;
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
auto endPos = ImGui::GetCursorPos(); auto endPos = ImGui::GetCursorPos();
if (otherProvidersVisible) { 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_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_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); 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")) { if (ImHexApi::System::getInitArguments().contains("update-available")) {
ImGui::TableNextRow(); 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::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))) 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"); RequestOpenWindow::post("Settings");
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5); ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
@ -315,9 +314,8 @@ namespace hex::plugin::builtin {
RequestOpenWindow::post("Achievements"); RequestOpenWindow::post("Achievements");
} }
} }
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
auto extraWelcomeScreenEntries = ContentRegistry::Interface::impl::getWelcomeScreenEntries(); auto extraWelcomeScreenEntries = ContentRegistry::Interface::impl::getWelcomeScreenEntries();
if (!extraWelcomeScreenEntries.empty()) { 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))) { if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.various"_lang, nullptr, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0))) {
for (const auto &callback : extraWelcomeScreenEntries) for (const auto &callback : extraWelcomeScreenEntries)
callback(); callback();
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
} }
if (s_infoBannerTexture.isValid()) { if (s_infoBannerTexture.isValid()) {
@ -346,9 +343,9 @@ namespace hex::plugin::builtin {
if (ImGui::IsItemClicked()) { if (ImGui::IsItemClicked()) {
hex::openWebpage(ImHexApiURL + hex::format("/info/{}/link", hex::toLower(ImHexApi::System::getOSName()))); hex::openWebpage(ImHexApiURL + hex::format("/info/{}/link", hex::toLower(ImHexApi::System::getOSName())));
} }
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
ImGui::PopStyleVar(); ImGui::PopStyleVar();
ImGui::PopStyleColor(); ImGui::PopStyleColor();
@ -411,8 +408,9 @@ namespace hex::plugin::builtin {
WorkspaceManager::switchWorkspace(s_simplifiedWelcomeScreen ? "Minimal" : "Default"); WorkspaceManager::switchWorkspace(s_simplifiedWelcomeScreen ? "Minimal" : "Default");
} }
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
ImGui::PopStyleColor(); ImGui::PopStyleColor();
hovered = ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlappedByItem | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); hovered = ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlappedByItem | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem);

View File

@ -80,9 +80,9 @@ namespace hex::plugin::yara {
const auto &ruleName = match.metadata.contains("name") ? match.metadata.at("name") : match.identifier; const auto &ruleName = match.metadata.contains("name") ? match.metadata.at("name") : match.identifier;
ImGui::TextUnformatted(ruleName.c_str()); ImGui::TextUnformatted(ruleName.c_str());
} }
ImGuiExt::EndSubWindow();
} }
ImGuiExt::EndSubWindow();
} }
ImGui::EndTable(); ImGui::EndTable();