fix: Some more popup rendering issues
This commit is contained in:
parent
b4d0f984a4
commit
70f3014390
@ -771,7 +771,7 @@ namespace hex {
|
|||||||
this->m_byteCount++;
|
this->m_byteCount++;
|
||||||
if (((this->m_byteCount % this->m_blockSize) == 0) || this->m_byteCount == (this->m_endAddress - this->m_startAddress)) [[unlikely]] {
|
if (((this->m_byteCount % this->m_blockSize) == 0) || this->m_byteCount == (this->m_endAddress - this->m_startAddress)) [[unlikely]] {
|
||||||
auto typeDist = calculateTypeDistribution(this->m_blockValueCounts, this->m_blockSize);
|
auto typeDist = calculateTypeDistribution(this->m_blockValueCounts, this->m_blockSize);
|
||||||
for (u8 i = 0; i < typeDist.size(); i++)
|
for (size_t i = 0; i < typeDist.size(); i++)
|
||||||
this->m_yBlockTypeDistributions[i][this->m_blockCount] = typeDist[i] * 100;
|
this->m_yBlockTypeDistributions[i][this->m_blockCount] = typeDist[i] * 100;
|
||||||
|
|
||||||
this->m_blockCount += 1;
|
this->m_blockCount += 1;
|
||||||
@ -858,7 +858,7 @@ namespace hex {
|
|||||||
this->m_byteCount++;
|
this->m_byteCount++;
|
||||||
if (((this->m_byteCount % this->m_blockSize) == 0) || this->m_byteCount == (this->m_endAddress - this->m_startAddress)) [[unlikely]] {
|
if (((this->m_byteCount % this->m_blockSize) == 0) || this->m_byteCount == (this->m_endAddress - this->m_startAddress)) [[unlikely]] {
|
||||||
auto typeDist = calculateTypeDistribution(this->m_blockValueCounts, this->m_blockSize);
|
auto typeDist = calculateTypeDistribution(this->m_blockValueCounts, this->m_blockSize);
|
||||||
for (u8 i = 0; i < typeDist.size(); i++)
|
for (size_t i = 0; i < typeDist.size(); i++)
|
||||||
this->m_yBlockTypeDistributions[i][this->m_blockCount] = typeDist[i] * 100;
|
this->m_yBlockTypeDistributions[i][this->m_blockCount] = typeDist[i] * 100;
|
||||||
|
|
||||||
this->m_blockCount += 1;
|
this->m_blockCount += 1;
|
||||||
@ -871,7 +871,7 @@ namespace hex {
|
|||||||
|
|
||||||
void processFinalize() {
|
void processFinalize() {
|
||||||
// Only save at most m_sampleSize elements of the result
|
// Only save at most m_sampleSize elements of the result
|
||||||
for (u8 i = 0; i < this->m_yBlockTypeDistributions.size(); ++i)
|
for (size_t i = 0; i < this->m_yBlockTypeDistributions.size(); ++i)
|
||||||
this->m_yBlockTypeDistributions[i] = sampleData(this->m_yBlockTypeDistributions[i], std::min<size_t>(this->m_blockCount, this->m_sampleSize));
|
this->m_yBlockTypeDistributions[i] = sampleData(this->m_yBlockTypeDistributions[i], std::min<size_t>(this->m_blockCount, this->m_sampleSize));
|
||||||
|
|
||||||
size_t stride = std::max(1.0, double(this->m_blockCount / this->m_yBlockTypeDistributions[0].size())) + 1;
|
size_t stride = std::max(1.0, double(this->m_blockCount / this->m_yBlockTypeDistributions[0].size())) + 1;
|
||||||
|
@ -52,7 +52,7 @@ namespace hex::plugin::builtin {
|
|||||||
if (ImGui::Button("hex.builtin.common.open"_lang) || doubleClicked) {
|
if (ImGui::Button("hex.builtin.common.open"_lang) || doubleClicked) {
|
||||||
for (const auto &index : this->m_indices)
|
for (const auto &index : this->m_indices)
|
||||||
this->m_openCallback(this->m_files[index]);
|
this->m_openCallback(this->m_files[index]);
|
||||||
ImGui::CloseCurrentPopup();
|
Popup::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -60,7 +60,7 @@ namespace hex::plugin::builtin {
|
|||||||
if (ImGui::Button("hex.builtin.common.browse"_lang)) {
|
if (ImGui::Button("hex.builtin.common.browse"_lang)) {
|
||||||
fs::openFileBrowser(fs::DialogMode::Open, this->m_validExtensions, [this](const auto &path) {
|
fs::openFileBrowser(fs::DialogMode::Open, this->m_validExtensions, [this](const auto &path) {
|
||||||
this->m_openCallback(path);
|
this->m_openCallback(path);
|
||||||
ImGui::CloseCurrentPopup();
|
Popup::close();
|
||||||
}, {}, this->m_multiple);
|
}, {}, this->m_multiple);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,10 @@ namespace hex::plugin::builtin {
|
|||||||
Popup::close();
|
Popup::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
||||||
|
return ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ViewPatternEditor *m_view;
|
ViewPatternEditor *m_view;
|
||||||
};
|
};
|
||||||
|
@ -56,7 +56,7 @@ namespace hex::plugin::builtin {
|
|||||||
EventManager::subscribe<EventProviderClosing>([](hex::prv::Provider *provider, bool *shouldClose) {
|
EventManager::subscribe<EventProviderClosing>([](hex::prv::Provider *provider, bool *shouldClose) {
|
||||||
if (provider->isDirty()) {
|
if (provider->isDirty()) {
|
||||||
*shouldClose = false;
|
*shouldClose = false;
|
||||||
PopupQuestion::open("hex.builtin.popup.close_provider.desc",
|
PopupQuestion::open("hex.builtin.popup.close_provider.desc"_lang,
|
||||||
[]{
|
[]{
|
||||||
ImHexApi::Provider::remove(ImHexApi::Provider::impl::getClosingProvider(), true);
|
ImHexApi::Provider::remove(ImHexApi::Provider::impl::getClosingProvider(), true);
|
||||||
PopupQuestion::close();
|
PopupQuestion::close();
|
||||||
|
Loading…
Reference in New Issue
Block a user