trackPanel.setLayout(new FlowLayout());
MooTrackTitle title = new MooTrackTitle(tracks[0]);
titlePanel.add(title);
- trackPanel.add(new MooTrackView(tracks[0], title));
+ MooTrackView mtv = new MooTrackView(tracks[0], title);
+ trackPanel.add(mtv);
+ title.setTrackView(mtv);
} else {
if (showProgress) {
// Creates dialog for progress bar.
progressDialog.pack();
progressDialog.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - progressDialog.getWidth()) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - progressDialog.getHeight()) / 2);
progressDialog.setVisible(true);
- } else System.out.println("Creating track views");
-
+ }
+
// Starts filling the track panel with track views, while updating the progress bar.
GridLayout gL = new GridLayout(1,numberOfTracks);
trackPanel.setLayout(gL);
if (Moosique.shouldBeDrawn(tracks[i])) {
MooTrackTitle title = new MooTrackTitle(tracks[i]);
titlePanel.add(title);
- trackPanel.add(new MooTrackView(tracks[i], title));
+ MooTrackView mtv = new MooTrackView(tracks[i], title);
+ trackPanel.add(mtv);
+ title.setTrackView(mtv);
if (showProgress) progressBar.setValue(i);
else System.out.print(".");
} else {
}
}
if (showProgress) progressDialog.dispose();
- else System.out.print("Done");
}
/* JPanel filler = new JPanel();
int totalViewLength = trackPanel.getComponents().length * MooTrackView.VIEW_WIDTH;
getViewport().setViewPosition(new Point((int)getViewport().getViewPosition().getX(), (int)(tickPosition / (Moosique.getSequence().getResolution() / 4)) * MooTrackView.NOTE_HEIGHT));
}
+
+ /**
+ * Creates a view for the given track and adds it to the main view.
+ * @param track the track for which to find the view
+ */
+ public MooTrackView getTrackView(Track track) {
+ for (int i = 0; i < trackPanel.getComponents().length; i++) {
+ MooTrackView mtv = (MooTrackView)(trackPanel.getComponents())[i];
+ if(mtv.getTrack() == track) return mtv;
+ }
+ return null;
+ }
+
/**
* Creates a view for the given track and adds it to the main view.
* @param track the track for which to add a view