1
0
mirror of synced 2025-01-30 11:37:32 +01:00

fix: Provider loader interface being closable and not resizing correctly

This commit is contained in:
WerWolv 2023-12-17 23:15:52 +01:00
parent 7ad7ea061c
commit f2a795c51e
7 changed files with 14 additions and 16 deletions

View File

@ -167,13 +167,12 @@ namespace hex {
void draw() final { void draw() final {
if (this->shouldDraw()) { if (this->shouldDraw()) {
ImGui::SetNextWindowSizeConstraints(this->getMinSize(), this->getMaxSize());
if (this->getWindowOpenState()) if (this->getWindowOpenState())
ImGui::OpenPopup(View::toWindowName(this->getUnlocalizedName()).c_str()); ImGui::OpenPopup(View::toWindowName(this->getUnlocalizedName()).c_str());
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5F, 0.5F)); ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5F, 0.5F));
if (ImGui::BeginPopupModal(View::toWindowName(this->getUnlocalizedName()).c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize | this->getWindowFlags())) { ImGui::SetNextWindowSizeConstraints(this->getMinSize(), this->getMaxSize());
if (ImGui::BeginPopupModal(View::toWindowName(this->getUnlocalizedName()).c_str(), this->hasCloseButton() ? &this->getWindowOpenState() : nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize | this->getWindowFlags())) {
this->drawContent(); this->drawContent();
ImGui::EndPopup(); ImGui::EndPopup();
@ -183,6 +182,8 @@ namespace hex {
this->getWindowOpenState() = false; this->getWindowOpenState() = false;
} }
} }
virtual bool hasCloseButton() const { return true; }
}; };
} }

View File

@ -14,6 +14,13 @@ namespace hex::plugin::builtin {
[[nodiscard]] bool hasViewMenuItemEntry() const override; [[nodiscard]] bool hasViewMenuItemEntry() const override;
[[nodiscard]] bool shouldDraw() const override { return true; } [[nodiscard]] bool shouldDraw() const override { return true; }
ImVec2 getMinSize() const override { return { -1, -1 }; }
ImVec2 getMaxSize() const override { return this->getMinSize(); }
bool hasCloseButton() const override {
return false;
}
}; };
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -70,11 +70,6 @@ Pos=1233,38
Size=687,1021 Size=687,1021
Collapsed=0 Collapsed=0
[Window][###hex.builtin.view.provider_settings.name]
Pos=822,38
Size=637,720
Collapsed=0
[Window][###hex.builtin.view.provider_settings.load_popup] [Window][###hex.builtin.view.provider_settings.load_popup]
Pos=585,322 Pos=585,322
Size=314,208 Size=314,208

View File

@ -70,11 +70,6 @@ Pos=1233,38
Size=687,1021 Size=687,1021
Collapsed=0 Collapsed=0
[Window][###hex.builtin.view.provider_settings.name]
Pos=822,38
Size=637,720
Collapsed=0
[Window][###hex.builtin.view.provider_settings.load_popup] [Window][###hex.builtin.view.provider_settings.load_popup]
Pos=585,322 Pos=585,322
Size=314,208 Size=314,208

View File

@ -179,7 +179,7 @@ namespace hex::plugin::builtin::recent {
uniqueProviders.insert(RecentEntry { uniqueProviders.insert(RecentEntry {
.displayName = jsonData.at("displayName"), .displayName = jsonData.at("displayName"),
.type = jsonData.at("type"), .type = jsonData.at("type"),
.entryFilePath = path, .entryFilePath = path,
.data = jsonData .data = jsonData
}); });
} catch (...) { } } catch (...) { }