musescore/MuseScore — pull request #934 by mgavioli (2014-05-26 23:51:42+00:00)
Title: Fix #18869 : restore original clef on ChangeStaffType undo

Fix #18869 : restore original clef on ChangeStaffType undo

When a staff type change is undone, the previous staff clef is not restored, if it has been changed to suit the new staff type.

Fixed by storing the original initial clef and restoring it on undo. Should fix the following issues: #18869, #23374, #24294 and, possibly others too.

- Added to `ChangeStaffType` class an `initialClef` member variable to hold the original staff initial clef type list.
- `ChangeStaffType::flip()` split into `undo()` and `redo()`, as managing the clef and setting the staff type must be applied in reversed order in the two cases.
- `Clef::layout()` now hides a clef not compatible with the staff group (if the clef is not generated) or changes it to the same clef as the staff initial clef (if generated).
- TAB ad-hoc code in `Clef::layout()` to check for compatibility between the clef type and the staff group generalized to all groups removed.
- Fixed GuitarPro test reference scores, which all contained wrong clefs for the TAB staves (this amounts to 23 out of the 27 modified files).

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