1 package tim.prune.function.compress;
4 import tim.prune.GenericFunction;
5 import tim.prune.I18nManager;
6 import tim.prune.undo.UndoDeleteMarked;
9 * Function to delete the marked points in the track
11 public class DeleteMarkedPointsFunction extends GenericFunction
13 private boolean _splitSegments = false;
14 private String _parentFunctionKey = null;
17 public DeleteMarkedPointsFunction(App inApp) {
22 public String getNameKey() {
23 return "function.deletemarked";
27 * Get notification about parent function
28 * @param inKey parent function name key
29 * @param inSplitSegments true to split segment, false to not
31 public void setParentFunction(String inKey, boolean inSplitSegments)
33 _parentFunctionKey = inKey;
34 _splitSegments = inSplitSegments;
40 UndoDeleteMarked undo = new UndoDeleteMarked(_app.getTrackInfo().getTrack());
41 // call track to do the actual delete//
42 int numPointsDeleted = _app.getTrackInfo().deleteMarkedPoints(_splitSegments);
43 // add to undo stack if successful
44 if (numPointsDeleted > 0)
46 undo.setNumPointsDeleted(numPointsDeleted);
47 _app.completeFunction(undo, "" + numPointsDeleted + " "
48 + (numPointsDeleted==1?I18nManager.getText("confirm.deletepoint.single"):I18nManager.getText("confirm.deletepoint.multi")));
52 final String titleKey = (_parentFunctionKey == null ? getNameKey() : _parentFunctionKey);
53 _app.showErrorMessage(titleKey, "dialog.deletemarked.nonefound");