Skip to content

Commit

Permalink
Merge pull request #4911 from MarcSabatella/287613-set-as-staff-defau…
Browse files Browse the repository at this point in the history
…lt-multiple

fix #287613: set as staff default with multiple barlines selected
  • Loading branch information
anatoly-os committed May 20, 2019
2 parents 1691755 + d6d32fe commit 0addba4
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions mscore/inspector/inspectorBarline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,29 @@ InspectorBarLine::InspectorBarLine(QWidget* parent)

void InspectorBarLine::setAsStaffDefault()
{
BarLine* bl = toBarLine(inspector->element());
Staff* staff = bl->staff();
Score* score = bl->score();
BarLine* ebl = toBarLine(inspector->element());
QVariant span = ebl->getProperty(Pid::BARLINE_SPAN);
QVariant spanFrom = ebl->getProperty(Pid::BARLINE_SPAN_FROM);
QVariant spanTo = ebl->getProperty(Pid::BARLINE_SPAN_TO);

std::set<Staff*> staffList;

Score* score = ebl->score();
score->startCmd();
staff->undoChangeProperty(Pid::STAFF_BARLINE_SPAN, bl->getProperty(Pid::BARLINE_SPAN));
staff->undoChangeProperty(Pid::STAFF_BARLINE_SPAN_FROM, bl->getProperty(Pid::BARLINE_SPAN_FROM));
staff->undoChangeProperty(Pid::STAFF_BARLINE_SPAN_TO, bl->getProperty(Pid::BARLINE_SPAN_TO));
if (bl->barLineType() == BarLineType::NORMAL)
bl->setGenerated(true);
for (Element* e : *inspector->el()) {
if (!e || !e->isBarLine())
continue;
BarLine* bl = toBarLine(e);
Staff* staff = bl->staff();
if (std::find(staffList.begin(), staffList.end(), staff) == staffList.end()) {
staff->undoChangeProperty(Pid::STAFF_BARLINE_SPAN, span);
staff->undoChangeProperty(Pid::STAFF_BARLINE_SPAN_FROM, spanFrom);
staff->undoChangeProperty(Pid::STAFF_BARLINE_SPAN_TO, spanTo);
staffList.insert(staff);
}
if (bl->barLineType() == BarLineType::NORMAL)
bl->setGenerated(true);
}
score->endCmd();
}

Expand Down

0 comments on commit 0addba4

Please sign in to comment.