[apps/shared] Make the float parameter controllers a dynamic controller

view

Change-Id: I216b7f6df15e5a406624ce3c1b0e892d0f871a6b
This commit is contained in:
Émilie Feral
2017-04-20 13:16:58 +02:00
parent 78317dc06c
commit 54c5f4dcda
12 changed files with 215 additions and 86 deletions

View File

@@ -7,8 +7,8 @@ namespace Shared {
GoToParameterController::GoToParameterController(Responder * parentResponder, InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor, I18n::Message symbol) :
FloatParameterController(parentResponder),
m_cursor(cursor),
m_abscisseCell(MessageTableCellWithEditableText(&m_selectableTableView, this, m_draftTextBuffer, symbol)),
m_graphRange(graphRange)
m_graphRange(graphRange),
m_abscissaSymbol(symbol)
{
}
@@ -21,6 +21,13 @@ int GoToParameterController::numberOfRows() {
return 2;
}
void GoToParameterController::unloadView() {
assert(m_abscisseCell != nullptr);
delete m_abscisseCell;
m_abscisseCell = nullptr;
FloatParameterController::unloadView();
}
float GoToParameterController::previousParameterAtIndex(int index) {
assert(index == 0);
return m_previousParameter;
@@ -28,7 +35,7 @@ float GoToParameterController::previousParameterAtIndex(int index) {
HighlightCell * GoToParameterController::reusableParameterCell(int index, int type) {
assert(index == 0);
return &m_abscisseCell;
return m_abscisseCell;
}
int GoToParameterController::reusableParameterCellCount(int type) {
@@ -43,4 +50,11 @@ void GoToParameterController::buttonAction() {
stack->pop();
}
View * GoToParameterController::createView() {
SelectableTableView * tableView = (SelectableTableView *)FloatParameterController::createView();
assert(m_abscisseCell == nullptr);
m_abscisseCell = new MessageTableCellWithEditableText(tableView, this, m_draftTextBuffer, m_abscissaSymbol);
return tableView;
}
}