[poincare/horizontal_layout] Uniformize selection background height

This commit is contained in:
Léa Saviot
2019-12-19 17:54:01 +01:00
parent 9ff3cbf32d
commit 97c9268d37
41 changed files with 78 additions and 40 deletions

View File

@@ -39,7 +39,7 @@ protected:
KDPoint positionOfChild(LayoutNode * child) override;
private:
KDCoordinate knHeight() { return nLayout()->layoutSize().height() + GridLayoutNode::k_gridEntryMargin + kLayout()->layoutSize().height(); }
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
LayoutNode * nLayout() { return childAtIndex(0); }
LayoutNode * kLayout() { return childAtIndex(1); }
};

View File

@@ -49,7 +49,7 @@ private:
virtual KDCoordinate verticalExternMargin() const { return k_verticalExternMargin; }
virtual bool renderTopBar() const { return true; }
virtual bool renderBottomBar() const { return true; }
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
};
}

View File

@@ -60,7 +60,7 @@ protected:
}
private:
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
bool isMultiplicationCodePoint() const;
bool protectedIsIdenticalTo(Layout l) override;
CodePoint m_codePoint;

View File

@@ -47,7 +47,7 @@ protected:
KDCoordinate computeBaseline() override;
KDPoint positionOfChild(LayoutNode * child) override;
private:
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override {}
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override {}
LayoutNode * baseLayout() { return childAtIndex(0); }
LayoutNode * subscriptLayout() { return childAtIndex(1); }
LayoutNode * superscriptLayout() { return childAtIndex(2); }

View File

@@ -38,7 +38,7 @@ private:
constexpr static KDCoordinate k_overlineVerticalMargin = 1;
LayoutNode * childLayout() { return childAtIndex(0); }
bool willReplaceChild(LayoutNode * oldChild, LayoutNode * newChild, LayoutCursor * cursor, bool force) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
};
class ConjugateLayout final : public Layout {

View File

@@ -65,7 +65,7 @@ private:
// LayoutNode
void moveCursorVertically(VerticalDirection direction, LayoutCursor * cursor, bool * shouldRecomputeLayout, bool equivalentPositionVisited) override;
bool willAddSibling(LayoutCursor * cursor, LayoutNode * sibling, bool moveCursor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
bool protectedIsIdenticalTo(Layout l) override;
bool m_isVisible;

View File

@@ -54,7 +54,7 @@ protected:
private:
constexpr static KDCoordinate k_fractionLineMargin = 2;
constexpr static KDCoordinate k_fractionLineHeight = 1;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
LayoutNode * numeratorLayout() { return childAtIndex(0); }
LayoutNode * denominatorLayout() { return childAtIndex(1); }
};

View File

@@ -86,7 +86,7 @@ private:
KDCoordinate height() const;
KDCoordinate columnWidth(int j) const;
KDCoordinate width() const;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override {}
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override {}
};
class GridLayout : public Layout {

View File

@@ -62,7 +62,7 @@ private:
bool willRemoveChild(LayoutNode * l, LayoutCursor * cursor, bool force) override;
void didRemoveChildAtIndex(int index, LayoutCursor * cursor, bool force) override;
bool willReplaceChild(LayoutNode * oldChild, LayoutNode * newChild, LayoutCursor * cursor, bool force) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override {}
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
// See comment on NAryExpressionNode
uint16_t m_numberOfChildren;
};

View File

@@ -56,7 +56,7 @@ private:
LayoutNode * differentialLayout() { return childAtIndex(k_differentialLayoutIndex); } // dx
LayoutNode * lowerBoundLayout() { return childAtIndex(2); } // a
LayoutNode * upperBoundLayout() { return childAtIndex(3); } // b
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
};
class IntegralLayout final : public Layout {

View File

@@ -34,8 +34,8 @@ public:
void draw(KDContext * ctx, KDPoint p, KDColor expressionColor = KDColorBlack, KDColor backgroundColor = KDColorWhite, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = Palette::Select) {
return node()->draw(ctx, p, expressionColor, backgroundColor, selectionStart, selectionEnd, selectionColor);
}
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
return node()->render(ctx, p, expressionColor, backgroundColor);
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) {
return node()->render(ctx, p, expressionColor, backgroundColor, selectionStart, selectionEnd, selectionColor);
}
KDSize layoutSize() { return node()->layoutSize(); }
KDPoint absoluteOrigin() { return node()->absoluteOrigin(); }

View File

