fix: Various pattern drawer issues
This commit is contained in:
parent
1e2cf87532
commit
456895a6a6
2
lib/external/pattern_language
vendored
2
lib/external/pattern_language
vendored
@ -1 +1 @@
|
||||
Subproject commit f0a68249e71f6a3f38fdba292c4a2c9e9bab3ad2
|
||||
Subproject commit 456dd11fc74b12630c1c7679862cb665e741c4d0
|
@ -174,7 +174,11 @@ namespace hex {
|
||||
|
||||
|
||||
void TaskManager::init() {
|
||||
for (u32 i = 0; i < std::thread::hardware_concurrency(); i++)
|
||||
const auto threadCount = std::thread::hardware_concurrency();
|
||||
|
||||
log::debug("Initializing task manager thread pool with {} workers.", threadCount);
|
||||
|
||||
for (u32 i = 0; i < threadCount; i++)
|
||||
TaskManager::s_workers.emplace_back(TaskManager::runner);
|
||||
}
|
||||
|
||||
@ -207,6 +211,7 @@ namespace hex {
|
||||
|
||||
try {
|
||||
task->m_function(*task);
|
||||
log::debug("Finished task {}", task->m_unlocalizedName);
|
||||
} catch (const Task::TaskInterruptor &) {
|
||||
task->interruption();
|
||||
} catch (const std::exception &e) {
|
||||
@ -222,6 +227,7 @@ namespace hex {
|
||||
}
|
||||
|
||||
TaskHolder TaskManager::createTask(std::string name, u64 maxValue, std::function<void(Task &)> function) {
|
||||
log::debug("Creating task {}", name);
|
||||
std::unique_lock lock(s_queueMutex);
|
||||
auto task = std::make_shared<Task>(std::move(name), maxValue, false, std::move(function));
|
||||
s_tasks.emplace_back(task);
|
||||
@ -233,6 +239,7 @@ namespace hex {
|
||||
}
|
||||
|
||||
TaskHolder TaskManager::createBackgroundTask(std::string name, std::function<void(Task &)> function) {
|
||||
log::debug("Creating background task {}", name);
|
||||
std::unique_lock lock(s_queueMutex);
|
||||
|
||||
auto task = std::make_shared<Task>(std::move(name), 0, true, std::move(function));
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "init/splash_window.hpp"
|
||||
#include "init/tasks.hpp"
|
||||
#include "init/tasks.hpp"
|
||||
|
||||
#include <hex/api/task.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
|
@ -83,20 +83,6 @@ namespace hex::plugin::builtin::ui {
|
||||
ImGui::TableNextColumn();
|
||||
}
|
||||
|
||||
void drawNameColumn(const pl::ptrn::Pattern& pattern) {
|
||||
highlightWhenSelected(pattern, [&]{
|
||||
auto name = pattern.getDisplayName();
|
||||
|
||||
ImGui::TextFormatted("{}", name);
|
||||
|
||||
if (ImGui::CalcTextSize(name.c_str()).x > ImGui::GetColumnWidth()) {
|
||||
ImGui::InfoTooltip(name.c_str());
|
||||
}
|
||||
|
||||
});
|
||||
ImGui::TableNextColumn();
|
||||
}
|
||||
|
||||
void drawColorColumn(const pl::ptrn::Pattern& pattern) {
|
||||
if (pattern.getVisibility() == pl::ptrn::Visibility::Visible)
|
||||
ImGui::ColorButton("color", ImColor(pattern.getColor()), ImGuiColorEditFlags_NoTooltip, ImVec2(ImGui::GetColumnWidth(), ImGui::GetTextLineHeight()));
|
||||
@ -364,12 +350,12 @@ namespace hex::plugin::builtin::ui {
|
||||
|
||||
void PatternDrawer::visit(pl::ptrn::PatternBitfieldField& pattern) {
|
||||
ImGui::TableNextRow();
|
||||
createTreeNode(pattern, true);
|
||||
ImGui::TableNextColumn();
|
||||
createTreeNode(pattern, true);
|
||||
ImGui::SameLine(0, 0);
|
||||
makeSelectable(pattern);
|
||||
drawCommentTooltip(pattern);
|
||||
ImGui::SameLine();
|
||||
drawNameColumn(pattern);
|
||||
ImGui::TableNextColumn();
|
||||
drawColorColumn(pattern);
|
||||
drawOffsetColumnForBitfieldMember(pattern);
|
||||
ImGui::TableNextColumn();
|
||||
@ -502,12 +488,12 @@ namespace hex::plugin::builtin::ui {
|
||||
|
||||
void PatternDrawer::visit(pl::ptrn::PatternEnum& pattern) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
createTreeNode(pattern, true);
|
||||
ImGui::SameLine(0, 0);
|
||||
makeSelectable(pattern);
|
||||
drawCommentTooltip(pattern);
|
||||
ImGui::TableNextColumn();
|
||||
makeSelectable(pattern);
|
||||
ImGui::SameLine();
|
||||
drawNameColumn(pattern);
|
||||
drawColorColumn(pattern);
|
||||
drawOffsetColumn(pattern);
|
||||
drawSizeColumn(pattern);
|
||||
@ -834,6 +820,7 @@ namespace hex::plugin::builtin::ui {
|
||||
if (chunkCount > displayEnd) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::Selectable(hex::format("... ({})", "hex.builtin.pattern_drawer.double_click"_lang).c_str(), false, ImGuiSelectableFlags_SpanAllColumns);
|
||||
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
|
||||
|
Loading…
x
Reference in New Issue
Block a user