From f43f47c306c09648c8cc7a52f6256173b355c00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 15:29:12 +0200 Subject: [PATCH 01/12] [apps/sequence][apps/graph] Implement copy paste in values controller Change-Id: Id4283e75c5e42debc4e6983aa1d7499acffbfc26 --- apps/shared/values_controller.cpp | 5 +++++ escher/include/escher/even_odd_buffer_text_cell.h | 1 + escher/src/even_odd_buffer_text_cell.cpp | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/apps/shared/values_controller.cpp b/apps/shared/values_controller.cpp index 926d0eb10..6ba138f54 100644 --- a/apps/shared/values_controller.cpp +++ b/apps/shared/values_controller.cpp @@ -75,6 +75,11 @@ bool ValuesController::handleEvent(Ion::Events::Event event) { if (selectableTableView()->selectedRow() == -1) { return header()->handleEvent(event); } + if (event == Ion::Events::Copy && selectableTableView()->selectedRow() > 0 && selectableTableView()->selectedColumn() > 0) { + EvenOddBufferTextCell * cell = (EvenOddBufferTextCell *)selectableTableView()->selectedCell(); + Clipboard::sharedClipboard()->store(cell->text()); + return true; + } return false; } diff --git a/escher/include/escher/even_odd_buffer_text_cell.h b/escher/include/escher/even_odd_buffer_text_cell.h index eebdc7d4e..653350a23 100644 --- a/escher/include/escher/even_odd_buffer_text_cell.h +++ b/escher/include/escher/even_odd_buffer_text_cell.h @@ -7,6 +7,7 @@ class EvenOddBufferTextCell : public EvenOddCell { public: EvenOddBufferTextCell(KDText::FontSize size = KDText::FontSize::Small, float horizontalAlignment = 1.0f, float verticalAlignment = 0.5f); + const char * text(); void setEven(bool even) override; void setHighlighted(bool highlight) override; void setText(const char * textContent); diff --git a/escher/src/even_odd_buffer_text_cell.cpp b/escher/src/even_odd_buffer_text_cell.cpp index 0dd1f4b9e..d83e7b399 100644 --- a/escher/src/even_odd_buffer_text_cell.cpp +++ b/escher/src/even_odd_buffer_text_cell.cpp @@ -7,6 +7,10 @@ EvenOddBufferTextCell::EvenOddBufferTextCell(KDText::FontSize size, float horizo { } +const char * EvenOddBufferTextCell::text() { + return m_bufferTextView.text(); +} + void EvenOddBufferTextCell::setHighlighted(bool highlight) { EvenOddCell::setHighlighted(highlight); m_bufferTextView.setBackgroundColor(backgroundColor()); From f6a24dc1d2827fa4aa4f7d867cd8a08f4fd019ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 15:53:09 +0200 Subject: [PATCH 02/12] [apps/statistics] Implement copy in calculation controller Change-Id: Ifb9d7ed46f484a2e7f30f0c473c7e785ea6e034a --- apps/statistics/calculation_controller.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/statistics/calculation_controller.cpp b/apps/statistics/calculation_controller.cpp index 9965862ca..8a11fe879 100644 --- a/apps/statistics/calculation_controller.cpp +++ b/apps/statistics/calculation_controller.cpp @@ -27,6 +27,11 @@ bool CalculationController::handleEvent(Ion::Events::Event event) { app()->setFirstResponder(tabController()); return true; } + if (event == Ion::Events::Copy && selectableTableView()->selectedColumn() == 1) { + EvenOddBufferTextCell * myCell = (EvenOddBufferTextCell *)selectableTableView()->selectedCell(); + Clipboard::sharedClipboard()->store(myCell->text()); + return true; + } return false; } From f65c8f3a27bf27701172c712f8f0266b6cf1a8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 15:53:41 +0200 Subject: [PATCH 03/12] [apps/regression] Implement copy in calculation controller Change-Id: I95d6bebb87c97079549596ce50c29a74d8ced967 --- apps/regression/calculation_controller.cpp | 14 ++++++++++++++ .../even_odd_double_buffer_text_cell.cpp | 8 ++++++++ apps/regression/even_odd_double_buffer_text_cell.h | 2 ++ 3 files changed, 24 insertions(+) diff --git a/apps/regression/calculation_controller.cpp b/apps/regression/calculation_controller.cpp index 319c4c36b..edaa139ef 100644 --- a/apps/regression/calculation_controller.cpp +++ b/apps/regression/calculation_controller.cpp @@ -36,6 +36,20 @@ bool CalculationController::handleEvent(Ion::Events::Event event) { app()->setFirstResponder(tabController()); return true; } + if (event == Ion::Events::Copy && selectableTableView()->selectedColumn() == 1 && selectableTableView()->selectedRow() > 0) { + if (selectableTableView()->selectedRow() < 6) { + EvenOddDoubleBufferTextCell * myCell = (EvenOddDoubleBufferTextCell *)selectableTableView()->selectedCell(); + if (myCell->firstTextSelected()) { + Clipboard::sharedClipboard()->store(myCell->firstText()); + } else { + Clipboard::sharedClipboard()->store(myCell->secondText()); + } + } else { + EvenOddBufferTextCell * myCell = (EvenOddBufferTextCell *)selectableTableView()->selectedCell(); + Clipboard::sharedClipboard()->store(myCell->text()); + } + return true; + } return false; } diff --git a/apps/regression/even_odd_double_buffer_text_cell.cpp b/apps/regression/even_odd_double_buffer_text_cell.cpp index c20efb160..8a0d3d40d 100644 --- a/apps/regression/even_odd_double_buffer_text_cell.cpp +++ b/apps/regression/even_odd_double_buffer_text_cell.cpp @@ -10,6 +10,14 @@ EvenOddDoubleBufferTextCell::EvenOddDoubleBufferTextCell(Responder * parentRespo { } +const char * EvenOddDoubleBufferTextCell::firstText() { + return m_firstBufferTextView.text(); +} + +const char * EvenOddDoubleBufferTextCell::secondText() { + return m_secondBufferTextView.text(); +} + bool EvenOddDoubleBufferTextCell::firstTextSelected() { return m_firstTextSelected; } diff --git a/apps/regression/even_odd_double_buffer_text_cell.h b/apps/regression/even_odd_double_buffer_text_cell.h index 8f4b6a093..7929b11bc 100644 --- a/apps/regression/even_odd_double_buffer_text_cell.h +++ b/apps/regression/even_odd_double_buffer_text_cell.h @@ -6,6 +6,8 @@ class EvenOddDoubleBufferTextCell : public EvenOddCell, public Responder{ public: EvenOddDoubleBufferTextCell(Responder * parentResponder = nullptr); + const char * firstText(); + const char * secondText(); void reloadCell() override; void setHighlighted(bool highlight) override; void setEven(bool even) override; From 7715da8e3691f1dd273b0e3b97d260d83ddd533d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 16:20:55 +0200 Subject: [PATCH 04/12] [apps/shared] In float parameter controllers, back has the same consequence as 'validate' Change-Id: Id45f824c50af2f6e47be5abd9115d98971a1e073 --- apps/probability/parameters_controller.cpp | 7 ------- apps/probability/parameters_controller.h | 2 -- apps/shared/float_parameter_controller.cpp | 5 ----- apps/shared/float_parameter_controller.h | 1 - apps/shared/go_to_parameter_controller.cpp | 10 ---------- apps/shared/go_to_parameter_controller.h | 3 --- apps/shared/interval_parameter_controller.cpp | 12 ------------ apps/shared/interval_parameter_controller.h | 3 --- apps/shared/range_parameter_controller.cpp | 17 ----------------- apps/shared/range_parameter_controller.h | 3 --- .../histogram_parameter_controller.cpp | 11 ----------- .../statistics/histogram_parameter_controller.h | 3 --- 12 files changed, 77 deletions(-) diff --git a/apps/probability/parameters_controller.cpp b/apps/probability/parameters_controller.cpp index c15405862..2399637fb 100644 --- a/apps/probability/parameters_controller.cpp +++ b/apps/probability/parameters_controller.cpp @@ -88,7 +88,6 @@ void ParametersController::setLaw(Law * law) { void ParametersController::viewWillAppear() { for (int i = 0; i < m_law->numberOfParameter(); i++) { - m_previousParameters[i] = parameterAtIndex(i); contentView()->parameterDefinitionAtIndex(i)->setMessage(m_law->parameterDefinitionAtIndex(i)); } contentView()->layoutSubviews(); @@ -133,12 +132,6 @@ void ParametersController::unloadView() { FloatParameterController::unloadView(); } -float ParametersController::previousParameterAtIndex(int index) { - assert(index >= 0); - assert(index < 2); - return m_previousParameters[index]; -} - float ParametersController::parameterAtIndex(int index) { return m_law->parameterValueAtIndex(index); } diff --git a/apps/probability/parameters_controller.h b/apps/probability/parameters_controller.h index 27f392ce2..727bf18e7 100644 --- a/apps/probability/parameters_controller.h +++ b/apps/probability/parameters_controller.h @@ -21,7 +21,6 @@ private: HighlightCell * reusableParameterCell(int index, int type) override; int reusableParameterCellCount(int type) override; void buttonAction() override; - float previousParameterAtIndex(int index) override; float parameterAtIndex(int index) override; bool setParameterAtIndex(int parameterIndex, float f) override; bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override; @@ -51,7 +50,6 @@ private: constexpr static int k_maxNumberOfCells = 2; char m_draftTextBuffer[MessageTableCellWithEditableText::k_bufferLength]; MessageTableCellWithEditableText * m_menuListCell[k_maxNumberOfCells]; - float m_previousParameters[k_maxNumberOfCells]; Law * m_law; CalculationController m_calculationController; }; diff --git a/apps/shared/float_parameter_controller.cpp b/apps/shared/float_parameter_controller.cpp index 53491d7ca..d874f5b92 100644 --- a/apps/shared/float_parameter_controller.cpp +++ b/apps/shared/float_parameter_controller.cpp @@ -46,11 +46,6 @@ void FloatParameterController::willExitResponderChain(Responder * nextFirstRespo bool FloatParameterController::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::Back) { - for (int i = 0; i < numberOfRows()-1; i++) { - if (parameterAtIndex(i) != previousParameterAtIndex(i)) { - setParameterAtIndex(i, previousParameterAtIndex(i)); - } - } stackController()->pop(); return true; } diff --git a/apps/shared/float_parameter_controller.h b/apps/shared/float_parameter_controller.h index 5f848760e..450839e30 100644 --- a/apps/shared/float_parameter_controller.h +++ b/apps/shared/float_parameter_controller.h @@ -43,7 +43,6 @@ private: virtual int reusableParameterCellCount(int type) = 0; virtual HighlightCell * reusableParameterCell(int index, int type) = 0; TextFieldDelegateApp * textFieldDelegateApp() override; - virtual float previousParameterAtIndex(int index) = 0; virtual bool setParameterAtIndex(int parameterIndex, float f) = 0; ButtonWithSeparator * m_okButton; }; diff --git a/apps/shared/go_to_parameter_controller.cpp b/apps/shared/go_to_parameter_controller.cpp index 5aa009e4f..d0eacfd40 100644 --- a/apps/shared/go_to_parameter_controller.cpp +++ b/apps/shared/go_to_parameter_controller.cpp @@ -12,11 +12,6 @@ GoToParameterController::GoToParameterController(Responder * parentResponder, In { } -void GoToParameterController::viewWillAppear() { - m_previousParameter = parameterAtIndex(0); - FloatParameterController::viewWillAppear(); -} - int GoToParameterController::numberOfRows() { return 2; } @@ -28,11 +23,6 @@ void GoToParameterController::unloadView() { FloatParameterController::unloadView(); } -float GoToParameterController::previousParameterAtIndex(int index) { - assert(index == 0); - return m_previousParameter; -} - HighlightCell * GoToParameterController::reusableParameterCell(int index, int type) { assert(index == 0); return m_abscisseCell; diff --git a/apps/shared/go_to_parameter_controller.h b/apps/shared/go_to_parameter_controller.h index 9ed7067ad..d9f21d52f 100644 --- a/apps/shared/go_to_parameter_controller.h +++ b/apps/shared/go_to_parameter_controller.h @@ -11,7 +11,6 @@ namespace Shared { class GoToParameterController : public FloatParameterController { public: GoToParameterController(Responder * parentResponder, InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor, I18n::Message symbol); - void viewWillAppear() override; int numberOfRows() override; void unloadView() override; protected: @@ -21,11 +20,9 @@ private: void buttonAction() override; HighlightCell * reusableParameterCell(int index, int type) override; int reusableParameterCellCount(int type) override; - float previousParameterAtIndex(int index) override; View * createView() override; char m_draftTextBuffer[MessageTableCellWithEditableText::k_bufferLength]; MessageTableCellWithEditableText * m_abscisseCell; - float m_previousParameter; InteractiveCurveViewRange * m_graphRange; I18n::Message m_abscissaSymbol; }; diff --git a/apps/shared/interval_parameter_controller.cpp b/apps/shared/interval_parameter_controller.cpp index e9a4da662..f6c359372 100644 --- a/apps/shared/interval_parameter_controller.cpp +++ b/apps/shared/interval_parameter_controller.cpp @@ -13,13 +13,6 @@ const char * IntervalParameterController::title() { return I18n::translate(I18n::Message::IntervalSet); } -void IntervalParameterController::viewWillAppear() { - for (int i = 0; i < k_totalNumberOfCell; i++) { - m_previousParameters[i] = parameterAtIndex(i); - } - FloatParameterController::viewWillAppear(); -} - int IntervalParameterController::numberOfRows() { return k_totalNumberOfCell+1; } @@ -47,11 +40,6 @@ void IntervalParameterController::unloadView() { FloatParameterController::unloadView(); } -float IntervalParameterController::previousParameterAtIndex(int index) { - assert(index >= 0 && index < k_totalNumberOfCell); - return m_previousParameters[index]; -} - float IntervalParameterController::parameterAtIndex(int index) { GetterPointer getters[k_totalNumberOfCell] = {&Interval::start, &Interval::end, &Interval::step}; return (m_interval->*getters[index])(); diff --git a/apps/shared/interval_parameter_controller.h b/apps/shared/interval_parameter_controller.h index 1ca4d900a..0012cf93f 100644 --- a/apps/shared/interval_parameter_controller.h +++ b/apps/shared/interval_parameter_controller.h @@ -12,7 +12,6 @@ public: IntervalParameterController(Responder * parentResponder, Interval * interval); Interval * interval(); const char * title() override; - void viewWillAppear() override; void willDisplayCellForIndex(HighlightCell * cell, int index) override; int numberOfRows() override; void unloadView() override; @@ -23,12 +22,10 @@ protected: private: HighlightCell * reusableParameterCell(int index, int type) override; int reusableParameterCellCount(int type) override; - float previousParameterAtIndex(int index) override; float parameterAtIndex(int index) override; View * createView() override; char m_draftTextBuffer[MessageTableCellWithEditableText::k_bufferLength]; MessageTableCellWithEditableText * m_intervalCells[k_totalNumberOfCell]; - float m_previousParameters[k_totalNumberOfCell]; }; } diff --git a/apps/shared/range_parameter_controller.cpp b/apps/shared/range_parameter_controller.cpp index bc6b95e5d..75feb404a 100644 --- a/apps/shared/range_parameter_controller.cpp +++ b/apps/shared/range_parameter_controller.cpp @@ -17,15 +17,6 @@ const char * RangeParameterController::title() { return I18n::translate(I18n::Message::Axis); } -void RangeParameterController::viewWillAppear() { - for (int i = 0; i < k_numberOfTextCell; i++) { - int index = i > 2 ? i + 1 : i; - m_previousParameters[i] = parameterAtIndex(index); - } - m_previousSwitchState = m_interactiveRange->yAuto(); - FloatParameterController::viewWillAppear(); -} - int RangeParameterController::numberOfRows() { return k_numberOfTextCell+2; } @@ -96,17 +87,9 @@ bool RangeParameterController::handleEvent(Ion::Events::Event event) { selectableTableView()->reloadData(); return true; } - if (event == Ion::Events::Back) { - m_interactiveRange->setYAuto(m_previousSwitchState); - } return FloatParameterController::handleEvent(event); } -float RangeParameterController::previousParameterAtIndex(int parameterIndex) { - int index = parameterIndex > 2 ? parameterIndex - 1 : parameterIndex; - return m_previousParameters[index]; -} - float RangeParameterController::parameterAtIndex(int parameterIndex) { ParameterGetterPointer getters[k_numberOfTextCell] = {&InteractiveCurveViewRange::xMin, &InteractiveCurveViewRange::xMax, &InteractiveCurveViewRange::yMin, &InteractiveCurveViewRange::yMax}; diff --git a/apps/shared/range_parameter_controller.h b/apps/shared/range_parameter_controller.h index b885a06bf..fa909e2e4 100644 --- a/apps/shared/range_parameter_controller.h +++ b/apps/shared/range_parameter_controller.h @@ -11,7 +11,6 @@ class RangeParameterController : public FloatParameterController { public: RangeParameterController(Responder * parentResponder, InteractiveCurveViewRange * interactiveCurveViewRange); const char * title() override; - void viewWillAppear() override; int numberOfRows() override; int typeAtLocation(int i, int j) override; void willDisplayCellForIndex(HighlightCell * cell, int index) override; @@ -22,7 +21,6 @@ public: private: HighlightCell * reusableParameterCell(int index, int type) override; int reusableParameterCellCount(int type) override; - float previousParameterAtIndex(int index) override; float parameterAtIndex(int index) override; bool setParameterAtIndex(int parameterIndex, float f) override; View * createView() override; @@ -31,7 +29,6 @@ private: char m_draftTextBuffer[MessageTableCellWithEditableText::k_bufferLength]; MessageTableCellWithEditableText * m_rangeCells[k_numberOfTextCell]; MessageTableCellWithSwitch * m_yAutoCell; - float m_previousParameters[k_numberOfTextCell]; bool m_previousSwitchState; }; diff --git a/apps/statistics/histogram_parameter_controller.cpp b/apps/statistics/histogram_parameter_controller.cpp index 3f8b5acb7..85a1ac89f 100644 --- a/apps/statistics/histogram_parameter_controller.cpp +++ b/apps/statistics/histogram_parameter_controller.cpp @@ -16,13 +16,6 @@ const char * HistogramParameterController::title() { return I18n::translate(I18n::Message::HistogramSet); } -void HistogramParameterController::viewWillAppear() { - for (int i = 0; i < k_numberOfCells; i++) { - m_previousParameters[i] = parameterAtIndex(i); - } - FloatParameterController::viewWillAppear(); -} - int HistogramParameterController::numberOfRows() { return 1+k_numberOfCells; } @@ -54,10 +47,6 @@ float HistogramParameterController::parameterAtIndex(int index) { return m_store->firstDrawnBarAbscissa(); } -float HistogramParameterController::previousParameterAtIndex(int index) { - return m_previousParameters[index]; -} - bool HistogramParameterController::setParameterAtIndex(int parameterIndex, float f) { assert(parameterIndex >= 0 && parameterIndex < k_numberOfCells); if (parameterIndex == 0) { diff --git a/apps/statistics/histogram_parameter_controller.h b/apps/statistics/histogram_parameter_controller.h index e33a7ecfb..5cd5d3a1c 100644 --- a/apps/statistics/histogram_parameter_controller.h +++ b/apps/statistics/histogram_parameter_controller.h @@ -11,7 +11,6 @@ class HistogramParameterController : public Shared::FloatParameterController { public: HistogramParameterController(Responder * parentResponder, Store * store); const char * title() override; - void viewWillAppear() override; int numberOfRows() override; void willDisplayCellForIndex(HighlightCell * cell, int index) override; void unloadView() override; @@ -19,13 +18,11 @@ private: HighlightCell * reusableParameterCell(int index, int type) override; int reusableParameterCellCount(int type) override; float parameterAtIndex(int index) override; - float previousParameterAtIndex(int index) override; bool setParameterAtIndex(int parameterIndex, float f) override; View * createView() override; char m_draftTextBuffer[MessageTableCellWithEditableText::k_bufferLength]; constexpr static int k_numberOfCells = 2; MessageTableCellWithEditableText * m_cells[k_numberOfCells]; - float m_previousParameters[k_numberOfCells]; Store * m_store; }; From e63657cf92182b22d9b2ca9314a3c649058c91b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 16:33:39 +0200 Subject: [PATCH 05/12] [apps/sequence] Fix bug in term sum controller Change-Id: I4ffc0071fe06c63753079c741f753e064387d88b --- apps/sequence/graph/term_sum_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sequence/graph/term_sum_controller.cpp b/apps/sequence/graph/term_sum_controller.cpp index 6cefc6718..aac23eee9 100644 --- a/apps/sequence/graph/term_sum_controller.cpp +++ b/apps/sequence/graph/term_sum_controller.cpp @@ -78,7 +78,7 @@ bool TermSumController::handleEvent(Ion::Events::Event event) { } if (event.hasText() && event.text()[0] >= '0' && event.text()[0] <= '9') { m_bufferCursorPosition = 10*m_bufferCursorPosition + event.text()[0]-'0'; - if (m_step > 0 && m_bufferCursorPosition < m_cursor->x()) { + if (m_step > 0 && m_bufferCursorPosition < m_startSum) { return false; } if (moveCursorHorizontallyToPosition(m_bufferCursorPosition)) { From 2ce50b761b12964360e486ad0fa093c66f6aa765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 16:47:35 +0200 Subject: [PATCH 06/12] [apps/sequence][apps/list] Hide the function color choice Change-Id: I1bcb5092ab278b1c557890768cf0dabf9b178935 --- apps/sequence/list/list_parameter_controller.cpp | 16 ++++++++-------- apps/sequence/list/list_parameter_controller.h | 3 ++- apps/shared/list_parameter_controller.cpp | 11 +++++------ apps/shared/list_parameter_controller.h | 5 +++-- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/apps/sequence/list/list_parameter_controller.cpp b/apps/sequence/list/list_parameter_controller.cpp index aced0a2a4..dd9c631ad 100644 --- a/apps/sequence/list/list_parameter_controller.cpp +++ b/apps/sequence/list/list_parameter_controller.cpp @@ -27,16 +27,16 @@ bool ListParameterController::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::OK) { int selectedRowIndex = m_selectableTableView.selectedRow(); switch (selectedRowIndex) { - case 0: - return handleEnterOnRow(selectedRowIndex); - case 1: + /*case 0: + return handleEnterOnRow(selectedRowIndex);*/ + case 0://1 { StackViewController * stack = (StackViewController *)(parentResponder()); m_typeParameterController.setSequence(m_sequence); stack->push(&m_typeParameterController); return true; } - case 3: + case 2://3 if (m_functionStore->numberOfFunctions() > 0) { m_functionStore->removeFunction(m_function); StackViewController * stack = (StackViewController *)(parentResponder()); @@ -56,10 +56,10 @@ int ListParameterController::numberOfRows() { HighlightCell * ListParameterController::reusableCell(int index) { switch (index) { - case 0: - return Shared::ListParameterController::reusableCell(index); - case 1: - return &m_typeCell; + /*case 0: + return Shared::ListParameterController::reusableCell(index);*/ + case 0://1: + return &m_typeCell; default: return Shared::ListParameterController::reusableCell(index-1); } diff --git a/apps/sequence/list/list_parameter_controller.h b/apps/sequence/list/list_parameter_controller.h index ff479670a..1fc9a2d5e 100644 --- a/apps/sequence/list/list_parameter_controller.h +++ b/apps/sequence/list/list_parameter_controller.h @@ -21,7 +21,8 @@ public: int reusableCellCount() override; void willDisplayCellForIndex(HighlightCell * cell, int index) override; private: - constexpr static int k_totalNumberOfCell = 4; + /* TODO: implement function color choice */ + constexpr static int k_totalNumberOfCell = 3;//4 MessageTableCellWithChevronAndExpression m_typeCell; TypeParameterController m_typeParameterController; Sequence * m_sequence; diff --git a/apps/shared/list_parameter_controller.cpp b/apps/shared/list_parameter_controller.cpp index f4d61d480..a2717cce6 100644 --- a/apps/shared/list_parameter_controller.cpp +++ b/apps/shared/list_parameter_controller.cpp @@ -8,7 +8,7 @@ ListParameterController::ListParameterController(Responder * parentResponder, Fu m_selectableTableView(SelectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_functionStore(functionStore), - m_colorCell(MessageTableCellWithChevron(functionColorMessage)), + //m_colorCell(MessageTableCellWithChevron(functionColorMessage)), m_enableCell(MessageTableCellWithSwitch(I18n::Message::ActivateDesactivate)), m_deleteCell(MessageTableCell(deleteFunctionMessage)) { @@ -58,7 +58,7 @@ int ListParameterController::numberOfRows() { HighlightCell * ListParameterController::reusableCell(int index) { assert(index >= 0); assert(index < k_totalNumberOfCell); - HighlightCell * cells[] = {&m_colorCell, &m_enableCell, &m_deleteCell}; + HighlightCell * cells[] = {&m_enableCell, &m_deleteCell};//{&m_colorCell, &m_enableCell, &m_deleteCell}; return cells[index]; } @@ -72,13 +72,12 @@ KDCoordinate ListParameterController::cellHeight() { bool ListParameterController::handleEnterOnRow(int rowIndex) { switch (rowIndex) { - case 0: - return true; - case 1: + /* TODO: implement function color choice */ + case 0://1: m_function->setActive(!m_function->isActive()); m_selectableTableView.reloadData(); return true; - case 2: + case 1://2: { if (m_functionStore->numberOfFunctions() > 1) { m_functionStore->removeFunction(m_function); diff --git a/apps/shared/list_parameter_controller.h b/apps/shared/list_parameter_controller.h index 236838718..7675dda9a 100644 --- a/apps/shared/list_parameter_controller.h +++ b/apps/shared/list_parameter_controller.h @@ -28,8 +28,9 @@ protected: FunctionStore * m_functionStore; Function * m_function; private: - constexpr static int k_totalNumberOfCell = 3; - MessageTableCellWithChevron m_colorCell; + /* TODO: implement function color choice */ + constexpr static int k_totalNumberOfCell = 2;//3; + //MessageTableCellWithChevron m_colorCell; MessageTableCellWithSwitch m_enableCell; MessageTableCell m_deleteCell; }; From 3e848b7a4d3b24f17c4e9d3e5c779bd8282a936e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 17:13:03 +0200 Subject: [PATCH 07/12] [apps/shared] In list controller, fix bug Change-Id: Ie3d4c933a9cc52fc39fac74b756344cd67e7ed90 --- apps/shared/list_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/shared/list_controller.cpp b/apps/shared/list_controller.cpp index c121b61eb..bc2a9461f 100644 --- a/apps/shared/list_controller.cpp +++ b/apps/shared/list_controller.cpp @@ -204,7 +204,7 @@ bool ListController::handleEvent(Ion::Events::Event event) { } } } - if (event == Ion::Events::Backspace && + if (event == Ion::Events::Backspace && selectableTableView()->selectedRow() >= 0 && (selectableTableView()->selectedRow() < numberOfRows() - 1 || m_functionStore->numberOfFunctions() == m_functionStore->maxNumberOfFunctions())) { Shared::Function * function = m_functionStore->functionAtIndex(functionIndexForRow(selectableTableView()->selectedRow())); if (selectableTableView()->selectedColumn() == 1) { From e3830b5fca87a74c74739b59b8e16c4a23a042f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 17:42:51 +0200 Subject: [PATCH 08/12] [apps] Erase clipboard in exam mode Change-Id: Ie54ff64c983aa9560c93efeb76272241739e3875 --- apps/apps_container.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/apps_container.cpp b/apps/apps_container.cpp index 2d27adc70..1d5ef45fe 100644 --- a/apps/apps_container.cpp +++ b/apps/apps_container.cpp @@ -60,6 +60,7 @@ App * AppsContainer::hardwareTestApp() { } void AppsContainer::reset() { + Clipboard::sharedClipboard()->reset(); for (int i = 0; i < numberOfApps(); i++) { ((ResettableApp *)appAtIndex(i))->reset(); } From e58e3e8a66a091c04808ae2b4f63bf1a1c2c370a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 17:49:03 +0200 Subject: [PATCH 09/12] [apps/sequence][apps/graph] Hide "copy column" functionnality Change-Id: I5c452faa1ef79bb1eec8bbdd8b69ba684661a38b --- apps/graph/values/derivative_parameter_controller.cpp | 9 +++++---- apps/graph/values/derivative_parameter_controller.h | 4 ++-- apps/graph/values/function_parameter_controller.cpp | 7 ++++--- apps/graph/values/function_parameter_controller.h | 3 ++- apps/sequence/values/values_controller.cpp | 4 ++-- apps/sequence/values/values_controller.h | 2 +- apps/shared/values_controller.cpp | 5 +++++ 7 files changed, 21 insertions(+), 13 deletions(-) diff --git a/apps/graph/values/derivative_parameter_controller.cpp b/apps/graph/values/derivative_parameter_controller.cpp index 8c48d28b8..bf734dc77 100644 --- a/apps/graph/values/derivative_parameter_controller.cpp +++ b/apps/graph/values/derivative_parameter_controller.cpp @@ -7,7 +7,7 @@ namespace Graph { DerivativeParameterController::DerivativeParameterController(ValuesController * valuesController) : ViewController(valuesController), m_hideColumn(MessageTableCell(I18n::Message::HideDerivativeColumn)), - m_copyColumn(MessageTableCellWithChevron(I18n::Message::CopyColumnInList)), +// m_copyColumn(MessageTableCellWithChevron(I18n::Message::CopyColumnInList)), m_selectableTableView(SelectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_function(nullptr), @@ -50,8 +50,9 @@ bool DerivativeParameterController::handleEvent(Ion::Events::Event event) { stack->pop(); return true; } - case 1: - return false; + /* TODO: implement copy column + * case 1: + return true;*/ default: assert(false); return false; @@ -67,7 +68,7 @@ int DerivativeParameterController::numberOfRows() { HighlightCell * DerivativeParameterController::reusableCell(int index) { assert(index >= 0); assert(index < k_totalNumberOfCell); - HighlightCell * cells[] = {&m_hideColumn, &m_copyColumn}; + HighlightCell * cells[] = {&m_hideColumn}; //{&m_hideColumn, &m_copyColumn}; return cells[index]; } diff --git a/apps/graph/values/derivative_parameter_controller.h b/apps/graph/values/derivative_parameter_controller.h index e29c4e473..9ca9caf68 100644 --- a/apps/graph/values/derivative_parameter_controller.h +++ b/apps/graph/values/derivative_parameter_controller.h @@ -23,11 +23,11 @@ public: void setFunction(CartesianFunction * function); private: - constexpr static int k_totalNumberOfCell = 2; + constexpr static int k_totalNumberOfCell = 1;//2; constexpr static int k_maxNumberOfCharsInTitle = 16; char m_pageTitle[k_maxNumberOfCharsInTitle]; MessageTableCell m_hideColumn; - MessageTableCellWithChevron m_copyColumn; +// MessageTableCellWithChevron m_copyColumn; 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 7fcf38227..38bf53a4f 100644 --- a/apps/graph/values/function_parameter_controller.cpp +++ b/apps/graph/values/function_parameter_controller.cpp @@ -32,8 +32,9 @@ bool FunctionParameterController::handleEvent(Ion::Events::Event event) { m_selectableTableView.reloadData(); return true; } - case 1: - return false; + /* TODO: implement copy column + * case 1: + return false;*/ default: assert(false); return false; @@ -49,7 +50,7 @@ int FunctionParameterController::numberOfRows() { HighlightCell * FunctionParameterController::reusableCell(int index) { assert(index >= 0); assert(index < k_totalNumberOfCell); - HighlightCell * cells[] = {&m_displayDerivativeColumn, &m_copyColumn}; + HighlightCell * cells[] = {&m_displayDerivativeColumn}; // {&m_displayDerivativeColumn, &m_copyColumn}; return cells[index]; } diff --git a/apps/graph/values/function_parameter_controller.h b/apps/graph/values/function_parameter_controller.h index 65cf043b4..cefffe39b 100644 --- a/apps/graph/values/function_parameter_controller.h +++ b/apps/graph/values/function_parameter_controller.h @@ -18,7 +18,8 @@ public: void willDisplayCellForIndex(HighlightCell * cell, int index) override; void setFunction(Shared::Function * function) override; private: - constexpr static int k_totalNumberOfCell = 2; + /* TODO: implement copy column */ + constexpr static int k_totalNumberOfCell = 1;//2; 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 fadcda94d..00ade7aa7 100644 --- a/apps/sequence/values/values_controller.cpp +++ b/apps/sequence/values/values_controller.cpp @@ -8,7 +8,7 @@ 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')), + //m_sequenceParameterController(Shared::ValuesFunctionParameterController('n')), m_intervalParameterController(IntervalParameterController(this, &m_interval)) { } @@ -89,7 +89,7 @@ SequenceStore * ValuesController::functionStore() const { } Shared::ValuesFunctionParameterController * ValuesController::functionParameterController() { - return &m_sequenceParameterController; + return nullptr; // TODO: return &m_sequenceParameterController; } View * ValuesController::createView() { diff --git a/apps/sequence/values/values_controller.h b/apps/sequence/values/values_controller.h index 37c6893e9..378c0710a 100644 --- a/apps/sequence/values/values_controller.h +++ b/apps/sequence/values/values_controller.h @@ -29,7 +29,7 @@ private: SequenceStore * m_sequenceStore; SequenceStore * functionStore() const override; View * createView() override; - Shared::ValuesFunctionParameterController m_sequenceParameterController; + //Shared::ValuesFunctionParameterController m_sequenceParameterController; Shared::ValuesFunctionParameterController * functionParameterController() override; IntervalParameterController m_intervalParameterController; }; diff --git a/apps/shared/values_controller.cpp b/apps/shared/values_controller.cpp index 6ba138f54..f45bde64a 100644 --- a/apps/shared/values_controller.cpp +++ b/apps/shared/values_controller.cpp @@ -262,6 +262,11 @@ void ValuesController::configureAbscissa() { } void ValuesController::configureFunction() { + /* Temporary: the sequence value controller does not have a function parameter + * controller yet but it shoult come soon. */ + if (functionParameterController() == nullptr) { + return; + } functionParameterController()->setFunction(functionAtColumn(selectableTableView()->selectedColumn())); StackViewController * stack = stackController(); stack->push(functionParameterController()); From c3617d84a2d4f7edcd52a8c120962a96093f4f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 17:56:19 +0200 Subject: [PATCH 10/12] [apps/regression][apps/statistics] Hide copy/import column in store controllers Change-Id: I63c87721d359ffb97de11df018c129deb44f4325 --- apps/shared/store_parameter_controller.cpp | 11 ++++++----- apps/shared/store_parameter_controller.h | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/shared/store_parameter_controller.cpp b/apps/shared/store_parameter_controller.cpp index 11dbcdf78..ba6bd288a 100644 --- a/apps/shared/store_parameter_controller.cpp +++ b/apps/shared/store_parameter_controller.cpp @@ -6,8 +6,8 @@ namespace Shared { StoreParameterController::StoreParameterController(Responder * parentResponder, FloatPairStore * store) : ViewController(parentResponder), m_deleteColumn(MessageTableCell(I18n::Message::ClearColumn)), - m_copyColumn(MessageTableCellWithChevron(I18n::Message::CopyColumnInList)), - m_importList(MessageTableCellWithChevron(I18n::Message::ImportList)), +// m_copyColumn(MessageTableCellWithChevron(I18n::Message::CopyColumnInList)), +// m_importList(MessageTableCellWithChevron(I18n::Message::ImportList)), m_selectableTableView(SelectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin)), m_store(store), @@ -46,10 +46,11 @@ bool StoreParameterController::handleEvent(Ion::Events::Event event) { stack->pop(); return true; } - case 1: + /* TODO: implement copy column and import list + * case 1: return false; case 2: - return false; + return false;*/ default: assert(false); return false; @@ -65,7 +66,7 @@ int StoreParameterController::numberOfRows() { HighlightCell * StoreParameterController::reusableCell(int index) { assert(index >= 0); assert(index < k_totalNumberOfCell); - HighlightCell * cells[] = {&m_deleteColumn, &m_copyColumn, &m_importList}; + HighlightCell * cells[] = {&m_deleteColumn};// {&m_deleteColumn, &m_copyColumn, &m_importList}; return cells[index]; } diff --git a/apps/shared/store_parameter_controller.h b/apps/shared/store_parameter_controller.h index a60c33ed3..1be0657ef 100644 --- a/apps/shared/store_parameter_controller.h +++ b/apps/shared/store_parameter_controller.h @@ -20,10 +20,11 @@ public: HighlightCell * reusableCell(int index) override; int reusableCellCount() override; private: - constexpr static int k_totalNumberOfCell = 3; + /* TODO: implement copy column and import list */ + constexpr static int k_totalNumberOfCell = 1;//3; MessageTableCell m_deleteColumn; - MessageTableCellWithChevron m_copyColumn; - MessageTableCellWithChevron m_importList; +// MessageTableCellWithChevron m_copyColumn; +// MessageTableCellWithChevron m_importList; SelectableTableView m_selectableTableView; FloatPairStore * m_store; bool m_xColumnSelected; From f4fa9083b3932c080d7fc2c0b9cef50175310547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 18:19:13 +0200 Subject: [PATCH 11/12] [apps] Hide matrix and list variables Change-Id: Ifa3aaf0e5e2fb6e4e3749f1e31f259de2fd34804 --- apps/variable_box_controller.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/variable_box_controller.cpp b/apps/variable_box_controller.cpp index 98c4a5933..ddb2d3338 100644 --- a/apps/variable_box_controller.cpp +++ b/apps/variable_box_controller.cpp @@ -33,7 +33,8 @@ void VariableBoxController::ContentViewController::didBecomeFirstResponder() { bool VariableBoxController::ContentViewController::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::Back) { - if (m_currentPage == Page::RootMenu) { + /* TODO: implement matrix and list contexts */ + if (m_currentPage == Page::Scalar) {//if (m_currentPage == Page::RootMenu) { m_firstSelectedRow = 0; app()->dismissModalViewController(); return true; @@ -228,7 +229,8 @@ void VariableBoxController::ContentViewController::reloadData() { } void VariableBoxController::ContentViewController::resetPage() { - m_currentPage = Page::RootMenu; + /* TODO: implement matrix and list contexts */ + m_currentPage = Page::Scalar;//Page::RootMenu; } void VariableBoxController::ContentViewController::deselectTable() { From 35991c8d70d36d4909702a9ba956408f4e9c4d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 26 Apr 2017 09:53:54 +0200 Subject: [PATCH 12/12] [poincare][toolbox] Hide matrix Change-Id: Ib7f57581130744f2963865d14fa539839ac28d8e --- apps/math_toolbox.cpp | 19 +++++++++++++------ poincare/src/expression_parser.y | 10 +++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/apps/math_toolbox.cpp b/apps/math_toolbox.cpp index 932c35470..0d78fe576 100644 --- a/apps/math_toolbox.cpp +++ b/apps/math_toolbox.cpp @@ -17,13 +17,20 @@ const ToolboxNode approximationChildren[4] = {ToolboxNode(I18n::Message::FloorCo const ToolboxNode trigonometryChildren[6] = {ToolboxNode(I18n::Message::CoshCommand, I18n::Message::Cosh), ToolboxNode(I18n::Message::SinhCommand, I18n::Message::Sinh), ToolboxNode(I18n::Message::TanhCommand, I18n::Message::Tanh), ToolboxNode(I18n::Message::AcoshCommand, I18n::Message::Acosh), ToolboxNode(I18n::Message::AsinhCommand, I18n::Message::Asinh), ToolboxNode(I18n::Message::AtanhCommand, I18n::Message::Atanh)}; const ToolboxNode predictionChildren[3] = {ToolboxNode(I18n::Message::Prediction95Command, I18n::Message::Prediction95), ToolboxNode(I18n::Message::PredictionCommand, I18n::Message::Prediction), ToolboxNode(I18n::Message::ConfidenceCommand, I18n::Message::Confidence)}; -const ToolboxNode menu[12] = {ToolboxNode(I18n::Message::AbsCommand, I18n::Message::AbsoluteValue), ToolboxNode(I18n::Message::RootCommand, I18n::Message::NthRoot), ToolboxNode(I18n::Message::LogCommand, I18n::Message::BasedLogarithm), - ToolboxNode(I18n::Message::Calculation, I18n::Message::Default, calculChildren, 4), ToolboxNode(I18n::Message::ComplexNumber, I18n::Message::Default, complexChildren, 5), - ToolboxNode(I18n::Message::Probability, I18n::Message::Default, probabilityChildren, 2), ToolboxNode(I18n::Message::Arithmetic, I18n::Message::Default, arithmeticChildren, 4), - ToolboxNode(I18n::Message::Matrices, I18n::Message::Default, matricesChildren, 5), ToolboxNode(I18n::Message::Lists, I18n::Message::Default, listesChildren, 5), - ToolboxNode(I18n::Message::Approximation, I18n::Message::Default, approximationChildren, 4), ToolboxNode(I18n::Message::HyperbolicTrigonometry, I18n::Message::Default, trigonometryChildren, 6), +const ToolboxNode menu[10] = {ToolboxNode(I18n::Message::AbsCommand, I18n::Message::AbsoluteValue), + ToolboxNode(I18n::Message::RootCommand, I18n::Message::NthRoot), + ToolboxNode(I18n::Message::LogCommand, I18n::Message::BasedLogarithm), + ToolboxNode(I18n::Message::Calculation, I18n::Message::Default, calculChildren, 4), + ToolboxNode(I18n::Message::ComplexNumber, I18n::Message::Default, complexChildren, 5), + ToolboxNode(I18n::Message::Probability, I18n::Message::Default, probabilityChildren, 2), + ToolboxNode(I18n::Message::Arithmetic, I18n::Message::Default, arithmeticChildren, 4), + //ToolboxNode(I18n::Message::Matrices, I18n::Message::Default, matricesChildren, 5), + //ToolboxNode(I18n::Message::Lists, I18n::Message::Default, listesChildren, 5), + ToolboxNode(I18n::Message::Approximation, I18n::Message::Default, approximationChildren, 4), + ToolboxNode(I18n::Message::HyperbolicTrigonometry, I18n::Message::Default, trigonometryChildren, 6), ToolboxNode(I18n::Message::Fluctuation, I18n::Message::Default, predictionChildren, 3)}; -const ToolboxNode toolboxModel = ToolboxNode(I18n::Message::Toolbox, I18n::Message::Default, menu, 12); +/* TODO: implement matrix and list */ +const ToolboxNode toolboxModel = ToolboxNode(I18n::Message::Toolbox, I18n::Message::Default, menu, 10);//ToolboxNode(I18n::Message::Toolbox, I18n::Message::Default, menu, 12); /* State */ diff --git a/poincare/src/expression_parser.y b/poincare/src/expression_parser.y index 8d52d7006..c9736273e 100644 --- a/poincare/src/expression_parser.y +++ b/poincare/src/expression_parser.y @@ -97,7 +97,7 @@ void poincare_expression_yyerror(Poincare::Expression ** expressionOutput, char %type number; %type symb; %type lstData; -%type mtxData; +/*%type mtxData;*/ /* During error recovery, some symbols need to be discarded. We need to tell * Bison how to get rid of them. Depending on the type of the symbol, it may @@ -106,7 +106,7 @@ void poincare_expression_yyerror(Poincare::Expression ** expressionOutput, char %destructor { delete $$; } FUNCTION %destructor { delete $$; } UNDEFINED exp number %destructor { delete $$; } lstData -%destructor { delete $$; } mtxData +/*%destructor { delete $$; } mtxData*/ %destructor { delete $$; } symb %% @@ -123,9 +123,9 @@ lstData: exp { $$ = new Poincare::ListData($1); } | lstData COMMA exp { $$ = $1; $$->pushExpression($3); } -mtxData: +/* mtxData: LEFT_BRACKET lstData RIGHT_BRACKET { $$ = new Poincare::MatrixData($2, true); delete $2; } - | mtxData LEFT_BRACKET lstData RIGHT_BRACKET { $$ = $1; $$->pushListData($3, true); delete $3; } + | mtxData LEFT_BRACKET lstData RIGHT_BRACKET { $$ = $1; $$->pushListData($3, true); delete $3; }*/ number: DIGITS { $$ = new Poincare::Integer($1.address, false); } @@ -155,7 +155,7 @@ exp: | exp POW exp { Poincare::Expression * terms[2] = {$1,$3}; $$ = new Poincare::Power(terms, false); } | MINUS exp { $$ = new Poincare::Opposite($2, false); } | LEFT_PARENTHESIS exp RIGHT_PARENTHESIS { $$ = new Poincare::Parenthesis($2, false); } - | LEFT_BRACKET mtxData RIGHT_BRACKET { $$ = new Poincare::Matrix($2); } +/* | LEFT_BRACKET mtxData RIGHT_BRACKET { $$ = new Poincare::Matrix($2); }*/ | FUNCTION LEFT_PARENTHESIS lstData RIGHT_PARENTHESIS { $$ = $1; $1->setArgument($3, true); delete $3; } ;