GSoC 2019: Week 6
This week I've been working on adding an instrument change warning automatically when an instrument change is added. So far I have a very basic implementation that adds the warning when an instrument change object is added before some notes, and automatically moves the warning when more notes are added before the existing warning. The basic idea is that if an instrument change is added, it finds the next note on that staff (if there is one), and adds a warning to it. Then, whenever a new note is added, it loops backwards through each segment. If it finds a note, it does nothing, but if it finds an instrument change before finding any notes, it means it is the first note of the passage after the instrument change, and therefore adds the warning the the newly added note. The warning currently is implemented as a staff text item, but I will be looking at implementing a new type of object specially for the warning, that can inherit the style of the current instrument change text.
The current implementation does have some bugs. It currently fails some of the automated tests, and also doesn't properly work with undo. It also does not update the warning if the first note of the passage is deleted. This next week I will be working on fixing these problems.