mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[poincare/layout_cursor] Rename MoveDirection -> Direction
This commit is contained in:
@@ -453,14 +453,14 @@ bool LayoutField::privateHandleMoveEvent(Ion::Events::Event event, bool * should
|
||||
}
|
||||
LayoutCursor result;
|
||||
if (event == Ion::Events::Left) {
|
||||
result = m_contentView.cursor()->cursorAtDirection(LayoutCursor::MoveDirection::Left, shouldRecomputeLayout);
|
||||
result = m_contentView.cursor()->cursorAtDirection(LayoutCursor::Direction::Left, shouldRecomputeLayout);
|
||||
} else if (event == Ion::Events::Right) {
|
||||
result = m_contentView.cursor()->cursorAtDirection(LayoutCursor::MoveDirection::Right, shouldRecomputeLayout);
|
||||
result = m_contentView.cursor()->cursorAtDirection(LayoutCursor::Direction::Right, shouldRecomputeLayout);
|
||||
} else if (event == Ion::Events::Up) {
|
||||
result = m_contentView.cursor()->cursorAtDirection(LayoutCursor::MoveDirection::Up, shouldRecomputeLayout);
|
||||
result = m_contentView.cursor()->cursorAtDirection(LayoutCursor::Direction::Up, shouldRecomputeLayout);
|
||||
} else {
|
||||
assert(event == Ion::Events::Down);
|
||||
result = m_contentView.cursor()->cursorAtDirection(LayoutCursor::MoveDirection::Down, shouldRecomputeLayout);
|
||||
result = m_contentView.cursor()->cursorAtDirection(LayoutCursor::Direction::Down, shouldRecomputeLayout);
|
||||
}
|
||||
if (result.isDefined()) {
|
||||
m_contentView.setCursor(result);
|
||||
@@ -477,10 +477,10 @@ bool LayoutField::privateHandleSelectionEvent(Ion::Events::Event event, bool * s
|
||||
LayoutCursor result;
|
||||
if (eventIsSelection(event)) {
|
||||
Layout addedSelection;
|
||||
LayoutCursor::MoveDirection direction = event == Ion::Events::ShiftLeft ? LayoutCursor::MoveDirection::Left :
|
||||
(event == Ion::Events::ShiftRight ? LayoutCursor::MoveDirection::Right :
|
||||
(event == Ion::Events::ShiftUp ? LayoutCursor::MoveDirection::Up :
|
||||
LayoutCursor::MoveDirection::Down));
|
||||
LayoutCursor::Direction direction = event == Ion::Events::ShiftLeft ? LayoutCursor::Direction::Left :
|
||||
(event == Ion::Events::ShiftRight ? LayoutCursor::Direction::Right :
|
||||
(event == Ion::Events::ShiftUp ? LayoutCursor::Direction::Up :
|
||||
LayoutCursor::Direction::Down));
|
||||
result = m_contentView.cursor()->selectAtDirection(direction, shouldRecomputeLayout, &addedSelection);
|
||||
if (addedSelection.isUninitialized()) {
|
||||
return false;
|
||||
|
||||
@@ -27,7 +27,7 @@ class LayoutCursor final {
|
||||
public:
|
||||
constexpr static KDCoordinate k_cursorWidth = 1;
|
||||
|
||||
enum class MoveDirection { //TODO LEA rename direction?
|
||||
enum class Direction {
|
||||
Left,
|
||||
Right,
|
||||
Up,
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
KDPoint middleLeftPoint();
|
||||
|
||||
/* Move */
|
||||
void move(MoveDirection direction, bool * shouldRecomputeLayout);
|
||||
void move(Direction direction, bool * shouldRecomputeLayout);
|
||||
void moveLeft(bool * shouldRecomputeLayout) {
|
||||
layoutNode()->moveCursorLeft(this, shouldRecomputeLayout);
|
||||
}
|
||||
@@ -95,15 +95,15 @@ public:
|
||||
void moveUnder(bool * shouldRecomputeLayout) {
|
||||
layoutNode()->moveCursorDown(this, shouldRecomputeLayout);
|
||||
}
|
||||
LayoutCursor cursorAtDirection(MoveDirection direction, bool * shouldRecomputeLayout) {
|
||||
LayoutCursor cursorAtDirection(Direction direction, bool * shouldRecomputeLayout) {
|
||||
LayoutCursor result = clone();
|
||||
result.move(direction, shouldRecomputeLayout);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Select */
|
||||
void select(MoveDirection direction, bool * shouldRecomputeLayout, Layout * selection);
|
||||
LayoutCursor selectAtDirection(MoveDirection direction, bool * shouldRecomputeLayout, Layout * selection) {
|
||||
void select(Direction direction, bool * shouldRecomputeLayout, Layout * selection);
|
||||
LayoutCursor selectAtDirection(Direction direction, bool * shouldRecomputeLayout, Layout * selection) {
|
||||
LayoutCursor result = clone();
|
||||
result.select(direction, shouldRecomputeLayout, selection);
|
||||
return result;
|
||||
|
||||
@@ -58,14 +58,14 @@ KDPoint LayoutCursor::middleLeftPoint() {
|
||||
}
|
||||
|
||||
/* Move */
|
||||
void LayoutCursor::move(MoveDirection direction, bool * shouldRecomputeLayout) {
|
||||
if (direction == MoveDirection::Left) {
|
||||
void LayoutCursor::move(Direction direction, bool * shouldRecomputeLayout) {
|
||||
if (direction == Direction::Left) {
|
||||
moveLeft(shouldRecomputeLayout);
|
||||
} else if (direction == MoveDirection::Right) {
|
||||
} else if (direction == Direction::Right) {
|
||||
moveRight(shouldRecomputeLayout);
|
||||
} else if (direction == MoveDirection::Up) {
|
||||
} else if (direction == Direction::Up) {
|
||||
moveAbove(shouldRecomputeLayout);
|
||||
} else if (direction == MoveDirection::Down) {
|
||||
} else if (direction == Direction::Down) {
|
||||
moveUnder(shouldRecomputeLayout);
|
||||
} else {
|
||||
assert(false);
|
||||
@@ -74,11 +74,11 @@ void LayoutCursor::move(MoveDirection direction, bool * shouldRecomputeLayout) {
|
||||
|
||||
/* Select */
|
||||
|
||||
void LayoutCursor::select(MoveDirection direction, bool * shouldRecomputeLayout, Layout * selection) {
|
||||
if (direction == MoveDirection::Right || direction == MoveDirection::Left) {
|
||||
selectLeftRight(direction == MoveDirection::Right, shouldRecomputeLayout, selection);
|
||||
void LayoutCursor::select(Direction direction, bool * shouldRecomputeLayout, Layout * selection) {
|
||||
if (direction == Direction::Right || direction == Direction::Left) {
|
||||
selectLeftRight(direction == Direction::Right, shouldRecomputeLayout, selection);
|
||||
} else {
|
||||
selectUpDown(direction == MoveDirection::Up, shouldRecomputeLayout, selection);
|
||||
selectUpDown(direction == Direction::Up, shouldRecomputeLayout, selection);
|
||||
}
|
||||
*shouldRecomputeLayout = true;
|
||||
}
|
||||
@@ -361,7 +361,7 @@ void LayoutCursor::selectLeftRight(bool right, bool * shouldRecomputeLayout, Lay
|
||||
|
||||
void LayoutCursor::selectUpDown(bool up, bool * shouldRecomputeLayout, Layout * selection) {
|
||||
// Move the cursor in the selection direction
|
||||
LayoutCursor c = cursorAtDirection(up ? MoveDirection::Up : MoveDirection::Down, shouldRecomputeLayout);
|
||||
LayoutCursor c = cursorAtDirection(up ? Direction::Up : Direction::Down, shouldRecomputeLayout);
|
||||
if (!c.isDefined()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user