[apps] Get rid of DynamicViewController (part 2)

This commit is contained in:
Émilie Feral
2018-09-07 17:55:21 +02:00
parent 0fbab2f35c
commit 579da3033a
24 changed files with 138 additions and 315 deletions

View File

@@ -16,6 +16,10 @@ ValuesController::ValuesController(Responder * parentResponder, CartesianFunctio
m_intervalParameterController(this, m_interval),
m_derivativeParameterController(this)
{
for (int i = 0; i < k_maxNumberOfFunctions; i++) {
m_functionTitleCells[i].setOrientation(FunctionTitleCell::Orientation::HorizontalIndicator);
m_functionTitleCells[i].setFontSize(KDText::FontSize::Small);
}
}
bool ValuesController::handleEvent(Ion::Events::Event event) {
@@ -124,12 +128,12 @@ int ValuesController::maxNumberOfFunctions() {
Shared::BufferFunctionTitleCell * ValuesController::functionTitleCells(int j) {
assert(j >= 0 && j < k_maxNumberOfFunctions);
return m_functionTitleCells[j];
return &m_functionTitleCells[j];
}
EvenOddBufferTextCell * ValuesController::floatCells(int j) {
assert(j >= 0 && j < k_maxNumberOfCells);
return m_floatCells[j];
return &m_floatCells[j];
}
CartesianFunctionStore * ValuesController::functionStore() const {
@@ -149,28 +153,6 @@ double ValuesController::evaluationOfAbscissaAtColumn(double abscissa, int colum
return function->evaluateAtAbscissa(abscissa, myApp->localContext());
}
View * ValuesController::loadView() {
for (int i = 0; i < k_maxNumberOfFunctions; i++) {
m_functionTitleCells[i] = new Shared::BufferFunctionTitleCell(FunctionTitleCell::Orientation::HorizontalIndicator, KDText::FontSize::Small);
}
for (int i = 0; i < k_maxNumberOfCells; i++) {
m_floatCells[i] = new EvenOddBufferTextCell();
}
return Shared::ValuesController::loadView();
}
void ValuesController::unloadView(View * view) {
for (int i = 0; i < k_maxNumberOfCells; i++) {
delete m_floatCells[i];
m_floatCells[i] = nullptr;
}
for (int i = 0; i < k_maxNumberOfFunctions; i++) {
delete m_functionTitleCells[i];
m_functionTitleCells[i] = nullptr;
}
Shared::ValuesController::unloadView(view);
}
void ValuesController::updateNumberOfColumns() {
int result = 1;
for (int i = 0; i < m_functionStore->numberOfActiveFunctions(); i++) {