1
0
mirror of synced 2025-01-19 01:24:15 +01:00

patterns: Fixed highlight colors of arrays not matching color shown in pattern data view

This commit is contained in:
WerWolv 2022-03-17 23:31:16 +01:00
parent 11441d632b
commit ec9a947259
3 changed files with 10 additions and 6 deletions

View File

@ -84,6 +84,12 @@ namespace hex::pl {
this->m_color = color;
this->m_manualColor = true;
}
void setBaseColor(u32 color) {
if (this->hasOverriddenColor())
this->setColor(color);
else
this->m_color = color;
}
[[nodiscard]] bool hasOverriddenColor() const { return this->m_manualColor; }
[[nodiscard]] std::endian getEndian() const {

View File

@ -110,10 +110,8 @@ namespace hex::pl {
void setEntries(std::vector<std::shared_ptr<Pattern>> &&entries) {
this->m_entries = std::move(entries);
if (this->hasOverriddenColor()) {
for (auto &entry : this->m_entries) {
entry->setColor(this->getColor());
}
for (auto &entry : this->m_entries) {
entry->setBaseColor(this->getColor());
}
}

View File

@ -122,8 +122,8 @@ namespace hex::pl {
this->m_highlightTemplate = this->m_template->clone();
this->m_entryCount = count;
if (this->hasOverriddenColor())
this->setColor(this->m_template->getColor());
this->m_template->setBaseColor(this->getColor());
this->m_highlightTemplate->setBaseColor(this->getColor());
}
[[nodiscard]] bool operator==(const Pattern &other) const override {