Plugin API: alter Cursor API for better usage in interactive plugins #5657
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements changes in Cursor API which could be useful for interactive plugins functioning. The most important of the proposed changes is to allow plugins explicitly choose whether Cursor actions (changing its position, adding notes) should influence score input state. It is proposed to make it independent of score input state by default while still offering an option of full synchronization of Cursor state with score input state (which hasn't been possible before). This should allow plugins to make use of
onScoreStateChanged
handler to modify score editing process while not breaking note input cursor behavior and even potentially co-existing with other plugins which might use Cursor in either mode as well (see this discussion for a possible example: dmitrio95/fretboard-plugin#1).Other changes are less important but could still be useful:
Score::tick2segment()
);endCmd()
does always get called once on undo/redo actions to make sure that plugins are always properly notified of undo/redo changes. This may be useful to prevent unwanted plugin-originated changes on undo/redo actions.Cursor.stringNumber
property for better integration with tablature note input.This PR also contains an interactive version of Note Names plugin to demonstrate some basic usage of this framework. I planned to create it after #5626, but it turned out to be problematic to create something fully usable before decoupling Cursor state from input state in Score. Other changes in this PR also make implementation of this plugin simpler.