mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-20 09:17:23 +01:00
[poincare] Left/Right Parenthesis and SquareBracket, Integral layouts
This commit is contained in:
@@ -16,7 +16,12 @@ objs += $(addprefix poincare/src/,\
|
||||
fraction_layout_node.o\
|
||||
grid_layout_node.o\
|
||||
horizontal_layout_node.o\
|
||||
integral_layout_node.o\
|
||||
left_parenthesis_layout_node.o\
|
||||
left_square_bracket_layout_node.o\
|
||||
matrix_layout_node.o\
|
||||
right_parenthesis_layout_node.o\
|
||||
right_square_bracket_layout_node.o\
|
||||
)
|
||||
|
||||
objs += $(addprefix poincare/src/,\
|
||||
|
||||
@@ -29,6 +29,8 @@ public:
|
||||
char XNTChar() const override { return 'x'; }
|
||||
|
||||
// TreeNode
|
||||
static IntegralLayoutNode * FailedAllocationStaticNode();
|
||||
IntegralLayoutNode * failedAllocationStaticNode() override { return FailedAllocationStaticNode(); }
|
||||
size_t size() const override { return sizeof(IntegralLayoutNode); }
|
||||
int numberOfChildren() const override { return 3; }
|
||||
#if TREE_LOG
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <poincare/square_bracket_layout_node.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -15,7 +16,8 @@ public:
|
||||
bool isLeftBracket() const override { return true; }
|
||||
|
||||
// TreeNode
|
||||
size_t size() const override { return sizeof(LeftSquareBracketLayoutNode); }
|
||||
static LeftSquareBracketLayoutNode * FailedAllocationStaticNode();
|
||||
LeftSquareBracketLayoutNode * failedAllocationStaticNode() override { return FailedAllocationStaticNode(); } size_t size() const override { return sizeof(LeftSquareBracketLayoutNode); }
|
||||
#if TREE_LOG
|
||||
const char * description() const override { return "LeftSquareBracketLayout"; }
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <poincare/parenthesis_layout_node.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <poincare/square_bracket_layout_node.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -15,6 +16,8 @@ public:
|
||||
bool isRightBracket() const override { return true; }
|
||||
|
||||
// TreeNode
|
||||
static RightSquareBracketLayoutNode * FailedAllocationStaticNode();
|
||||
RightSquareBracketLayoutNode * failedAllocationStaticNode() override { return FailedAllocationStaticNode(); }
|
||||
size_t size() const override { return sizeof(RightSquareBracketLayoutNode); }
|
||||
#if TREE_LOG
|
||||
const char * description() const override { return "RightSquareBracketLayout"; }
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <poincare/integral_layout_node.h>
|
||||
#include <poincare/allocation_failure_layout_node.h>
|
||||
#include <poincare/char_layout_node.h>
|
||||
#include <poincare/horizontal_layout_node.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
@@ -22,6 +24,12 @@ const uint8_t bottomSymbolPixel[IntegralLayoutNode::k_symbolHeight][IntegralLayo
|
||||
{0xFF, 0xFF, 0x00, 0x00},
|
||||
};
|
||||
|
||||
IntegralLayoutNode * IntegralLayoutNode::FailedAllocationStaticNode() {
|
||||
static AllocationFailureLayoutNode<IntegralLayoutNode> failure;
|
||||
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
|
||||
return &failure;
|
||||
}
|
||||
|
||||
void IntegralLayoutNode::moveCursorLeft(LayoutCursor * cursor, bool * shouldRecomputeLayout) {
|
||||
if (cursor->position() == LayoutCursor::Position::Left
|
||||
&& ((upperBoundLayout() && cursor->layoutNode() == upperBoundLayout())
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <poincare/left_parenthesis_layout_node.h>
|
||||
#include <poincare/allocation_failure_layout_node.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
#include <poincare/left_square_bracket_layout_node.h>
|
||||
#include <poincare/allocation_failure_layout_node.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
LeftSquareBracketLayoutNode * LeftSquareBracketLayoutNode::FailedAllocationStaticNode() {
|
||||
static AllocationFailureLayoutNode<LeftSquareBracketLayoutNode> failure;
|
||||
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
|
||||
return &failure;
|
||||
}
|
||||
|
||||
void LeftSquareBracketLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
|
||||
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);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <poincare/right_parenthesis_layout_node.h>
|
||||
#include <poincare/allocation_failure_layout_node.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
#include <poincare/right_square_bracket_layout_node.h>
|
||||
#include <poincare/allocation_failure_layout_node.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
RightSquareBracketLayoutNode * RightSquareBracketLayoutNode::FailedAllocationStaticNode() {
|
||||
static AllocationFailureLayoutNode<RightSquareBracketLayoutNode> failure;
|
||||
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
|
||||
return &failure;
|
||||
}
|
||||
|
||||
void RightSquareBracketLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user