From 4e54d929977ac2e44781d58919da3cb454caa5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 1 Mar 2017 16:24:52 +0100 Subject: [PATCH] [apps/shared] In sequence and function list, implement short cup to plot the function or go to the value table Change-Id: I08ea3c58cfe060391dceeb7f8c0019aa65571ad4 --- apps/shared/list_controller.cpp | 11 +++++++++-- apps/shared/list_controller.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/shared/list_controller.cpp b/apps/shared/list_controller.cpp index ccbe15fdb..4e5093d06 100644 --- a/apps/shared/list_controller.cpp +++ b/apps/shared/list_controller.cpp @@ -10,8 +10,14 @@ ListController::ListController(Responder * parentResponder, FunctionStore * func m_functionStore(functionStore), m_addNewFunction(text), m_plotButton(this, "Tracer", Invocation([](void * context, void * sender) { + ListController * list = (ListController *)context; + TabViewController * tabController = list->tabController(); + tabController->setActiveTab(1); }, this), KDText::FontSize::Large), m_valuesButton(this, "Afficher les valeurs", Invocation([](void * context, void * sender) { + ListController * list = (ListController *)context; + TabViewController * tabController = list->tabController(); + tabController->setActiveTab(2); }, this), KDText::FontSize::Large) { } @@ -149,6 +155,7 @@ void ListController::didBecomeFirstResponder() { if (m_selectableTableView.selectedRow() >= numberOfRows()) { m_selectableTableView.selectCellAtLocation(m_selectableTableView.selectedColumn(), numberOfRows()-1); } + footer()->setSelectedButton(-1); app()->setFirstResponder(&m_selectableTableView); } @@ -235,8 +242,8 @@ void ListController::reinitExpression(Function * function) { m_selectableTableView.reloadData(); } -Responder * ListController::tabController() const{ - return (parentResponder()->parentResponder()->parentResponder()->parentResponder()); +TabViewController * ListController::tabController() const{ + return (TabViewController *)(parentResponder()->parentResponder()->parentResponder()->parentResponder()); } int ListController::functionIndexForRow(int j) { diff --git a/apps/shared/list_controller.h b/apps/shared/list_controller.h index d2d53c26b..93c41e00e 100644 --- a/apps/shared/list_controller.h +++ b/apps/shared/list_controller.h @@ -36,7 +36,7 @@ protected: FunctionStore * m_functionStore; private: static constexpr KDCoordinate k_functionNameWidth = 65; - Responder * tabController() const; + TabViewController * tabController() const; virtual int functionIndexForRow(int j); virtual void addEmptyFunction(); virtual void editExpression(Function * function, Ion::Events::Event event) = 0;