Fix clef change and courtesy clef display.

Clef changes and courtesy clef on/off display have several issues: changed clef is not always shown, courtesy clefs on/off is unreliable and so on.

In this fix:

- A clef change at measure boundary is always placed at the end of the previous measure (unless for the very first measure).
- This measure-final clef is never destroyed or re-created (the clef at the beginning of the next staff is managed by Score::layoutSystemRow() as before): this ensures a consistent context.
- Showing / hiding of a courtesy clef is managed by Clef::layout() rather than by Score::layoutSystemRow() as before.
- The clef change on measure boundary (always at the end of the previous measure and always present) is shown if:
-- there is not another clef at the beginning of the next measure (not a courtesy clef at all);
-- the score is set to show courtesy clefs
-- the previous measure is not the last of a repeat or of a section
-- the individual clef is set to show courtesy clef.
- In all other cases, the clef is hidden (i.e. laid out to a element without any symbol).
- The Clef Inspector is changed so that, if there is a pair of matching courtesy and main clef, their Show Courtesy flags are kept in sync (modifying either modifies both)
Add test.
Merge pull request #601 from mgavioli/Fix_clef_change_and_courtesy_clef

Fix clef change and courtesy clef display.