GSoC 2019: Week 1
After the community bonding period, this week has been the first week of coding for the Google Summer of Code. The start of the week was spent setting up the git repository, and becoming more familiar with the codebase.
Part of what I had planned to do in the first week was to add the instrument change button to the inspector, rather than to the right click menu. This has actually been implemented by Isaac Weiss (https://github.com/musescore/MuseScore/pull/5010), so I implemented my work on top of his pull request.
The work I did do was to show the instrument change dialog when an instrument change object is added, which should help to streamline the user experience, and reduce confusion in how to actually change the instrument. There were a few complications with this. The first was working around the abstraction between the front end and back end code, which are kept in separate modules in the codebase. The front end can interact with the back end, but not vice-versa, so it was a challenge to find where to insert the code in a way that it would trigger once the object had been inserted.
The second challenge I had was to do with inserting an instrument change on a selection. The current behaviour is to insert an instrument change object on every object in the selection, which, if there is a dialog popping up for every object added, can be quite disruptive. This did, however, bring up the issue of whether the program should even add an instrument change for every object in the selection. This is not something that would have much practical use, and there are a number of objects, such as tempo changes, where you would not want multiple in close proximity. I therefore added a mechanism in which objects could define whether they should be inserted for all objects in a selection, or should just be placed on the first. This provided a fairly neat solution to the problem, although currently the change is only made for instrument change objects.
In the next week I will be looking to implement automatically changing the instrument change text when the instrument is chosen.
Comments
That placeMultiple() implementation has been sorely needed, and you very neatly made it immediately usable for more elements by simply adding this line. Inheritance is awesome.
In reply to That placeMultiple()… by Isaac Weiss
Thank you, I'm hoping it will be useful. Inheritance has its problems sometimes, but this the kind of place it really shines.
Working on top of someone else's PR gets tricky if they make changes to their code, or if they rebase against changes in master. See the Git Workflow for how best to deal with this.
In reply to Working on top of someone… by shoogle
Yes, that's what I used in the end. I'm hoping the PR will be merged soon, which should make things simpler, but for now it seems to have been working.