Skip to content

Commit

Permalink
Merge pull request #6137 from MarcSabatella/279926-similar-range
Browse files Browse the repository at this point in the history
fix #279926: shift+click to select similar
  • Loading branch information
anatoly-os committed Jun 2, 2020
2 parents 4538416 + e678df4 commit 436534d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions libmscore/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3133,6 +3133,38 @@ void Score::selectRange(Element* e, int staffIdx)
_selection.setStartSegment(cr->segment());
}
else {
// try to select similar in range
Element* selectedElement = _selection.element();
if (selectedElement && e->type() == selectedElement->type()) {
int idx1 = selectedElement->staffIdx();
int idx2 = e->staffIdx();
if (idx1 >= 0 && idx2 >= 0) {
Fraction t1 = selectedElement->tick();
Fraction t2 = e->tick();
if (t1 > t2) {
Fraction temp = t1;
t1 = t2;
t2 = temp;
}
Segment* s1 = tick2segmentMM(t1, true, SegmentType::ChordRest);
Segment* s2 = tick2segmentMM(t2, true, SegmentType::ChordRest);
if (s2)
s2 = s2->next1MM(SegmentType::ChordRest);
if (s1 && s2) {
_selection.setRange(s1, s2, idx1, idx2 + 1);
selectSimilarInRange(e);
if (selectedElement->track() == e->track()) {
// limit to this voice only
const QList<Element*>& list = _selection.elements();
for (Element* el : list) {
if (el->track() != e->track())
_selection.remove(el);
}
}
return;
}
}
}
select(e, SelectType::SINGLE, staffIdx);
return;
}
Expand Down

0 comments on commit 436534d

Please sign in to comment.