mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-20 22:30:30 +01:00
[poincare] Rename ParenthesisLeftLayout into LeftParenthesisLayout
Change-Id: Iaedd556ce912d650432d395b294c39e53bfc16a0
This commit is contained in:
@@ -109,7 +109,7 @@ objs += $(addprefix poincare/src/layout/,\
|
||||
integral_layout.o\
|
||||
matrix_layout.o\
|
||||
nth_root_layout.o\
|
||||
parenthesis_left_layout.o\
|
||||
left_parenthesis_layout.o\
|
||||
parenthesis_layout.o\
|
||||
right_parenthesis_layout.o\
|
||||
product_layout.o\
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <poincare/src/layout/integral_layout.h>
|
||||
#include <poincare/src/layout/matrix_layout.h>
|
||||
#include <poincare/src/layout/nth_root_layout.h>
|
||||
#include <poincare/src/layout/parenthesis_left_layout.h>
|
||||
#include <poincare/src/layout/left_parenthesis_layout.h>
|
||||
#include <poincare/src/layout/right_parenthesis_layout.h>
|
||||
#include <poincare/src/layout/product_layout.h>
|
||||
#include <poincare/src/layout/sequence_layout.h>
|
||||
|
||||
@@ -171,7 +171,7 @@ void ExpressionLayoutCursor::insertText(const char * text) {
|
||||
ExpressionLayout * pointedChild = nullptr;
|
||||
for (int i = 0; i < textLength; i++) {
|
||||
if (text[i] == '(') {
|
||||
newChild = new ParenthesisLeftLayout();
|
||||
newChild = new LeftParenthesisLayout();
|
||||
if (pointedChild == nullptr) {
|
||||
pointedChild = newChild;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "empty_layout.h"
|
||||
#include "grid_layout.h"
|
||||
#include "horizontal_layout.h"
|
||||
#include "parenthesis_left_layout.h"
|
||||
#include "left_parenthesis_layout.h"
|
||||
#include "parenthesis_layout.h"
|
||||
#include "right_parenthesis_layout.h"
|
||||
#include <poincare/expression_layout_cursor.h>
|
||||
@@ -96,7 +96,7 @@ bool BinomialCoefficientLayout::moveDown(ExpressionLayoutCursor * cursor, bool *
|
||||
|
||||
void BinomialCoefficientLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
|
||||
// Render the parentheses.
|
||||
ParenthesisLeftLayout * dummyLeftParenthesis = new ParenthesisLeftLayout();
|
||||
LeftParenthesisLayout * dummyLeftParenthesis = new LeftParenthesisLayout();
|
||||
RightParenthesisLayout * dummyRightParenthesis = new RightParenthesisLayout();
|
||||
GridLayout * dummyGridLayout = new GridLayout(ExpressionLayoutArray(nLayout(), kLayout()).array(), 2, 1, true);
|
||||
HorizontalLayout dummyLayout(dummyLeftParenthesis, dummyGridLayout, dummyRightParenthesis, false);
|
||||
@@ -117,7 +117,7 @@ void BinomialCoefficientLayout::computeBaseline() {
|
||||
}
|
||||
|
||||
KDPoint BinomialCoefficientLayout::positionOfChild(ExpressionLayout * child) {
|
||||
ParenthesisLeftLayout * dummyLeftParenthesis = new ParenthesisLeftLayout();
|
||||
LeftParenthesisLayout * dummyLeftParenthesis = new LeftParenthesisLayout();
|
||||
RightParenthesisLayout * dummyRightParenthesis = new RightParenthesisLayout();
|
||||
GridLayout * dummyGridLayout = new GridLayout(ExpressionLayoutArray(nLayout(), kLayout()).array(), 2, 1, true);
|
||||
HorizontalLayout dummyLayout(dummyLeftParenthesis, dummyGridLayout, dummyRightParenthesis, false);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "parenthesis_left_layout.h"
|
||||
#include "left_parenthesis_layout.h"
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
@@ -26,12 +26,12 @@ const uint8_t bottomLeftCurve[ParenthesisLayout::k_parenthesisCurveHeight][Paren
|
||||
{0xFF, 0xFF, 0xFF, 0xF9, 0x66},
|
||||
};
|
||||
|
||||
ExpressionLayout * ParenthesisLeftLayout::clone() const {
|
||||
ParenthesisLeftLayout * layout = new ParenthesisLeftLayout();
|
||||
ExpressionLayout * LeftParenthesisLayout::clone() const {
|
||||
LeftParenthesisLayout * layout = new LeftParenthesisLayout();
|
||||
return layout;
|
||||
}
|
||||
|
||||
bool ParenthesisLeftLayout::isCollapsable(int * numberOfOpenParenthesis, bool goingLeft) const {
|
||||
bool LeftParenthesisLayout::isCollapsable(int * numberOfOpenParenthesis, bool goingLeft) const {
|
||||
if (*numberOfOpenParenthesis == 0 && goingLeft) {
|
||||
return false;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ bool ParenthesisLeftLayout::isCollapsable(int * numberOfOpenParenthesis, bool go
|
||||
return true;
|
||||
}
|
||||
|
||||
void ParenthesisLeftLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
|
||||
void LeftParenthesisLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
|
||||
KDRect frame(p.x()+ParenthesisLayout::k_externWidthMargin,
|
||||
p.y()+ParenthesisLayout::k_externHeightMargin,
|
||||
ParenthesisLayout::k_parenthesisCurveWidth,
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef POINCARE_PARENTHESIS_LEFT_LAYOUT_H
|
||||
#define POINCARE_PARENTHESIS_LEFT_LAYOUT_H
|
||||
#ifndef POINCARE_LEFT_PARENTHESIS_LAYOUT_H
|
||||
#define POINCARE_LEFT_PARENTHESIS_LAYOUT_H
|
||||
|
||||
#include <poincare/src/layout/parenthesis_layout.h>
|
||||
#include <poincare/layout_engine.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
class ParenthesisLeftLayout : public ParenthesisLayout {
|
||||
class LeftParenthesisLayout : public ParenthesisLayout {
|
||||
friend class BinomialCoefficientLayout;
|
||||
friend class SequenceLayout;
|
||||
public:
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "sequence_layout.h"
|
||||
#include "char_layout.h"
|
||||
#include "horizontal_layout.h"
|
||||
#include "parenthesis_left_layout.h"
|
||||
#include "left_parenthesis_layout.h"
|
||||
#include "right_parenthesis_layout.h"
|
||||
#include <poincare/expression_layout_cursor.h>
|
||||
#include <assert.h>
|
||||
@@ -193,7 +193,7 @@ ExpressionLayout * SequenceLayout::argumentLayout() {
|
||||
|
||||
KDSize SequenceLayout::computeSize() {
|
||||
KDSize lowerBoundSizeWithNEquals = HorizontalLayout(new CharLayout('n'), new CharLayout('='), lowerBoundLayout()->clone(), false).size();
|
||||
ParenthesisLeftLayout * dummyLeftParenthesis = new ParenthesisLeftLayout();
|
||||
LeftParenthesisLayout * dummyLeftParenthesis = new LeftParenthesisLayout();
|
||||
RightParenthesisLayout * dummyRightParenthesis = new RightParenthesisLayout();
|
||||
HorizontalLayout dummyLayout2(dummyLeftParenthesis, argumentLayout()->clone(), dummyRightParenthesis, false);
|
||||
KDSize dummyLayoutSize = dummyLayout2.size();
|
||||
@@ -209,7 +209,7 @@ KDPoint SequenceLayout::positionOfChild(ExpressionLayout * eL) {
|
||||
HorizontalLayout dummyLayout1(new CharLayout('n'), new CharLayout('='), lowerBoundClone, false);
|
||||
KDSize lowerBoundSizeWithNEquals = dummyLayout1.size();
|
||||
KDSize upperBoundSize = upperBoundLayout()->size();
|
||||
ParenthesisLeftLayout * dummyLeftParenthesis = new ParenthesisLeftLayout();
|
||||
LeftParenthesisLayout * dummyLeftParenthesis = new LeftParenthesisLayout();
|
||||
HorizontalLayout dummyLayout2(dummyLeftParenthesis, argumentLayout()->clone(), false);
|
||||
KDCoordinate x = 0;
|
||||
KDCoordinate y = 0;
|
||||
@@ -239,7 +239,7 @@ void SequenceLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor,
|
||||
ctx->drawString("n=", p.translatedBy(nEqualsPosition), dummyN->fontSize(), expressionColor, backgroundColor);
|
||||
|
||||
// Render the parentheses.
|
||||
ParenthesisLeftLayout * dummyLeftParenthesis = new ParenthesisLeftLayout();
|
||||
LeftParenthesisLayout * dummyLeftParenthesis = new LeftParenthesisLayout();
|
||||
RightParenthesisLayout * dummyRightParenthesis = new RightParenthesisLayout();
|
||||
HorizontalLayout dummyLayout2(dummyLeftParenthesis, argumentLayout()->clone(), dummyRightParenthesis, false);
|
||||
KDPoint leftParenthesisPoint = positionOfChild(argumentLayout()).translatedBy(dummyLayout2.positionOfChild(dummyLeftParenthesis)).translatedBy(dummyLayout2.positionOfChild(dummyLayout2.editableChild(1)).opposite());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "vertical_offset_layout.h"
|
||||
#include "empty_layout.h"
|
||||
#include "parenthesis_left_layout.h"
|
||||
#include "left_parenthesis_layout.h"
|
||||
#include "right_parenthesis_layout.h"
|
||||
#include <ion/charset.h>
|
||||
#include <poincare/expression_layout_cursor.h>
|
||||
@@ -285,14 +285,14 @@ void VerticalOffsetLayout::privateAddBrother(ExpressionLayoutCursor * cursor, Ex
|
||||
// Add the Left parenthesis
|
||||
int indexInParent = m_parent->indexOfChild(this);
|
||||
int leftParenthesisIndex = indexInParent;
|
||||
ParenthesisLeftLayout * parenthesisLeft = new ParenthesisLeftLayout();
|
||||
LeftParenthesisLayout * leftParenthesis = new LeftParenthesisLayout();
|
||||
int numberOfOpenParenthesis = 0;
|
||||
while (leftParenthesisIndex > 0
|
||||
&& editableParent()->editableChild(leftParenthesisIndex-1)->isCollapsable(&numberOfOpenParenthesis, true))
|
||||
{
|
||||
leftParenthesisIndex--;
|
||||
}
|
||||
m_parent->addChildAtIndex(parenthesisLeft, leftParenthesisIndex);
|
||||
m_parent->addChildAtIndex(leftParenthesis, leftParenthesisIndex);
|
||||
indexInParent++;
|
||||
|
||||
// Add the Right parenthesis
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <poincare/layout_engine.h>
|
||||
#include "layout/char_layout.h"
|
||||
#include "layout/horizontal_layout.h"
|
||||
#include "layout/parenthesis_left_layout.h"
|
||||
#include "layout/left_parenthesis_layout.h"
|
||||
#include "layout/right_parenthesis_layout.h"
|
||||
#include "layout/vertical_offset_layout.h"
|
||||
extern "C" {
|
||||
@@ -55,7 +55,7 @@ ExpressionLayout * LayoutEngine::createPrefixLayout(const Expression * expressio
|
||||
|
||||
ExpressionLayout * LayoutEngine::createParenthesedLayout(ExpressionLayout * layout, bool cloneLayout) {
|
||||
HorizontalLayout * result = new HorizontalLayout();
|
||||
result->addChildAtIndex(new ParenthesisLeftLayout(), 0);
|
||||
result->addChildAtIndex(new LeftParenthesisLayout(), 0);
|
||||
if (layout != nullptr) {
|
||||
result->addOrMergeChildAtIndex(cloneLayout ? layout->clone() : layout, 1, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user