diff --git a/apps/graph/list/list_controller.cpp b/apps/graph/list/list_controller.cpp index 1a416237a..add1851dc 100644 --- a/apps/graph/list/list_controller.cpp +++ b/apps/graph/list/list_controller.cpp @@ -106,6 +106,14 @@ TableViewCell * ListController::expressionCells(int index) { return &m_expressionCells[index]; } +void ListController::configureFunction(Shared::Function * function) { + StackViewController * stack = stackController(); + parameterController()->setFunction(function); + stack->push(parameterController()); + // Force to reload the table (deleted functions, desactivated function) + m_selectableTableView.dataHasChanged(true); +} + void ListController::willDisplayTitleCellAtIndex(TableViewCell * cell, int j) { FunctionTitleCell * myFunctionCell = (FunctionTitleCell *)cell; Function * function = ((FunctionStore *)m_functionStore)->functionAtIndex(j); diff --git a/apps/graph/list/list_controller.h b/apps/graph/list/list_controller.h index 4e7c4c31a..dd3fe9cc1 100644 --- a/apps/graph/list/list_controller.h +++ b/apps/graph/list/list_controller.h @@ -23,6 +23,7 @@ private: int maxNumberOfRows() override; TableViewCell * titleCells(int index) override; TableViewCell * expressionCells(int index) override; + void configureFunction(Shared::Function * function); void willDisplayTitleCellAtIndex(TableViewCell * cell, int j) override; void willDisplayExpressionCellAtIndex(TableViewCell * cell, int j) override; constexpr static int k_maxNumberOfRows = 5; diff --git a/apps/sequence/list/sequence_title_cell.cpp b/apps/sequence/list/sequence_title_cell.cpp index c89d2abc9..3bd788c15 100644 --- a/apps/sequence/list/sequence_title_cell.cpp +++ b/apps/sequence/list/sequence_title_cell.cpp @@ -126,7 +126,19 @@ bool SequenceTitleCell::handleEvent(Ion::Events::Event event) { selectSubCell(m_selectedSubCell-1); return true; } + if (event == Ion::Events::OK) { + StackViewController * stack = stackController(); + m_listParameterController->setFunction(m_sequence); + stack->push(m_listParameterController); + SelectableTableView * table = (SelectableTableView *)parentResponder(); + table->dataHasChanged(true); + return true; + } return false; } +StackViewController * SequenceTitleCell::stackController() { + return (StackViewController *)parentResponder()->parentResponder()->parentResponder()->parentResponder(); +} + } diff --git a/apps/sequence/list/sequence_title_cell.h b/apps/sequence/list/sequence_title_cell.h index 7adf2976b..952eaa70b 100644 --- a/apps/sequence/list/sequence_title_cell.h +++ b/apps/sequence/list/sequence_title_cell.h @@ -23,6 +23,7 @@ public: bool handleEvent(Ion::Events::Event event) override; private: constexpr static KDCoordinate k_separatorThickness = 1; + StackViewController * stackController(); int m_numberOfSubCells; int m_selectedSubCell; EvenOddBufferTextCell m_definitionView; diff --git a/apps/shared/list_controller.cpp b/apps/shared/list_controller.cpp index 21676b747..4e70e8c18 100644 --- a/apps/shared/list_controller.cpp +++ b/apps/shared/list_controller.cpp @@ -148,14 +148,6 @@ void ListController::didBecomeFirstResponder() { app()->setFirstResponder(&m_selectableTableView); } -void ListController::configureFunction(Function * function) { - StackViewController * stack = stackController(); - parameterController()->setFunction(function); - stack->push(parameterController()); - // Force to reload the table (deleted functions, desactivated function) - m_selectableTableView.dataHasChanged(true); -} - bool ListController::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::Up) { m_selectableTableView.deselectTable(); diff --git a/apps/shared/list_controller.h b/apps/shared/list_controller.h index 2ab0b3e38..f5f9d8358 100644 --- a/apps/shared/list_controller.h +++ b/apps/shared/list_controller.h @@ -28,7 +28,6 @@ public: bool handleEvent(Ion::Events::Event event) override; protected: static constexpr KDCoordinate k_emptyRowHeight = 50; - void configureFunction(Function * function); StackViewController * stackController() const; SelectableTableView m_selectableTableView; FunctionStore * m_functionStore;