mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 11:39:58 +02:00
[poincare] Clean Layouts.
Do not compute the baseline at construction, and use base class constructors. Change-Id: I4361a6d92d7652b2aae2d662388b8d2c90afd3ce
This commit is contained in:
@@ -9,7 +9,6 @@ BaselineRelativeLayout::BaselineRelativeLayout(ExpressionLayout * base, Expressi
|
||||
StaticLayoutHierarchy(base, indice, cloneOperands),
|
||||
m_type(type)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * BaselineRelativeLayout::clone() const {
|
||||
|
||||
@@ -7,12 +7,6 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
BracketLayout::BracketLayout(ExpressionLayout * operandLayout, bool cloneOperands) :
|
||||
StaticLayoutHierarchy<1>(operandLayout, cloneOperands)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * BracketLayout::clone() const {
|
||||
BracketLayout * layout = new BracketLayout(const_cast<BracketLayout *>(this)->operandLayout(), true);
|
||||
return layout;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Poincare {
|
||||
|
||||
class BracketLayout : public StaticLayoutHierarchy<1> {
|
||||
public:
|
||||
BracketLayout(ExpressionLayout * operandLayout, bool cloneOperands);
|
||||
using StaticLayoutHierarchy::StaticLayoutHierarchy;
|
||||
ExpressionLayout * clone() const override;
|
||||
bool moveLeft(ExpressionLayoutCursor * cursor) override;
|
||||
bool moveRight(ExpressionLayoutCursor * cursor) override;
|
||||
|
||||
@@ -10,7 +10,6 @@ CharLayout::CharLayout(char c, KDText::FontSize fontSize) :
|
||||
m_char(c),
|
||||
m_fontSize(fontSize)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * CharLayout::clone() const {
|
||||
|
||||
@@ -5,12 +5,6 @@
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
CondensedSumLayout::CondensedSumLayout(ExpressionLayout * base, ExpressionLayout * subscript, ExpressionLayout * superscript, bool cloneOperands) :
|
||||
StaticLayoutHierarchy<3>(base, subscript, superscript, cloneOperands)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * CondensedSumLayout::clone() const {
|
||||
CondensedSumLayout * layout = new CondensedSumLayout(const_cast<CondensedSumLayout *>(this)->baseLayout(), const_cast<CondensedSumLayout *>(this)->subscriptLayout(), const_cast<CondensedSumLayout *>(this)->superscriptLayout(), true);
|
||||
return layout;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Poincare {
|
||||
|
||||
class CondensedSumLayout : public StaticLayoutHierarchy<3> {
|
||||
public:
|
||||
CondensedSumLayout(ExpressionLayout * base, ExpressionLayout * subscript, ExpressionLayout * superscript, bool cloneOperands);
|
||||
using StaticLayoutHierarchy::StaticLayoutHierarchy;
|
||||
ExpressionLayout * clone() const override;
|
||||
bool moveLeft(ExpressionLayoutCursor * cursor) override;
|
||||
bool moveRight(ExpressionLayoutCursor * cursor) override;
|
||||
|
||||
@@ -8,12 +8,6 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
ConjugateLayout::ConjugateLayout(ExpressionLayout * operand, bool cloneOperands) :
|
||||
StaticLayoutHierarchy<1>(operand, cloneOperands)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * ConjugateLayout::clone() const {
|
||||
ConjugateLayout * layout = new ConjugateLayout(const_cast<ConjugateLayout *>(this)->operandLayout(), true);
|
||||
return layout;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Poincare {
|
||||
|
||||
class ConjugateLayout : public StaticLayoutHierarchy<1> {
|
||||
public:
|
||||
ConjugateLayout(ExpressionLayout * operand, bool cloneOperands);
|
||||
using StaticLayoutHierarchy::StaticLayoutHierarchy;
|
||||
ExpressionLayout * clone() const override;
|
||||
bool moveLeft(ExpressionLayoutCursor * cursor) override;
|
||||
bool moveRight(ExpressionLayoutCursor * cursor) override;
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
EmptyLayout::EmptyLayout() :
|
||||
StaticLayoutHierarchy<0>()
|
||||
{
|
||||
m_baseline = 0;
|
||||
}
|
||||
|
||||
ExpressionLayout * EmptyLayout::clone() const {
|
||||
EmptyLayout * layout = new EmptyLayout();
|
||||
return layout;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Poincare {
|
||||
|
||||
class EmptyLayout : public StaticLayoutHierarchy<0> {
|
||||
public:
|
||||
EmptyLayout();
|
||||
using StaticLayoutHierarchy::StaticLayoutHierarchy;
|
||||
ExpressionLayout * clone() const override;
|
||||
void addBrother(ExpressionLayoutCursor * cursor, ExpressionLayout * brother) override;
|
||||
bool moveLeft(ExpressionLayoutCursor * cursor) override;
|
||||
|
||||
@@ -8,7 +8,6 @@ EmptyVisibleLayout::EmptyVisibleLayout() :
|
||||
EmptyLayout(),
|
||||
m_fillRectColor(KDColor::RGB24(0xffd370)) //TODO make static or in Palette?
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * EmptyVisibleLayout::clone() const {
|
||||
|
||||
@@ -6,12 +6,6 @@
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
FractionLayout::FractionLayout(ExpressionLayout * numerator, ExpressionLayout * denominator, bool cloneOperands) :
|
||||
StaticLayoutHierarchy<2>(numerator, denominator, cloneOperands)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * FractionLayout::clone() const {
|
||||
FractionLayout * layout = new FractionLayout(const_cast<FractionLayout *>(this)->numeratorLayout(), const_cast<FractionLayout *>(this)->denominatorLayout(), true);
|
||||
return layout;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Poincare {
|
||||
|
||||
class FractionLayout : public StaticLayoutHierarchy<2> {
|
||||
public:
|
||||
FractionLayout(ExpressionLayout * numerator, ExpressionLayout * denominator, bool cloneOperands);
|
||||
using StaticLayoutHierarchy::StaticLayoutHierarchy;
|
||||
ExpressionLayout * clone() const override;
|
||||
bool moveLeft(ExpressionLayoutCursor * cursor) override;
|
||||
bool moveRight(ExpressionLayoutCursor * cursor) override;
|
||||
|
||||
@@ -12,7 +12,6 @@ GridLayout::GridLayout(ExpressionLayout ** entryLayouts, int numberOfRows, int n
|
||||
m_numberOfRows(numberOfRows),
|
||||
m_numberOfColumns(numberOfColumns)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * GridLayout::clone() const {
|
||||
|
||||
@@ -10,17 +10,6 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
HorizontalLayout::HorizontalLayout() :
|
||||
DynamicLayoutHierarchy()
|
||||
{
|
||||
}
|
||||
|
||||
HorizontalLayout::HorizontalLayout(ExpressionLayout ** childrenLayouts, int childrenCount, bool cloneOperands) :
|
||||
DynamicLayoutHierarchy(childrenLayouts, childrenCount, cloneOperands)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * HorizontalLayout::clone() const {
|
||||
HorizontalLayout * layout = new HorizontalLayout(const_cast<ExpressionLayout **>(children()), numberOfChildren(), true);
|
||||
return layout;
|
||||
|
||||
@@ -7,8 +7,7 @@ namespace Poincare {
|
||||
|
||||
class HorizontalLayout : public DynamicLayoutHierarchy {
|
||||
public:
|
||||
HorizontalLayout();
|
||||
HorizontalLayout(ExpressionLayout ** layouts, int childrenCount, bool cloneOperands);
|
||||
using DynamicLayoutHierarchy::DynamicLayoutHierarchy;
|
||||
ExpressionLayout * clone() const override;
|
||||
|
||||
/* Navigation */
|
||||
|
||||
@@ -19,12 +19,6 @@ const uint8_t bottomSymbolPixel[IntegralLayout::k_symbolHeight][IntegralLayout::
|
||||
{0xFF, 0xFF, 0x00, 0x00},
|
||||
};
|
||||
|
||||
IntegralLayout::IntegralLayout(ExpressionLayout * lowerBound, ExpressionLayout * upperBound, ExpressionLayout * integrand, bool cloneOperands) :
|
||||
StaticLayoutHierarchy<3>(upperBound, lowerBound, integrand, cloneOperands)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * IntegralLayout::clone() const {
|
||||
IntegralLayout * layout = new IntegralLayout(const_cast<IntegralLayout *>(this)->lowerBoundLayout(), const_cast<IntegralLayout *>(this)->upperBoundLayout(), const_cast<IntegralLayout *>(this)->integrandLayout(), true);
|
||||
return layout;
|
||||
|
||||
@@ -9,7 +9,7 @@ class IntegralLayout : public StaticLayoutHierarchy<3> {
|
||||
public:
|
||||
constexpr static KDCoordinate k_symbolHeight = 4;
|
||||
constexpr static KDCoordinate k_symbolWidth = 4;
|
||||
IntegralLayout(ExpressionLayout * lowerBound, ExpressionLayout * upperBound, ExpressionLayout * integrand, bool cloneOperands);
|
||||
using StaticLayoutHierarchy::StaticLayoutHierarchy;
|
||||
ExpressionLayout * clone() const override;
|
||||
bool moveLeft(ExpressionLayoutCursor * cursor) override;
|
||||
bool moveRight(ExpressionLayoutCursor * cursor) override;
|
||||
|
||||
@@ -16,12 +16,6 @@ const uint8_t radixPixel[NthRootLayout::k_leftRadixHeight][NthRootLayout::k_left
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0x00},
|
||||
};
|
||||
|
||||
NthRootLayout::NthRootLayout(ExpressionLayout * radicand, ExpressionLayout * index, bool cloneOperands) :
|
||||
StaticLayoutHierarchy<2>(radicand, index, cloneOperands)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * NthRootLayout::clone() const {
|
||||
NthRootLayout * layout = new NthRootLayout(const_cast<NthRootLayout *>(this)->radicandLayout(), const_cast<NthRootLayout *>(this)->indexLayout(), true);
|
||||
return layout;
|
||||
|
||||
@@ -9,7 +9,7 @@ class NthRootLayout : public StaticLayoutHierarchy<2> {
|
||||
public:
|
||||
constexpr static KDCoordinate k_leftRadixHeight = 8;
|
||||
constexpr static KDCoordinate k_leftRadixWidth = 5;
|
||||
NthRootLayout(ExpressionLayout * radicand, ExpressionLayout * index, bool cloneOperands);
|
||||
using StaticLayoutHierarchy::StaticLayoutHierarchy;
|
||||
ExpressionLayout * clone() const override;
|
||||
bool moveLeft(ExpressionLayoutCursor * cursor) override;
|
||||
bool moveRight(ExpressionLayoutCursor * cursor) override;
|
||||
|
||||
@@ -15,7 +15,6 @@ ParenthesisLayout::ParenthesisLayout(ExpressionLayout * operand, bool cloneOpera
|
||||
ExpressionLayout * leftParenthesis = new ParenthesisLeftLayout();
|
||||
ExpressionLayout * rightParenthesis = new ParenthesisRightLayout();
|
||||
build(ExpressionLayout::ExpressionLayoutArray3(leftParenthesis, operand, rightParenthesis), 3, cloneOperands);
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
ExpressionLayout * ParenthesisLayout::clone() const {
|
||||
|
||||
@@ -6,12 +6,6 @@
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
SequenceLayout::SequenceLayout(ExpressionLayout * lowerBound, ExpressionLayout * upperBound, ExpressionLayout * argument, bool cloneOperands) :
|
||||
StaticLayoutHierarchy<3>(upperBound, lowerBound, argument, cloneOperands)
|
||||
{
|
||||
computeBaseline();
|
||||
}
|
||||
|
||||
bool SequenceLayout::moveLeft(ExpressionLayoutCursor * cursor) {
|
||||
// Case: Left of the bounds.
|
||||
// Go Left of the sequence.
|
||||
|
||||
@@ -9,7 +9,7 @@ class SequenceLayout : public StaticLayoutHierarchy<3> {
|
||||
public:
|
||||
constexpr static KDCoordinate k_symbolHeight = 15;
|
||||
constexpr static KDCoordinate k_symbolWidth = 9;
|
||||
SequenceLayout(ExpressionLayout * lowerBound, ExpressionLayout * upperBound, ExpressionLayout * argument, bool cloneOperands);
|
||||
using StaticLayoutHierarchy::StaticLayoutHierarchy;
|
||||
bool moveLeft(ExpressionLayoutCursor * cursor) override;
|
||||
bool moveRight(ExpressionLayoutCursor * cursor) override;
|
||||
bool moveUp(ExpressionLayoutCursor * cursor, ExpressionLayout * previousLayout, ExpressionLayout * previousPreviousLayout) override;
|
||||
|
||||
Reference in New Issue
Block a user