Improved Tracks (simpler numbering, faster inserting, prevent deletion of locked tracks) #2491
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 is a pretty big re-write of the Track / Layers logic, with respects to how we number them, and how we insert, add, and remove them. The tracks numbering is now spread out:
Track 5 (number: 5,000,000)
Track 4 (number: 4,000,000)
Track 3 (number: 3,000,000)
Track 2 (number: 2,000,000)
Track 1 (number: 1,000,000)
Inserting a new track now simply picks a number halfway between the gap... for example:
Track 5 (number: 5,000,000)
Track 4 (number: 4,000,000)
Inserted Track (number 3,500,000)
Track 3 (number: 3,000,000)
Track 2 (number: 2,000,000)
Track 1 (number: 1,000,000)
With this logic, no other data is required to change, and it all magically works. However, if a user inserts around 30 tracks at the exact same spot, the 1/2'ing will eventually run out of a gap, and will then renumber things that conflict (similar to the current logic).
Also, disabled tracks are now blocked from the "Delete" context menu.
Otherwise, the behavior of Tracks is identical to before, just faster, simpler, and more stable.