X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2FRemoveAudioFunction.java;h=4f3b0ce7a0bea78614968246b5630a0d3b2d2568;hb=a6197ddcaac11c0b943183da7d46169742d024af;hp=fa859bec74f2a85ed643bd988ed1eaa2c87ee6f6;hpb=f35b6d628f68e3b5ef19965ad8988d0dd1eb8efa;p=GpsPrune.git diff --git a/tim/prune/function/RemoveAudioFunction.java b/tim/prune/function/RemoveAudioFunction.java index fa859be..4f3b0ce 100644 --- a/tim/prune/function/RemoveAudioFunction.java +++ b/tim/prune/function/RemoveAudioFunction.java @@ -5,11 +5,11 @@ import javax.swing.JOptionPane; import tim.prune.App; import tim.prune.GenericFunction; import tim.prune.I18nManager; -import tim.prune.data.AudioFile; +import tim.prune.data.AudioClip; import tim.prune.undo.UndoDeleteAudio; /** - * Function to remove the currently selected audio file + * Function to remove the currently selected audio clip */ public class RemoveAudioFunction extends GenericFunction { @@ -32,7 +32,7 @@ public class RemoveAudioFunction extends GenericFunction public void begin() { // Delete the current audio, and optionally its point too, keeping undo information - AudioFile currentAudio = _app.getTrackInfo().getCurrentAudio(); + AudioClip currentAudio = _app.getTrackInfo().getCurrentAudio(); if (currentAudio != null) { // Audio is selected, see if it has a point or not @@ -48,8 +48,11 @@ public class RemoveAudioFunction extends GenericFunction else { // point is attached, so need to confirm point deletion + final int pointIndex = _app.getTrackInfo().getTrack().getPointIndex(currentAudio.getDataPoint()); undoAction = new UndoDeleteAudio(currentAudio, _app.getTrackInfo().getSelection().getCurrentAudioIndex(), - currentAudio.getDataPoint(), _app.getTrackInfo().getTrack().getPointIndex(currentAudio.getDataPoint())); + currentAudio.getDataPoint(), pointIndex); + undoAction.setAtBoundaryOfSelectedRange(pointIndex == _app.getTrackInfo().getSelection().getStart() || + pointIndex == _app.getTrackInfo().getSelection().getEnd()); int response = JOptionPane.showConfirmDialog(_app.getFrame(), I18nManager.getText("dialog.deleteaudio.deletepoint"), I18nManager.getText(getNameKey()), JOptionPane.YES_NO_CANCEL_OPTION); @@ -61,7 +64,7 @@ public class RemoveAudioFunction extends GenericFunction } // Add undo information to stack if necessary if (deleted) { - _app.completeFunction(undoAction, currentAudio.getFile().getName() + " " + I18nManager.getText("confirm.media.removed")); + _app.completeFunction(undoAction, currentAudio.getName() + " " + I18nManager.getText("confirm.media.removed")); } } }