fix #22026: Instrument not completely removed from part

This commit is contained in:
lasconic 2013-09-16 21:57:54 +02:00
parent 3b0442ebc3
commit 8b8e73914e
2 changed files with 22 additions and 1 deletions

View file

@ -2536,9 +2536,22 @@ void Score::adjustKeySigs(int sidx, int eidx, KeyList km)
void Score::cmdRemoveStaff(int staffIdx)
{
adjustBracketsDel(staffIdx, staffIdx+1);
Staff* s = staff(staffIdx);
adjustBracketsDel(staffIdx, staffIdx+1);
undoRemoveStaff(s, staffIdx);
// remove linked staff and measures in linked staves
// should be done earlier for the main staff
for(Staff* staff : s->linkedStaves()->staves()) {
Score* lscore = staff->score();
if(lscore != this) {
int lstaffIdx = lscore->staffIdx(staff);
adjustBracketsDel(lstaffIdx, lstaffIdx+1);
for (Measure* m = lscore->firstMeasure(); m; m = m->nextMeasure())
m->cmdRemoveStaves(lstaffIdx, lstaffIdx + 1);
undoRemoveStaff(staff, lstaffIdx);
}
}
}
//---------------------------------------------------------

View file

@ -1177,6 +1177,14 @@ void MuseScore::editInstrList()
if (rootScore->measures()->size() == 0)
rootScore->insertMeasure(Element::MEASURE, 0, false);
QList<Score*> toDelete;
for (Excerpt* excpt : rootScore->excerpts()) {
if (excpt->score()->staves().size() == 0)
toDelete.append(excpt->score());
}
for(Score* s: toDelete)
rootScore->undo(new RemoveExcerpt(s));
rootScore->setLayoutAll(true);
rootScore->endCmd();
rootScore->rebuildMidiMapping();