[escher] Change dynamic view controller paradigm

Change-Id: I57fd41c9b9ad8a1e8b684b97fdf80ddffd71881d
This commit is contained in:
Émilie Feral
2017-05-03 10:26:44 +02:00
parent a1f3c21d9b
commit 70fc734f7b
61 changed files with 338 additions and 475 deletions

View File

@@ -227,20 +227,8 @@ Responder * ValuesController::defaultController() {
}
void ValuesController::viewWillAppear() {
header()->setSelectedButton(-1);
EditableCellTableViewController::viewWillAppear();
}
void ValuesController::unloadView() {
assert(m_abscissaTitleCell != nullptr);
delete m_abscissaTitleCell;
m_abscissaTitleCell = nullptr;
for (int i = 0; i < k_maxNumberOfAbscissaCells; i++) {
assert(m_abscissaCells[i] != nullptr);
delete m_abscissaCells[i];
m_abscissaCells[i] = nullptr;
}
EditableCellTableViewController::unloadView();
header()->setSelectedButton(-1);
}
Function * ValuesController::functionAtColumn(int i) {
@@ -305,16 +293,24 @@ float ValuesController::evaluationOfAbscissaAtColumn(float abscissa, int columnI
return function->evaluateAtAbscissa(abscissa, myApp->localContext());
}
View * ValuesController::createView() {
SelectableTableView * tableView = (SelectableTableView*)EditableCellTableViewController::createView();
assert(m_abscissaTitleCell == nullptr);
View * ValuesController::loadView() {
SelectableTableView * tableView = (SelectableTableView*)EditableCellTableViewController::loadView();
m_abscissaTitleCell = new EvenOddMessageTextCell(KDText::FontSize::Small);
for (int i = 0; i < k_maxNumberOfAbscissaCells; i++) {
assert(m_abscissaCells[i] == nullptr);
m_abscissaCells[i] = new EvenOddEditableTextCell(tableView, this, m_draftTextBuffer, KDText::FontSize::Small);
}
return tableView;
}
void ValuesController::unloadView(View * view) {
delete m_abscissaTitleCell;
m_abscissaTitleCell = nullptr;
for (int i = 0; i < k_maxNumberOfAbscissaCells; i++) {
delete m_abscissaCells[i];
m_abscissaCells[i] = nullptr;
}
EditableCellTableViewController::unloadView(view);
}
}