Initial implementation of repeat courtesy key signatures
I opened this issue a while back after seeing its use in some scores: https://musescore.org/en/node/35076
Behind Bars references this practice on page 234, and Gould says it is required (though there should still be an option on the jump to disable it).
So far, I implemented just the courtesy keysigs. When the keysig of a measure before an end repeat does not match the keysig at the corresponding start repeat, a courtesy is created immediately before the end repeat barline. If the measure is followed by another key change, this keysig is placed immediately after the repeat barline. If the end repeat is at the end of a system, courtesy keysigs are generated normally.
I moved some helpful code from repeatlist.cpp into measure.cpp and added new code in layout.cpp. I've never added any layout code before, so I'm sure this implementation is incomplete. Right now, the key signature is generated automatically, and most of it works correctly. Known issues:
* The jumps do not currently have any "show courtesy" option yet. When implemented, it will need to be saved to the file.
* There's an assert failure in segment.cpp in certain cases with undo.
* The courtesy keysig cannot be disabled if the key over the system break is the same as the mid-repeat change. Workaround is to add an explicit key change at that point.
* Still would like to implement courtesy timesigs and clefs.
I'm sure those of you experienced with layout code can help me finish this implementation. Please check it out and tell me what you think!