1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
package tim.prune.undo;
import tim.prune.I18nManager;
import tim.prune.UpdateMessageBroker;
import tim.prune.data.TrackInfo;
/**
* Undo addition/subtraction of a time offset
*/
public class UndoAddTimeOffset implements UndoOperation
{
/** Start and end indices of section */
private int _startIndex, _endIndex;
/** time offset */
private long _timeOffset;
/**
* Constructor
* @param inStart start index of section
* @param inEnd end index of section
* @param inOffset time offset
*/
public UndoAddTimeOffset(int inStart, int inEnd, long inOffset)
{
_startIndex = inStart;
_endIndex = inEnd;
_timeOffset = inOffset;
}
/**
* @return description of operation including number of points adjusted
*/
public String getDescription()
{
return I18nManager.getText("undo.addtimeoffset") + " (" + (_endIndex - _startIndex + 1) + ")";
}
/**
* Perform the undo operation on the given Track
* @param inTrackInfo TrackInfo object on which to perform the operation
*/
public void performUndo(TrackInfo inTrackInfo) throws UndoException
{
// Perform the inverse operation
inTrackInfo.getTrack().addTimeOffset(_startIndex, _endIndex, -_timeOffset, true);
UpdateMessageBroker.informSubscribers();
}
}
|