Fix #23447 and #21577 : Adding or removing a time sig deletes key changes in the affected score span

The function TrackList::write(), which restores a score span after reworking the measure affected by the time change, ignores key sig changes. Corrected.

As key sigs have to be placed at measure beginning, an existing key sig which, with the new time subdivision, would be placed mid-measure is moved at the beginning of the measure it falls into.

Note: this may e not round-trip safe; i.e. if a time signature which alters measure boundaries is added and then (manually) removed, key signatures may end up at different points than originally. Undo, however, works as expected.
Merge pull request #535 from mgavioli/Fix_23447_adding_removing_timesig_at_keysig_change

Fix #23447 and #21577 : Time sig addition and deletion and key sigs