[poincare] Clean

This commit is contained in:
Émilie Feral
2017-12-07 09:51:37 +01:00
committed by Ecco
parent d8963e33e3
commit 9b83bee8b6

View File

@@ -19,24 +19,22 @@ BracketLayout::~BracketLayout() {
}
void BracketLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
const KDCoordinate k_widthMargin = widthMargin();
KDSize operandSize = m_operandLayout->size();
ctx->fillRect(KDRect(p.x(), p.y(), k_lineThickness, m_operandLayout->size().height()), expressionColor);
ctx->fillRect(KDRect(p.x()+operandSize.width()+2*k_widthMargin+k_lineThickness, p.y(), k_lineThickness, m_operandLayout->size().height()), expressionColor);
ctx->fillRect(KDRect(p.x()+operandSize.width()+2*widthMargin()+k_lineThickness, p.y(), k_lineThickness, m_operandLayout->size().height()), expressionColor);
if (renderTopBar()) {
ctx->fillRect(KDRect(p.x(), p.y(), k_bracketWidth, k_lineThickness), expressionColor);
ctx->fillRect(KDRect(p.x()+2*k_lineThickness+operandSize.width()+2*k_widthMargin-k_bracketWidth, p.y(), k_bracketWidth, k_lineThickness), expressionColor);
ctx->fillRect(KDRect(p.x()+2*k_lineThickness+operandSize.width()+2*widthMargin()-k_bracketWidth, p.y(), k_bracketWidth, k_lineThickness), expressionColor);
}
if (renderBottomBar()) {
ctx->fillRect(KDRect(p.x(), p.y()+operandSize.height()-k_lineThickness, k_bracketWidth, k_lineThickness), expressionColor);
ctx->fillRect(KDRect(p.x()+2*k_lineThickness+operandSize.width()+2*k_widthMargin-k_bracketWidth, p.y()+operandSize.height()-k_lineThickness, k_bracketWidth, k_lineThickness), expressionColor);
ctx->fillRect(KDRect(p.x()+2*k_lineThickness+operandSize.width()+2*widthMargin()-k_bracketWidth, p.y()+operandSize.height()-k_lineThickness, k_bracketWidth, k_lineThickness), expressionColor);
}
}
KDSize BracketLayout::computeSize() {
const KDCoordinate k_widthMargin = widthMargin();
KDSize operandSize = m_operandLayout->size();
return KDSize(operandSize.width() + 2*k_widthMargin + 2*k_lineThickness, operandSize.height());
return KDSize(operandSize.width() + 2*widthMargin() + 2*k_lineThickness, operandSize.height());
}
ExpressionLayout * BracketLayout::child(uint16_t index) {
@@ -47,8 +45,7 @@ ExpressionLayout * BracketLayout::child(uint16_t index) {
}
KDPoint BracketLayout::positionOfChild(ExpressionLayout * child) {
const KDCoordinate k_widthMargin = widthMargin();
return KDPoint(k_widthMargin+k_lineThickness, 0);
return KDPoint(widthMargin()+k_lineThickness, 0);
}
}