[apps/sequence]Correct sequence toolbox

Change-Id: Ifbe1c45f6002604b248bcb072d57c08808e5c5b0
This commit is contained in:
Émilie Feral
2017-02-20 10:39:25 +01:00
parent 8311e8857c
commit 704dd22fbc
4 changed files with 29 additions and 16 deletions

View File

@@ -21,7 +21,7 @@ bool SequenceToolbox::handleEvent(Ion::Events::Event event) {
return selectAddedCell(selectedRow);
}
}
return MathToolbox::handleEvent(event);
return MathToolbox::handleEventForRow(event, mathToolboxIndex(m_selectableTableView.selectedRow()));
}
int SequenceToolbox::numberOfRows() {
@@ -47,7 +47,7 @@ void SequenceToolbox::willDisplayCellForIndex(HighlightCell * cell, int index) {
myCell->setExpression(m_addedCellLayout[index]);
return;
} else {
MathToolbox::willDisplayCellForIndex(cell, index);
MathToolbox::willDisplayCellForIndex(cell, mathToolboxIndex(index));
}
}
@@ -55,14 +55,14 @@ KDCoordinate SequenceToolbox::rowHeight(int j) {
if (typeAtLocation(0, j) == 2) {
return k_addedRowHeight;
}
return MathToolbox::rowHeight(j);
return MathToolbox::rowHeight(mathToolboxIndex(j));
}
int SequenceToolbox::typeAtLocation(int i, int j) {
if (stackDepth() == 0 && j < m_numberOfAddedCells) {
return 2;
}
return MathToolbox::typeAtLocation(i,j);
return MathToolbox::typeAtLocation(i,mathToolboxIndex(j));
}
void SequenceToolbox::addCells(int recurrenceDepth) {
@@ -95,4 +95,12 @@ bool SequenceToolbox::selectAddedCell(int selectedRow){
return true;
}
int SequenceToolbox::mathToolboxIndex(int index) {
int indexMathToolbox = index;
if (stackDepth() == 0) {
indexMathToolbox = index - m_numberOfAddedCells;
}
return indexMathToolbox;
}
}