X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Ftim%2Fprune%2FApp.java;fp=src%2Ftim%2Fprune%2FApp.java;h=f76edb177d2ffb4f8ba09e3feda928022be052d5;hb=9b2386d166007f68fefcaba8c27a1eefcd67af8b;hp=94e10e0e2ed873e6bbf7558419de14e393c20f08;hpb=8b20e3e027058cdf6ff52993ee5576193d08667a;p=GpsPrune.git diff --git a/src/tim/prune/App.java b/src/tim/prune/App.java index 94e10e0..f76edb1 100644 --- a/src/tim/prune/App.java +++ b/src/tim/prune/App.java @@ -51,6 +51,7 @@ public class App { // Instance variables private JFrame _frame = null; + private String _titlePrefix = null; private Track _track = null; private TrackInfo _trackInfo = null; private int _lastSavePosition = 0; @@ -79,6 +80,7 @@ public class App public App(JFrame inFrame) { _frame = inFrame; + _titlePrefix = _frame.getTitle(); _undoStack = new UndoStack(); _track = new Track(); _trackInfo = new TrackInfo(_track); @@ -454,6 +456,22 @@ public class App } + /** + * Remove altitudes from selected points + */ + public void removeAltitudes(int selStart, int selEnd) + { + UndoRemoveAltitudes undo = new UndoRemoveAltitudes(_trackInfo, selStart, selEnd); + if (_trackInfo.getTrack().removeAltitudes(selStart, selEnd)) + { + _undoStack.add(undo); + _trackInfo.getSelection().markInvalid(); + UpdateMessageBroker.informSubscribers(DataSubscriber.DATA_EDITED); + UpdateMessageBroker.informSubscribers(I18nManager.getText("confirm.removealtitudes")); + } + } + + /** * Merge the track segments within the current selection */ @@ -773,6 +791,10 @@ public class App UpdateMessageBroker.informSubscribers(); // update menu _menuManager.informFileLoaded(); + // recentre viewport on new file data + _viewport.recentreViewport(); + // update main window title + updateTitle(); // Remove busy lock _busyLoading = false; // load next file if there's a queue @@ -1015,4 +1037,16 @@ public class App public void setCurrentMode(AppMode inMode) { _appMode = inMode; } + + /** Update main window title **/ + public void updateTitle() { + ArrayList filenames = _trackInfo.getFileInfo().getFilenames(); + if (filenames.size() > 0) { + _frame.setTitle(_titlePrefix + ": " + String.join(", ", filenames)); + } + else + { + _frame.setTitle(_titlePrefix); + } + } }