fix #294485: don't wrap to begin/end on next/previous element
Blind users find it disorienting for the previous element command to wrap to the end, or for next element to wrap back to the beginning. Besides, no other navigation commands work that way. This commit stops that behavior by simply swapping the calls to Score::lastElement() and Score::firstElement() in the places where this wrapping occurs. That is, if previous-element finds no previous element, we return the first element.
This commit is contained in:
parent
b382ebdf11
commit
2f2aa3c731
5 changed files with 11 additions and 11 deletions
|
@ -3202,7 +3202,7 @@ Element* Measure::nextElementStaff(int staff)
|
|||
if (next)
|
||||
return next;
|
||||
|
||||
return score()->firstElement();
|
||||
return score()->lastElement();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -3217,7 +3217,7 @@ Element* Measure::prevElementStaff(int staff)
|
|||
if (seg)
|
||||
return seg->lastElement(staff);
|
||||
}
|
||||
return score()->lastElement();
|
||||
return score()->firstElement();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -635,7 +635,7 @@ Element* Score::nextElement()
|
|||
}
|
||||
e = e->parent();
|
||||
}
|
||||
return score()->firstElement();
|
||||
return score()->lastElement();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -760,7 +760,7 @@ Element* Score::prevElement()
|
|||
}
|
||||
e = e->parent();
|
||||
}
|
||||
return score()->lastElement();
|
||||
return score()->firstElement();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1575,7 +1575,7 @@ Element* Segment::nextElement(int activeStaff)
|
|||
Segment* nextSegment = seg->next1enabled();
|
||||
if (!nextSegment) {
|
||||
MeasureBase* mb = measure()->next();
|
||||
return mb && mb->isBox() ? mb : score()->firstElement();
|
||||
return mb && mb->isBox() ? mb : score()->lastElement();
|
||||
}
|
||||
|
||||
// check for frame
|
||||
|
@ -1713,7 +1713,7 @@ Element* Segment::prevElement(int activeStaff)
|
|||
Segment* prevSeg = seg->prev1enabled();
|
||||
if (!prevSeg) {
|
||||
MeasureBase* mb = measure()->prev();
|
||||
return mb && mb->isBox() ? mb : score()->lastElement();
|
||||
return mb && mb->isBox() ? mb : score()->firstElement();
|
||||
}
|
||||
|
||||
// check for frame
|
||||
|
@ -1728,7 +1728,7 @@ Element* Segment::prevElement(int activeStaff)
|
|||
prev = lastElementOfSegment(prevSeg, activeStaff);
|
||||
}
|
||||
if (!prevSeg)
|
||||
return score()->lastElement();
|
||||
return score()->firstElement();
|
||||
|
||||
if (notChordRestType(prevSeg)) {
|
||||
Element* lastEl = lastElementOfSegment(prevSeg, activeStaff);
|
||||
|
|
|
@ -976,7 +976,7 @@ Element* Spanner::nextSegmentElement()
|
|||
Segment* s = startSegment();
|
||||
if (s)
|
||||
return s->firstElement(staffIdx());
|
||||
return score()->firstElement();
|
||||
return score()->lastElement();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -988,7 +988,7 @@ Element* Spanner::prevSegmentElement()
|
|||
Segment* s = endSegment();
|
||||
if (s)
|
||||
return s->lastElement(staffIdx());
|
||||
return score()->lastElement();
|
||||
return score()->firstElement();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -1150,7 +1150,7 @@ Element* System::nextSegmentElement()
|
|||
if (firstSeg)
|
||||
return firstSeg->element(0);
|
||||
}
|
||||
return score()->firstElement();
|
||||
return score()->lastElement();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -1164,7 +1164,7 @@ Element* System::prevSegmentElement()
|
|||
while (!re) {
|
||||
seg = seg->prev1MM();
|
||||
if (!seg)
|
||||
return score()->lastElement();
|
||||
return score()->firstElement();
|
||||
|
||||
if (seg->segmentType() == SegmentType::EndBarLine)
|
||||
score()->inputState().setTrack((score()->staves().size() - 1) * VOICES); //corection
|
||||
|
|
Loading…
Reference in a new issue