mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 01:29:58 +01:00
[apps/escher/toolbox] handleEventWithText for all responders.
This makes the code in the various toolbox more generic. The arguments of the text to insert are each replaced by a Ion::Charset::Empty. These Empty chars are used to create layouts in ExpressionLayoutFields, and to compute the position of the cursor in other fields, before being removed. Change-Id: Ie81c1e394b06fef2ab801ccff919d6550f70ec30
This commit is contained in:
@@ -24,15 +24,11 @@ const char * ListController::title() {
|
||||
}
|
||||
|
||||
Toolbox * ListController::toolboxForTextInput(TextInput * textInput) {
|
||||
setToolboxExtraCells();
|
||||
m_sequenceToolbox.setSenderAndAction(textInput, MathToolbox::actionForTextInput);
|
||||
return &m_sequenceToolbox;
|
||||
return toolbox(textInput);
|
||||
}
|
||||
|
||||
Toolbox * ListController::toolboxForExpressionLayoutField(ExpressionLayoutField * expressionLayoutField) {
|
||||
setToolboxExtraCells();
|
||||
m_sequenceToolbox.setSenderAndAction(expressionLayoutField, MathToolbox::actionForExpressionLayoutField);
|
||||
return &m_sequenceToolbox;
|
||||
return toolbox(expressionLayoutField);
|
||||
}
|
||||
|
||||
TextFieldDelegateApp * ListController::textFieldDelegateApp() {
|
||||
@@ -87,6 +83,20 @@ void ListController::selectPreviousNewSequenceCell() {
|
||||
}
|
||||
}
|
||||
|
||||
Toolbox * ListController::toolbox(Responder * sender) {
|
||||
// Set extra cells
|
||||
int recurrenceDepth = -1;
|
||||
int sequenceDefinition = sequenceDefinitionForRow(selectedRow());
|
||||
Sequence * sequence = m_sequenceStore->functionAtIndex(functionIndexForRow(selectedRow()));
|
||||
if (sequenceDefinition == 0) {
|
||||
recurrenceDepth = sequence->numberOfElements()-1;
|
||||
}
|
||||
m_sequenceToolbox.setExtraCells(sequence->name(), recurrenceDepth);
|
||||
// Set sender
|
||||
m_sequenceToolbox.setSender(sender);
|
||||
return &m_sequenceToolbox;
|
||||
}
|
||||
|
||||
void ListController::editExpression(Sequence * sequence, int sequenceDefinition, Ion::Events::Event event) {
|
||||
char * initialText = nullptr;
|
||||
char initialTextContent[TextField::maxBufferSize()];
|
||||
@@ -309,14 +319,4 @@ void ListController::unloadView(View * view) {
|
||||
Shared::ListController::unloadView(view);
|
||||
}
|
||||
|
||||
void ListController::setToolboxExtraCells() {
|
||||
int recurrenceDepth = -1;
|
||||
int sequenceDefinition = sequenceDefinitionForRow(selectedRow());
|
||||
Sequence * sequence = m_sequenceStore->functionAtIndex(functionIndexForRow(selectedRow()));
|
||||
if (sequenceDefinition == 0) {
|
||||
recurrenceDepth = sequence->numberOfElements()-1;
|
||||
}
|
||||
m_sequenceToolbox.setExtraCells(sequence->name(), recurrenceDepth);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user