mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-30 04:00:02 +02:00
[apps/sequence] Redesign list controller
Change-Id: If114a643b0f682e98076cf1ec9f4479b3dafdfa6
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
#include "list_parameter_controller.h"
|
||||
#include "../../../poincare/src/layout/baseline_relative_layout.h"
|
||||
#include "../../../poincare/src/layout/string_layout.h"
|
||||
|
||||
using namespace Poincare;
|
||||
using namespace Shared;
|
||||
@@ -10,31 +8,25 @@ namespace Sequence {
|
||||
ListParameterController::ListParameterController(Responder * parentResponder, SequenceStore * sequenceStore) :
|
||||
Shared::ListParameterController(parentResponder, sequenceStore),
|
||||
m_typeCell(ChevronExpressionMenuListCell((char *)"Type de suite")),
|
||||
m_changeTypeParameterController(this)
|
||||
m_typeParameterController(TypeParameterController(this, sequenceStore, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin))
|
||||
{
|
||||
}
|
||||
|
||||
ListParameterController::~ListParameterController() {
|
||||
if (m_typeLayout) {
|
||||
delete m_typeLayout;
|
||||
m_typeLayout = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
const char * ListParameterController::title() const {
|
||||
return "Options de la suite";
|
||||
}
|
||||
|
||||
void ListParameterController::setSequence(Sequence * sequence) {
|
||||
setFunction(sequence);
|
||||
m_sequence = sequence;
|
||||
void ListParameterController::setFunction(Shared::Function * function) {
|
||||
Shared::ListParameterController::setFunction(function);
|
||||
m_sequence = (Sequence *)function;
|
||||
}
|
||||
|
||||
bool ListParameterController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK && m_selectableTableView.selectedRow() == 3) {
|
||||
StackViewController * stack = (StackViewController *)(parentResponder());
|
||||
m_changeTypeParameterController.setSequence(m_sequence);
|
||||
stack->push(&m_changeTypeParameterController);
|
||||
m_typeParameterController.setSequence(m_sequence);
|
||||
stack->push(&m_typeParameterController);
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::OK && m_selectableTableView.selectedRow() == 2) {
|
||||
@@ -66,20 +58,7 @@ int ListParameterController::reusableCellCount() {
|
||||
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);
|
||||
m_typeCell.setExpression(m_sequence->definitionName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user