Revising the clef <--> staff group matter
I have the feeling that the code dealing with clefs, partly in themselves but above all in relationship with staff groups (standard, percussion, tablature) had grown 'organically' and has several ad hoc work-arounds which:
*) become more and more difficult to maintain and
*) make cumbersome to fix the several bugs plaguing the combination of clefs and staff groups (maybe, sometime are even responsible for these bugs)
Then, I am trying to review and, if possible, to simplify the matter. My immediate goal is to have the proper clef(s) correctly displayed whenever the staff group is changed (for instance from standard to TAB or vice versa) AND when such a change is undone.
My current approach is to make the clef map within each staff to be as far as possible in control of the clefs shown in the staff itself (currently, the clef map and the clefs appearing in the staff seem rather unrelated or un-coordinated).
I have some points about which I ask core developers in particular and forum fellows in general for advise and comments.
1) Are there circumstances in which it makes sense to have several occurrences of the same clef in a row (i.e. without a different clef in between)? Or repeated clefs can be removed from the clef map?
2) Is it safe to assume that a TAB staff will not change of clef mid-score? If it is, I assume all clef changes can be removed when a non-TAB staff is changed into a TAB (of course, restoring the original clefs changes on undo will be the duty of the undo system).
3) Same as 2), but for percussion staves (I don't know how frequent are changes between standard <==> percussion groups, but I assume they should be supported anyway).
Thanks,
M.
Comments
My immediate goal is to have the proper clef(s) correctly displayed whenever the staff group is changed (for instance from standard to TAB or vice versa) AND when such a change is undone.
From what I understand, the main reason why this is no feasible currently is that guitar and guitar(tablature) are two different instruments in instruments.xml, each one with its own key. When the user chooses a guitar (tablature) instrument and changes his mind, or add a linked staff to guitar (tablature) and change to standard, we don't have a clue that the standard staff should be in G8vb clef.
I don't understand how it's related to clef map vs clef shown in the staff. Except when changing to standard to Tab, the list of clefs should be cleared and use only Tab at the beginning. The list of clefs should be restored on Undo.
Regarding the questions,
1/ In the clef map probably not. In a score, yes, courtesy clef at end of system is one example. Clefs repeated on every new system is another one.
2/ Yes, it's safe for me. Except if we plan to attach tuning information to clef to handle tuning change?
3/ I would not support change between standard and percussion if it's a burden... in worth case, copy paste is currently possible...
In reply to My immediate goal is to have by [DELETED] 5
Thank you for the reply.
" the main reason why this is no feasible currently is that guitar and guitar(tablature) are two different instruments in instruments.xml, each one with its own key...".
This is relatively easy to fix; with a minimum of editing and no change in file structure, the <clef> tag in instruments. xml could be changed to mean the standard staff clef, giving by implicit that an instrument which uses a tablature will normally have a TAB clef (similarly for percussion instr.). Or in any other way we may think better...
However, the current situation is much worse than that:
a) if a standard staff is changed to TAB and then back to standard, the clefs remain TAB's! And
b) if there originally were some clef changes (may happens with viola da gamba), in standard => tab each clef remains there (and becomes a repeated TAB clef) and each remains TAB when going back to standard.
And more...
I currently have code fixing a), but not b) yet, precisely because what happens to the clef map does not (currently) reflects on clefs in the score: clearing the map is not enough for the clefs in the score to disappear (this is what I am working on at the moment).
Regarding your answers:
1) Yes, my questions were about the clef map, not about clefs displayed in the score which, of course, depends on the integration of the map with notation rules (like the courtesy clef or the staff initial clef examples).
2) Ok. About tuning changes, there are probably better places to attach them to than a clef...
3) I do not think standard <==> percuss. would be a significant burden to support, if it is (or may be) needed (and, in the worst case, copy and paste of code is always possible ;-) ).
Thanks,
M.