@@ -171,7 +171,7 @@ private:
LayoutNode ** childResult,
void * resultPosition,
int * resultScore);
virtual void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) = 0;
virtual void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) = 0;
bool changeGreySquaresOfAllMatrixAncestors(bool add);
};

View File

@@ -32,7 +32,7 @@ public:
#endif
protected:
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
};
class LeftParenthesisLayout final : public Layout {

View File

@@ -27,7 +27,7 @@ public:
#endif
protected:
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
};
class LeftSquareBracketLayout final : public Layout {

View File

@@ -53,7 +53,7 @@ private:
bool hasGreySquares() const;
// LayoutNode
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
void didReplaceChildAtIndex(int index, LayoutCursor * cursor, bool force) override;
};

View File

@@ -53,7 +53,7 @@ private:
constexpr static KDCoordinate k_widthMargin = 2;
constexpr static KDCoordinate k_radixLineThickness = 1;
KDSize adjustedIndexSize();
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
bool protectedIsIdenticalTo(Layout l) override;
LayoutNode * radicandLayout() { return childAtIndex(0); }
LayoutNode * indexLayout() { return m_hasIndex ? childAtIndex(1) : nullptr; }

View File

@@ -22,7 +22,7 @@ public:
#endif
protected:
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
private:
constexpr static KDCoordinate k_lineThickness = 1;
};

View File

