[poincare/layout_cursor] Rename layoutReference -> layout

It was an historic name
This commit is contained in:
Léa Saviot
2019-12-19 16:00:24 +01:00
parent 5c2ea9899d
commit 785cd2f88c
6 changed files with 23 additions and 23 deletions

View File

@@ -107,12 +107,12 @@ void LayoutField::ContentView::addSelection(Layout addedLayout) {
* +++++----- -> next selection
* */
LayoutCursor c1 = LayoutCursor(addedLayout, LayoutCursor::Position::Left);
if (c1.layoutReference() == m_selectionStart) {
if (c1.layout() == m_selectionStart) {
m_selectionStart = Layout();
m_selectionEnd = Layout();
} else {
LayoutCursor c2 = addedLayout.equivalentCursor(&c1);
Layout c2Layout = c2.layoutReference();
Layout c2Layout = c2.layout();
if (c2.position() == LayoutCursor::Position::Right) {
assert(IsBefore(m_selectionStart, c2Layout, false));
m_selectionEnd = c2Layout;
@@ -129,12 +129,12 @@ void LayoutField::ContentView::addSelection(Layout addedLayout) {
* -----+++++ -> next selection
* */
LayoutCursor c1 = LayoutCursor(addedLayout, LayoutCursor::Position::Right);
if (c1.layoutReference() == m_selectionEnd) {
if (c1.layout() == m_selectionEnd) {
m_selectionStart = Layout();
m_selectionEnd = Layout();
} else {
LayoutCursor c2 = addedLayout.equivalentCursor(&c1);
Layout c2Layout = c2.layoutReference();
Layout c2Layout = c2.layout();
if (c2.position() == LayoutCursor::Position::Left) {
assert(IsBefore(c2Layout, m_selectionEnd, false));
m_selectionStart = c2Layout;
@@ -234,11 +234,11 @@ void LayoutField::ContentView::layoutCursorSubview(bool force) {
return;
}
KDPoint expressionViewOrigin = m_expressionView.absoluteDrawingOrigin();
Layout pointedLayoutR = m_cursor.layoutReference();
Layout pointedLayoutR = m_cursor.layout();
LayoutCursor::Position cursorPosition = m_cursor.position();
LayoutCursor eqCursor = pointedLayoutR.equivalentCursor(&m_cursor);
if (eqCursor.isDefined() && pointedLayoutR.hasChild(eqCursor.layoutReference())) {
pointedLayoutR = eqCursor.layoutReference();
if (eqCursor.isDefined() && pointedLayoutR.hasChild(eqCursor.layout())) {
pointedLayoutR = eqCursor.layout();
cursorPosition = eqCursor.position();
}
KDPoint cursoredExpressionViewOrigin = pointedLayoutR.absoluteOrigin();
@@ -258,7 +258,7 @@ void LayoutField::setEditing(bool isEditing) {
}
CodePoint LayoutField::XNTCodePoint(CodePoint defaultXNTCodePoint) {
CodePoint xnt = m_contentView.cursor()->layoutReference().XNTCodePoint();
CodePoint xnt = m_contentView.cursor()->layout().XNTCodePoint();
if (xnt != UCodePointNull) {
return xnt;
}
@@ -583,7 +583,7 @@ void LayoutField::insertLayoutAtCursor(Layout layoutR, Poincare::Expression corr
}
// Handle matrices
cursor->layoutReference().addGreySquaresToAllMatrixAncestors();
cursor->layout().addGreySquaresToAllMatrixAncestors();
// Handle empty layouts
cursor->hideEmptyLayoutIfNeeded();

View File

@@ -57,7 +57,7 @@ public:
bool isDefined() const { return !m_layout.isUninitialized(); }
// Getters and setters
Layout layoutReference() { return m_layout; }
Layout layout() { return m_layout; }
int layoutIdentifier() { return m_layout.identifier(); }
void setLayout(Layout r) {
@@ -66,7 +66,7 @@ public:
}
}
void setTo(LayoutCursor * other) {
m_layout = other->layoutReference();
m_layout = other->layout();
m_position = other->position();
}
Position position() const { return m_position; }

View File

@@ -128,7 +128,7 @@ void Layout::replaceWithJuxtapositionOf(Layout leftChild, Layout rightChild, Lay
}
castedParent.addOrMergeChildAtIndex(rightChild, idxInParent, true);
castedParent.addOrMergeChildAtIndex(leftChild, idxInParent, true, putCursorInTheMiddle ? cursor : nullptr);
p.removeChild(*this, cursor->layoutReference() == *this ? cursor : nullptr);
p.removeChild(*this, cursor->layout() == *this ? cursor : nullptr);
}
void Layout::addChildAtIndex(Layout l, int index, int currentNumberOfChildren, LayoutCursor * cursor) {

View File

@@ -28,7 +28,7 @@ KDCoordinate LayoutCursor::baseline() {
return k_cursorHeight/2;
}
KDCoordinate layoutBaseline = m_layout.baseline();
Layout equivalentLayout = m_layout.equivalentCursor(this).layoutReference();
Layout equivalentLayout = m_layout.equivalentCursor(this).layout();
if (equivalentLayout.isUninitialized()) {
return layoutBaseline;
}
@@ -51,7 +51,7 @@ bool LayoutCursor::isEquivalentTo(LayoutCursor cursor) {
/* Position */
KDPoint LayoutCursor::middleLeftPoint() {
KDPoint layoutOrigin = layoutReference().absoluteOrigin();
KDPoint layoutOrigin = layout().absoluteOrigin();
KDCoordinate x = layoutOrigin.x() + (m_position == Position::Left ? 0 : m_layout.layoutSize().width());
KDCoordinate y = layoutOrigin.y() + m_layout.baseline() - k_cursorHeight/2;
return KDPoint(x,y);
@@ -223,7 +223,7 @@ void LayoutCursor::clearLayout() {
/* Private */
KDCoordinate LayoutCursor::layoutHeight() {
Layout equivalentLayout = m_layout.equivalentCursor(this).layoutReference();
Layout equivalentLayout = m_layout.equivalentCursor(this).layout();
if (!equivalentLayout.isUninitialized() && m_layout.hasChild(equivalentLayout)) {
return equivalentLayout.layoutSize().height();
}
@@ -269,8 +269,8 @@ bool LayoutCursor::baseForNewPowerLayout() {
return true;
}
LayoutCursor equivalentLayoutCursor = m_layout.equivalentCursor(this);
if (equivalentLayoutCursor.layoutReference().isUninitialized()
|| (equivalentLayoutCursor.layoutReference().type() == LayoutNode::Type::HorizontalLayout
if (equivalentLayoutCursor.layout().isUninitialized()
|| (equivalentLayoutCursor.layout().type() == LayoutNode::Type::HorizontalLayout
&& equivalentLayoutCursor.position() == Position::Left))
{
return false;
@@ -289,7 +289,7 @@ bool LayoutCursor::privateShowHideEmptyLayoutIfNeeded(bool show) {
adjacentEmptyLayout = m_layout;
} else {
// Check the equivalent cursor position
Layout equivalentPointedLayout = m_layout.equivalentCursor(this).layoutReference();
Layout equivalentPointedLayout = m_layout.equivalentCursor(this).layout();
if (!equivalentPointedLayout.isUninitialized() && equivalentPointedLayout.isEmpty()) {
adjacentEmptyLayout = equivalentPointedLayout;
}
@@ -319,7 +319,7 @@ void LayoutCursor::selectLeftRight(bool right, bool * shouldRecomputeLayout, Lay
// Find the layout to select
LayoutCursor equivalentCursor = m_layout.equivalentCursor(this);
Layout equivalentLayout = equivalentCursor.layoutReference();
Layout equivalentLayout = equivalentCursor.layout();
bool currentLayoutIsEmpty = m_layout.type() == LayoutNode::Type::EmptyLayout;
if (!currentLayoutIsEmpty && m_position == ingoingPosition) {
@@ -368,7 +368,7 @@ void LayoutCursor::selectUpDown(bool up, bool * shouldRecomputeLayout, Layout *
}
/* Find the first common ancestor between the current layout and the layout of
* the moved cursor. */
TreeHandle ancestor = m_layout.commonAncestorWith(c.layoutReference());
TreeHandle ancestor = m_layout.commonAncestorWith(c.layout());
*selection = static_cast<Layout &>(ancestor);
m_layout = *selection;
m_position = up ? Position::Left : Position::Right;

View File

@@ -91,7 +91,7 @@ void LayoutNode::invalidAllSizesPositionsAndBaselines() {
LayoutCursor LayoutNode::equivalentCursor(LayoutCursor * cursor) {
// Only HorizontalLayout may have no parent, and it overloads this method
assert(parent() != nullptr);
return (cursor->layoutReference().node() == this) ? parent()->equivalentCursor(cursor) : LayoutCursor();
return (cursor->layout().node() == this) ? parent()->equivalentCursor(cursor) : LayoutCursor();
}
// Tree modification
@@ -173,7 +173,7 @@ void LayoutNode::moveCursorVertically(VerticalDirection direction, LayoutCursor
if (!equivalentPositionVisited) {
LayoutCursor cursorEquivalent = equivalentCursor(cursor);
if (cursorEquivalent.isDefined()) {
cursor->setLayout(cursorEquivalent.layoutReference());
cursor->setLayout(cursorEquivalent.layout());
cursor->setPosition(cursorEquivalent.position());
if (direction == VerticalDirection::Up) {
cursor->layoutNode()->moveCursorUp(cursor, shouldRecomputeLayout, true);

View File

@@ -192,7 +192,7 @@ void MatrixLayoutNode::moveCursorVertically(VerticalDirection direction, LayoutC
if (i >= lastIndex) {
break;
}
if (cursor->layoutReference().node()->hasAncestor(l, true)) {
if (cursor->layout().node()->hasAncestor(l, true)) {
// The cursor is leaving the matrix, so remove the grey squares.
shouldRemoveGreySquares = true;
break;