+ // give to selection object
+ _selection.selectPointPhotoAudio(pointIndex, inPhotoIndex, audioIndex);
+ }
+
+ /**
+ * Select the given audio object and its point if any
+ * @param inAudioIndex index of audio item to select
+ */
+ public void selectAudio(int inAudioIndex)
+ {
+ if (_selection.getCurrentAudioIndex() == inAudioIndex) {
+ return;
+ }
+ // Audio selection takes priority, deselecting point if necessary
+ AudioClip audio = _audioList.getAudio(inAudioIndex);
+ int pointIndex = _selection.getCurrentPointIndex();
+ DataPoint currPoint = getCurrentPoint();
+ if (audio != null)
+ {
+ // Find point object and its index
+ if (audio.isConnected()) {
+ pointIndex = _track.getPointIndex(audio.getDataPoint());
+ }
+ else {
+ // Check whether to deselect current point or not if audio not correlated
+ if (pointIndex >= 0 && _track.getPoint(pointIndex).getAudio() != null) {
+ pointIndex = -1;
+ }
+ }
+ }
+ else {
+ // check if current point has audio or not
+ if (currPoint != null && currPoint.getAudio() != null) {
+ pointIndex = -1;
+ }
+ }
+ // Has the new point got a photo?
+ DataPoint selectedPoint = _track.getPoint(pointIndex);
+ int photoIndex = _selection.getCurrentPhotoIndex();
+ if (selectedPoint != null && selectedPoint.getPhoto() != null) {
+ // New point has a photo, so select it
+ photoIndex = _photoList.getPhotoIndex(selectedPoint.getPhoto());
+ }
+ else if (currPoint != null && selectedPoint != currPoint && currPoint.getPhoto() != null) {
+ // Old point had a photo, so deselect it
+ photoIndex = -1;
+ }
+ // give to selection object
+ _selection.selectPointPhotoAudio(pointIndex, photoIndex, inAudioIndex);