musescore/MuseScore — pull request #919 by mgavioli (2014-05-20 21:51:33+00:00)
Title: ChangeStaffType remembers and restores the previous staff clef maps.

When a staff type change is undone, the previous staff clef(s) are not restored, if they have been changed to suit the new staff type.

Changed by storing the staff clef map and restoring it on undo. Should fix the following issues: #18869, #23374, #24294 and, possibly others too.

- Added to `ChangeStaffType` class an `initClefList` member variable to hold the previous clef map state.
- `ChangeStaffType::flip()` split into `undo()` and `redo()`, as the managing the clef map and setting the staff type must be applied in reversed order in the two cases.
- `Clef::layout()` now retrieves the clef type from the staff clef map.
- TAB ad-hoc code in `Clef::layout()` to check for compatibility between the clef type and the staff group generalized to all groups (temporarily disabled to let any inconsistency to show up).
- Staff clef map now controls addition and removal of clefs in the score measures.
- The map itself is now a protected member of `ClefList`, rather than a public derivation, to hide from outside map operations. A number of specific usages have been added as `ClefList` member functions (as `isClefChangeAt()`, `clear()`, `insertTime()` ).
- Making courtesy clefs small moved from `Score::removeGeneratedElements()` to `Clef::layout()`.

Tested with a few 2.0 and 1.3 scores; more tests are probably necessary.