GSoC 2019: Week 2
After last week's work of automatically opening the instrument change dialog when an instrument change is added, my goal this week was to automatically change the instrument change text to the newly selected instrument.
After a bit of experimentation, this turned out to be a fairly simple thing to do, using the trackName() function on the instrument template, which gets the long name. There is some scope for future work for allowing the user to choose which name to use (long or short), although books such as Elaine Gould's Behind Bars recommends only using the long name.
After doing this, I decided to move on to automatically changing the clef when an instrument change was placed, if necessary. This proved more difficult, as I found it quite tricky to follow the steps of creating a clef, although I got there in the end. My first implementation worked well, and if, for example, the user changed from flute to bassoon, the clef would automatically be changed. The only issue was that if the instrument change was placed at the start of the bar, the clef would be placed after the barline. I therefore added a check, to find the position of the object in the bar, and inserted the clef at the start of the measure if necessary, which places it before the barline.
Over the next week, I will be aiming to automatically change the key signature for transposing instruments.