Skip to content

Commit

Permalink
Fix "Same measure" for text lines
Browse files Browse the repository at this point in the history
  • Loading branch information
worldwideweary authored and Jojo-Schmitz committed Nov 25, 2023
1 parent 6a6c6b4 commit ba87541
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
16 changes: 14 additions & 2 deletions libmscore/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3315,6 +3315,8 @@ void Score::selectRange(Element* e, int staffIdx)
void Score::collectMatch(void* data, Element* e)
{
ElementPattern* p = static_cast<ElementPattern*>(data);
auto eMeasure = e->findMeasure();

if (p->type != int(e->type()))
return;

Expand Down Expand Up @@ -3354,8 +3356,18 @@ void Score::collectMatch(void* data, Element* e)
return;
}

if (p->measure && (p->measure != e->findMeasure()))
return;
if (p->measure) {
if (!eMeasure && e->isSpannerSegment()) {
if (auto ss = toSpannerSegment(e)) {
if (auto s = ss->spanner()) {
if (auto se = s->startElement()) {
if (auto mse = se->findMeasure()) {
eMeasure = mse;
}}}}
}
if (p->measure != eMeasure)
return;
}

if ((p->beat.isValid()) && (p->beat != e->beat()))
return;
Expand Down
15 changes: 13 additions & 2 deletions mscore/selectdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,19 @@ void SelectDialog::setPattern(ElementPattern* p)
else
p->beat = Fraction(0,0);

if (sameMeasure->isChecked())
p->measure = e->findMeasure();
if (sameMeasure->isChecked()) {
auto m = e->findMeasure();
if (!m && e->isSpannerSegment()) {
if (auto ss = toSpannerSegment(e)) {
if (auto s = ss->spanner()) {
if (auto se = s->startElement()) {
if (auto mse = se->findMeasure()) {
m = mse;
}}}}
}
if (m)
p->measure = m;
}
else
p->measure = nullptr;

Expand Down

0 comments on commit ba87541

Please sign in to comment.