Skip to content

Commit

Permalink
fix #209326: Don't auto-correct rhythms in normal note input mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Feb 13, 2018
1 parent f924a38 commit 54ef6c0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ void Score::createCRSequence(Fraction f, ChordRest* cr, int tick)
// return segment of last created note/rest
//---------------------------------------------------------

Segment* Score::setNoteRest(Segment* segment, int track, NoteVal nval, Fraction sd, Direction stemDirection)
Segment* Score::setNoteRest(Segment* segment, int track, NoteVal nval, Fraction sd, Direction stemDirection, bool rhythmic)
{
Q_ASSERT(segment->segmentType() == SegmentType::ChordRest);

Expand All @@ -621,7 +621,11 @@ Segment* Score::setNoteRest(Segment* segment, int track, NoteVal nval, Fraction
}

measure = segment->measure();
std::vector<TDuration> dl = toRhythmicDurationList(dd, isRest, segment->rtick(), sigmap()->timesig(tick).nominal(), measure, 1);
std::vector<TDuration> dl;
if (rhythmic)
dl = toRhythmicDurationList(dd, isRest, segment->rtick(), sigmap()->timesig(tick).nominal(), measure, 1);
else
dl = toDurationList(dd, true);
int n = dl.size();
for (int i = 0; i < n; ++i) {
const TDuration& d = dl[i];
Expand Down
4 changes: 2 additions & 2 deletions libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ void Score::regroupNotesAndRests(int startTick, int endTick, int track)
lastRest = cr;
}
int restTicks = lastRest->tick() + lastRest->duration().ticks() - curr->tick();
seg = setNoteRest(seg, curr->track(), NoteVal(), Fraction::fromTicks(restTicks), Direction::AUTO);
seg = setNoteRest(seg, curr->track(), NoteVal(), Fraction::fromTicks(restTicks), Direction::AUTO, true);
}
else {
// combine tied chords
Expand All @@ -1003,7 +1003,7 @@ void Score::regroupNotesAndRests(int startTick, int endTick, int track)
nn->setTieFor(0);
}
int noteTicks = lastTiedChord->tick() + lastTiedChord->duration().ticks() - chord->tick();
seg = setNoteRest(seg, curr->track(), NoteVal(pitches[0]), Fraction::fromTicks(noteTicks), Direction::AUTO);
seg = setNoteRest(seg, curr->track(), NoteVal(pitches[0]), Fraction::fromTicks(noteTicks), Direction::AUTO, true);
Chord* newChord = toChord(seg->cr(track));
Note* n = newChord->notes().front();
undoRemoveElement(n);
Expand Down
2 changes: 1 addition & 1 deletion libmscore/score.h
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ class Score : public QObject, ScoreElement {

Note* setGraceNote(Chord*, int pitch, NoteType type, int len);

Segment* setNoteRest(Segment*, int track, NoteVal nval, Fraction, Direction stemDirection = Direction::AUTO);
Segment* setNoteRest(Segment*, int track, NoteVal nval, Fraction, Direction stemDirection = Direction::AUTO, bool rhythmic = false);
void changeCRlen(ChordRest* cr, const TDuration&);
void changeCRlen(ChordRest* cr, const Fraction&, bool fillWithRest=true);
void createCRSequence(Fraction f, ChordRest* cr, int tick);
Expand Down

0 comments on commit 54ef6c0

Please sign in to comment.