import java.util.ArrayList;
import java.util.EmptyStackException;
import java.util.Set;
-import java.util.Stack;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import tim.prune.function.AsyncMediaLoader;
import tim.prune.function.SaveConfig;
import tim.prune.function.SelectTracksFunction;
-import tim.prune.function.browser.BrowserLauncher;
-import tim.prune.function.browser.UrlGenerator;
import tim.prune.function.edit.FieldEditList;
import tim.prune.function.edit.PointEditor;
import tim.prune.gui.MenuManager;
/**
* @return the undo stack
*/
- public Stack<UndoOperation> getUndoStack()
+ public UndoStack getUndoStack()
{
return _undoStack;
}
// pass to track for completion
if (_track.editPoint(currentPoint, inEditList, false))
{
- _undoStack.push(undo);
+ _undoStack.add(undo);
// Confirm point edit
UpdateMessageBroker.informSubscribers(I18nManager.getText("confirm.point.edit"));
}
if (_trackInfo.deletePoint())
{
// Delete was successful so add undo info to stack
- _undoStack.push(undo);
+ _undoStack.add(undo);
if (currentPhoto != null)
{
// delete photo if necessary
}
- /**
- * Finish the compression by deleting the marked points
- */
- public void finishCompressTrack()
- {
- UndoDeleteMarked undo = new UndoDeleteMarked(_track);
- // call track to do compress
- int numPointsDeleted = _trackInfo.deleteMarkedPoints();
- // add to undo stack if successful
- if (numPointsDeleted > 0)
- {
- undo.setNumPointsDeleted(numPointsDeleted);
- _undoStack.add(undo);
- UpdateMessageBroker.informSubscribers("" + numPointsDeleted + " "
- + (numPointsDeleted==1?I18nManager.getText("confirm.deletepoint.single"):I18nManager.getText("confirm.deletepoint.multi")));
- }
- else {
- showErrorMessage("function.compress", "dialog.deletemarked.nonefound");
- }
- }
-
/**
* Reverse the currently selected section of the track
*/
}
else
{
- new UndoManager(this, _frame);
+ new UndoManager(this, _frame).show();
}
}
{
for (int i=0; i<inNumUndos; i++)
{
- _undoStack.pop().performUndo(_trackInfo);
+ _undoStack.popOperation().performUndo(_trackInfo);
}
String message = "" + inNumUndos + " "
+ (inNumUndos==1?I18nManager.getText("confirm.undo.single"):I18nManager.getText("confirm.undo.multi"));
/**
* @return the current data status, used for later comparison
*/
- public DataStatus getCurrentDataStatus() {
- return new DataStatus(_undoStack.size(), _undoStack.getNumTimesDeleted());
- }
-
- /**
- * Show a map url in an external browser
- * @param inSourceIndex index of map source to use
- */
- public void showExternalMap(int inSourceIndex)
+ public DataStatus getCurrentDataStatus()
{
- BrowserLauncher.launchBrowser(UrlGenerator.generateUrl(inSourceIndex, _trackInfo));
+ return new DataStatus(_undoStack.size(), _undoStack.getNumUndos());
}
+
/**
* Display a standard error message
* @param inTitleKey key to lookup for window title