// final List collChannelMeters;
// PeakMeter[] meters;
TrackRowHeader chanHead;
Track t;
int oldNumWaveTracks, newNumWaveTracks;
Axis chanRuler;
// PeakMeter chanMeter;
newNumWaveTracks = doc.getActiveTransmitters().size(); // EEE doc.getDisplayDescr().channels;
oldNumWaveTracks = collChannelHeaders.size();
// System.out.println( "oldNumWaveTracks = " + oldNumWaveTracks + "; newNumWaveTracks = " + newNumWaveTracks );
// meters = channelMeters;
// collChannelMeters = new ArrayList( meters.length );
// for( int ch = 0; ch < meters.length; ch++ ) {
// collChannelMeters.add( meters[ ch ]);
// }
// first kick out editors whose tracks have been removed
for( int ch = 0; ch < oldNumWaveTracks; ch++ ) {
chanHead = (TrackRowHeader) collChannelHeaders.get( ch );
t = chanHead.getTrack();
if( !doc.getActiveTransmitters().contains( t )) {
//System.out.println( "removing " + t );
chanHead = (TrackRowHeader) collChannelHeaders.remove( ch );
// chanMeter = (PeakMeter) collChannelMeters.remove( ch );
chanRuler = (Axis) collChannelRulers.remove( ch );
oldNumWaveTracks--;
// XXX : dispose trnsEdit (e.g. free vectors, remove listeners!!)
flagsPanel.remove( chanHead );
// metersPanel.remove( chanMeter );
rulersPanel.remove( chanRuler );
ch--;
chanHead.dispose();
// chanMeter.dispose();
chanRuler.dispose();
}
}
// next look for newly added transmitters and create editors for them
// System.out.println( "now oldNumWaveTracks = " + oldNumWaveTracks + "; collChannelHeaders.size = " + collChannelHeaders.size() );
// EEE
newLp: for( int ch = 0; ch < newNumWaveTracks; ch++ ) {
t = (Track) doc.getActiveTransmitters().get( ch );
for( int ch2 = 0; ch2 < oldNumWaveTracks; ch2++ ) {
chanHead = (TrackRowHeader) collChannelHeaders.get( ch2 );
if( chanHead.getTrack() == t ) continue newLp;
}
chanHead = new TransmitterRowHeader( t, doc.getTracks(), doc.getMutableSelectedTracks(), doc.getUndoManager() );
collChannelHeaders.add( chanHead );
flagsPanel.add( chanHead, ch );
// chanMeter = new PeakMeter();
// collChannelMeters.add( chanMeter );
// metersPanel.add( chanMeter, ch );
chanRuler = new Axis( Axis.VERTICAL, Axis.FIXEDBOUNDS );
collChannelRulers.add( chanRuler );
rulersPanel.add( chanRuler, ch );
}
// meters = new PeakMeter[ collChannelMeters.size() ];