mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-28 18:20:14 +01:00
[poincare] Clean inlines in LayoutCursor and LayoutReference
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
#ifndef POINCARE_LAYOUT_CURSOR_H
|
||||
#define POINCARE_LAYOUT_CURSOR_H
|
||||
|
||||
#include "layout_reference.h"
|
||||
#include "layout_node.h"
|
||||
#include <stdio.h>
|
||||
#include <poincare/layout_reference.h>
|
||||
#include <poincare/layout_node.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -82,23 +81,19 @@ public:
|
||||
KDPoint middleLeftPoint();
|
||||
|
||||
/* Move */
|
||||
void move(MoveDirection direction, bool * shouldRecomputeLayout) {
|
||||
if (direction == MoveDirection::Left) {
|
||||
moveLeft(shouldRecomputeLayout);
|
||||
} else if (direction == MoveDirection::Right) {
|
||||
moveRight(shouldRecomputeLayout);
|
||||
} else if (direction == MoveDirection::Up) {
|
||||
moveAbove(shouldRecomputeLayout);
|
||||
} else if (direction == MoveDirection::Down) {
|
||||
moveUnder(shouldRecomputeLayout);
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
void move(MoveDirection direction, bool * shouldRecomputeLayout);
|
||||
void moveLeft(bool * shouldRecomputeLayout) {
|
||||
layoutNode()->moveCursorLeft(this, shouldRecomputeLayout);
|
||||
}
|
||||
void moveRight(bool * shouldRecomputeLayout) {
|
||||
layoutNode()->moveCursorRight(this, shouldRecomputeLayout);
|
||||
}
|
||||
void moveAbove(bool * shouldRecomputeLayout) {
|
||||
layoutNode()->moveCursorUp(this, shouldRecomputeLayout);
|
||||
}
|
||||
void moveUnder(bool * shouldRecomputeLayout) {
|
||||
layoutNode()->moveCursorDown(this, shouldRecomputeLayout);
|
||||
}
|
||||
void moveLeft(bool * shouldRecomputeLayout);
|
||||
void moveRight(bool * shouldRecomputeLayout);
|
||||
void moveAbove(bool * shouldRecomputeLayout);
|
||||
void moveUnder(bool * shouldRecomputeLayout);
|
||||
LayoutCursor cursorAtDirection(MoveDirection direction, bool * shouldRecomputeLayout) {
|
||||
LayoutCursor result = clone();
|
||||
result.move(direction, shouldRecomputeLayout);
|
||||
|
||||
@@ -19,19 +19,8 @@ public:
|
||||
using TreeByReference::operator!=;
|
||||
|
||||
LayoutReference() : TreeByReference() {}
|
||||
LayoutReference(const LayoutNode * node) :
|
||||
TreeByReference(node) {}
|
||||
|
||||
LayoutReference clone() const {
|
||||
if (isUninitialized()) {
|
||||
return LayoutReference();
|
||||
}
|
||||
TreeByReference c = TreeByReference::clone();
|
||||
LayoutReference cast = LayoutReference(static_cast<LayoutNode *>(c.node()));
|
||||
cast.invalidAllSizesPositionsAndBaselines();
|
||||
return cast;
|
||||
}
|
||||
|
||||
LayoutReference(const LayoutNode * node) : TreeByReference(node) {}
|
||||
LayoutReference clone() const;
|
||||
LayoutNode * node() const {
|
||||
assert(isUninitialized() || !TreeByReference::node()->isGhost());
|
||||
return static_cast<LayoutNode *>(TreeByReference::node());
|
||||
@@ -46,7 +35,6 @@ public:
|
||||
}
|
||||
//TODO: check these methods are needed here, not just in Node
|
||||
KDSize layoutSize() { return node()->layoutSize(); }
|
||||
//KDPoint layoutOrigin() { return this->node()->origin(); }
|
||||
KDPoint absoluteOrigin() { return node()->absoluteOrigin(); }
|
||||
KDCoordinate baseline() { return node()->baseline(); }
|
||||
void invalidAllSizesPositionsAndBaselines() { return node()->invalidAllSizesPositionsAndBaselines(); }
|
||||
|
||||
@@ -54,21 +54,18 @@ KDPoint LayoutCursor::middleLeftPoint() {
|
||||
}
|
||||
|
||||
/* Move */
|
||||
|
||||
void LayoutCursor::moveLeft(bool * shouldRecomputeLayout) {
|
||||
layoutNode()->moveCursorLeft(this, shouldRecomputeLayout);
|
||||
}
|
||||
|
||||
void LayoutCursor::moveRight(bool * shouldRecomputeLayout) {
|
||||
layoutNode()->moveCursorRight(this, shouldRecomputeLayout);
|
||||
}
|
||||
|
||||
void LayoutCursor::moveAbove(bool * shouldRecomputeLayout) {
|
||||
layoutNode()->moveCursorUp(this, shouldRecomputeLayout);
|
||||
}
|
||||
|
||||
void LayoutCursor::moveUnder(bool * shouldRecomputeLayout) {
|
||||
layoutNode()->moveCursorDown(this, shouldRecomputeLayout);
|
||||
void LayoutCursor::move(MoveDirection direction, bool * shouldRecomputeLayout) {
|
||||
if (direction == MoveDirection::Left) {
|
||||
moveLeft(shouldRecomputeLayout);
|
||||
} else if (direction == MoveDirection::Right) {
|
||||
moveRight(shouldRecomputeLayout);
|
||||
} else if (direction == MoveDirection::Up) {
|
||||
moveAbove(shouldRecomputeLayout);
|
||||
} else if (direction == MoveDirection::Down) {
|
||||
moveUnder(shouldRecomputeLayout);
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
/* Layout modification */
|
||||
@@ -221,7 +218,6 @@ KDCoordinate LayoutCursor::layoutHeight() {
|
||||
+ max(pointedLayoutHeight - pointedLayoutBaseline, equivalentLayoutHeight - equivalentLayoutBaseline);
|
||||
}
|
||||
return pointedLayoutHeight;
|
||||
|
||||
}
|
||||
|
||||
void LayoutCursor::privateAddEmptyPowerLayout(VerticalOffsetLayoutRef v) {
|
||||
|
||||
@@ -7,6 +7,15 @@
|
||||
#include <poincare/layout_cursor.h>
|
||||
|
||||
namespace Poincare {
|
||||
LayoutReference LayoutReference::clone() const {
|
||||
if (isUninitialized()) {
|
||||
return LayoutReference();
|
||||
}
|
||||
TreeByReference c = TreeByReference::clone();
|
||||
LayoutReference cast = LayoutReference(static_cast<LayoutNode *>(c.node()));
|
||||
cast.invalidAllSizesPositionsAndBaselines();
|
||||
return cast;
|
||||
}
|
||||
|
||||
// Cursor
|
||||
LayoutCursor LayoutReference::cursor() const {
|
||||
|
||||
Reference in New Issue
Block a user