@@ -33,7 +33,7 @@ public:
#endif
protected:
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
};
class RightParenthesisLayout final : public Layout {

View File

@@ -27,7 +27,7 @@ public:
#endif
protected:
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
};
class RightSquareBracketLayout final : public Layout {

View File

@@ -43,7 +43,7 @@ protected:
LayoutNode * variableLayout() { return childAtIndex(k_variableLayoutIndex); }
LayoutNode * lowerBoundLayout() { return childAtIndex(2); }
LayoutNode * upperBoundLayout() { return childAtIndex(3); }
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
private:
static constexpr int k_argumentLayoutIndex = 0;
static constexpr int k_variableLayoutIndex = 1;

View File

@@ -22,7 +22,7 @@ public:
#endif
private:
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
};
class SumLayout final : public Layout {

View File

@@ -52,7 +52,7 @@ private:
constexpr static KDCoordinate k_indiceHeight = 5;
constexpr static KDCoordinate k_separationMargin = 5;
bool willAddSibling(LayoutCursor * cursor, LayoutNode * sibling, bool moveCursor) override;
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override {}
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override {}
bool protectedIsIdenticalTo(Layout l) override;
LayoutNode * indiceLayout() { return childAtIndex(0); }
LayoutNode * baseLayout();

View File

@@ -98,7 +98,7 @@ KDPoint BinomialCoefficientLayoutNode::positionOfChild(LayoutNode * child) {
return KDPoint(horizontalCenter - kLayout()->layoutSize().width()/2, knHeight() - kLayout()->layoutSize().height());
}
void BinomialCoefficientLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void BinomialCoefficientLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
// Render the parentheses.
KDCoordinate childHeight = knHeight();
KDCoordinate rightParenthesisPointX = maxCoordinate(nLayout()->layoutSize().width(), kLayout()->layoutSize().width()) + LeftParenthesisLayoutNode::ParenthesisWidth();

View File

@@ -111,7 +111,7 @@ int BracketPairLayoutNode::serialize(char * buffer, int bufferSize, Preferences:
return numberOfChar;
}
void BracketPairLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void BracketPairLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
KDSize childSize = childLayout()->layoutSize();
KDCoordinate verticalBarHeight = childSize.height() + 2*k_verticalMargin;
ctx->fillRect(KDRect(p.x()+externWidthMargin(), p.y()+verticalExternMargin(), k_lineThickness, verticalBarHeight), expressionColor);

View File

@@ -103,7 +103,7 @@ KDCoordinate CodePointLayoutNode::computeBaseline() {
return m_font->glyphSize().height()/2;
}
void CodePointLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void CodePointLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
constexpr int bufferSize = sizeof(CodePoint)/sizeof(char) + 1; // Null-terminating char
char buffer[bufferSize];
SerializationHelper::CodePoint(buffer, bufferSize, m_codePoint);

View File

@@ -81,7 +81,7 @@ KDPoint ConjugateLayoutNode::positionOfChild(LayoutNode * child) {
k_overlineWidth + k_overlineVerticalMargin);
}
void ConjugateLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void ConjugateLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
ctx->fillRect(
KDRect(
p.x() + Metric::FractionAndConjugateHorizontalMargin,

View File

@@ -86,7 +86,7 @@ bool EmptyLayoutNode::willAddSibling(LayoutCursor * cursor, LayoutNode * sibling
}
}
void EmptyLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void EmptyLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
if (m_isVisible) {
KDColor fillColor = m_color == Color::Yellow ? Palette::YellowDark : Palette::GreyBright;
ctx->fillRect(KDRect(p.x()+(m_margins ? k_marginWidth : 0), p.y()+(m_margins ? k_marginHeight : 0), width(), height()), fillColor);

View File

@@ -188,7 +188,7 @@ KDPoint FractionLayoutNode::positionOfChild(LayoutNode * child) {
return KDPoint(x, y);
}
void FractionLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void FractionLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
KDCoordinate fractionLineY = p.y() + numeratorLayout()->layoutSize().height() + k_fractionLineMargin;
ctx->fillRect(KDRect(p.x()+Metric::FractionAndConjugateHorizontalMargin, fractionLineY, layoutSize().width()-2*Metric::FractionAndConjugateHorizontalMargin, k_fractionLineHeight), expressionColor);
}

View File

@@ -416,6 +416,43 @@ bool HorizontalLayoutNode::willReplaceChild(LayoutNode * oldChild, LayoutNode *
return true;
}
void HorizontalLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
// Fill the background
KDSize s = layoutSize();
ctx->fillRect(KDRect(p, s), backgroundColor);
// Fill the selection background
HorizontalLayout thisLayout = HorizontalLayout(this);
bool childrenAreSelected = selectionStart != nullptr && selectionEnd != nullptr
&& !selectionStart->isUninitialized() && !selectionStart->isUninitialized()
&& thisLayout.hasChild(*selectionStart);
if (childrenAreSelected) {
assert(thisLayout.hasChild(*selectionEnd));
// Compute the positions
KDCoordinate selectionXStart = positionOfChild(selectionStart->node()).x();
KDCoordinate selectionXEnd = positionOfChild(selectionEnd->node()).x() + selectionEnd->layoutSize().width();
KDCoordinate drawX = p.x() + selectionXStart;
KDCoordinate drawWidth = selectionXEnd - selectionXStart;
// Compute the height
int firstSelectedNodeIndex = thisLayout.indexOfChild(*selectionStart);
int secondSelectedNodeIndex = thisLayout.indexOfChild(*selectionEnd);
if (firstSelectedNodeIndex == 0 && secondSelectedNodeIndex == numberOfChildren() - 1) {
ctx->fillRect(KDRect(KDPoint(drawX, p.y()), KDSize(drawWidth, s.height())), selectionColor);
return;
}
KDCoordinate maxUnderBaseline = 0;
KDCoordinate maxAboveBaseline = 0;
for (int i = firstSelectedNodeIndex; i <= secondSelectedNodeIndex; i++) {
Layout childi = thisLayout.childAtIndex(i);
KDSize childSize = childi.layoutSize();
maxUnderBaseline = maxCoordinate(maxUnderBaseline, childSize.height() - childi.baseline());
maxAboveBaseline = maxCoordinate(maxAboveBaseline, childi.baseline());
}
ctx->fillRect(KDRect(KDPoint(drawX, p.y() + baseline() - maxAboveBaseline), KDSize(drawWidth, maxUnderBaseline + maxAboveBaseline)), selectionColor);
}
}
// HorizontalLayout
void HorizontalLayout::addOrMergeChildAtIndex(Layout l, int index, bool removeEmptyChildren, LayoutCursor * cursor) {

View File

@@ -248,7 +248,7 @@ KDPoint IntegralLayoutNode::positionOfChild(LayoutNode * child) {
return KDPoint(x,y);
}
void IntegralLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void IntegralLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
KDSize integrandSize = integrandLayout()->layoutSize();
KDSize differentialSize = differentialLayout()->layoutSize();
KDSize upperBoundSize = upperBoundLayout()->layoutSize();

View File

@@ -85,6 +85,7 @@ void LayoutCursor::select(MoveDirection direction, bool * shouldRecomputeLayout,
} else {
selectUpDown(direction == MoveDirection::Up, shouldRecomputeLayout, selection);
}
*shouldRecomputeLayout = true;
}
/* Layout modification */

View File

