GSoC weekly update : August 8th to August 14th

Posted 7 years ago

Hello everyone,
This week I worked on extending the support for range annotations. The previous implementation did not include the support for highlighting a range selection which includes multiple staves. This week I primarily worked on implementing the same.

There were a few challenges I faced during the implementation. One of them being - calculating the exact co-ordinates of the staves which are in consideration, in order to draw the highlighting correctly. This was tricky because I was trying to reference the staff distances for these co-ordinates were not being calculated yet. This included the y value of the top and bottom staff of the selection, which were crucial for the correct drawing. I tried various methods (like staffYpage, system->staff(staffIdX)->y()) for the same and after much trying, I realized that this won't work because this needs the staff distances to be computed, which currently happens after the spanners are laid out. The sysStaff (from which the y value is retrieved) is actually partially laid out in System::layoutSystem -including the calculation of x offsets and heights for each staff. However, the rest of the layout doesn't happen until layout2() - in particular, the y offsets which I needed don't get calculated until then. This is because the layout of spanners can affect staff spacing, since staves automatically adjust the spacing as needed to accommodate spanners. However, the range annotations - a special case of the spanners, would not affect the staff distances (since they are just highlighting applied to the staves).

Hence, I found a workaround by laying out the range annotation spanners after the staff distances are computed, and the approach I mentioned above works fine on doing this. So now, we can have annotations spanning multiple systems and/or multiple staves, in addition to the already existing implementation. So now, we can also have something like this :

I also added various properties which enable to control the "look" of his annotation. These include the border width, top/bottom margins and the left/right margins. The coming week I will wrap up the implementation by adding the UI for the Inspector for the Range Annotation, and also adding suitable tests.

Stay tuned!