Select window and filter in xml
This week I have been working on the new selection filter approach, as well as adding a range filter to the Select Window.
I have added a range filter option in the select window. When this PR will be merged, it will be possible to further select elements that are in the current range selection. In case of checking the same staff checkbox, elements will be selected from the same staff as the clicked element, but belonging to the current range selection. The new checkbox is disabled if there is no range selection.
After the discussion on IRC with Werner Schweer and Nicolas Froment regarding my clone segment approach, we decided to try something different. The major factor was the fact that the functions used to remove elements had to many side effects, that could change the score. A much simple solution was needed. Instead of making a clone of all elements in the score, and removing them if the filter does not include the element type, I have moved the filter check into the xml generation. Each element has a write function which takes an Xml object as a parameter. I have added the filter inside the xml object, and each element can check if it can be added into the xml.
There have been a few issues, such as having to add another check for slurs inside of the chord write function. This is because we include spanner info inside the chord tag.
One major drawback is the fact that this approach does not allow us to filter out 2 note tremolos. That is because information about a tremolo is included in chord, while note duration is written in the DurationElement::write function. Removing a 2 note tremolo not only removes it from chord, but it also changes the duration. This is not that big of a problem, since we will probably dissallow selection a part of a 2 note tremolo.
I have started working on voice filtering. My first goal is to fix this bug, that have to do with copy paste of measures with a second voice. The issue seems to be in the makeGap function. It is only called for the first voice. I have changed it too be called for each voice in a staff, but this has caused an exception. I will work on this in the following week.
Tasks in the upcoming week
I will work on the makeGap functions to fix the paste issues. Later on I will implement a filter to enable the user to only copy and paste a single voice.