mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/*/expression_model_list_controller] editExpression sets text instead of InputViewController::edit
This commit is contained in:
committed by
LeaNumworks
parent
7d9f479f3c
commit
1d966ce23c
@@ -87,9 +87,9 @@ void ListController::selectPreviousNewSequenceCell() {
|
||||
void ListController::editExpression(int sequenceDefinition, Ion::Events::Event event) {
|
||||
Ion::Storage::Record record = modelStore()->recordAtIndex(modelIndexForRow(selectedRow()));
|
||||
Sequence * sequence = modelStore()->modelForRecord(record);
|
||||
char * initialText = nullptr;
|
||||
char initialTextContent[TextField::maxBufferSize()];
|
||||
InputViewController * inputController = Shared::FunctionApp::app()->inputViewController();
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
char initialTextContent[Constant::MaxSerializedExpressionSize];
|
||||
switch (sequenceDefinition) {
|
||||
case 0:
|
||||
sequence->text(initialTextContent, sizeof(initialTextContent));
|
||||
@@ -101,14 +101,13 @@ void ListController::editExpression(int sequenceDefinition, Ion::Events::Event e
|
||||
sequence->secondInitialConditionText(initialTextContent, sizeof(initialTextContent));
|
||||
break;
|
||||
}
|
||||
initialText = initialTextContent;
|
||||
inputController->setTextBody(initialTextContent);
|
||||
}
|
||||
InputViewController * inputController = Shared::FunctionApp::app()->inputViewController();
|
||||
// Invalidate the sequences context cache
|
||||
App::app()->localContext()->resetCache();
|
||||
switch (sequenceDefinition) {
|
||||
case 0:
|
||||
inputController->edit(this, event, this, initialText,
|
||||
inputController->edit(this, event, this,
|
||||
[](void * context, void * sender){
|
||||
ListController * myController = static_cast<ListController *>(context);
|
||||
InputViewController * myInputViewController = (InputViewController *)sender;
|
||||
@@ -120,7 +119,7 @@ void ListController::editExpression(int sequenceDefinition, Ion::Events::Event e
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
inputController->edit(this, event, this, initialText,
|
||||
inputController->edit(this, event, this,
|
||||
[](void * context, void * sender){
|
||||
ListController * myController = static_cast<ListController *>(context);
|
||||
InputViewController * myInputViewController = (InputViewController *)sender;
|
||||
@@ -132,7 +131,7 @@ void ListController::editExpression(int sequenceDefinition, Ion::Events::Event e
|
||||
});
|
||||
break;
|
||||
default:
|
||||
inputController->edit(this, event, this, initialText,
|
||||
inputController->edit(this, event, this,
|
||||
[](void * context, void * sender){
|
||||
ListController * myController = static_cast<ListController *>(context);
|
||||
InputViewController * myInputViewController = (InputViewController *)sender;
|
||||
|
||||
@@ -223,16 +223,15 @@ void ExpressionModelListController::reinitSelectedExpression(ExpiringPointer<Exp
|
||||
}
|
||||
|
||||
void ExpressionModelListController::editExpression(Ion::Events::Event event) {
|
||||
char * initialText = nullptr;
|
||||
constexpr int initialTextContentMaxSize = Constant::MaxSerializedExpressionSize;
|
||||
char initialTextContent[initialTextContentMaxSize];
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
Ion::Storage::Record record = modelStore()->recordAtIndex(modelIndexForRow(selectedRow()));
|
||||
ExpiringPointer<ExpressionModelHandle> model = modelStore()->modelForRecord(record);
|
||||
constexpr size_t initialTextContentMaxSize = Constant::MaxSerializedExpressionSize;
|
||||
char initialTextContent[initialTextContentMaxSize];
|
||||
model->text(initialTextContent, initialTextContentMaxSize);
|
||||
initialText = initialTextContent;
|
||||
inputController()->setTextBody(initialTextContent);
|
||||
}
|
||||
inputController()->edit(this, event, this, initialText,
|
||||
inputController()->edit(this, event, this,
|
||||
[](void * context, void * sender){
|
||||
ExpressionModelListController * myController = static_cast<ExpressionModelListController *>(context);
|
||||
InputViewController * myInputViewController = (InputViewController *)sender;
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
void setTextBody(const char * text) {
|
||||
m_expressionFieldController.expressionField()->setText(text);
|
||||
}
|
||||
void edit(Responder * caller, Ion::Events::Event event, void * context, const char * initialText, Invocation::Action successAction, Invocation::Action failureAction);
|
||||
void edit(Responder * caller, Ion::Events::Event event, void * context, Invocation::Action successAction, Invocation::Action failureAction);
|
||||
bool isEditing();
|
||||
void abortEditionAndDismiss();
|
||||
|
||||
|
||||
@@ -25,13 +25,10 @@ InputViewController::InputViewController(Responder * parentResponder, ViewContro
|
||||
{
|
||||
}
|
||||
|
||||
void InputViewController::edit(Responder * caller, Ion::Events::Event event, void * context, const char * initialText, Invocation::Action successAction, Invocation::Action failureAction) {
|
||||
void InputViewController::edit(Responder * caller, Ion::Events::Event event, void * context, Invocation::Action successAction, Invocation::Action failureAction) {
|
||||
m_successAction = Invocation(successAction, context);
|
||||
m_failureAction = Invocation(failureAction, context);
|
||||
displayModalViewController(&m_expressionFieldController, 1.0f, 1.0f);
|
||||
if (initialText != nullptr) {
|
||||
m_expressionFieldController.expressionField()->setText(initialText);
|
||||
}
|
||||
m_expressionFieldController.expressionField()->handleEvent(event);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user