diff --git a/apps/sequence/list/list_controller.cpp b/apps/sequence/list/list_controller.cpp index ec431efed..52cd7fc02 100644 --- a/apps/sequence/list/list_controller.cpp +++ b/apps/sequence/list/list_controller.cpp @@ -231,4 +231,20 @@ void ListController::editExpression(Shared::Function * function, Ion::Events::Ev editExpression(sequence, sequenceDefinitionForRow(m_selectableTableView.selectedRow()), event); } +void ListController::reinitExpression(Shared::Function * function) { + Sequence * sequence = (Sequence *)function; + switch (sequenceDefinitionForRow(m_selectableTableView.selectedRow())) { + case 1: + sequence->setFirstInitialConditionContent(""); + break; + case 2: + sequence->setSecondInitialConditionContent(""); + break; + default: + sequence->setContent(""); + break; + } + m_selectableTableView.reloadData(); +} + } diff --git a/apps/sequence/list/list_controller.h b/apps/sequence/list/list_controller.h index af897c037..8179e343d 100644 --- a/apps/sequence/list/list_controller.h +++ b/apps/sequence/list/list_controller.h @@ -35,6 +35,7 @@ private: int sequenceDefinitionForRow(int j); void addEmptyFunction() override; void editExpression(Shared::Function * function, Ion::Events::Event event) override; + void reinitExpression(Shared::Function * function) override; static constexpr KDCoordinate k_emptySubRowHeight = 30; constexpr static int k_maxNumberOfRows = 9; SequenceStore * m_sequenceStore; diff --git a/apps/shared/list_controller.cpp b/apps/shared/list_controller.cpp index 77e18368e..e9bd10541 100644 --- a/apps/shared/list_controller.cpp +++ b/apps/shared/list_controller.cpp @@ -168,6 +168,10 @@ bool ListController::handleEvent(Ion::Events::Event event) { } } } + if (event == Ion::Events::Backspace && m_selectableTableView.selectedColumn() == 1) { + Shared::Function * function = m_functionStore->functionAtIndex(functionIndexForRow(m_selectableTableView.selectedRow())); + reinitExpression(function); + } if ((event.hasText() || event == Ion::Events::XNT) && m_selectableTableView.selectedColumn() == 1 && (m_selectableTableView.selectedRow() != numberOfRows() - 1 @@ -193,6 +197,11 @@ void ListController::configureFunction(Shared::Function * function) { stack->push(parameterController()); } +void ListController::reinitExpression(Function * function) { + function->setContent(""); + m_selectableTableView.reloadData(); +} + Responder * ListController::tabController() const{ return (parentResponder()->parentResponder()->parentResponder()); } diff --git a/apps/shared/list_controller.h b/apps/shared/list_controller.h index 89c9ed2fa..d79fdda5d 100644 --- a/apps/shared/list_controller.h +++ b/apps/shared/list_controller.h @@ -28,7 +28,8 @@ public: protected: static constexpr KDCoordinate k_emptyRowHeight = 50; StackViewController * stackController() const; - void configureFunction(Shared::Function * function); + void configureFunction(Function * function); + virtual void reinitExpression(Function * function); SelectableTableView m_selectableTableView; FunctionStore * m_functionStore; private: