1
0
mirror of synced 2024-11-24 15:50:16 +01:00

patterns: Fixed color attribute not working correctly for arrays and structs

Fixes #388
This commit is contained in:
WerWolv 2021-12-31 11:01:22 +01:00
parent 077bc45b7d
commit 490eaef5c1
2 changed files with 37 additions and 2 deletions

View File

@ -115,7 +115,7 @@ namespace hex::pl {
void setTypeName(std::string name) { this->m_typeName = std::move(name); }
[[nodiscard]] u32 getColor() const { return this->m_color; }
void setColor(u32 color) { this->m_color = color; }
virtual void setColor(u32 color) { this->m_color = color; }
[[nodiscard]] std::endian getEndian() const { return this->m_endian; }
void setEndian(std::endian endian) { this->m_endian = endian; }
@ -429,6 +429,11 @@ namespace hex::pl {
return this->m_pointedAt;
}
void setColor(u32 color) override {
PatternData::setColor(color);
this->m_pointedAt->setColor(color);
}
[[nodiscard]] bool operator==(const PatternData &other) const override {
return areCommonPropertiesEqual<decltype(*this)>(other) &&
*static_cast<const PatternDataPointer*>(&other)->m_pointedAt == *this->m_pointedAt;
@ -756,6 +761,12 @@ namespace hex::pl {
PatternData::setOffset(offset);
}
void setColor(u32 color) override {
PatternData::setColor(color);
for (auto &entry : this->m_entries)
entry->setColor(color);
}
void createEntry(prv::Provider* &provider) override {
if (this->m_entries.empty())
return;
@ -956,6 +967,11 @@ namespace hex::pl {
PatternData::clearHighlightedAddresses();
}
void setColor(u32 color) override {
PatternData::setColor(color);
this->m_template->setColor(color);
}
[[nodiscard]] std::string getFormattedName() const override {
return this->m_template->getTypeName() + "[" + std::to_string(this->m_entryCount) + "]";
}
@ -1079,6 +1095,12 @@ namespace hex::pl {
PatternData::clearHighlightedAddresses();
}
void setColor(u32 color) override {
PatternData::setColor(color);
for (auto &member : this->m_members)
member->setColor(color);
}
void sort(ImGuiTableSortSpecs *sortSpecs, prv::Provider *provider) override {
this->m_sortedMembers = this->m_members;
@ -1219,6 +1241,12 @@ namespace hex::pl {
PatternData::clearHighlightedAddresses();
}
void setColor(u32 color) override {
PatternData::setColor(color);
for (auto &member : this->m_members)
member->setColor(color);
}
void sort(ImGuiTableSortSpecs *sortSpecs, prv::Provider *provider) override {
this->m_sortedMembers = this->m_members;
@ -1514,6 +1542,12 @@ namespace hex::pl {
}
}
void setColor(u32 color) override {
PatternData::setColor(color);
for (auto &field : this->m_fields)
field->setColor(color);
}
[[nodiscard]] bool operator==(const PatternData &other) const override {
if (!areCommonPropertiesEqual<decltype(*this)>(other))
return false;

View File

@ -522,6 +522,7 @@ namespace hex {
if (hasWindow) {
ImGui::Begin(View::toWindowName(view->getUnlocalizedName()).c_str());
focused = ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows);
ImGui::End();
}