[apps/escher] Changed setExpression to setExpressionLayout.

Change-Id: I095a12868fd7eaf8d4eb2408617941a86f43e1ee
This commit is contained in:
Léa Saviot
2017-12-05 17:45:54 +01:00
parent be9cde8ca4
commit 4ad3adaab2
29 changed files with 43 additions and 43 deletions

View File

@@ -83,7 +83,7 @@ void HistoryViewCell::layoutSubviews() {
}
void HistoryViewCell::setCalculation(Calculation * calculation) {
m_inputView.setExpression(calculation->inputLayout());
m_inputView.setExpressionLayout(calculation->inputLayout());
App * calculationApp = (App *)app();
/* Both output expressions have to be updated at the same time. The
* outputView points to deleted layouts and a call to

View File

@@ -16,8 +16,8 @@ OutputExpressionsView::OutputExpressionsView(Responder * parentResponder) :
}
void OutputExpressionsView::setExpressions(ExpressionLayout ** expressionsLayout) {
m_approximateExpressionView.setExpression(expressionsLayout[0]);
m_exactExpressionView.setExpression(expressionsLayout[1]);
m_approximateExpressionView.setExpressionLayout(expressionsLayout[0]);
m_exactExpressionView.setExpressionLayout(expressionsLayout[1]);
layoutSubviews();
}

View File

@@ -10,8 +10,8 @@ ScrollableExpressionView::ScrollableExpressionView(Responder * parentResponder)
{
}
void ScrollableExpressionView::setExpression(ExpressionLayout * expressionLayout) {
m_expressionView.setExpression(expressionLayout);
void ScrollableExpressionView::setExpressionLayout(ExpressionLayout * expressionLayout) {
m_expressionView.setExpressionLayout(expressionLayout);
layoutSubviews();
}

View File

@@ -8,7 +8,7 @@ namespace Calculation {
class ScrollableExpressionView : public ScrollableView, public ScrollViewDataSource {
public:
ScrollableExpressionView(Responder * parentResponder);
void setExpression(Poincare::ExpressionLayout * expressionLayout);
void setExpressionLayout(Poincare::ExpressionLayout * expressionLayout);
void setBackgroundColor(KDColor backgroundColor);
KDSize minimalSizeForOptimalDisplay() const override;
private:

View File

@@ -6,7 +6,7 @@ Controller::ContentView::ContentView(ExpressionAndLayout * expressionAndLayout)
SolidColorView(KDColorWhite),
m_expressionView()
{
m_expressionView.setExpression(expressionAndLayout->expressionLayout());
m_expressionView.setExpressionLayout(expressionAndLayout->expressionLayout());
}
void Controller::ContentView::layoutSubviews() {

View File

@@ -90,7 +90,7 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int j) {
FunctionExpressionCell * myCell = (FunctionExpressionCell *)cell;
Function * f = m_functionStore->functionAtIndex(j);
myCell->setExpression(f->layout());
myCell->setExpressionLayout(f->layout());
bool active = f->isActive();
KDColor textColor = active ? KDColorBlack : Palette::GreyDark;
myCell->setTextColor(textColor);

View File

@@ -129,7 +129,7 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int
if (i == 0) {
if (j == numberOfRows()-1) {
EvenOddExpressionCell * myCell = (EvenOddExpressionCell *)cell;
myCell->setExpression(m_r2Layout);
myCell->setExpressionLayout(m_r2Layout);
return;
}
EvenOddMessageTextCell * myCell = (EvenOddMessageTextCell *)cell;

View File

@@ -34,7 +34,7 @@ void StoreController::willDisplayCellAtLocation(HighlightCell * cell, int i, int
return;
}
EvenOddExpressionCell * mytitleCell = (EvenOddExpressionCell *)cell;
mytitleCell->setExpression(m_titleLayout[i]);
mytitleCell->setExpressionLayout(m_titleLayout[i]);
}
HighlightCell * StoreController::titleCells(int index) {

View File

@@ -201,7 +201,7 @@ void TermSumController::LegendView::setSumSubscript(float start) {
char buffer[PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)];
Complex<float>::convertFloatToText(start, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, Expression::FloatDisplayMode::Decimal);
m_sumLayout = new CondensedSumLayout(new StringLayout(sigma, sizeof(sigma)), new StringLayout(buffer, strlen(buffer), KDText::FontSize::Small), nullptr);
m_sum.setExpression(m_sumLayout);
m_sum.setExpressionLayout(m_sumLayout);
m_sum.setAlignment(0.0f, 0.5f);
}
@@ -216,7 +216,7 @@ void TermSumController::LegendView::setSumSuperscript(float start, float end) {
char bufferEnd[PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)];
Complex<float>::convertFloatToText(end, bufferEnd, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, Expression::FloatDisplayMode::Decimal);
m_sumLayout = new CondensedSumLayout(new StringLayout(sigma, sizeof(sigma)), new StringLayout(bufferStart, strlen(bufferStart), KDText::FontSize::Small), new StringLayout(bufferEnd, strlen(bufferEnd), KDText::FontSize::Small));
m_sum.setExpression(m_sumLayout);
m_sum.setExpressionLayout(m_sumLayout);
m_sum.setAlignment(0.0f, 0.5f);
}
@@ -229,7 +229,7 @@ void TermSumController::LegendView::setSumResult(const char * sequenceName, doub
childrenLayouts[1] = new BaselineRelativeLayout(new StringLayout(sequenceName, 1, KDText::FontSize::Small), new StringLayout("n", 1, KDText::FontSize::Small), BaselineRelativeLayout::Type::Subscript);
childrenLayouts[0] = m_sumLayout;
m_sumLayout = new HorizontalLayout(childrenLayouts, 3);
m_sum.setExpression(m_sumLayout);
m_sum.setExpressionLayout(m_sumLayout);
m_sum.setAlignment(0.5f, 0.5f);
}

View File

@@ -169,13 +169,13 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
SequenceTitleCell * myCell = (SequenceTitleCell *)cell;
Sequence * sequence = m_sequenceStore->functionAtIndex(functionIndexForRow(j));
if (sequenceDefinitionForRow(j) == 0) {
myCell->setExpression(sequence->definitionName());
myCell->setExpressionLayout(sequence->definitionName());
}
if (sequenceDefinitionForRow(j) == 1) {
myCell->setExpression(sequence->firstInitialConditionName());
myCell->setExpressionLayout(sequence->firstInitialConditionName());
}
if (sequenceDefinitionForRow(j) == 2) {
myCell->setExpression(sequence->secondInitialConditionName());
myCell->setExpressionLayout(sequence->secondInitialConditionName());
}
KDColor nameColor = sequence->isActive() ? sequence->color() : Palette::GreyDark;
myCell->setColor(nameColor);
@@ -185,13 +185,13 @@ void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int
FunctionExpressionCell * myCell = (FunctionExpressionCell *)cell;
Sequence * sequence = m_sequenceStore->functionAtIndex(functionIndexForRow(j));
if (sequenceDefinitionForRow(j) == 0) {
myCell->setExpression(sequence->layout());
myCell->setExpressionLayout(sequence->layout());
}
if (sequenceDefinitionForRow(j) == 1) {
myCell->setExpression(sequence->firstInitialConditionLayout());
myCell->setExpressionLayout(sequence->firstInitialConditionLayout());
}
if (sequenceDefinitionForRow(j) == 2) {
myCell->setExpression(sequence->secondInitialConditionLayout());
myCell->setExpressionLayout(sequence->secondInitialConditionLayout());
}
bool active = sequence->isActive();
KDColor textColor = active ? KDColorBlack : Palette::GreyDark;

View File

@@ -103,7 +103,7 @@ void ListParameterController::willDisplayCellForIndex(HighlightCell * cell, int
cell->setHighlighted(index == selectedRow()); // See FIXME in SelectableTableView::reloadData()
Shared::ListParameterController::willDisplayCellForIndex(cell, index);
if (cell == &m_typeCell && m_sequence != nullptr) {
m_typeCell.setExpression(m_sequence->definitionName());
m_typeCell.setExpressionLayout(m_sequence->definitionName());
}
if (cell == &m_initialRankCell && m_sequence != nullptr) {
MessageTableCellWithEditableText * myCell = (MessageTableCellWithEditableText *) cell;

View File

@@ -54,7 +54,7 @@ HighlightCell * SequenceToolbox::reusableCell(int index, int type) {
void SequenceToolbox::willDisplayCellForIndex(HighlightCell * cell, int index) {
if (typeAtLocation(0, index) == 2) {
ExpressionTableCell * myCell = (ExpressionTableCell *)cell;
myCell->setExpression(m_addedCellLayout[index]);
myCell->setExpressionLayout(m_addedCellLayout[index]);
return;
} else {
MathToolbox::willDisplayCellForIndex(cell, mathToolboxIndex(index));

View File

@@ -122,7 +122,7 @@ void TypeParameterController::willDisplayCellAtLocation(HighlightCell * cell, in
}
m_expressionLayouts[j] = new BaselineRelativeLayout(new StringLayout(nextName, 1, size), new StringLayout(subscripts[j], strlen(subscripts[j]), KDText::FontSize::Small), BaselineRelativeLayout::Type::Subscript);
ExpressionTableCellWithPointer * myCell = (ExpressionTableCellWithPointer *)cell;
myCell->setExpression(m_expressionLayouts[j]);
myCell->setExpressionLayout(m_expressionLayouts[j]);
}
void TypeParameterController::setSequence(Sequence * sequence) {

View File

@@ -12,8 +12,8 @@ SequenceTitleCell::SequenceTitleCell(Orientation orientation) :
{
}
void SequenceTitleCell::setExpression(Poincare::ExpressionLayout * expressionLayout) {
m_titleTextView.setExpression(expressionLayout);
void SequenceTitleCell::setExpressionLayout(Poincare::ExpressionLayout * expressionLayout) {
m_titleTextView.setExpressionLayout(expressionLayout);
}
void SequenceTitleCell::setHighlighted(bool highlight) {

View File

@@ -8,7 +8,7 @@ namespace Sequence {
class SequenceTitleCell : public Shared::FunctionTitleCell {
public:
SequenceTitleCell(Orientation orientation);
void setExpression(Poincare::ExpressionLayout * expressionLayout);
void setExpressionLayout(Poincare::ExpressionLayout * expressionLayout);
void setEven(bool even) override;
void setHighlighted(bool highlight) override;
void setColor(KDColor color) override;

View File

@@ -30,7 +30,7 @@ void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, in
if (j == 0 && i > 0) {
SequenceTitleCell * myCell = (SequenceTitleCell *)cell;
Sequence * sequence = m_sequenceStore->activeFunctionAtIndex(i-1);
myCell->setExpression(sequence->nameLayout());
myCell->setExpressionLayout(sequence->nameLayout());
myCell->setColor(sequence->color());
}
}

View File

@@ -183,7 +183,7 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
m_complexFormatLayout = new BaselineRelativeLayout(new StringLayout(base, sizeof(base), KDText::FontSize::Small), new StringLayout(superscript, sizeof(superscript), KDText::FontSize::Small), BaselineRelativeLayout::Type::Superscript);
}
MessageTableCellWithChevronAndExpression * myExpCell = (MessageTableCellWithChevronAndExpression *)cell;
myExpCell->setExpression(m_complexFormatLayout);
myExpCell->setExpressionLayout(m_complexFormatLayout);
return;
}
if (index == 3) {

View File

@@ -28,7 +28,7 @@ SubController::SubController(Responder * parentResponder) :
const char superscript[] = {Ion::Charset::IComplex, Ion::Charset::SmallTheta, ' '};
m_complexFormatLayout[1] = new BaselineRelativeLayout(new StringLayout(base, sizeof(base)), new StringLayout(superscript, sizeof(superscript)), BaselineRelativeLayout::Type::Superscript);
for (int i = 0; i < 2; i++) {
m_complexFormatCells[i].setExpression(m_complexFormatLayout[i]);
m_complexFormatCells[i].setExpressionLayout(m_complexFormatLayout[i]);
}
m_editableCell.setMessage(I18n::Message::SignificantFigures);
m_editableCell.setMessageFontSize(KDText::FontSize::Large);

View File

@@ -11,8 +11,8 @@ FunctionExpressionCell::FunctionExpressionCell() :
{
}
void FunctionExpressionCell::setExpression(ExpressionLayout * expressionLayout) {
m_expressionView.setExpression(expressionLayout);
void FunctionExpressionCell::setExpressionLayout(ExpressionLayout * expressionLayout) {
m_expressionView.setExpressionLayout(expressionLayout);
}
void FunctionExpressionCell::setTextColor(KDColor textColor) {

View File

@@ -9,7 +9,7 @@ namespace Shared {
class FunctionExpressionCell : public EvenOddCell {
public:
FunctionExpressionCell();
void setExpression(Poincare::ExpressionLayout * expressionLayout);
void setExpressionLayout(Poincare::ExpressionLayout * expressionLayout);
void setTextColor(KDColor color);
void setEven(bool even) override;
void setHighlighted(bool highlight) override;

View File

@@ -91,7 +91,7 @@ void VariableBoxLeafCell::setExpression(const Expression * expression) {
if (expression) {
m_expressionLayout = expression->createLayout();
}
m_expressionView.setExpression(m_expressionLayout);
m_expressionView.setExpressionLayout(m_expressionLayout);
}
void VariableBoxLeafCell::drawRect(KDContext * ctx, KDRect rect) const {

View File

@@ -10,7 +10,7 @@ public:
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
void setEven(bool even) override;
void setHighlighted(bool highlight) override;
void setExpression(Poincare::ExpressionLayout * expressionLayout);
void setExpressionLayout(Poincare::ExpressionLayout * expressionLayout);
void setBackgroundColor(KDColor backgroundColor);
void setTextColor(KDColor textColor);
KDSize minimalSizeForOptimalDisplay() const override;

View File

@@ -9,7 +9,7 @@ public:
ExpressionTableCell(Layout layout = Layout::Horizontal);
View * labelView() const override;
void setHighlighted(bool highlight) override;
void setExpression(Poincare::ExpressionLayout * expressionLayout);
void setExpressionLayout(Poincare::ExpressionLayout * expressionLayout);
private:
ExpressionView m_labelExpressionView;
};

View File

@@ -16,7 +16,7 @@ public:
ExpressionView(float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
Poincare::ExpressionLayout * expressionLayout() const;
void setExpression(Poincare::ExpressionLayout * expressionLayout);
void setExpressionLayout(Poincare::ExpressionLayout * expressionLayout);
void drawRect(KDContext * ctx, KDRect rect) const override;
void setBackgroundColor(KDColor backgroundColor);
void setTextColor(KDColor textColor);

View File

@@ -9,7 +9,7 @@ public:
MessageTableCellWithChevronAndExpression(I18n::Message message = (I18n::Message)0, KDText::FontSize size = KDText::FontSize::Small);
View * subAccessoryView() const override;
void setHighlighted(bool highlight) override;
void setExpression(Poincare::ExpressionLayout * expressionLayout);
void setExpressionLayout(Poincare::ExpressionLayout * expressionLayout);
private:
ExpressionView m_subtitleView;
};

View File

@@ -19,8 +19,8 @@ void EvenOddExpressionCell::setEven(bool even) {
m_expressionView.setBackgroundColor(backgroundColor());
}
void EvenOddExpressionCell::setExpression(ExpressionLayout * expressionLayout) {
m_expressionView.setExpression(expressionLayout);
void EvenOddExpressionCell::setExpressionLayout(ExpressionLayout * expressionLayout) {
m_expressionView.setExpressionLayout(expressionLayout);
}
void EvenOddExpressionCell::setBackgroundColor(KDColor backgroundColor) {

View File

@@ -18,7 +18,7 @@ void ExpressionTableCell::setHighlighted(bool highlight) {
m_labelExpressionView.setBackgroundColor(backgroundColor);
}
void ExpressionTableCell::setExpression(Poincare::ExpressionLayout * expressionLayout) {
m_labelExpressionView.setExpression(expressionLayout);
void ExpressionTableCell::setExpressionLayout(Poincare::ExpressionLayout * expressionLayout) {
m_labelExpressionView.setExpressionLayout(expressionLayout);
layoutSubviews();
}

View File

@@ -15,7 +15,7 @@ ExpressionLayout * ExpressionView::expressionLayout() const {
return m_expressionLayout;
}
void ExpressionView::setExpression(ExpressionLayout * expressionLayout) {
void ExpressionView::setExpressionLayout(ExpressionLayout * expressionLayout) {
m_expressionLayout = expressionLayout;
markRectAsDirty(bounds());
}

View File

@@ -17,8 +17,8 @@ void MessageTableCellWithChevronAndExpression::setHighlighted(bool highlight) {
m_subtitleView.setBackgroundColor(backgroundColor);
}
void MessageTableCellWithChevronAndExpression::setExpression(Poincare::ExpressionLayout * expressionLayout) {
m_subtitleView.setExpression(expressionLayout);
void MessageTableCellWithChevronAndExpression::setExpressionLayout(Poincare::ExpressionLayout * expressionLayout) {
m_subtitleView.setExpressionLayout(expressionLayout);
reloadCell();
layoutSubviews();
}