mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[apps/calculation] Improve text inserted in EditExpressionController
when handling OK events on additional outputs pop-ups
This commit is contained in:
@@ -59,4 +59,8 @@ Poincare::Layout ExpressionsListController::layoutAtIndex(int index) {
|
||||
return m_layouts[index];
|
||||
}
|
||||
|
||||
int ExpressionsListController::textAtIndex(char * buffer, size_t bufferSize, int index) {
|
||||
return m_layouts[index].serializeParsedExpression(buffer, bufferSize);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ protected:
|
||||
mutable Poincare::Layout m_layouts[k_maxNumberOfCells];
|
||||
private:
|
||||
Poincare::Layout layoutAtIndex(int index);
|
||||
virtual int textAtIndex(char * buffer, size_t bufferSize, int index) override;
|
||||
virtual void computeLayoutAtIndex(int index) = 0;
|
||||
virtual I18n::Message messageAtIndex(int index) = 0;
|
||||
// Cells
|
||||
|
||||
@@ -119,4 +119,8 @@ void IllustratedListController::setExpression(Poincare::Expression e) {
|
||||
context->setExpressionForSymbolAbstract(e, s);
|
||||
}
|
||||
|
||||
int IllustratedListController::textAtIndex(char * buffer, size_t bufferSize, int index) {
|
||||
return strlcpy(buffer, m_calculationStore.calculationAtIndex(index-1)->exactOutputText(), bufferSize);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ protected:
|
||||
Poincare::Expression m_savedExpression;
|
||||
CalculationStore m_calculationStore;
|
||||
private:
|
||||
int textAtIndex(char * buffer, size_t bufferSize, int index) override;
|
||||
virtual CodePoint expressionSymbol() const = 0;
|
||||
constexpr static int k_maxNumberOfAdditionalCalculations = 4;
|
||||
// Cells
|
||||
|
||||
@@ -30,7 +30,9 @@ ListController::ListController(Responder * parentResponder, EditExpressionContro
|
||||
|
||||
bool ListController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
m_editExpressionController->insertTextBody("TODO");
|
||||
char buffer[Constant::MaxSerializedExpressionSize];
|
||||
textAtIndex(buffer, Constant::MaxSerializedExpressionSize, selectedRow());
|
||||
m_editExpressionController->insertTextBody(buffer);
|
||||
Container::activeApp()->dismissModalViewController();
|
||||
Container::activeApp()->setFirstResponder(m_editExpressionController);
|
||||
return true;
|
||||
|
||||
@@ -30,6 +30,7 @@ protected:
|
||||
private:
|
||||
SelectableTableView m_selectableTableView;
|
||||
};
|
||||
virtual int textAtIndex(char * buffer, size_t bufferSize, int index) = 0;
|
||||
InnerListController m_listController;
|
||||
EditExpressionController * m_editExpressionController;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user