From e4dccc8cc11828ff4ef8f0ffc41231efa205bbe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 19 Apr 2018 15:13:20 +0200 Subject: [PATCH] [poincare] Rename ParenthesisLeftLayout into LeftParenthesisLayout Change-Id: Iaedd556ce912d650432d395b294c39e53bfc16a0 --- poincare/Makefile | 2 +- poincare/include/poincare_layouts.h | 2 +- poincare/src/expression_layout_cursor.cpp | 2 +- poincare/src/layout/binomial_coefficient_layout.cpp | 6 +++--- ...sis_left_layout.cpp => left_parenthesis_layout.cpp} | 10 +++++----- ...nthesis_left_layout.h => left_parenthesis_layout.h} | 6 +++--- poincare/src/layout/sequence_layout.cpp | 8 ++++---- poincare/src/layout/vertical_offset_layout.cpp | 6 +++--- poincare/src/layout_engine.cpp | 4 ++-- 9 files changed, 23 insertions(+), 23 deletions(-) rename poincare/src/layout/{parenthesis_left_layout.cpp => left_parenthesis_layout.cpp} (88%) rename poincare/src/layout/{parenthesis_left_layout.h => left_parenthesis_layout.h} (84%) diff --git a/poincare/Makefile b/poincare/Makefile index 7c4f18a88..fc310b5dd 100644 --- a/poincare/Makefile +++ b/poincare/Makefile @@ -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\ diff --git a/poincare/include/poincare_layouts.h b/poincare/include/poincare_layouts.h index fff7cef2c..e68c0c256 100644 --- a/poincare/include/poincare_layouts.h +++ b/poincare/include/poincare_layouts.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/poincare/src/expression_layout_cursor.cpp b/poincare/src/expression_layout_cursor.cpp index 442b90c21..ab2656ca4 100644 --- a/poincare/src/expression_layout_cursor.cpp +++ b/poincare/src/expression_layout_cursor.cpp @@ -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; } diff --git a/poincare/src/layout/binomial_coefficient_layout.cpp b/poincare/src/layout/binomial_coefficient_layout.cpp index c1b8167c1..e10b32a7a 100644 --- a/poincare/src/layout/binomial_coefficient_layout.cpp +++ b/poincare/src/layout/binomial_coefficient_layout.cpp @@ -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 @@ -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); diff --git a/poincare/src/layout/parenthesis_left_layout.cpp b/poincare/src/layout/left_parenthesis_layout.cpp similarity index 88% rename from poincare/src/layout/parenthesis_left_layout.cpp rename to poincare/src/layout/left_parenthesis_layout.cpp index bd486d9c2..880225bb6 100644 --- a/poincare/src/layout/parenthesis_left_layout.cpp +++ b/poincare/src/layout/left_parenthesis_layout.cpp @@ -1,4 +1,4 @@ -#include "parenthesis_left_layout.h" +#include "left_parenthesis_layout.h" extern "C" { #include #include @@ -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, diff --git a/poincare/src/layout/parenthesis_left_layout.h b/poincare/src/layout/left_parenthesis_layout.h similarity index 84% rename from poincare/src/layout/parenthesis_left_layout.h rename to poincare/src/layout/left_parenthesis_layout.h index 13aaff112..2d9878c5c 100644 --- a/poincare/src/layout/parenthesis_left_layout.h +++ b/poincare/src/layout/left_parenthesis_layout.h @@ -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 #include namespace Poincare { -class ParenthesisLeftLayout : public ParenthesisLayout { +class LeftParenthesisLayout : public ParenthesisLayout { friend class BinomialCoefficientLayout; friend class SequenceLayout; public: diff --git a/poincare/src/layout/sequence_layout.cpp b/poincare/src/layout/sequence_layout.cpp index 76a17985e..9fc35c4c5 100644 --- a/poincare/src/layout/sequence_layout.cpp +++ b/poincare/src/layout/sequence_layout.cpp @@ -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 #include @@ -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()); diff --git a/poincare/src/layout/vertical_offset_layout.cpp b/poincare/src/layout/vertical_offset_layout.cpp index 7d523a402..d54100597 100644 --- a/poincare/src/layout/vertical_offset_layout.cpp +++ b/poincare/src/layout/vertical_offset_layout.cpp @@ -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 #include @@ -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 diff --git a/poincare/src/layout_engine.cpp b/poincare/src/layout_engine.cpp index 4bc28c2d0..65fc1ef3d 100644 --- a/poincare/src/layout_engine.cpp +++ b/poincare/src/layout_engine.cpp @@ -1,7 +1,7 @@ #include #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); }