Element filters finished
I’m happy to say that I have finished the element filters for range selection. There is still some work to do regarding voice filtering.
I have fixed the copy paste behavior of 2 note tremolo - PR. The branch has been merged. The change fixes 2 bugs in the following situations:
- Copy of range selection including only the first note from the tremolo pair
- Paste of a tremolo pair at the end of a measure resulting in a tremolo between two measures
In the first case, the solution was to create a modifiable copy of the range, and remove the tremolo if both notes were not included.
The second case was fixed temporarily by removing the tremolo if the resulting note pair would be separated by a bar line. It would be better to split the pair into two pairs, so we would keep the tremolo, but the current paste implementation does not make it possible to see the length of the next note. This solution at least makes it impossible to corrupt the score by pasting a tremolo.
Grace notes where quite easy to implement. Slurs connected with grace notes were a bit of a problem, since they had to be filtered along with grace notes. (We cannot include a slur that does not have a start/end chord). Fortunately, I have managed to fix all the issues, and the filter is ready.
Tasks in the upcoming week
I have decided to add a new option in the selection menu - Select similar in range. To do this, I have to add a way to check if an element lies in range.
The most straightforward way is to add a virtual tick method to the
Element class. I think that this is not the best solution, as we will be able to call tick on any element, even though the call would not make sense.
An example of a class that inherits from
StaffLines. There is no situation where a call to tick would make sense. Furthermore, the current selection implementation allows us to add an object of class
StaffLines to a selection.
Instead I propose to add a new class, that will have a virtual tick method. All classes that can be in a selection will inherit from this class. This will take a while to write properly, but we will make the selection code more bug proof.
I have also looked at the voice filtering which I already talked about in this post. There are a few bugs that have to do with copy-paste of notes with more than one voice. In the following week, I will report as many bugs to try to decide how the overall paste code can be changed to work with filters.
The problem right now is that a call to
makeGap is made that removes all chord rests in the tick range. We might want to leave the chordrests alone if we paste it in a different voice.
I have added a new paste operation that does not call
makeGap. There are a few bugs that need addressing which I hope to solve next week.