X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fsave%2FGpsSaver.java;h=5c74a7a3894d22dd7c06d9e3e3bdb4b3fca7f1c3;hb=4d5796d02a15808311c09448d79e6e7d1de9d636;hp=944a7e4e4f1ff4780263d2a3ec58f80245caa5d6;hpb=1ee49ae3c8ef3aa2e63eadd458531e5f8bd4f92c;p=GpsPrune.git diff --git a/tim/prune/save/GpsSaver.java b/tim/prune/save/GpsSaver.java index 944a7e4..5c74a7a 100644 --- a/tim/prune/save/GpsSaver.java +++ b/tim/prune/save/GpsSaver.java @@ -6,6 +6,8 @@ import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; @@ -121,6 +123,19 @@ public class GpsSaver extends GenericFunction implements Runnable gridPanel.setAlignmentX(Component.CENTER_ALIGNMENT); gridPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 20)); mainPanel.add(gridPanel); + // close dialog when escape pressed + KeyAdapter closer = new KeyAdapter() { + public void keyReleased(KeyEvent e) + { + // close dialog if escape pressed + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + _dialog.dispose(); + } + } + }; + _deviceField.addKeyListener(closer); + _formatField.addKeyListener(closer); + _trackNameField.addKeyListener(closer); // checkboxes ChangeListener checkboxListener = new ChangeListener() { @@ -257,8 +272,8 @@ public class GpsSaver extends GenericFunction implements Runnable if (trackName == null || trackName.equals("")) {trackName = "prune";} // Generate the GPX file and send to the GPS OutputStreamWriter writer = new OutputStreamWriter(process.getOutputStream()); - boolean[] saveFlags = {true, true, true, false, true}; // export everything - GpxExporter.exportData(writer, _app.getTrackInfo(), trackName, null, saveFlags, false); + boolean[] saveFlags = {true, true, true, true, false, true}; // export everything + GpxExporter.exportData(writer, _app.getTrackInfo(), trackName, null, saveFlags, null); writer.close(); // Read the error stream to see if there's a better error message there