+ _selection.selectPointPhotoAudio(inPointIndex, photoIndex, audioIndex);
+ }
+
+ /**
+ * Select the given Photo and its point if any
+ * @param inPhotoIndex index of photo to select
+ */
+ public void selectPhoto(int inPhotoIndex)
+ {
+ if (_selection.getCurrentPhotoIndex() == inPhotoIndex) {return;}
+ // Photo is primary selection here, not as a result of a point selection
+ // Therefore the photo selection takes priority, deselecting point if necessary
+ // Find Photo object
+ Photo photo = _photoList.getPhoto(inPhotoIndex);
+ int pointIndex = _selection.getCurrentPointIndex();
+ DataPoint currPoint = getCurrentPoint();
+ if (photo != null)
+ {
+ // Has the photo got a point?
+ if (photo.isConnected()) {
+ pointIndex = _track.getPointIndex(photo.getDataPoint());
+ }
+ else {
+ // Check whether to deselect current point or not if photo not correlated
+ if (pointIndex >= 0 && _track.getPoint(pointIndex).getPhoto() != null) {
+ pointIndex = -1;
+ }
+ }
+ }
+ else {
+ // no photo, but maybe need to deselect point
+ if (currPoint != null && currPoint.getPhoto() != null) {
+ pointIndex = -1;
+ }
+ }
+ // Has the new point got an audio clip?
+ DataPoint selectedPoint = _track.getPoint(pointIndex);
+ int audioIndex = _selection.getCurrentAudioIndex();
+ if (selectedPoint != null && selectedPoint.getAudio() != null) {
+ // New point has an audio, so select it
+ audioIndex = _audioList.getAudioIndex(selectedPoint.getAudio());
+ }
+ else if (currPoint != null && selectedPoint != currPoint && currPoint.getAudio() != null) {
+ // Old point had an audio, so deselect it
+ audioIndex = -1;
+ }
+ // 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);
+ }
+
+
+ /**
+ * Extend the current selection to end at the given point, eg by shift-clicking
+ * @param inPointNum index of end point
+ */
+ public void extendSelection(int inPointNum)
+ {
+ // See whether to start selection from current range start or current point
+ int rangeStart = _selection.getStart();
+ if (rangeStart < 0 || _selection.getCurrentPointIndex() != _selection.getEnd()) {
+ rangeStart = _selection.getCurrentPointIndex();
+ }
+ selectPoint(inPointNum);
+ if (rangeStart < inPointNum) {
+ _selection.selectRange(rangeStart, inPointNum);
+ }