diff --git a/apps/graph/list/list_controller.cpp b/apps/graph/list/list_controller.cpp index 2bc8d3278..781567b23 100644 --- a/apps/graph/list/list_controller.cpp +++ b/apps/graph/list/list_controller.cpp @@ -7,7 +7,7 @@ ListController::ListController(Responder * parentResponder, Graph::FunctionStore m_activeCell(-1), m_manualScrolling(0), m_functionStore(functionStore), - m_parameterController(ParameterController(this)) + m_parameterController(ParameterController(this, functionStore)) { } diff --git a/apps/graph/list/parameter_controller.cpp b/apps/graph/list/parameter_controller.cpp index 6ef14cdf9..b5551b8c0 100644 --- a/apps/graph/list/parameter_controller.cpp +++ b/apps/graph/list/parameter_controller.cpp @@ -1,13 +1,14 @@ #include "parameter_controller.h" #include -ParameterController::ParameterController(Responder * parentResponder) : +ParameterController::ParameterController(Responder * parentResponder, Graph::FunctionStore * functionStore) : ViewController(parentResponder), m_colorCell(TableViewCell((char*)"Couleur de la fonction")), m_enableCell(SwitchTableViewCell((char*)"Activer/Desactiver")), m_deleteCell(TableViewCell((char*)"Supprimer la fonction")), m_tableView(TableView(this)), - m_activeCell(0) + m_activeCell(0), + m_functionStore(functionStore) { } @@ -78,13 +79,19 @@ bool ParameterController::handleEnter() { return true; } case 2: + { + m_functionStore->removeFunction(m_function); + StackViewController * stack = (StackViewController *)(parentResponder()); + stack->pop(); return true; + } default: + { return false; + } } } - int ParameterController::numberOfCells() { return k_totalNumberOfCell; }; diff --git a/apps/graph/list/parameter_controller.h b/apps/graph/list/parameter_controller.h index 3140caed6..ca9970287 100644 --- a/apps/graph/list/parameter_controller.h +++ b/apps/graph/list/parameter_controller.h @@ -7,7 +7,7 @@ class ParameterController : public ViewController, public TableViewDataSource { public: - ParameterController(Responder * parentResponder); + ParameterController(Responder * parentResponder, Graph::FunctionStore * functionStore); View * view() override; const char * title() const override; @@ -30,6 +30,7 @@ private: TableView m_tableView; int m_activeCell; Graph::Function * m_function; + Graph::FunctionStore * m_functionStore; }; #endif