Skip to content

Commit

Permalink
fix #62956: create range selection on shift+click measure
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed May 30, 2015
1 parent 9341f4e commit ed95870
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions libmscore/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2837,27 +2837,23 @@ void Score::selectRange(Element* e, int staffIdx)

ChordRest* cr = static_cast<ChordRest*>(oe);
int oetick = cr->segment()->tick();
Segment* startSegment = cr->segment();
Segment* endSegment = m->last();
if (tick < oetick) {
_selection.setStartSegment(m->tick2segment(tick));
if (etick >= oetick)
_selection.setEndSegment(m->last());
else
_selection.setEndSegment(cr->nextSegmentAfterCR(Segment::Type::ChordRest
startSegment = m->tick2segment(tick);
if (etick < oetick)

This comment has been minimized.

Copy link
@MarcSabatella

MarcSabatella May 30, 2015

Contributor

One corner case I just ran into that is not handled quite right: click the first note of a measure, then shift click the previous measure. In this case, etick == oetick, but we should still set endSegment to nextSegmentAfterCR. Looks like it wasn't handled correctly before either.

endSegment = cr->nextSegmentAfterCR(Segment::Type::ChordRest
| Segment::Type::EndBarLine
| Segment::Type::Clef));
| Segment::Type::Clef);

}
else {
_selection.setStartSegment(cr->segment());
_selection.setEndSegment(m->last());
}

_selection.setStaffStart(staffIdx);
_selection.setStaffEnd(staffIdx + 1);
if (_selection.staffStart() > cr->staffIdx())
_selection.setStaffStart(cr->staffIdx());
else if (cr->staffIdx() >= _selection.staffEnd())
_selection.setStaffEnd(cr->staffIdx() + 1);
int staffStart = staffIdx;
int endStaff = staffIdx + 1;
if (staffStart > cr->staffIdx())
staffStart = cr->staffIdx();
else if (cr->staffIdx() >= endStaff)
endStaff = cr->staffIdx() + 1;
_selection.setRange(startSegment, endSegment, staffStart, endStaff);
}
else {
deselectAll();
Expand All @@ -2877,7 +2873,6 @@ void Score::selectRange(Element* e, int staffIdx)
e = e->parent();
ChordRest* cr = static_cast<ChordRest*>(e);


if (_selection.isNone()
|| (_selection.isList() && !_selection.isSingle())) {
if (_selection.isList())
Expand Down Expand Up @@ -2905,7 +2900,6 @@ void Score::selectRange(Element* e, int staffIdx)
endSeg,
oe->staffIdx(),
oe->staffIdx() + 1);

_selection.extendRangeSelection(cr);

}
Expand Down

0 comments on commit ed95870

Please sign in to comment.