2 #include "../constant.h" 3 #include "../apps_container.h" 4 #include "../../poincare/src/layout/baseline_relative_layout.h" 5 #include "../../poincare/src/layout/string_layout.h" 18 m_r2TitleCell(
nullptr),
19 m_columnTitleCell(
nullptr),
20 m_doubleCalculationCells{},
45 if (
selectedRow() <= k_totalNumberOfDoubleBufferRows) {
67 TabTableController::didBecomeFirstResponder();
78 if (previousSelectedCellX == 0 && previousSelectedCellY == 1) {
87 bool firstSubCellSelected =
true;
88 if (previousSelectedCellX == 1 && previousSelectedCellY >= 0 && previousSelectedCellY <= k_totalNumberOfDoubleBufferRows) {
104 return I18n::Message::NoValueToCompute;
108 return tabController();
112 return k_totalNumberOfRows;
116 return k_totalNumberOfColumns;
123 if (j == 0 && i > 0) {
141 I18n::Message titles[k_totalNumberOfRows-1] = {I18n::Message::Mean, I18n::Message::Sum, I18n::Message::SquareSum, I18n::Message::StandardDeviation, I18n::Message::Deviation, I18n::Message::NumberOfDots, I18n::Message::Covariance, I18n::Message::Sxy, I18n::Message::Regression, I18n::Message::A, I18n::Message::B, I18n::Message::R, I18n::Message::Default};
145 if (i == 1 && j > 0 && j <= k_totalNumberOfDoubleBufferRows) {
148 double calculation1 = (m_store->*calculationMethods[j-1])(0);
149 double calculation2 = (m_store->*calculationMethods[j-1])(1);
158 if (i == 1 && j == 9) {
163 if (i == 1 && j > k_totalNumberOfDoubleBufferRows) {
167 double calculation = (m_store->*calculationMethods[j-k_totalNumberOfDoubleBufferRows-1])();
186 assert(index < k_maxNumberOfDisplayableRows);
187 assert(m_titleCells[index] !=
nullptr);
188 return m_titleCells[index];
192 return m_r2TitleCell;
196 return m_columnTitleCell;
199 assert(index < k_totalNumberOfDoubleBufferRows);
200 assert(m_doubleCalculationCells[index] !=
nullptr);
201 return m_doubleCalculationCells[index];
203 assert(index < k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows);
204 assert(m_calculationCells[index] !=
nullptr);
205 return m_calculationCells[index];
210 return k_maxNumberOfDisplayableRows;
219 return k_totalNumberOfDoubleBufferRows;
221 return k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows;
225 if (i == 0 && j == k_totalNumberOfRows-1) {
234 if (j > 0 && j <= k_totalNumberOfDoubleBufferRows) {
240 Responder * CalculationController::tabController()
const {
244 View * CalculationController::loadView() {
251 for (
int i = 0; i < k_maxNumberOfDisplayableRows; i++) {
254 for (
int i = 0; i < k_totalNumberOfDoubleBufferRows; i++) {
259 for (
int i = 0; i < k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows;i++) {
266 void CalculationController::unloadView(
View * view) {
267 delete m_r2TitleCell;
268 m_r2TitleCell =
nullptr;
269 delete m_columnTitleCell;
270 m_columnTitleCell =
nullptr;
271 for (
int i = 0; i < k_totalNumberOfDoubleBufferRows; i++) {
272 delete m_doubleCalculationCells[i];
273 m_doubleCalculationCells[i] =
nullptr;
275 for (
int i = 0; i < k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows;i++) {
276 delete m_calculationCells[i];
277 m_calculationCells[i] =
nullptr;
279 for (
int i = 0; i < k_maxNumberOfDisplayableRows; i++) {
280 delete m_titleCells[i];
281 m_titleCells[i] =
nullptr;
283 TabTableController::unloadView(
view);
void didBecomeFirstResponder() override
double squaredCorrelationCoefficient()
double columnProductSum()
void setFirstText(const char *textContent)
void setAlignment(float horizontalAlignment, float verticalAlignment)
double standardDeviationOfColumn(int i)
HighlightCell * selectedCell()
int reusableCellCount(int type) override
virtual void setEven(bool even)
Responder * parentResponder() const
static constexpr KDColor GreyDark
double meanOfColumn(int i)
double(Store::* CalculPointer)()
void setVerticalCellOverlap(KDCoordinate o)
double sumOfColumn(int i)
bool selectCellAtLocation(int i, int j, bool setFirstResponder=true)
void tableViewDidChangeSelection(SelectableTableView *t, int previousSelectedCellX, int previousSelectedCellY) override
double correlationCoefficient()
HighlightCell * cellAtLocation(int i, int j)
const char * secondText()
KDCoordinate rowHeight(int j) override
double varianceOfColumn(int i)
void setTextColor(KDColor textColor)
double(Store::* ArgCalculPointer)(int)
void setText(const char *textContent)
void store(const char *storedText)
enum Message uint16_t enum Language uint16_t const char * translate(Message m, Language l=(Language) 0)
const char * title() override
void setTextColor(KDColor textColor)
void setParentResponder(Responder *responder)
bool isEmpty() const override
int numberOfRows() override
static constexpr int LargeNumberOfSignificantDigits
KDCoordinate columnWidth(int i) override
int numberOfColumns() override
HighlightCell * reusableCell(int index, int type) override
void selectFirstText(bool selectFirstText)
void setMessage(I18n::Message textContent, KDColor textColor=KDColorBlack)
double squaredValueSumOfColumn(int i)
void setFirstResponder(Responder *responder)
bool handleEvent(Ion::Events::Event event) override
static Clipboard * sharedClipboard()
void willDisplayCellAtLocation(HighlightCell *cell, int i, int j) override
virtual void setHighlighted(bool highlight)
I18n::Message emptyMessage() override
void selectCellAtLocation(int i, int j)
SelectableTableView * selectableTableView()
void setExpression(Poincare::ExpressionLayout *expressionLayout)
Responder * defaultController() override
void setSecondText(const char *textContent)
int typeAtLocation(int i, int j) override
static constexpr KDColor WallScreenDark