Plugin coding: selection vs staves vs cursors
I tried to find documentation about how cursors and staff numbers behave when the user selects a region "a few staves short of a full score", as it were. I think asking here might be quicker than developing code to explor it. Yes, I looked in the "MS Plugin Developer's handbook" and could not find this addressed. Is this not the right place to ask?
Comments
(too late to delete). I've figured it out from ColorNotes. Works great. Documentation would still be nice.
Cursor has access to a track which is the internal counter of all voices across the full score (counting vertically).
As each staff has 4 voices allocated to it, you can convert a track to a staff & voice using /4 and %4 respectively.
When you
rewind
a Cursor to the SELECTION_START position, then (assuming a selection exists) it'll position itself at the "top-left" position of the selection. You can query which track/staffIdx/voice that is respectively. As far as I'm aware, it always positions itself at the first voice of the first staff within the selection (wonders what happens in combination with the selection filter now)Similarly, if you move the Cursor to SELECTION_END it'll be at the "bottom-right" position of the selection.
In reply to Cursor has access to a track… by jeetee
Thanks!!! Not at all obvious!
When the offTime enhancement has its onTime in the NightlyBuild, I will have a very powerful plugin in the works.