As of 10 February 2010 linking and everything to do with it is a mess. Here are some proposals for how to fix it.
AWD: I assume any real solution to the linking woes involves:
* Fixing the iterators to use the original definition of a track group: n audio tracks followed by m label tracks (currently only one label track is allowed). * Make it easier for code that needs linking behavior to get it correctly. * Get rid of all the incorrect re-implementations of the iterators (see pretty much every place where grouping behavior is handled: cut, paste, clear, just about every effect etc.) and replace by using those easier methods.
Linking affects selection but not action
AWD: This has been proposed by James. The basic idea is that when linking is enabled to only allow selection by group (no selection of tracks independent of their groups). Then actions like Cut/Paste/effects/generators don't have to know about linking at all (major simplification of code).
This is perfect for removing audio, but for inserting it, it's hard to control which tracks receive audio (it's also hard to control which tracks are copied to the clipboard). Some proposals:
* Only insert to the first selected track. If a user wants to insert to a different track s/he can move it. * Some sort of refinement where the user can select which track(s?) is(/are?) to receive audio or be copied.
I (Al) think that the major strength of this idea is simplicity and orthogonality. Linking isn't even considered in effects, or in Cut/Paste/Clear/etc.
The major weakness is the loss of selection granularity. If there's a refinement where the user can select which tracks receive/copy then that adds the granularity back in a different way, adding back some of the complexity of grouping as it is. And the user-facing part of that complexity would probably have to remain even with linking disabled, if linking is not to effect anything but the selection.
Linking as second-tier selection
AWD: I think the current way we do linking essentially creates a second tier of selection. We just don't present it that way to the user or to ourselves. So my proposal goes something like:
* Selection means exactly what it does now. * Show users the "second-tier selection" somehow. Maybe a diagonally-striped selection tint. * Add bool Track::IsGroupSelected(), which checks whether any track in this track's group is selected using the group iterators. * Use that in all the peripheral places possible instead of dealing with the group iterators. * Get rid of the distinction between Track::HandleClear() and Track::Clear(). Track::Clear() shouldn't be clearing from other tracks; if it's dead-simple to figure out whether a track is in a selected group there's no need to put that in the Track class.
(These are smaller ideas that could fit under any scheme)
* AWD: Possibly change the definition of track groups so that if you have some audio tracks but no label tracks it's still a group. I understand that the original point of this feature was to keep labels synchronized, but it turns out after taking the full implications into account that labels are really secondary to the feature. * AWD: Along similar lines, don't use label tracks as the boundary between groups; instead have a dedicated group separator. That way a label track can be at the top of a group, in the middle, anywhere the user wants.