From 4ec7b801fd1587982d0e5dca2d16e91908e8f390 Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Wed, 31 Jul 2019 15:07:43 +0200 Subject: [PATCH] [apps/shared/values_controller] Clean willDisplayCellAtLocation --- apps/shared/values_controller.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/apps/shared/values_controller.cpp b/apps/shared/values_controller.cpp index d9721c8f5..923b4c288 100644 --- a/apps/shared/values_controller.cpp +++ b/apps/shared/values_controller.cpp @@ -151,28 +151,18 @@ Button * ValuesController::buttonAtIndex(int index, ButtonRowController::Positio void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) { willDisplayCellAtLocationWithDisplayMode(cell, i, j, Preferences::sharedPreferences()->displayMode()); - if (cellAtLocationIsEditable(i, j)) { - return; - } // The cell is not a title cell and not editable if (j > 0 && i > 0) { constexpr int precision = Preferences::LargeNumberOfSignificantDigits; char buffer[PrintFloat::bufferSizeForFloatsWithPrecision(precision)]; // Special case: last row - if (j == numberOfRows() - 1) { - int numberOfIntervalElements = m_interval->numberOfElements(); - if (numberOfIntervalElements < Interval::k_maxNumberOfElements) { - buffer[0] = 0; - EvenOddBufferTextCell * myValueCell = (EvenOddBufferTextCell *)cell; - myValueCell->setText(buffer); - return; - } + if (j == numberOfElements() + 1) { + buffer[0] = 0; + } else { + double x = m_interval->element(j-1); + PoincareHelpers::ConvertFloatToText(evaluationOfAbscissaAtColumn(x, i), buffer, cellBufferSize(i), precision); } - // The cell is a value cell - EvenOddBufferTextCell * myValueCell = (EvenOddBufferTextCell *)cell; - double x = m_interval->element(j-1); - PoincareHelpers::ConvertFloatToText(evaluationOfAbscissaAtColumn(x, i), buffer, cellBufferSize(i), precision); - myValueCell->setText(buffer); + static_cast(cell)->setText(buffer); } }