Skip to content

Commit

Permalink
Disable most editing options for trill cue notes
Browse files Browse the repository at this point in the history
  • Loading branch information
miiizen committed Sep 6, 2023
1 parent f147992 commit db3c6a0
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/engraving/dom/chordrest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,15 @@ Breath* ChordRest::hasBreathMark() const
return s ? toBreath(s->element(track())) : 0;
}

void ChordRest::setIsTrillCueNote(bool v)
{
if (isChord()) {
m_isTrillCueNote = v;
} else {
m_isTrillCueNote = false;
}
}

//---------------------------------------------------------
// nextSegmentAfterCR
// returns first segment at tick CR->tick + CR->actualTicks
Expand Down
5 changes: 5 additions & 0 deletions src/engraving/dom/chordrest.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ class ChordRest : public DurationElement
bool isGraceAfter() const;
Breath* hasBreathMark() const;

bool isTrillCueNote() const { return m_isTrillCueNote; }
void setIsTrillCueNote(bool v);

Segment* nextSegmentAfterCR(SegmentType types) const;

void setScore(Score* s) override;
Expand Down Expand Up @@ -220,6 +223,8 @@ class ChordRest : public DurationElement
TDuration m_durationType;
int m_staffMove = 0; // -1, 0, +1, used for crossbeaming
int m_storedStaffMove = 0; // used to remember and re-apply staff move if needed

bool m_isTrillCueNote = false;
};
} // namespace mu::engraving
#endif
8 changes: 8 additions & 0 deletions src/engraving/dom/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3482,6 +3482,14 @@ mu::PointF Note::posInStaffCoordinates()
return mu::PointF(X, y());
}

void Note::setIsTrillCueNote(bool v)
{
m_isTrillCueNote = v;
if (chord()) {
chord()->setIsTrillCueNote(v);
}
}

void Note::addLineAttachPoint(PointF point, EngravingItem* line)
{
// IMPORTANT: the point is expected in *staff* coordinates
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/note.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class Note final : public EngravingItem
mu::PointF posInStaffCoordinates();

bool isTrillCueNote() const { return m_isTrillCueNote; }
void setIsTrillCueNote(bool v) { m_isTrillCueNote = v; }
void setIsTrillCueNote(bool v);

SymId noteHead() const;
bool isNoteName() const;
Expand Down
10 changes: 9 additions & 1 deletion src/engraving/dom/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2939,6 +2939,14 @@ void Score::cmdConcertPitchChanged(bool flag)

void Score::padToggle(Pad p, const EditData& ed)
{
if (!noteEntryMode()) {
for (ChordRest* cr : getSelectedChordRests()) {
if (cr->isTrillCueNote()) {
return;
}
}
}

int oldDots = m_is.duration().dots();
switch (p) {
case Pad::NOTE00:
Expand Down Expand Up @@ -5040,7 +5048,7 @@ void Score::changeSelectedNotesVoice(voice_idx_t voice)
Chord* chord = note->chord();

// move grace notes with main chord only
if (chord->isGrace()) {
if (chord->isGrace() || chord->isTrillCueNote()) {
continue;
}

Expand Down
7 changes: 5 additions & 2 deletions src/notation/internal/notationinteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3794,6 +3794,9 @@ void NotationInteraction::changeSelectedNotesArticulation(SymbolId articulationS

std::set<Chord*> chords;
for (Note* note: notes) {
if (note->isTrillCueNote()) {
return;
}
Chord* chord = note->chord();
if (chords.find(chord) == chords.end()) {
chords.insert(chord);
Expand Down Expand Up @@ -3844,7 +3847,7 @@ void NotationInteraction::addGraceNotesToSelectedNotes(GraceNoteType type)
bool NotationInteraction::canAddTupletToSelectedChordRests() const
{
for (ChordRest* chordRest : score()->getSelectedChordRests()) {
if (chordRest->isGrace()) {
if (chordRest->isGrace() || chordRest->isTrillCueNote()) {
continue;
}

Expand All @@ -3866,7 +3869,7 @@ void NotationInteraction::addTupletToSelectedChordRests(const TupletOptions& opt
startEdit();

for (ChordRest* chordRest : score()->getSelectedChordRests()) {
if (!chordRest->isGrace()) {
if (!chordRest->isGrace() && !chordRest->isTrillCueNote()) {
Fraction ratio = options.ratio;
if (options.autoBaseLen) {
ratio.setDenominator(Tuplet::computeTupletDenominator(ratio.numerator(), chordRest->ticks()));
Expand Down

0 comments on commit db3c6a0

Please sign in to comment.