mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-30 12:10:03 +02:00
[poincare] Delete empty layouts when adding something next to them.
Change-Id: Ie89fa84edb0bdd57ead42fac68cbb564c5327556
This commit is contained in:
@@ -47,7 +47,7 @@ public:
|
||||
|
||||
bool insertLayoutAtCursor(ExpressionLayout * newChild, ExpressionLayoutCursor * cursor);
|
||||
|
||||
void addBrother(ExpressionLayoutCursor * cursor, ExpressionLayout * brother);
|
||||
virtual void addBrother(ExpressionLayoutCursor * cursor, ExpressionLayout * brother);
|
||||
ExpressionLayout * replaceWith(ExpressionLayout * newChild, bool deleteAfterReplace = true);
|
||||
ExpressionLayout * replaceWithJuxtapositionOf(ExpressionLayout * leftChild, ExpressionLayout * rightChild, bool deleteAfterReplace);
|
||||
void replaceChild(const ExpressionLayout * oldChild, ExpressionLayout * newChild, bool deleteOldChild = true);
|
||||
|
||||
@@ -15,6 +15,10 @@ ExpressionLayout * EmptyLayout::clone() const {
|
||||
return layout;
|
||||
}
|
||||
|
||||
void EmptyLayout::addBrother(ExpressionLayoutCursor * cursor, ExpressionLayout * brother) {
|
||||
replaceWith(brother, true);
|
||||
}
|
||||
|
||||
bool EmptyLayout::moveLeft(ExpressionLayoutCursor * cursor) {
|
||||
assert(cursor->pointedExpressionLayout() == this);
|
||||
// Ask the parent.
|
||||
|
||||
@@ -10,6 +10,7 @@ class EmptyLayout : public StaticLayoutHierarchy<0> {
|
||||
public:
|
||||
EmptyLayout();
|
||||
ExpressionLayout * clone() const override;
|
||||
void addBrother(ExpressionLayoutCursor * cursor, ExpressionLayout * brother) override;
|
||||
bool moveLeft(ExpressionLayoutCursor * cursor) override;
|
||||
bool moveRight(ExpressionLayoutCursor * cursor) override;
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user