}
/**
- * Get the currently selected audio file, if any
- * @return AudioFile if selected, otherwise null
+ * Get the currently selected audio clip, if any
+ * @return AudioClip if selected, otherwise null
*/
- public AudioFile getCurrentAudio() {
+ public AudioClip getCurrentAudio() {
return _audioList.getAudio(_selection.getCurrentAudioIndex());
}
* @param inSet Set containing Audio objects
* @return number of audio objects added
*/
- public int addAudios(Set<AudioFile> inSet)
+ public int addAudios(Set<AudioClip> inSet)
{
int numAudiosAdded = 0;
if (inSet != null && !inSet.isEmpty())
{
- for (AudioFile audio : inSet)
+ for (AudioClip audio : inSet)
{
if (audio != null && !_audioList.contains(audio))
{
return numAudiosAdded;
}
- /**
- * Delete the currently selected range of points
- * @return true if successful
- */
- public boolean deleteRange()
- {
- int startSel = _selection.getStart();
- int endSel = _selection.getEnd();
- boolean answer = _track.deleteRange(startSel, endSel);
- // clear range selection
- _selection.modifyRangeDeleted();
- return answer;
- }
-
-
/**
* Delete the currently selected point
* @return true if point deleted
if (_track.deletePoint(_selection.getCurrentPointIndex()))
{
_selection.modifyPointDeleted();
- UpdateMessageBroker.informSubscribers();
return true;
}
return false;
int audioIndex = _selection.getCurrentAudioIndex();
if (audioIndex >= 0)
{
- AudioFile audio = _audioList.getAudio(audioIndex);
+ AudioClip audio = _audioList.getAudio(audioIndex);
_audioList.deleteAudio(audioIndex);
// has it got a point?
if (audio.getDataPoint() != null)
/**
* Delete all the points which have been marked for deletion
+ * @param inSplitSegments true to split segments at deleted points
* @return number of points deleted
*/
- public int deleteMarkedPoints()
+ public int deleteMarkedPoints(boolean inSplitSegments)
{
- int numDeleted = _track.deleteMarkedPoints();
- if (numDeleted > 0) {
+ int numDeleted = _track.deleteMarkedPoints(inSplitSegments);
+ if (numDeleted > 0)
+ {
_selection.clearAll();
UpdateMessageBroker.informSubscribers();
}
{
boolean firstTrackPoint = true;
// Loop between start and end
- for (int i=inStart; i<=inEnd; i++) {
+ for (int i=inStart; i<=inEnd; i++)
+ {
DataPoint point = _track.getPoint(i);
// Set all segments to false apart from first track point
if (point != null && !point.isWaypoint()) {
}
// Find following track point, if any
DataPoint nextPoint = _track.getNextTrackPoint(inEnd+1);
- if (nextPoint != null) {nextPoint.setSegmentStart(true);}
+ if (nextPoint != null) {
+ nextPoint.setSegmentStart(true);
+ }
_selection.markInvalid();
UpdateMessageBroker.informSubscribers();
return true;
}
- /**
- * Interpolate extra points between two selected ones
- * @param inNumPoints num points to insert
- * @return true if successful
- */
- public boolean interpolate(int inNumPoints)
- {
- boolean success = _track.interpolate(_selection.getStart(), inNumPoints);
- if (success) {
- _selection.selectRangeEnd(_selection.getEnd() + inNumPoints);
- }
- return success;
- }
-
/**
* Average selected points to create a new one
selectPoint(_track.getPointIndex(inPoint));
}
+ /**
+ * Increment the selected point index by the given increment
+ * @param inPointIncrement +1 for next point, -1 for previous etc
+ */
+ public void incrementPointIndex(int inPointIncrement)
+ {
+ int index = _selection.getCurrentPointIndex() + inPointIncrement;
+ if (index < 0)
+ index = 0;
+ else if (index >= _track.getNumPoints())
+ index = _track.getNumPoints()-1;
+ selectPoint(index);
+ }
+
/**
* Select the data point with the given index
* @param inPointIndex index of DataPoint to select, or -1 for none
*/
public void selectPoint(int inPointIndex)
{
- if (_selection.getCurrentPointIndex() == inPointIndex || inPointIndex >= _track.getNumPoints()) {return;}
+ if (_selection.getCurrentPointIndex() == inPointIndex || inPointIndex >= _track.getNumPoints()) {
+ return;
+ }
DataPoint selectedPoint = _track.getPoint(inPointIndex);
// get the index of the current photo
int photoIndex = _selection.getCurrentPhotoIndex();
audioIndex = _audioList.getAudioIndex(selectedPoint.getAudio());
}
else if (audioIndex < 0 || _audioList.getAudio(audioIndex).isConnected()) {
- // deselect current audio file
+ // deselect current audio clip
audioIndex = -1;
}
// give to selection
*/
public void selectPhoto(int inPhotoIndex)
{
- if (_selection.getCurrentPhotoIndex() == inPhotoIndex) {return;}
+ 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
pointIndex = -1;
}
}
- // Has the new point got an audio file?
+ // Has the new point got an audio clip?
DataPoint selectedPoint = _track.getPoint(pointIndex);
int audioIndex = _selection.getCurrentAudioIndex();
- if (selectedPoint != null) {
- if (selectedPoint.getAudio() != null) audioIndex = _audioList.getAudioIndex(selectedPoint.getAudio());
+ if (selectedPoint != null && selectedPoint.getAudio() != null)
+ {
+ // New point has an audio, so select it
+ audioIndex = _audioList.getAudioIndex(selectedPoint.getAudio());
}
- else {
- if (selectedPoint != currPoint && currPoint.getAudio() != null) {audioIndex = -1;}
+ 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);
*/
public void selectAudio(int inAudioIndex)
{
- if (_selection.getCurrentAudioIndex() == inAudioIndex) {return;}
+ if (_selection.getCurrentAudioIndex() == inAudioIndex) {
+ return;
+ }
// Audio selection takes priority, deselecting point if necessary
- AudioFile audio = _audioList.getAudio(inAudioIndex);
+ AudioClip audio = _audioList.getAudio(inAudioIndex);
int pointIndex = _selection.getCurrentPointIndex();
DataPoint currPoint = getCurrentPoint();
if (audio != null)
// Has the new point got a photo?
DataPoint selectedPoint = _track.getPoint(pointIndex);
int photoIndex = _selection.getCurrentPhotoIndex();
- if (selectedPoint != null) {
- if (selectedPoint.getPhoto() != null) photoIndex = _photoList.getPhotoIndex(selectedPoint.getPhoto());
+ if (selectedPoint != null && selectedPoint.getPhoto() != null) {
+ // New point has a photo, so select it
+ photoIndex = _photoList.getPhotoIndex(selectedPoint.getPhoto());
}
- else {
- if (selectedPoint != currPoint && currPoint.getPhoto() != null) {photoIndex = -1;}
+ 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);