#include "values_controller.h" #include #include using namespace Shared; namespace Sequence { ValuesController::ValuesController(Responder * parentResponder,InputEventHandlerDelegate * inputEventHandlerDelegate, Interval * interval, ButtonRowController * header) : Shared::StorageValuesController(parentResponder, inputEventHandlerDelegate, header, I18n::Message::NColumn, &m_intervalParameterController, interval), m_sequenceTitleCells{}, m_floatCells{}, #if COPY_COLUMN m_sequenceParameterController('n'), #endif m_intervalParameterController(this, inputEventHandlerDelegate, m_interval) { for (int i = 0; i < k_maxNumberOfSequences; i++) { m_sequenceTitleCells[i].setOrientation(FunctionTitleCell::Orientation::HorizontalIndicator); } } void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) { Shared::StorageValuesController::willDisplayCellAtLocation(cell, i, j); // The cell is the abscissa title cell: if (j == 0 && i == 0) { EvenOddMessageTextCell * mytitleCell = (EvenOddMessageTextCell *)cell; mytitleCell->setMessage(I18n::Message::N); return; } // The cell is a function title cell: if (j == 0 && i > 0) { SequenceTitleCell * myCell = (SequenceTitleCell *)cell; Sequence * sequence = functionStore()->modelForRecord(recordAtColumn(i)); myCell->setLayout(sequence->nameLayout()); myCell->setColor(sequence->color()); } } I18n::Message ValuesController::emptyMessage() { if (functionStore()->numberOfDefinedModels() == 0) { return I18n::Message::NoSequence; } return I18n::Message::NoActivatedSequence; } IntervalParameterController * ValuesController::intervalParameterController() { return &m_intervalParameterController; } bool ValuesController::setDataAtLocation(double floatBody, int columnIndex, int rowIndex) { if (floatBody < 0) { return false; } return Shared::StorageValuesController::setDataAtLocation(std::round(floatBody), columnIndex, rowIndex); } int ValuesController::maxNumberOfCells() { return k_maxNumberOfCells; } int ValuesController::maxNumberOfFunctions() { return k_maxNumberOfSequences; } SequenceTitleCell * ValuesController::functionTitleCells(int j) { assert(j >= 0 && j < k_maxNumberOfSequences); return &m_sequenceTitleCells[j]; } EvenOddBufferTextCell * ValuesController::floatCells(int j) { assert(j >= 0 && j < k_maxNumberOfCells); return &m_floatCells[j]; } Shared::StorageValuesFunctionParameterController * ValuesController::functionParameterController() { #if COPY_COLUMN return &m_sequenceParameterController; #else return nullptr; #endif } }