mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 17:20:53 +01:00
[apps/sequence] Select the right cell in list after changing sequence
type Change-Id: If92944aca236653ba4b25f14b3029be2a522f37b
This commit is contained in:
committed by
Romain Goyet
parent
10238fe9d1
commit
df9dba94dd
@@ -14,7 +14,7 @@ ListController::ListController(Responder * parentResponder, SequenceStore * sequ
|
||||
SequenceTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), SequenceTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), SequenceTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), SequenceTitleCell(FunctionTitleCell::Orientation::VerticalIndicator),
|
||||
SequenceTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), SequenceTitleCell(FunctionTitleCell::Orientation::VerticalIndicator)},
|
||||
m_parameterController(ListParameterController(this, sequenceStore)),
|
||||
m_typeParameterController(this, sequenceStore, TableCell::Layout::Vertical),
|
||||
m_typeParameterController(this, sequenceStore, this, TableCell::Layout::Vertical),
|
||||
m_typeStackController(StackViewController(nullptr, &m_typeParameterController, true, KDColorWhite, Palette::PurpleDark, Palette::PurpleDark)),
|
||||
m_sequenceToolbox(SequenceToolbox(m_sequenceStore))
|
||||
{
|
||||
@@ -77,6 +77,12 @@ void ListController::willDisplayCellAtLocation(HighlightCell * cell, int i, int
|
||||
myCell->setEven(functionIndexForRow(j)%2 == 0);
|
||||
}
|
||||
|
||||
void ListController::selectPreviousNewSequenceCell() {
|
||||
if (sequenceDefinitionForRow(m_selectableTableView.selectedRow()) >= 0) {
|
||||
m_selectableTableView.selectCellAtLocation(m_selectableTableView.selectedRow()-sequenceDefinitionForRow(m_selectableTableView.selectedRow()), m_selectableTableView.selectedColumn());
|
||||
}
|
||||
}
|
||||
|
||||
void ListController::editExpression(Sequence * sequence, int sequenceDefinition, Ion::Events::Event event) {
|
||||
char * initialText = nullptr;
|
||||
char initialTextContent[255];
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
virtual KDCoordinate rowHeight(int j) override;
|
||||
void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
|
||||
Toolbox * toolboxForTextField(TextField * textField) override;
|
||||
void selectPreviousNewSequenceCell();
|
||||
private:
|
||||
Shared::TextFieldDelegateApp * textFieldDelegateApp() override;
|
||||
void editExpression(Sequence * sequence, int sequenceDefinitionIndex, Ion::Events::Event event);
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#include "list_parameter_controller.h"
|
||||
#include "list_controller.h"
|
||||
|
||||
using namespace Poincare;
|
||||
using namespace Shared;
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
ListParameterController::ListParameterController(Responder * parentResponder, SequenceStore * sequenceStore) :
|
||||
Shared::ListParameterController(parentResponder, sequenceStore),
|
||||
ListParameterController::ListParameterController(ListController * listController, SequenceStore * sequenceStore) :
|
||||
Shared::ListParameterController(listController, sequenceStore),
|
||||
m_typeCell(PointerTableCellWithChevronAndExpression((char *)"Type de suite")),
|
||||
m_typeParameterController(TypeParameterController(this, sequenceStore, TableCell::Layout::Horizontal, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
m_typeParameterController(TypeParameterController(this, sequenceStore, listController, TableCell::Layout::Horizontal, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
class ListController;
|
||||
|
||||
class ListParameterController : public Shared::ListParameterController {
|
||||
public:
|
||||
ListParameterController(Responder * parentResponder, SequenceStore * sequenceStore);
|
||||
ListParameterController(ListController * list, SequenceStore * sequenceStore);
|
||||
const char * title() const override;
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
void setFunction(Shared::Function * function) override;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "type_parameter_controller.h"
|
||||
#include "list_controller.h"
|
||||
#include <assert.h>
|
||||
#include "../../../poincare/src/layout/baseline_relative_layout.h"
|
||||
#include "../../../poincare/src/layout/string_layout.h"
|
||||
@@ -7,7 +8,7 @@ using namespace Poincare;
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
TypeParameterController::TypeParameterController(Responder * parentResponder, SequenceStore * sequenceStore, TableCell::Layout cellLayout,
|
||||
TypeParameterController::TypeParameterController(Responder * parentResponder, SequenceStore * sequenceStore, ListController * list, TableCell::Layout cellLayout,
|
||||
KDCoordinate topMargin, KDCoordinate rightMargin, KDCoordinate bottomMargin, KDCoordinate leftMargin) :
|
||||
ViewController(parentResponder),
|
||||
m_expliciteCell(ExpressionTableCellWithPointer((char*)"Explicite", cellLayout)),
|
||||
@@ -15,7 +16,8 @@ TypeParameterController::TypeParameterController(Responder * parentResponder, Se
|
||||
m_doubleRecurenceCell(ExpressionTableCellWithPointer((char*)"Recurrence d'ordre 2", cellLayout)),
|
||||
m_selectableTableView(SelectableTableView(this, this, topMargin, rightMargin, bottomMargin, leftMargin)),
|
||||
m_sequenceStore(sequenceStore),
|
||||
m_sequence(nullptr)
|
||||
m_sequence(nullptr),
|
||||
m_listController(list)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -54,6 +56,7 @@ bool TypeParameterController::handleEvent(Ion::Events::Event event) {
|
||||
m_sequence->setFirstInitialConditionContent("");
|
||||
m_sequence->setSecondInitialConditionContent("");
|
||||
m_sequence->setType((Sequence::Type)m_selectableTableView.selectedRow());
|
||||
m_listController->selectPreviousNewSequenceCell();
|
||||
}
|
||||
StackViewController * stack = stackController();
|
||||
stack->pop();
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
|
||||
namespace Sequence {
|
||||
|
||||
class ListController;
|
||||
|
||||
class TypeParameterController : public ViewController, public SimpleListViewDataSource {
|
||||
public:
|
||||
TypeParameterController(Responder * parentResponder, SequenceStore * sequenceStore,
|
||||
TypeParameterController(Responder * parentResponder, SequenceStore * sequenceStore, ListController * list,
|
||||
TableCell::Layout cellLayout, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0,
|
||||
KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
|
||||
~TypeParameterController();
|
||||
@@ -32,6 +34,7 @@ private:
|
||||
SelectableTableView m_selectableTableView;
|
||||
SequenceStore * m_sequenceStore;
|
||||
Sequence * m_sequence;
|
||||
ListController * m_listController;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user