mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[apps/sequence/list] display the page change type when clicking on the
sequence type row in the list parameters Change-Id: I11a2931cb81eda8a14a9e163ded93148dba5bb4c
This commit is contained in:
@@ -9,7 +9,8 @@ namespace Sequence {
|
||||
|
||||
ListParameterController::ListParameterController(Responder * parentResponder, SequenceStore * sequenceStore) :
|
||||
Shared::ListParameterController(parentResponder, sequenceStore),
|
||||
m_typeCell(ChevronExpressionMenuListCell((char *)"Type de suite"))
|
||||
m_typeCell(ChevronExpressionMenuListCell((char *)"Type de suite")),
|
||||
m_changeTypeParameterController(this)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -26,25 +27,15 @@ const char * ListParameterController::title() const {
|
||||
|
||||
void ListParameterController::setSequence(Sequence * sequence) {
|
||||
setFunction(sequence);
|
||||
if (m_typeLayout != nullptr) {
|
||||
delete m_typeLayout;
|
||||
m_typeLayout = nullptr;
|
||||
}
|
||||
if (sequence->type() == Sequence::Type::Explicite) {
|
||||
m_typeLayout = new BaselineRelativeLayout(new StringLayout(sequence->name(), 1), new StringLayout("n", 1, KDText::FontSize::Small), BaselineRelativeLayout::Type::Subscript);
|
||||
}
|
||||
if (sequence->type() == Sequence::Type::SingleRecurrence) {
|
||||
m_typeLayout = new BaselineRelativeLayout(new StringLayout(sequence->name(), 1), new StringLayout("n+1", 3, KDText::FontSize::Small), BaselineRelativeLayout::Type::Subscript);
|
||||
}
|
||||
if (sequence->type() == Sequence::Type::DoubleRecurrence) {
|
||||
m_typeLayout = new BaselineRelativeLayout(new StringLayout(sequence->name(), 1), new StringLayout("n+2", 3, KDText::FontSize::Small), BaselineRelativeLayout::Type::Subscript);
|
||||
}
|
||||
m_typeCell.setExpression(m_typeLayout);
|
||||
m_sequence = sequence;
|
||||
}
|
||||
|
||||
bool ListParameterController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK && m_selectableTableView.selectedRow() == 3) {
|
||||
return false;
|
||||
StackViewController * stack = (StackViewController *)(parentResponder());
|
||||
m_changeTypeParameterController.setSequence(m_sequence);
|
||||
stack->push(&m_changeTypeParameterController);
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::OK && m_selectableTableView.selectedRow() == 2) {
|
||||
if (m_functionStore->numberOfFunctions() > 0) {
|
||||
@@ -72,4 +63,24 @@ int ListParameterController::reusableCellCount() {
|
||||
return k_totalNumberOfCell;
|
||||
}
|
||||
|
||||
void ListParameterController::willDisplayCellForIndex(TableViewCell * cell, int index) {
|
||||
Shared::ListParameterController::willDisplayCellForIndex(cell, index);
|
||||
if (cell == &m_typeCell && m_sequence != nullptr) {
|
||||
if (m_typeLayout != nullptr) {
|
||||
delete m_typeLayout;
|
||||
m_typeLayout = nullptr;
|
||||
}
|
||||
if (m_sequence->type() == Sequence::Type::Explicite) {
|
||||
m_typeLayout = new BaselineRelativeLayout(new StringLayout(m_sequence->name(), 1), new StringLayout("n", 1, KDText::FontSize::Small), BaselineRelativeLayout::Type::Subscript);
|
||||
}
|
||||
if (m_sequence->type() == Sequence::Type::SingleRecurrence) {
|
||||
m_typeLayout = new BaselineRelativeLayout(new StringLayout(m_sequence->name(), 1), new StringLayout("n+1", 3, KDText::FontSize::Small), BaselineRelativeLayout::Type::Subscript);
|
||||
}
|
||||
if (m_sequence->type() == Sequence::Type::DoubleRecurrence) {
|
||||
m_typeLayout = new BaselineRelativeLayout(new StringLayout(m_sequence->name(), 1), new StringLayout("n+2", 3, KDText::FontSize::Small), BaselineRelativeLayout::Type::Subscript);
|
||||
}
|
||||
m_typeCell.setExpression(m_typeLayout);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "../../shared/list_parameter_controller.h"
|
||||
#include "../sequence.h"
|
||||
#include "../sequence_store.h"
|
||||
#include "change_type_parameter_controller.h"
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
@@ -17,10 +18,13 @@ public:
|
||||
int numberOfRows() override;
|
||||
TableViewCell * reusableCell(int index) override;
|
||||
int reusableCellCount() override;
|
||||
void willDisplayCellForIndex(TableViewCell * cell, int index) override;
|
||||
private:
|
||||
constexpr static int k_totalNumberOfCell = 4;
|
||||
ChevronExpressionMenuListCell m_typeCell;
|
||||
Poincare::ExpressionLayout * m_typeLayout;
|
||||
ChangeTypeParameterController m_changeTypeParameterController;
|
||||
Sequence * m_sequence;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,11 @@ View * ListParameterController::view() {
|
||||
|
||||
void ListParameterController::didBecomeFirstResponder() {
|
||||
m_selectableTableView.dataHasChanged(true);
|
||||
m_selectableTableView.selectCellAtLocation(0, 0);
|
||||
if (m_selectableTableView.selectedRow() == -1) {
|
||||
m_selectableTableView.selectCellAtLocation(0, 0);
|
||||
} else {
|
||||
m_selectableTableView.selectCellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow());
|
||||
}
|
||||
app()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
@@ -37,6 +41,7 @@ void ListParameterController::willDisplayCellForIndex(TableViewCell * cell, int
|
||||
|
||||
void ListParameterController::setFunction(Function * function) {
|
||||
m_function = function;
|
||||
m_selectableTableView.selectCellAtLocation(0, 0);
|
||||
}
|
||||
|
||||
bool ListParameterController::handleEvent(Ion::Events::Event event) {
|
||||
|
||||
Reference in New Issue
Block a user