diff --git a/apps/sequence/graph/curve_parameter_controller.cpp b/apps/sequence/graph/curve_parameter_controller.cpp index ab32ce574..6ab052623 100644 --- a/apps/sequence/graph/curve_parameter_controller.cpp +++ b/apps/sequence/graph/curve_parameter_controller.cpp @@ -1,13 +1,15 @@ #include "curve_parameter_controller.h" +#include "graph_controller.h" #include using namespace Shared; namespace Sequence { -CurveParameterController::CurveParameterController(InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor) : +CurveParameterController::CurveParameterController(GraphController * graphController, InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor) : FunctionCurveParameterController(graphRange, cursor), - m_sumCell(PointerTableCell((char*)"Somme des termes")) + m_sumCell(PointerTableCell((char*)"Somme des termes")), + m_graphController(graphController) { } @@ -19,7 +21,12 @@ bool CurveParameterController::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::OK) { switch (m_selectableTableView.selectedRow()) { case 0: + { + StackViewController * stack = (StackViewController *)parentResponder(); + stack->pop(); + m_graphController->displayTermSumController(); return true; + } case 1: return handleGotoSelection(); default: diff --git a/apps/sequence/graph/curve_parameter_controller.h b/apps/sequence/graph/curve_parameter_controller.h index 4e768062a..b790594a2 100644 --- a/apps/sequence/graph/curve_parameter_controller.h +++ b/apps/sequence/graph/curve_parameter_controller.h @@ -6,9 +6,11 @@ namespace Sequence { +class GraphController; + class CurveParameterController : public Shared::FunctionCurveParameterController { public: - CurveParameterController(Shared::InteractiveCurveViewRange * graphRange, Shared::CurveViewCursor * cursor); + CurveParameterController(GraphController * graphController, Shared::InteractiveCurveViewRange * graphRange, Shared::CurveViewCursor * cursor); const char * title() const override; bool handleEvent(Ion::Events::Event event) override; int numberOfRows() override; @@ -17,6 +19,7 @@ public: private: constexpr static int k_totalNumberOfCells = 2; PointerTableCell m_sumCell; + GraphController * m_graphController; }; } diff --git a/apps/sequence/graph/graph_controller.cpp b/apps/sequence/graph/graph_controller.cpp index 63f1d9bdb..aeea2feb9 100644 --- a/apps/sequence/graph/graph_controller.cpp +++ b/apps/sequence/graph/graph_controller.cpp @@ -9,11 +9,19 @@ GraphController::GraphController(Responder * parentResponder, SequenceStore * se m_bannerView(BannerView()), m_view(GraphView(sequenceStore, &m_graphRange, &m_cursor, &m_bannerView, &m_cursorView)), m_graphRange(CurveViewRange(&m_cursor, this)), - m_curveParameterController(CurveParameterController(&m_graphRange, &m_cursor)), + m_curveParameterController(CurveParameterController(this, &m_graphRange, &m_cursor)), + m_termSumController(TermSumController(this, &m_view, &m_graphRange, &m_cursor)), m_sequenceStore(sequenceStore) { } +void GraphController::viewWillAppear() { + m_view.setVerticalCursor(false); + m_view.setCursorView(&m_cursorView); + m_view.setBannerView(&m_bannerView); + FunctionGraphController::viewWillAppear(); +} + const char * GraphController::emptyMessage() { if (m_sequenceStore->numberOfDefinedFunctions() == 0) { return "Aucune suite"; @@ -21,6 +29,11 @@ const char * GraphController::emptyMessage() { return "Aucune suite activee"; } +void GraphController::displayTermSumController() { + m_termSumController.setSequence(m_sequenceStore->activeFunctionAtIndex(m_indexFunctionSelectedByCursor)); + stackController()->push(&m_termSumController); +} + BannerView * GraphController::bannerView() { return &m_bannerView; } diff --git a/apps/sequence/graph/graph_controller.h b/apps/sequence/graph/graph_controller.h index 01cce1a99..2e9216aba 100644 --- a/apps/sequence/graph/graph_controller.h +++ b/apps/sequence/graph/graph_controller.h @@ -5,6 +5,7 @@ #include "banner_view.h" #include "curve_parameter_controller.h" #include "curve_view_range.h" +#include "term_sum_controller.h" #include "../../shared/function_graph_controller.h" #include "../sequence_store.h" @@ -13,7 +14,9 @@ namespace Sequence { class GraphController : public Shared::FunctionGraphController { public: GraphController(Responder * parentResponder, SequenceStore * sequenceStore, HeaderViewController * header); + void viewWillAppear() override; const char * emptyMessage() override; + void displayTermSumController(); private: BannerView * bannerView() override; bool moveCursorHorizontally(int direction) override; @@ -26,6 +29,7 @@ private: GraphView m_view; CurveViewRange m_graphRange; CurveParameterController m_curveParameterController; + TermSumController m_termSumController; SequenceStore * m_sequenceStore; };