mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[escher] Optimize redrawing when changing features in cells (color,
highlight, even) Change-Id: I0afa8b6fad656d578bb8e071183646196bc816f9
This commit is contained in:
@@ -126,6 +126,7 @@ void ListController::willDisplayCellAtLocation(HighlightCell * cell, int i, int
|
||||
EvenOddCell * myCell = (EvenOddCell *)cell;
|
||||
myCell->setEven(j%2 == 0);
|
||||
myCell->setHighlighted(i == selectedColumn() && j == selectedRow());
|
||||
myCell->reloadCell();
|
||||
}
|
||||
|
||||
int ListController::numberOfButtons(ButtonRowController::Position position) const {
|
||||
|
||||
@@ -9,8 +9,13 @@ NewFunctionCell::NewFunctionCell(I18n::Message text) :
|
||||
{
|
||||
}
|
||||
|
||||
void NewFunctionCell::reloadCell() {
|
||||
EvenOddCell::reloadCell();
|
||||
void NewFunctionCell::setEven(bool even) {
|
||||
EvenOddCell::setEven(even);
|
||||
m_messageTextView.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
void NewFunctionCell::setHighlighted(bool highlight) {
|
||||
EvenOddCell::setHighlighted(highlight);
|
||||
m_messageTextView.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ namespace Shared {
|
||||
class NewFunctionCell : public EvenOddCell {
|
||||
public:
|
||||
NewFunctionCell(I18n::Message text);
|
||||
void reloadCell() override;
|
||||
void setEven(bool even) override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
int numberOfSubviews() const override;
|
||||
View * subviewAtIndex(int index) override;
|
||||
void layoutSubviews() override;
|
||||
|
||||
@@ -8,8 +8,10 @@ EvenOddCell::EvenOddCell() :
|
||||
}
|
||||
|
||||
void EvenOddCell::setEven(bool even) {
|
||||
if (even != m_even) {
|
||||
m_even = even;
|
||||
reloadCell();
|
||||
}
|
||||
}
|
||||
|
||||
KDColor EvenOddCell::backgroundColor() const {
|
||||
|
||||
@@ -21,13 +21,17 @@ void ExpressionView::setExpression(ExpressionLayout * expressionLayout) {
|
||||
}
|
||||
|
||||
void ExpressionView::setBackgroundColor(KDColor backgroundColor) {
|
||||
m_backgroundColor = backgroundColor;
|
||||
markRectAsDirty(bounds());
|
||||
if (m_backgroundColor != backgroundColor) {
|
||||
m_backgroundColor = backgroundColor;
|
||||
markRectAsDirty(bounds());
|
||||
}
|
||||
}
|
||||
|
||||
void ExpressionView::setTextColor(KDColor textColor) {
|
||||
m_textColor = textColor;
|
||||
markRectAsDirty(bounds());
|
||||
if (textColor != m_textColor) {
|
||||
m_textColor = textColor;
|
||||
markRectAsDirty(bounds());
|
||||
}
|
||||
}
|
||||
|
||||
void ExpressionView::setAlignment(float horizontalAlignment, float verticalAlignment) {
|
||||
|
||||
@@ -7,8 +7,10 @@ HighlightCell::HighlightCell() :
|
||||
}
|
||||
|
||||
void HighlightCell::setHighlighted(bool highlight) {
|
||||
m_highlighted = highlight;
|
||||
reloadCell();
|
||||
if (m_highlighted != highlight) {
|
||||
m_highlighted = highlight;
|
||||
reloadCell();
|
||||
}
|
||||
}
|
||||
|
||||
bool HighlightCell::isHighlighted() const {
|
||||
|
||||
Reference in New Issue
Block a user