[apps/graph] make the function title cells consistent

Change-Id: Ib59f3d5f8a679cddd8a88e16711138425a6e9ecb
This commit is contained in:
Émilie Feral
2016-10-24 16:07:28 +02:00
parent b101308922
commit b56d88cefa
17 changed files with 139 additions and 193 deletions

View File

@@ -203,8 +203,7 @@ bool ListController::handleEnter() {
if (m_activeCelly == numberOfRows() - 1) {
return true;
}
FunctionNameView * functionCell = (FunctionNameView *)(m_tableView.cellAtLocation(m_activeCellx, m_activeCelly));
configureFunction(functionCell->function());
configureFunction(m_functionStore->functionAtIndex(m_activeCelly));
return true;
}
case 1:
@@ -241,7 +240,7 @@ View * ListController::reusableCell(int index, int type) {
assert(index < k_maxNumberOfRows);
switch (type) {
case 0:
return &m_nameCells[index];
return &m_functionTitleCells[index];
case 1:
return &m_expressionCells[index];
case 2:
@@ -263,8 +262,19 @@ int ListController::reusableCellCount(int type) {
void ListController::willDisplayCellAtLocation(View * cell, int i, int j) {
if (j < numberOfRows() - 1) {
FunctionCell * myCell = (FunctionCell *)cell;
myCell->setFunction(m_functionStore->functionAtIndex(j));
if (i == 0) {
FunctionTitleCell * myFunctionCell = (FunctionTitleCell *)cell;
Function * function = m_functionStore->functionAtIndex(j);
char bufferName[5] = "*(x)";
bufferName[0] = *function->name();
myFunctionCell->setText(bufferName);
KDColor functionNameColor = function->isActive() ? function->color() : Palette::k_desactiveTextColor;
myFunctionCell->setColor(functionNameColor);
myFunctionCell->setOrientation(FunctionTitleCell::Orientation::VerticalIndicator);
} else {
FunctionExpressionView * myCell = (FunctionExpressionView *)cell;
myCell->setFunction(m_functionStore->functionAtIndex(j));
}
}
EvenOddCell * myCell = (EvenOddCell *)cell;
myCell->setEven(j%2 == 0);