[apps/calculation] HistoryViewCell cleaning

This commit is contained in:
Léa Saviot
2020-05-20 10:28:55 +02:00
committed by EmilieNumworks
parent 6948011ae0
commit feee0a673c
2 changed files with 7 additions and 25 deletions

View File

@@ -11,9 +11,6 @@ namespace Calculation {
/* HistoryViewCellDataSource */
HistoryViewCellDataSource::HistoryViewCellDataSource() :
m_selectedSubviewType(SubviewType::Output) {}
void HistoryViewCellDataSource::setSelectedSubviewType(SubviewType subviewType, bool sameCell, int previousSelectedCellX, int previousSelectedCellY) {
HistoryViewCell * selectedCell = nullptr;
HistoryViewCell * previouslySelectedCell = nullptr;
@@ -49,10 +46,6 @@ HistoryViewCell::HistoryViewCell(Responder * parentResponder) :
{
}
Shared::ScrollableTwoExpressionsView * HistoryViewCell::outputView() {
return &m_scrollableOutputView; //TODO LEA inline
}
void HistoryViewCell::setEven(bool even) {
EvenOddCell::setEven(even);
m_inputView.setBackgroundColor(backgroundColor());
@@ -138,15 +131,6 @@ void HistoryViewCell::cellDidSelectSubview(HistoryViewCellDataSource::SubviewTyp
reloadScroll();
}
KDColor HistoryViewCell::backgroundColor() const {
KDColor background = m_even ? KDColorWhite : Palette::WallScreen;
return background;
}
int HistoryViewCell::numberOfSubviews() const {
return 2 + displayedEllipsis();
}
View * HistoryViewCell::subviewAtIndex(int index) {
/* The order of the subviews should not matter here as they don't overlap.
* However, the order determines the order of redrawing as well. For several
@@ -350,8 +334,4 @@ bool HistoryViewCell::handleEvent(Ion::Events::Event event) {
return true;
}
bool HistoryViewCell::displayedEllipsis() const {
return m_highlighted && m_calculationAdditionInformation != Calculation::AdditionalInformationType::None;
}
}

View File

@@ -17,7 +17,7 @@ public:
Output = 2,
Ellipsis = 3
};
HistoryViewCellDataSource();
HistoryViewCellDataSource() : m_selectedSubviewType(SubviewType::Output) {}
void setSelectedSubviewType(SubviewType subviewType, bool sameCell, int previousSelectedX = -1, int previousSelectedY = -1);
SubviewType selectedSubviewType() { return m_selectedSubviewType; }
private:
@@ -46,21 +46,23 @@ public:
return this;
}
Poincare::Layout layout() const override;
KDColor backgroundColor() const override;
KDColor backgroundColor() const override { return m_even ? KDColorWhite : Palette::WallScreen; }
void resetMemoization();
void setCalculation(Calculation * calculation, bool expanded);
int numberOfSubviews() const override;
int numberOfSubviews() const override { return 2 + displayedEllipsis(); }
View * subviewAtIndex(int index) override;
void layoutSubviews(bool force = false) override;
void didBecomeFirstResponder() override;
bool handleEvent(Ion::Events::Event event) override;
Shared::ScrollableTwoExpressionsView * outputView();
Shared::ScrollableTwoExpressionsView * outputView() { return &m_scrollableOutputView; }
Calculation::AdditionalInformationType additionalInformationType() const { return m_calculationAdditionInformation; }
private:
constexpr static KDCoordinate k_resultWidth = 80;
void reloadScroll();
void reloadOutputSelection(HistoryViewCellDataSource::SubviewType previousType);
bool displayedEllipsis() const;
bool displayedEllipsis() const {
return m_highlighted && m_calculationAdditionInformation != Calculation::AdditionalInformationType::None;
}
uint32_t m_calculationCRC32;
Calculation::DisplayOutput m_calculationDisplayOutput;
Calculation::AdditionalInformationType m_calculationAdditionInformation;