mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 07:10:40 +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:
@@ -114,26 +114,7 @@ bool SequenceToolbox::selectAddedCell(int selectedRow){
|
||||
int bufferSize = 10;
|
||||
char buffer[bufferSize];
|
||||
m_addedCellLayout[selectedRow]->writeTextInBuffer(buffer, bufferSize);
|
||||
if (m_action == MathToolbox::actionForTextInput) {
|
||||
/* DIRTY. The symbols are layouted using a Subscript VerticalOffsetLayout,
|
||||
* which serializes into "_{}", but we want parentheses for text fields. We
|
||||
* thus need to remove any underscores, and changes brackets into
|
||||
* parentheses. */
|
||||
for (int i = 0; i < bufferSize; i++) {
|
||||
if (buffer[i] == '{') {
|
||||
buffer[i] = '(';
|
||||
}
|
||||
if (buffer[i] == '}') {
|
||||
buffer[i] = ')';
|
||||
}
|
||||
if (buffer[i] == '_') {
|
||||
memmove(&buffer[i], &buffer[i+1], bufferSize - (i+1) + 1);
|
||||
bufferSize--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_action(sender(), buffer, false);
|
||||
sender()->handleEventWithText(buffer);
|
||||
app()->dismissModalViewController();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user