Skip to content

Commit

Permalink
Rhythm input mode
Browse files Browse the repository at this point in the history
  • Loading branch information
shoogle committed Aug 8, 2016
1 parent 2d11c86 commit 2011942
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions libmscore/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2482,6 +2482,7 @@ void Score::addAudioTrack()

void Score::padToggle(Pad n)
{
int oldDots = _is.duration().dots();
switch (n) {
case Pad::NOTE00:
_is.setDuration(TDuration::DurationType::V_LONG);
Expand Down Expand Up @@ -2556,8 +2557,35 @@ void Score::padToggle(Pad n)
// if in "note enter" mode, reset
// rest flag
//
if (noteEntryMode())
_is.setRest(false);
if (noteEntryMode()) {
if (usingNoteEntryMethod(NoteEntryMethod::RHYTHM)) {
switch (oldDots) {
case 1:
padToggle(Pad::DOT);
break;
case 2:
padToggle(Pad::DOTDOT);
break;
}
NoteVal nval;
if (_is.rest()) {
// Enter a rest
nval = NoteVal();
}
else {
// Enter a note on the middle staff line
Staff* s = staff(_is.track() / VOICES);
int tick = _is.tick();
ClefType clef = s->clef(tick);
Key key = s->key(tick);
nval = NoteVal(line2pitch(4, clef, key));
}
setNoteRest(_is.segment(), _is.track(), nval, _is.duration().fraction());
_is.moveToNextInputPos();
}
else
_is.setRest(false);
}
}

if (noteEntryMode() || !selection().isSingle())
Expand Down

0 comments on commit 2011942

Please sign in to comment.