ui: Fixed highlighting color and tooltips
This commit is contained in:
parent
3db8e2aec2
commit
ca3b5b72ca
plugins/builtin/source/content/views
@ -61,11 +61,11 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
|
|
||||||
if (ImGui::BeginTable("##tooltips", 1, ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) {
|
ImGui::PushID(&bookmark);
|
||||||
|
if (ImGui::BeginTable("##tooltips", 1, ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
|
||||||
ImGui::PushID(&bookmark);
|
|
||||||
{
|
{
|
||||||
ImGui::ColorButton("##color", ImColor(bookmark.color));
|
ImGui::ColorButton("##color", ImColor(bookmark.color));
|
||||||
ImGui::SameLine(0, 10);
|
ImGui::SameLine(0, 10);
|
||||||
@ -73,7 +73,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
if (ImGui::GetIO().KeyShift) {
|
if (ImGui::GetIO().KeyShift) {
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
if (ImGui::BeginTable("##extra_info", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_NoClip)) {
|
if (ImGui::BeginTable("##extra_info", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) {
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
@ -98,13 +98,13 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopID();
|
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_TableRowBg, bookmark.color);
|
ImGui::PushStyleColor(ImGuiCol_TableRowBg, bookmark.color);
|
||||||
ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, bookmark.color);
|
ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, bookmark.color);
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
ImGui::PopStyleColor(2);
|
ImGui::PopStyleColor(2);
|
||||||
}
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
@ -234,20 +234,15 @@ namespace hex::plugin::builtin {
|
|||||||
if (this->m_runningEvaluators != 0)
|
if (this->m_runningEvaluators != 0)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
bool foundColor = false;
|
std::optional<ImColor> color;
|
||||||
ImColor color = ImColor(0xFF, 0xFF, 0xFF, 0x70);
|
|
||||||
for (const auto &pattern : ImHexApi::Provider::get()->getPatternLanguageRuntime().getPatterns(address)) {
|
for (const auto &pattern : ImHexApi::Provider::get()->getPatternLanguageRuntime().getPatterns(address)) {
|
||||||
color = ImAlphaBlendColors(color, pattern->getColor());
|
if (color.has_value())
|
||||||
|
color = ImAlphaBlendColors(*color, pattern->getColor());
|
||||||
foundColor = true;
|
else
|
||||||
|
color = pattern->getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundColor)
|
|
||||||
return std::nullopt;
|
|
||||||
else {
|
|
||||||
color.Value.w = 0x70;
|
|
||||||
return color;
|
return color;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ImHexApi::HexEditor::addTooltipProvider([this](u64 address, const u8 *data, size_t size) {
|
ImHexApi::HexEditor::addTooltipProvider([this](u64 address, const u8 *data, size_t size) {
|
||||||
@ -256,20 +251,21 @@ namespace hex::plugin::builtin {
|
|||||||
auto patterns = ImHexApi::Provider::get()->getPatternLanguageRuntime().getPatterns(address);
|
auto patterns = ImHexApi::Provider::get()->getPatternLanguageRuntime().getPatterns(address);
|
||||||
if (!patterns.empty()) {
|
if (!patterns.empty()) {
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
if (ImGui::BeginTable("##tooltips", 1, ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) {
|
|
||||||
for (const auto &pattern : patterns) {
|
for (const auto &pattern : patterns) {
|
||||||
auto tooltipColor = (pattern->getColor() & 0x00FF'FFFF) | 0x7000'0000;
|
auto tooltipColor = (pattern->getColor() & 0x00FF'FFFF) | 0x7000'0000;
|
||||||
ImGui::PushStyleColor(ImGuiCol_TableRowBg, tooltipColor);
|
ImGui::PushID(pattern);
|
||||||
ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, tooltipColor);
|
if (ImGui::BeginTable("##tooltips", 1, ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) {
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
|
||||||
ImGui::PopStyleColor(2);
|
|
||||||
|
|
||||||
this->drawPatternTooltip(pattern);
|
this->drawPatternTooltip(pattern);
|
||||||
}
|
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_TableRowBg, tooltipColor);
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, tooltipColor);
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
|
ImGui::PopStyleColor(2);
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
@ -685,7 +681,7 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::TextFormatted("{}", pattern->getEndian() == std::endian::little ? "Little" : "Big");
|
ImGui::TextFormatted("{}", pattern->getEndian() == std::endian::little ? "Little" : "Big");
|
||||||
|
|
||||||
if (auto comment = pattern->getComment(); comment.has_value()) {
|
if (const auto &comment = pattern->getComment(); comment.has_value()) {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::TextFormatted("Comment: ");
|
ImGui::TextFormatted("Comment: ");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user