patterns: Fixed jumping to and displaying tooltips of static array entries
This commit is contained in:
parent
2e95184d30
commit
754eb89f04
@ -267,9 +267,15 @@ namespace hex::pl {
|
|||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TreeNodeEx(this->getDisplayName().c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_AllowItemOverlap);
|
ImGui::TreeNodeEx(this->getDisplayName().c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_AllowItemOverlap);
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
if (ImGui::Selectable(("##PatternDataLine"s + std::to_string(u64(this))).c_str(), false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) {
|
|
||||||
|
ImGui::PushID(this->getOffset());
|
||||||
|
ImGui::PushID(this->getVariableName().c_str());
|
||||||
|
if (ImGui::Selectable("##PatternDataLine", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) {
|
||||||
ImHexApi::HexEditor::setSelection(this->getOffset(), this->getSize());
|
ImHexApi::HexEditor::setSelection(this->getOffset(), this->getSize());
|
||||||
}
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
ImGui::PopID();
|
||||||
|
|
||||||
this->drawCommentTooltip();
|
this->drawCommentTooltip();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextUnformatted(this->getDisplayName().c_str());
|
ImGui::TextUnformatted(this->getDisplayName().c_str());
|
||||||
@ -1019,7 +1025,6 @@ namespace hex::pl {
|
|||||||
void setColor(u32 color) override {
|
void setColor(u32 color) override {
|
||||||
PatternData::setColor(color);
|
PatternData::setColor(color);
|
||||||
this->m_template->setColor(color);
|
this->m_template->setColor(color);
|
||||||
this->m_highlightTemplate->setColor(color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] std::string getFormattedName() const override {
|
[[nodiscard]] std::string getFormattedName() const override {
|
||||||
@ -1058,6 +1063,10 @@ namespace hex::pl {
|
|||||||
[[nodiscard]] const PatternData *getPattern(u64 offset) const override {
|
[[nodiscard]] const PatternData *getPattern(u64 offset) const override {
|
||||||
if (this->isHidden()) return nullptr;
|
if (this->isHidden()) return nullptr;
|
||||||
|
|
||||||
|
this->m_highlightTemplate->setColor(this->getColor());
|
||||||
|
this->m_highlightTemplate->setVariableName(this->getVariableName());
|
||||||
|
this->m_highlightTemplate->setDisplayName(this->getDisplayName());
|
||||||
|
|
||||||
if (offset >= this->getOffset() && offset < (this->getOffset() + this->getSize())) {
|
if (offset >= this->getOffset() && offset < (this->getOffset() + this->getSize())) {
|
||||||
this->m_highlightTemplate->setOffset((offset / this->m_highlightTemplate->getSize()) * this->m_highlightTemplate->getSize());
|
this->m_highlightTemplate->setOffset((offset / this->m_highlightTemplate->getSize()) * this->m_highlightTemplate->getSize());
|
||||||
return this->m_highlightTemplate->getPattern(offset);
|
return this->m_highlightTemplate->getPattern(offset);
|
||||||
|
@ -229,7 +229,7 @@ namespace hex::plugin::builtin {
|
|||||||
for (const auto &pattern : patterns) {
|
for (const auto &pattern : patterns) {
|
||||||
auto child = pattern->getPattern(address);
|
auto child = pattern->getPattern(address);
|
||||||
if (child != nullptr) {
|
if (child != nullptr) {
|
||||||
return ImHexApi::HexEditor::Highlighting(Region { address, 1 }, child->getColor(), child->getVariableName());
|
return ImHexApi::HexEditor::Highlighting(Region { address, 1 }, child->getColor(), child->getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,7 +672,7 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
EventManager::post<EventHighlightingChanged>();
|
ImHexApi::HexEditor::invalidateHighlight();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->m_runningEvaluators--;
|
this->m_runningEvaluators--;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user