musescore/MuseScore — pull request #280 by heuchi (2013-03-23 10:52:33+00:00)
Title: Fix #20573 and improve performance of KeySig handling

Added new method Score::cmdUpdateAccidentals(Measure* beginMeasure, int staffIdx) which updates accidentals in a given staff beginning at a given measure until a new key signature is hit or till the end of the staff, if there are no more keySig changes.
This is used when a key signature change appears in the undo system and replaces calls to Score::cmdUpdateNotes(), which would run through the whole score and considerably slow down the application: A ConcertPitch change of a file containing 200 measures, for example, took more than 4 seconds.

Unnecessary calls to cmdUpdateNotes() were removed: adding, removing or changing a generated key signature doesn't do any changes to accidentals, because a generated key signature is not actually a new one, but only repeated (eg. at the beginning of a line.)

Undo's RemoveElement, ChangeElement, AddElement and ChangeKeySig events now update the keymap and call cmdUpdateAccidentals to update accidentals in the affected measures. (Fix for #20573)