@@ -27,7 +27,7 @@ void LayoutNode::draw(KDContext * ctx, KDPoint p, KDColor expressionColor, KDCol
KDColor backColor = isSelected ? selectionColor : backgroundColor;
KDPoint renderingAbsoluteOrigin = absoluteOrigin().translatedBy(p);
ctx->fillRect(KDRect(renderingAbsoluteOrigin, layoutSize()), backColor);
render(ctx, renderingAbsoluteOrigin, expressionColor, backColor);
render(ctx, renderingAbsoluteOrigin, expressionColor, backColor, selectionStart, selectionEnd, selectionColor);
if (!isSelected) {
for (LayoutNode * l : children()) {
l->draw(ctx, p, expressionColor, backgroundColor, selectionStart, selectionEnd, selectionColor);

View File

@@ -55,7 +55,7 @@ bool LeftParenthesisLayoutNode::isCollapsable(int * numberOfOpenParenthesis, boo
return true;
}
void LeftParenthesisLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void LeftParenthesisLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
RenderWithChildHeight(ParenthesisLayoutNode::ChildHeightGivenLayoutHeight(layoutSize().height()), ctx, p, expressionColor, backgroundColor);
}

View File

@@ -2,7 +2,7 @@
namespace Poincare {
void LeftSquareBracketLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void LeftSquareBracketLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
ctx->fillRect(KDRect(p.x()+k_externWidthMargin, p.y(), k_lineThickness, childHeight()), expressionColor);
ctx->fillRect(KDRect(p.x()+k_externWidthMargin, p.y(), k_bracketWidth, k_lineThickness), expressionColor);
ctx->fillRect(KDRect(p.x()+k_externWidthMargin, p.y() + childHeight(), k_bracketWidth, k_lineThickness), expressionColor);

View File

@@ -308,7 +308,7 @@ bool MatrixLayoutNode::hasGreySquares() const {
return false;
}
void MatrixLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void MatrixLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
BracketPairLayoutNode::RenderWithChildSize(gridSize(), ctx, p, expressionColor, backgroundColor);
}

View File

@@ -207,7 +207,7 @@ KDSize NthRootLayoutNode::adjustedIndexSize() {
KDSize(maxCoordinate(k_leftRadixWidth, indexLayout()->layoutSize().width()), indexLayout()->layoutSize().height());
}
void NthRootLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void NthRootLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
KDSize radicandSize = radicandLayout()->layoutSize();
KDSize indexSize = adjustedIndexSize();
KDColor workingBuffer[k_leftRadixWidth*k_leftRadixHeight];

View File

@@ -10,7 +10,7 @@ int ProductLayoutNode::serialize(char * buffer, int bufferSize, Preferences::Pri
return SequenceLayoutNode::writeDerivedClassInBuffer("product", buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits);
}
void ProductLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void ProductLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
// Compute sizes.
KDSize upperBoundSize = upperBoundLayout()->layoutSize();
KDSize lowerBoundNEqualsSize = lowerBoundSizeWithVariableEquals();

View File

@@ -55,7 +55,7 @@ bool RightParenthesisLayoutNode::isCollapsable(int * numberOfOpenParenthesis, bo
return true;
}
void RightParenthesisLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void RightParenthesisLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
RenderWithChildHeight(ParenthesisLayoutNode::ChildHeightGivenLayoutHeight(layoutSize().height()), ctx, p, expressionColor, backgroundColor);
}

View File

@@ -2,7 +2,7 @@
namespace Poincare {
void RightSquareBracketLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void RightSquareBracketLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
ctx->fillRect(KDRect(p.x()+k_widthMargin, p.y(), k_lineThickness, childHeight()), expressionColor);
ctx->fillRect(KDRect(p.x()+k_widthMargin-k_bracketWidth+1, p.y(), k_bracketWidth, k_lineThickness), expressionColor);
ctx->fillRect(KDRect(p.x()+k_widthMargin-k_bracketWidth+1, p.y() + childHeight(), k_bracketWidth, k_lineThickness), expressionColor);

View File

@@ -244,7 +244,7 @@ int SequenceLayoutNode::writeDerivedClassInBuffer(const char * operatorName, cha
return numberOfChar;
}
void SequenceLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void SequenceLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
// Render the "="
KDSize variableSize = variableLayout()->layoutSize();
KDPoint equalPosition = positionOfChild(variableLayout()).translatedBy(KDPoint(variableSize.width(), variableLayout()->baseline()-k_font->stringSize(k_equal).height()/2));

View File

@@ -29,7 +29,7 @@ int SumLayoutNode::serialize(char * buffer, int bufferSize, Preferences::PrintFl
return SequenceLayoutNode::writeDerivedClassInBuffer("sum", buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits);
}
void SumLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
void SumLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
// Computes sizes.
KDSize upperBoundSize = upperBoundLayout()->layoutSize();
KDSize lowerBoundNEqualsSize = lowerBoundSizeWithVariableEquals();