@@ -484,19 +484,20 @@ int Rest::computeVoiceOffset(int lines, LayoutData* ldata) const
484484 return voiceLineOffset * upSign;
485485}
486486
487- int Rest::computeWholeRestOffset (int voiceOffset, int lines) const
487+ int Rest::computeWholeOrBreveRestOffset (int voiceOffset, int lines) const
488488{
489- if (!isWholeRest ()) {
490- return 0 ;
491- }
492489 int lineMove = 0 ;
493- bool moveToLineAbove = (lines > 5 )
494- || ((lines > 1 || voiceOffset == -1 || voiceOffset == 2 ) && !(voiceOffset == -2 || voiceOffset == 1 ));
495- if (moveToLineAbove) {
496- lineMove = -1 ;
490+ if (isWholeRest ()) {
491+ bool moveToLineAbove = (lines > 5 )
492+ || ((lines > 1 || voiceOffset == -1 || voiceOffset == 2 ) && !(voiceOffset == -2 || voiceOffset == 1 ));
493+ if (moveToLineAbove) {
494+ lineMove = -1 ;
495+ }
496+ } else if (isBreveRest () && lines == 1 ) {
497+ lineMove = 1 ;
497498 }
498499
499- if (!isFullMeasureRest ()) {
500+ if (!isFullMeasureRest () || ! measure () ) {
500501 return lineMove;
501502 }
502503
@@ -529,7 +530,7 @@ int Rest::computeWholeRestOffset(int voiceOffset, int lines) const
529530 }
530531 }
531532
532- if (hasNotesAbove && hasNotesBelow) {
533+ if (hasNotesAbove == hasNotesBelow) {
533534 return lineMove; // Don't do anything
534535 }
535536
@@ -546,6 +547,10 @@ int Rest::computeWholeRestOffset(int voiceOffset, int lines) const
546547 lineMove = std::min (lineMove, topLine - centerLine);
547548 }
548549
550+ if (isBreveRest ()) {
551+ lineMove++;
552+ }
553+
549554 return lineMove;
550555}
551556
@@ -556,6 +561,13 @@ bool Rest::isWholeRest() const
556561 || (durType == DurationType::V_MEASURE && measure () && measure ()->ticks () < Fraction (2 , 1 ));
557562}
558563
564+ bool Rest::isBreveRest () const
565+ {
566+ TDuration durType = durationType ();
567+ return durType == DurationType::V_BREVE
568+ || (durType == DurationType::V_MEASURE && measure () && measure ()->ticks () >= Fraction (2 , 1 ));
569+ }
570+
559571int Rest::computeNaturalLine (int lines) const
560572{
561573 int line = (lines % 2 ) ? floor (double (lines) / 2 ) : ceil (double (lines) / 2 );
0 commit comments