[apps/sequence] Create a values tab

Change-Id: I37ffc57bdce85c74f46d9966a4ba4db8233e6053
This commit is contained in:
Émilie Feral
2017-02-24 16:58:22 +01:00
parent 4596602080
commit eef5f8dacb
9 changed files with 101 additions and 51 deletions

View File

@@ -1,52 +1,71 @@
#include "values_controller.h"
#include <assert.h>
using namespace Shared;
namespace Sequence {
ValuesController::ValuesController(Responder * parentResponder, SequenceStore * sequenceStore,
HeaderViewController * header) :
ViewController(parentResponder),
HeaderViewDelegate(header),
m_view(SolidColorView(KDColorRed)),
m_sequenceStore(sequenceStore)
ValuesController::ValuesController(Responder * parentResponder, SequenceStore * sequenceStore, HeaderViewController * header) :
Shared::ValuesController(parentResponder, header, 'n'),
m_sequenceTitleCells{SequenceTitleCell(FunctionTitleCell::Orientation::HorizontalIndicator), SequenceTitleCell(FunctionTitleCell::Orientation::HorizontalIndicator),
SequenceTitleCell(FunctionTitleCell::Orientation::HorizontalIndicator)},
m_sequenceStore(sequenceStore),
m_sequenceParameterController(Shared::ValuesFunctionParameterController('n'))
{
}
const char * ValuesController::title() const {
return "Valeurs";
int ValuesController::numberOfColumns() {
return m_sequenceStore->numberOfActiveFunctions()+1;
}
View * ValuesController::view() {
return &m_view;
}
void ValuesController::didBecomeFirstResponder() {
headerViewController()->setSelectedButton(-1);
}
int ValuesController::numberOfButtons() const {
return 0;
}
Button * ValuesController::buttonAtIndex(int index) {
return nullptr;
}
bool ValuesController::isEmpty() const {
if (m_sequenceStore->numberOfActiveFunctions() == 0) {
return true;
void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
Shared::ValuesController::willDisplayCellAtLocation(cell, i, j);
// The cell is the abscissa title cell:
if (j == 0 && i == 0) {
EvenOddPointerTextCell * mytitleCell = (EvenOddPointerTextCell *)cell;
mytitleCell->setText("n");
return;
}
// The cell is a function title cell:
if (j == 0 && i > 0) {
SequenceTitleCell * myCell = (SequenceTitleCell *)cell;
Sequence * sequence = m_sequenceStore->activeFunctionAtIndex(i-1);
myCell->setExpression(sequence->nameLayout());
myCell->setColor(sequence->color());
}
return false;
}
const char * ValuesController::emptyMessage() {
if (m_sequenceStore->numberOfDefinedFunctions() == 0) {
return "Aucune fonction";
return "Aucune suite";
}
return "Aucune fonction selectionnee";
return "Aucune suite selectionnee";
}
Responder * ValuesController::defaultController() {
return (parentResponder()->parentResponder()->parentResponder()->parentResponder());
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];
}
SequenceStore * ValuesController::functionStore() const {
return m_sequenceStore;
}
Shared::ValuesFunctionParameterController * ValuesController::functionParameterController() {
return &m_sequenceParameterController;
}
}