mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 03:29:58 +02:00
[poincare] Rename ParenthesisLeftRightLayout into ParenthesisLayout
Change-Id: I45e7812d43318bbc13f712a36d758c43ce8781a5
This commit is contained in:
@@ -110,7 +110,7 @@ objs += $(addprefix poincare/src/layout/,\
|
||||
matrix_layout.o\
|
||||
nth_root_layout.o\
|
||||
parenthesis_left_layout.o\
|
||||
parenthesis_left_right_layout.o\
|
||||
parenthesis_layout.o\
|
||||
parenthesis_right_layout.o\
|
||||
product_layout.o\
|
||||
sequence_layout.o\
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "grid_layout.h"
|
||||
#include "horizontal_layout.h"
|
||||
#include "parenthesis_left_layout.h"
|
||||
#include "parenthesis_left_right_layout.h"
|
||||
#include "parenthesis_layout.h"
|
||||
#include "parenthesis_right_layout.h"
|
||||
#include <poincare/expression_layout_cursor.h>
|
||||
#include <poincare/expression_layout_array.h>
|
||||
@@ -108,7 +108,7 @@ void BinomialCoefficientLayout::render(KDContext * ctx, KDPoint p, KDColor expre
|
||||
|
||||
KDSize BinomialCoefficientLayout::computeSize() {
|
||||
KDSize coefficientsSize = GridLayout(ExpressionLayoutArray(nLayout(), kLayout()).array(), 2, 1, true).size();
|
||||
return KDSize(coefficientsSize.width() + 2*ParenthesisLeftRightLayout::parenthesisWidth(), coefficientsSize.height());
|
||||
return KDSize(coefficientsSize.width() + 2*ParenthesisLayout::parenthesisWidth(), coefficientsSize.height());
|
||||
}
|
||||
|
||||
void BinomialCoefficientLayout::computeBaseline() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "parenthesis_left_right_layout.h"
|
||||
#include "parenthesis_layout.h"
|
||||
#include <escher/metric.h>
|
||||
#include <poincare/expression_layout_cursor.h>
|
||||
extern "C" {
|
||||
@@ -11,18 +11,18 @@ namespace Poincare {
|
||||
static inline int max(int x, int y) { return (x>y ? x : y); }
|
||||
|
||||
|
||||
ParenthesisLeftRightLayout::ParenthesisLeftRightLayout() :
|
||||
ParenthesisLayout::ParenthesisLayout() :
|
||||
StaticLayoutHierarchy<0>(),
|
||||
m_operandHeightComputed(false)
|
||||
{
|
||||
}
|
||||
|
||||
void ParenthesisLeftRightLayout::invalidAllSizesPositionsAndBaselines() {
|
||||
void ParenthesisLayout::invalidAllSizesPositionsAndBaselines() {
|
||||
m_operandHeightComputed = false;
|
||||
ExpressionLayout::invalidAllSizesPositionsAndBaselines();
|
||||
}
|
||||
|
||||
bool ParenthesisLeftRightLayout::moveLeft(ExpressionLayoutCursor * cursor, bool * shouldRecomputeLayout) {
|
||||
bool ParenthesisLayout::moveLeft(ExpressionLayoutCursor * cursor, bool * shouldRecomputeLayout) {
|
||||
assert(cursor->pointedExpressionLayout() == this);
|
||||
// Case: Right.
|
||||
// Go Left.
|
||||
@@ -39,7 +39,7 @@ bool ParenthesisLeftRightLayout::moveLeft(ExpressionLayoutCursor * cursor, bool
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ParenthesisLeftRightLayout::moveRight(ExpressionLayoutCursor * cursor, bool * shouldRecomputeLayout) {
|
||||
bool ParenthesisLayout::moveRight(ExpressionLayoutCursor * cursor, bool * shouldRecomputeLayout) {
|
||||
assert(cursor->pointedExpressionLayout() == this);
|
||||
// Case: Left.
|
||||
// Go Right.
|
||||
@@ -56,11 +56,11 @@ bool ParenthesisLeftRightLayout::moveRight(ExpressionLayoutCursor * cursor, bool
|
||||
return false;
|
||||
}
|
||||
|
||||
KDSize ParenthesisLeftRightLayout::computeSize() {
|
||||
KDSize ParenthesisLayout::computeSize() {
|
||||
return KDSize(parenthesisWidth(), operandHeight() + k_verticalMargin);
|
||||
}
|
||||
|
||||
void ParenthesisLeftRightLayout::computeBaseline() {
|
||||
void ParenthesisLayout::computeBaseline() {
|
||||
assert(m_parent != nullptr);
|
||||
bool isParenthesisLeft = isLeftParenthesis();
|
||||
int indexInParent = m_parent->indexOfChild(this);
|
||||
@@ -111,7 +111,7 @@ void ParenthesisLeftRightLayout::computeBaseline() {
|
||||
m_baselined = true;
|
||||
}
|
||||
|
||||
KDCoordinate ParenthesisLeftRightLayout::operandHeight() {
|
||||
KDCoordinate ParenthesisLayout::operandHeight() {
|
||||
if (!m_operandHeightComputed) {
|
||||
computeOperandHeight();
|
||||
m_operandHeightComputed = true;
|
||||
@@ -119,7 +119,7 @@ KDCoordinate ParenthesisLeftRightLayout::operandHeight() {
|
||||
return m_operandHeight;
|
||||
}
|
||||
|
||||
void ParenthesisLeftRightLayout::computeOperandHeight() {
|
||||
void ParenthesisLayout::computeOperandHeight() {
|
||||
assert(m_parent != nullptr);
|
||||
m_operandHeight = Metric::MinimalBracketAndParenthesisHeight;
|
||||
bool isParenthesisLeft = isLeftParenthesis();
|
||||
@@ -172,7 +172,7 @@ void ParenthesisLeftRightLayout::computeOperandHeight() {
|
||||
}
|
||||
}
|
||||
|
||||
KDPoint ParenthesisLeftRightLayout::positionOfChild(ExpressionLayout * child) {
|
||||
KDPoint ParenthesisLayout::positionOfChild(ExpressionLayout * child) {
|
||||
assert(false);
|
||||
return KDPointZero;
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef POINCARE_PARENTHESIS_LEFT_RIGHT_LAYOUT_H
|
||||
#define POINCARE_PARENTHESIS_LEFT_RIGHT_LAYOUT_H
|
||||
#ifndef POINCARE_PARENTHESIS_LAYOUT_H
|
||||
#define POINCARE_PARENTHESIS_LAYOUT_H
|
||||
|
||||
#include <poincare/static_layout_hierarchy.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
class ParenthesisLeftRightLayout : public StaticLayoutHierarchy<0> {
|
||||
class ParenthesisLayout : public StaticLayoutHierarchy<0> {
|
||||
public:
|
||||
ParenthesisLeftRightLayout();
|
||||
ParenthesisLayout();
|
||||
void invalidAllSizesPositionsAndBaselines() override;
|
||||
bool moveLeft(ExpressionLayoutCursor * cursor, bool * shouldRecomputeLayout) override;
|
||||
bool moveRight(ExpressionLayoutCursor * cursor, bool * shouldRecomputeLayout) override;
|
||||
@@ -6,7 +6,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
const uint8_t topLeftCurve[ParenthesisLeftRightLayout::k_parenthesisCurveHeight][ParenthesisLeftRightLayout::k_parenthesisCurveWidth] = {
|
||||
const uint8_t topLeftCurve[ParenthesisLayout::k_parenthesisCurveHeight][ParenthesisLayout::k_parenthesisCurveWidth] = {
|
||||
{0xFF, 0xFF, 0xFF, 0xF9, 0x66},
|
||||
{0xFF, 0xFF, 0xEB, 0x40, 0x9A},
|
||||
{0xFF, 0xF2, 0x40, 0xBF, 0xFF},
|
||||
@@ -16,7 +16,7 @@ const uint8_t topLeftCurve[ParenthesisLeftRightLayout::k_parenthesisCurveHeight]
|
||||
{0x11, 0xEE, 0xFF, 0xFF, 0xFF},
|
||||
};
|
||||
|
||||
const uint8_t bottomLeftCurve[ParenthesisLeftRightLayout::k_parenthesisCurveHeight][ParenthesisLeftRightLayout::k_parenthesisCurveWidth] = {
|
||||
const uint8_t bottomLeftCurve[ParenthesisLayout::k_parenthesisCurveHeight][ParenthesisLayout::k_parenthesisCurveWidth] = {
|
||||
{0x11, 0xEE, 0xFF, 0xFF, 0xFF},
|
||||
{0x45, 0xBE, 0xFF, 0xFF, 0xFF},
|
||||
{0xA9, 0x5A, 0xFF, 0xFF, 0xFF},
|
||||
@@ -40,24 +40,24 @@ bool ParenthesisLeftLayout::isCollapsable(int * numberOfOpenParenthesis, bool go
|
||||
}
|
||||
|
||||
void ParenthesisLeftLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
|
||||
KDRect frame(p.x()+ParenthesisLeftRightLayout::k_externWidthMargin,
|
||||
p.y()+ParenthesisLeftRightLayout::k_externHeightMargin,
|
||||
ParenthesisLeftRightLayout::k_parenthesisCurveWidth,
|
||||
ParenthesisLeftRightLayout::k_parenthesisCurveHeight);
|
||||
KDRect frame(p.x()+ParenthesisLayout::k_externWidthMargin,
|
||||
p.y()+ParenthesisLayout::k_externHeightMargin,
|
||||
ParenthesisLayout::k_parenthesisCurveWidth,
|
||||
ParenthesisLayout::k_parenthesisCurveHeight);
|
||||
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)topLeftCurve, (KDColor *)(ParenthesisLeftRightLayout::s_parenthesisWorkingBuffer));
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)topLeftCurve, (KDColor *)(ParenthesisLayout::s_parenthesisWorkingBuffer));
|
||||
|
||||
frame = KDRect(p.x()+ParenthesisLeftRightLayout::k_externWidthMargin,
|
||||
p.y() + size().height() - ParenthesisLeftRightLayout::k_parenthesisCurveHeight - ParenthesisLeftRightLayout::k_externHeightMargin,
|
||||
ParenthesisLeftRightLayout::k_parenthesisCurveWidth,
|
||||
ParenthesisLeftRightLayout::k_parenthesisCurveHeight);
|
||||
frame = KDRect(p.x()+ParenthesisLayout::k_externWidthMargin,
|
||||
p.y() + size().height() - ParenthesisLayout::k_parenthesisCurveHeight - ParenthesisLayout::k_externHeightMargin,
|
||||
ParenthesisLayout::k_parenthesisCurveWidth,
|
||||
ParenthesisLayout::k_parenthesisCurveHeight);
|
||||
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)bottomLeftCurve, (KDColor *)(ParenthesisLeftRightLayout::s_parenthesisWorkingBuffer));
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)bottomLeftCurve, (KDColor *)(ParenthesisLayout::s_parenthesisWorkingBuffer));
|
||||
|
||||
ctx->fillRect(KDRect(p.x()+ParenthesisLeftRightLayout::k_externWidthMargin,
|
||||
p.y()+ParenthesisLeftRightLayout::k_parenthesisCurveHeight+ParenthesisLeftRightLayout::k_externHeightMargin,
|
||||
ParenthesisLeftRightLayout::k_lineThickness,
|
||||
size().height() - 2*(ParenthesisLeftRightLayout::k_parenthesisCurveHeight+ParenthesisLeftRightLayout::k_externHeightMargin)),
|
||||
ctx->fillRect(KDRect(p.x()+ParenthesisLayout::k_externWidthMargin,
|
||||
p.y()+ParenthesisLayout::k_parenthesisCurveHeight+ParenthesisLayout::k_externHeightMargin,
|
||||
ParenthesisLayout::k_lineThickness,
|
||||
size().height() - 2*(ParenthesisLayout::k_parenthesisCurveHeight+ParenthesisLayout::k_externHeightMargin)),
|
||||
expressionColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef POINCARE_PARENTHESIS_LEFT_LAYOUT_H
|
||||
#define POINCARE_PARENTHESIS_LEFT_LAYOUT_H
|
||||
|
||||
#include <poincare/src/layout/parenthesis_left_right_layout.h>
|
||||
#include <poincare/src/layout/parenthesis_layout.h>
|
||||
#include <poincare/layout_engine.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
class ParenthesisLeftLayout : public ParenthesisLeftRightLayout {
|
||||
class ParenthesisLeftLayout : public ParenthesisLayout {
|
||||
friend class BinomialCoefficientLayout;
|
||||
friend class SequenceLayout;
|
||||
public:
|
||||
using ParenthesisLeftRightLayout::ParenthesisLeftRightLayout;
|
||||
using ParenthesisLayout::ParenthesisLayout;
|
||||
ExpressionLayout * clone() const override;
|
||||
int writeTextInBuffer(char * buffer, int bufferSize, int numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits) const override {
|
||||
return LayoutEngine::writeOneCharInBuffer(buffer, bufferSize, '(');
|
||||
|
||||
@@ -6,7 +6,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
const uint8_t topRightCurve[ParenthesisLeftRightLayout::k_parenthesisCurveHeight][ParenthesisLeftRightLayout::k_parenthesisCurveWidth] = {
|
||||
const uint8_t topRightCurve[ParenthesisLayout::k_parenthesisCurveHeight][ParenthesisLayout::k_parenthesisCurveWidth] = {
|
||||
{0x66, 0xF9, 0xFF, 0xFF, 0xFF},
|
||||
{0x9A, 0x40, 0xEB, 0xFF, 0xFF},
|
||||
{0xFF, 0xBF, 0x40, 0xF2, 0xFF},
|
||||
@@ -16,7 +16,7 @@ const uint8_t topRightCurve[ParenthesisLeftRightLayout::k_parenthesisCurveHeight
|
||||
{0xFF, 0xFF, 0xFF, 0xEE, 0x11},
|
||||
};
|
||||
|
||||
const uint8_t bottomRightCurve[ParenthesisLeftRightLayout::k_parenthesisCurveHeight][ParenthesisLeftRightLayout::k_parenthesisCurveWidth] = {
|
||||
const uint8_t bottomRightCurve[ParenthesisLayout::k_parenthesisCurveHeight][ParenthesisLayout::k_parenthesisCurveWidth] = {
|
||||
{0xFF, 0xFF, 0xFF, 0xEE, 0x11},
|
||||
{0xFF, 0xFF, 0xFF, 0xBE, 0x45},
|
||||
{0xFF, 0xFF, 0xFF, 0x5A, 0xA9},
|
||||
@@ -40,24 +40,24 @@ bool ParenthesisRightLayout::isCollapsable(int * numberOfOpenParenthesis, bool g
|
||||
}
|
||||
|
||||
void ParenthesisRightLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
|
||||
KDRect frame = KDRect(p.x() + ParenthesisLeftRightLayout::k_widthMargin + ParenthesisLeftRightLayout::k_lineThickness - ParenthesisLeftRightLayout::k_parenthesisCurveWidth,
|
||||
p.y() + ParenthesisLeftRightLayout::k_externHeightMargin,
|
||||
ParenthesisLeftRightLayout::k_parenthesisCurveWidth,
|
||||
ParenthesisLeftRightLayout::k_parenthesisCurveHeight);
|
||||
KDRect frame = KDRect(p.x() + ParenthesisLayout::k_widthMargin + ParenthesisLayout::k_lineThickness - ParenthesisLayout::k_parenthesisCurveWidth,
|
||||
p.y() + ParenthesisLayout::k_externHeightMargin,
|
||||
ParenthesisLayout::k_parenthesisCurveWidth,
|
||||
ParenthesisLayout::k_parenthesisCurveHeight);
|
||||
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)topRightCurve, (KDColor *)(ParenthesisLeftRightLayout::s_parenthesisWorkingBuffer));
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)topRightCurve, (KDColor *)(ParenthesisLayout::s_parenthesisWorkingBuffer));
|
||||
|
||||
frame = KDRect(p.x() + ParenthesisLeftRightLayout::k_widthMargin + ParenthesisLeftRightLayout::k_lineThickness - ParenthesisLeftRightLayout::k_parenthesisCurveWidth,
|
||||
p.y() + size().height() - ParenthesisLeftRightLayout::k_parenthesisCurveHeight - ParenthesisLeftRightLayout::k_externHeightMargin,
|
||||
ParenthesisLeftRightLayout::k_parenthesisCurveWidth,
|
||||
ParenthesisLeftRightLayout::k_parenthesisCurveHeight);
|
||||
frame = KDRect(p.x() + ParenthesisLayout::k_widthMargin + ParenthesisLayout::k_lineThickness - ParenthesisLayout::k_parenthesisCurveWidth,
|
||||
p.y() + size().height() - ParenthesisLayout::k_parenthesisCurveHeight - ParenthesisLayout::k_externHeightMargin,
|
||||
ParenthesisLayout::k_parenthesisCurveWidth,
|
||||
ParenthesisLayout::k_parenthesisCurveHeight);
|
||||
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)bottomRightCurve, (KDColor *)(ParenthesisLeftRightLayout::s_parenthesisWorkingBuffer));
|
||||
ctx->blendRectWithMask(frame, expressionColor, (const uint8_t *)bottomRightCurve, (KDColor *)(ParenthesisLayout::s_parenthesisWorkingBuffer));
|
||||
|
||||
ctx->fillRect(KDRect(p.x()+ParenthesisLeftRightLayout::k_widthMargin,
|
||||
p.y()+ParenthesisLeftRightLayout::k_parenthesisCurveHeight+2,
|
||||
ParenthesisLeftRightLayout::k_lineThickness,
|
||||
size().height() - 2*(ParenthesisLeftRightLayout::k_parenthesisCurveHeight+ParenthesisLeftRightLayout::k_externHeightMargin)),
|
||||
ctx->fillRect(KDRect(p.x()+ParenthesisLayout::k_widthMargin,
|
||||
p.y()+ParenthesisLayout::k_parenthesisCurveHeight+2,
|
||||
ParenthesisLayout::k_lineThickness,
|
||||
size().height() - 2*(ParenthesisLayout::k_parenthesisCurveHeight+ParenthesisLayout::k_externHeightMargin)),
|
||||
expressionColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef POINCARE_PARENTHESIS_RIGHT_LAYOUT_H
|
||||
#define POINCARE_PARENTHESIS_RIGHT_LAYOUT_H
|
||||
|
||||
#include <poincare/src/layout/parenthesis_left_right_layout.h>
|
||||
#include <poincare/src/layout/parenthesis_layout.h>
|
||||
#include <poincare/layout_engine.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
class ParenthesisRightLayout : public ParenthesisLeftRightLayout {
|
||||
class ParenthesisRightLayout : public ParenthesisLayout {
|
||||
friend class BinomialCoefficientLayout;
|
||||
friend class SequenceLayout;
|
||||
public:
|
||||
using ParenthesisLeftRightLayout::ParenthesisLeftRightLayout;
|
||||
using ParenthesisLayout::ParenthesisLayout;
|
||||
ExpressionLayout * clone() const override;
|
||||
int writeTextInBuffer(char * buffer, int bufferSize, int numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits) const override {
|
||||
return LayoutEngine::writeOneCharInBuffer(buffer, bufferSize, ')');
|
||||
|
||||
Reference in New Issue
Block a user