Inserting bar moves clef inconsistently
Clefs are saved in a MuseScore file at two different places. This leads to a strange bug.
The places where they're saved are:
- In <museScore><Part><Staff><cleflist>
- In the bar where it occurs.
I have commented before that this is not an optimal design choice.
It indeed leads to inconsistencies, for example like this:
- Open a new file and add some instrument.
- Put a clef somewhere in the middle of the score, let's say in front of measure 9. Clef.mscx
- Select measure nine and push insert to insert a new bar left from measure 9. Now the clef did not visually move to measure 10, but it stayed at measure 9. If one tries to delete it, it doesn't work. Clef2.mscx
What happened? MuseScore needs to update the position of the clef in two parts of the file:
- It needs to change the "tick" attribute of the clef tag in the cleflist. This works perfectly. Compare lines 40 of the attached files.
- It needs to move the clef tag from "in front of measure 9" to "in front of measure 10". This fails. See lines 132 to 134. I suspect that the problem here is that "in front of measure 9" is saved as "at the end of measure 8".