From 4b18d16b2b4ad9c3ecdbbb956556972b6be09fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 2 May 2017 14:08:34 +0200 Subject: [PATCH] [apps/sequence||graph] Improve hiding of copy column functionnality Change-Id: Ic31734f99c0c223e5865b46c48866b89aa62d383 --- .../values/derivative_parameter_controller.cpp | 18 +++++++++++++----- .../values/derivative_parameter_controller.h | 10 ++++++++-- .../values/function_parameter_controller.cpp | 14 ++++++++++---- .../values/function_parameter_controller.h | 7 +++++-- apps/sequence/values/values_controller.cpp | 10 ++++++++-- apps/sequence/values/values_controller.h | 4 +++- apps/shared/values_controller.cpp | 3 +++ 7 files changed, 50 insertions(+), 16 deletions(-) diff --git a/apps/graph/values/derivative_parameter_controller.cpp b/apps/graph/values/derivative_parameter_controller.cpp index 5e7ff54ec..1af323201 100644 --- a/apps/graph/values/derivative_parameter_controller.cpp +++ b/apps/graph/values/derivative_parameter_controller.cpp @@ -7,7 +7,9 @@ namespace Graph { DerivativeParameterController::DerivativeParameterController(ValuesController * valuesController) : ViewController(valuesController), m_hideColumn(MessageTableCell(I18n::Message::HideDerivativeColumn)), -// m_copyColumn(MessageTableCellWithChevron(I18n::Message::CopyColumnInList)), +#if COPY_COLUMN + m_copyColumn(MessageTableCellWithChevron(I18n::Message::CopyColumnInList)), +#endif m_selectableTableView(SelectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin, this)), m_function(nullptr), @@ -50,9 +52,11 @@ bool DerivativeParameterController::handleEvent(Ion::Events::Event event) { stack->pop(); return true; } - /* TODO: implement copy column - * case 1: - return true;*/ +#if COPY_COLUMN + case 1: + /* TODO: implement function copy column */ + return true; +#endif default: assert(false); return false; @@ -68,7 +72,11 @@ int DerivativeParameterController::numberOfRows() { HighlightCell * DerivativeParameterController::reusableCell(int index) { assert(index >= 0); assert(index < k_totalNumberOfCell); - HighlightCell * cells[] = {&m_hideColumn}; //{&m_hideColumn, &m_copyColumn}; +#if COPY_COLUMN + HighlightCell * cells[] = {&m_hideColumn, &m_copyColumn}; +#else + HighlightCell * cells[] = {&m_hideColumn}; +#endif return cells[index]; } diff --git a/apps/graph/values/derivative_parameter_controller.h b/apps/graph/values/derivative_parameter_controller.h index 9d51123cf..a35284df1 100644 --- a/apps/graph/values/derivative_parameter_controller.h +++ b/apps/graph/values/derivative_parameter_controller.h @@ -23,11 +23,17 @@ public: void setFunction(CartesianFunction * function); private: - constexpr static int k_totalNumberOfCell = 1;//2; +#if COPY_COLUMN + constexpr static int k_totalNumberOfCell = 2; +#else + constexpr static int k_totalNumberOfCell = 1; +#endif constexpr static int k_maxNumberOfCharsInTitle = 16; char m_pageTitle[k_maxNumberOfCharsInTitle]; MessageTableCell m_hideColumn; -// MessageTableCellWithChevron m_copyColumn; +#if COPY_COLUMN + MessageTableCellWithChevron m_copyColumn; +#endif SelectableTableView m_selectableTableView; CartesianFunction * m_function; ValuesController * m_valuesController; diff --git a/apps/graph/values/function_parameter_controller.cpp b/apps/graph/values/function_parameter_controller.cpp index 12052b89e..6ee871741 100644 --- a/apps/graph/values/function_parameter_controller.cpp +++ b/apps/graph/values/function_parameter_controller.cpp @@ -31,9 +31,11 @@ bool FunctionParameterController::handleEvent(Ion::Events::Event event) { m_selectableTableView.reloadData(); return true; } - /* TODO: implement copy column - * case 1: - return false;*/ +#if COPY_COLUMN + case 1: + /* TODO: implement function copy column */ + return true; +#endif default: assert(false); return false; @@ -49,7 +51,11 @@ int FunctionParameterController::numberOfRows() { HighlightCell * FunctionParameterController::reusableCell(int index) { assert(index >= 0); assert(index < k_totalNumberOfCell); - HighlightCell * cells[] = {&m_displayDerivativeColumn}; // {&m_displayDerivativeColumn, &m_copyColumn}; +#if COPY_COLUMN + HighlightCell * cells[] = {&m_displayDerivativeColumn, &m_copyColumn}; +#else + HighlightCell * cells[] = {&m_displayDerivativeColumn}; +#endif return cells[index]; } diff --git a/apps/graph/values/function_parameter_controller.h b/apps/graph/values/function_parameter_controller.h index cefffe39b..cf39caa75 100644 --- a/apps/graph/values/function_parameter_controller.h +++ b/apps/graph/values/function_parameter_controller.h @@ -18,8 +18,11 @@ public: void willDisplayCellForIndex(HighlightCell * cell, int index) override; void setFunction(Shared::Function * function) override; private: - /* TODO: implement copy column */ - constexpr static int k_totalNumberOfCell = 1;//2; +#if COPY_COLUMN + constexpr static int k_totalNumberOfCell = 2; +#else + constexpr static int k_totalNumberOfCell = 1; +#endif MessageTableCellWithSwitch m_displayDerivativeColumn; CartesianFunction * m_cartesianFunction; ValuesController * m_valuesController; diff --git a/apps/sequence/values/values_controller.cpp b/apps/sequence/values/values_controller.cpp index 00ade7aa7..e7fd60edb 100644 --- a/apps/sequence/values/values_controller.cpp +++ b/apps/sequence/values/values_controller.cpp @@ -8,7 +8,9 @@ namespace Sequence { ValuesController::ValuesController(Responder * parentResponder, SequenceStore * sequenceStore, ButtonRowController * header) : Shared::ValuesController(parentResponder, header, I18n::Message::NColumn, &m_intervalParameterController), m_sequenceStore(sequenceStore), - //m_sequenceParameterController(Shared::ValuesFunctionParameterController('n')), +#if COPY_COLUMN + m_sequenceParameterController(Shared::ValuesFunctionParameterController('n')), +#endif m_intervalParameterController(IntervalParameterController(this, &m_interval)) { } @@ -89,7 +91,11 @@ SequenceStore * ValuesController::functionStore() const { } Shared::ValuesFunctionParameterController * ValuesController::functionParameterController() { - return nullptr; // TODO: return &m_sequenceParameterController; +#if COPY_COLUMN + return &m_sequenceParameterController; +#else + return nullptr; +#endif } View * ValuesController::createView() { diff --git a/apps/sequence/values/values_controller.h b/apps/sequence/values/values_controller.h index 378c0710a..bf3b5e007 100644 --- a/apps/sequence/values/values_controller.h +++ b/apps/sequence/values/values_controller.h @@ -29,7 +29,9 @@ private: SequenceStore * m_sequenceStore; SequenceStore * functionStore() const override; View * createView() override; - //Shared::ValuesFunctionParameterController m_sequenceParameterController; +#if COPY_COLUMN + Shared::ValuesFunctionParameterController m_sequenceParameterController; +#endif Shared::ValuesFunctionParameterController * functionParameterController() override; IntervalParameterController m_intervalParameterController; }; diff --git a/apps/shared/values_controller.cpp b/apps/shared/values_controller.cpp index 03e302033..1b32539ab 100644 --- a/apps/shared/values_controller.cpp +++ b/apps/shared/values_controller.cpp @@ -262,11 +262,14 @@ void ValuesController::configureAbscissa() { } void ValuesController::configureFunction() { +#if COPY_COLUMN +#else /* Temporary: the sequence value controller does not have a function parameter * controller yet but it shoult come soon. */ if (functionParameterController() == nullptr) { return; } +#endif functionParameterController()->setFunction(functionAtColumn(selectedColumn())); StackViewController * stack = stackController(); stack->push(functionParameterController());