[1.1] Initial clef(s) cannot be changed more than once

• Jul 17, 2011 - 12:40
S4 - Minor

Setup: SVN branch rev. 4539; Qt lib 2.7.3; Win XP SP3


1) Create a score; a sample empty score with 4 standard SATB parts is attached;

2) Change some of the initial clefs to something else: see second sample score attached.

3) Try to change again the initial clefs to whatever you like:

Result: whatever clef is dragged to the beginning of a stave, it becomes a treble clef.

Expected result: it should be possible to change any clef to any other.

Note: This only applies to the initial clef(s); clefs changes within the score seem to be fine.

Analysis: part of the problem is in file staff.cpp, function Staff::changeClef(), line 394:

if (!e || (etick < tick))

Here the code is looking for a potential next clef change to remove it if it happens to be the same as the clef we just entered.

However it starts looking from the same tick where (when?) the newly entered clef is located, founds it and remove it:

Result: no longer ANY clef, which (apparently) defaults to treble clef.

By changing the above line to:

if (!e || (etick <= tick))

(note the '=' added to the test) this bug disappears. However, in some cases, clef changes in the middle of the score start to behave erratically.

So, the code needs a deeper analysis by someone more familiar with it than I am!