From 9d7462cb4d10b666e6f6b9d7a4917f34cb725a99 Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Tue, 3 Sep 2024 11:10:22 +0200 Subject: [PATCH] Change `moveAlt()` to take a `MoveDirection` --- src/engraving/dom/navigate.cpp | 5 +++-- src/engraving/dom/score.h | 6 +++++- src/notation/internal/notationinteraction.cpp | 7 +++---- src/notation/notationtypes.h | 2 -- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/engraving/dom/navigate.cpp b/src/engraving/dom/navigate.cpp index cc416cc0a25c8..f9593cf3d46b5 100644 --- a/src/engraving/dom/navigate.cpp +++ b/src/engraving/dom/navigate.cpp @@ -35,6 +35,7 @@ #include "staff.h" #include "soundflag.h" #include "guitarbend.h" +#include "notation/notationtypes.h" using namespace mu; @@ -392,12 +393,12 @@ Note* Score::downAltCtrl(Note* note) const // or top/bottom of next/previous track's chord if at wit's end //--------------------------------------------------------- -EngravingItem* Score::moveAlt(EngravingItem* element, DirectionV direction) +EngravingItem* Score::moveAlt(EngravingItem* element, notation::MoveDirection direction) { EngravingItem* result = nullptr; ChordRest* cr = nullptr; auto originalTrack = element->track(); - bool moveUp = (direction == DirectionV::UP); + bool moveUp = (direction == notation::MoveDirection::Up); bool isNote = element->isNote(); bool isRest = element->isRest(); diff --git a/src/engraving/dom/score.h b/src/engraving/dom/score.h index 519a7d7683c76..cd231cb298109 100644 --- a/src/engraving/dom/score.h +++ b/src/engraving/dom/score.h @@ -90,6 +90,10 @@ namespace mu::engraving::compat { class WriteScoreHook; } +namespace mu::notation { +enum class MoveDirection; +} + namespace mu::engraving { class Articulation; class Audio; @@ -934,7 +938,7 @@ class Score : public EngravingObject, public muse::Injectable Note* upAltCtrl(Note*) const; EngravingItem* downAlt(EngravingItem*); Note* downAltCtrl(Note*) const; - EngravingItem* moveAlt(EngravingItem*, DirectionV); + EngravingItem* moveAlt(EngravingItem*, notation::MoveDirection); EngravingItem* firstElement(bool frame = true); EngravingItem* lastElement(bool frame = true); diff --git a/src/notation/internal/notationinteraction.cpp b/src/notation/internal/notationinteraction.cpp index dccffe77a0ab3..4052a512d5a41 100644 --- a/src/notation/internal/notationinteraction.cpp +++ b/src/notation/internal/notationinteraction.cpp @@ -701,16 +701,15 @@ void NotationInteraction::moveChordNoteSelection(MoveDirection d) EngravingItem* oldSingle = currentSingle; bool isRange = selection.isRange(); std::vector notes; - DirectionV dir = d == MoveDirection::Up ? DirectionV::UP : DirectionV::DOWN; // Single traverse: if (currentSingle && (currentSingle->isNote() || currentSingle->isRest())) { - EngravingItem* newSingle = _score.moveAlt(currentSingle, dir); + EngravingItem* newSingle = _score.moveAlt(currentSingle, d); if (newSingle == currentSingle) { return; } while (newSingle && newSingle->isRest() && toRest(newSingle)->isGap()) { - newSingle = _score.moveAlt(newSingle, dir); + newSingle = _score.moveAlt(newSingle, d); if (newSingle == oldSingle) { break; } @@ -729,7 +728,7 @@ void NotationInteraction::moveChordNoteSelection(MoveDirection d) : selectedNote->chord()->upNote(); notes.emplace_back(newSelection); } else { // List - auto newSelection = _score.moveAlt(selectedNote, dir); + auto newSelection = _score.moveAlt(selectedNote, d); bool keepSelection = !newSelection; if (newSelection) { if (newSelection->isNote()) { diff --git a/src/notation/notationtypes.h b/src/notation/notationtypes.h index 073042dfd9dcb..fccb916f1985a 100644 --- a/src/notation/notationtypes.h +++ b/src/notation/notationtypes.h @@ -22,8 +22,6 @@ #ifndef MU_NOTATION_NOTATIONTYPES_H #define MU_NOTATION_NOTATIONTYPES_H -#include -#include #include #include "translation.h"