X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=micropeak%2FMicroPeak.java;h=9023f452df7f4d4578beda8b13b857c1351723e2;hp=57f17dbe4780abb310feb062688a401572cf9187;hb=c62816a00b9aa40879a2ea98da2d10667e09b704;hpb=bf88c5f829ea5d32043431945e862a9f6c96740a diff --git a/micropeak/MicroPeak.java b/micropeak/MicroPeak.java index 57f17dbe..9023f452 100644 --- a/micropeak/MicroPeak.java +++ b/micropeak/MicroPeak.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,8 +24,8 @@ import javax.swing.*; import java.io.*; import java.util.concurrent.*; import java.util.*; -import org.altusmetrum.altoslib_1.*; -import org.altusmetrum.altosuilib_1.*; +import org.altusmetrum.altoslib_11.*; +import org.altusmetrum.altosuilib_11.*; public class MicroPeak extends MicroFrame implements ActionListener, ItemListener { @@ -64,6 +65,11 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene FileInputStream fis = new FileInputStream(filename); try { data = new MicroData((InputStream) fis, filename.getName()); + AltosUIPreferences.set_last_logdir(filename); + } catch (MicroData.NonHexcharException nhe) { + data = null; + } catch (MicroData.FileEndedException nhe) { + data = null; } catch (InterruptedException ie) { data = null; } finally { @@ -102,7 +108,7 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene private void DownloadData() { AltosDevice device = MicroDeviceDialog.show(this); - + if (device != null) new MicroDownload(this, device); } @@ -123,7 +129,7 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene if (save.runDialog()) SetName(data.name); } - + private void Export() { if (data == null) { no_data(); @@ -185,10 +191,25 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene public void itemStateChanged(ItemEvent e) { } + /* OSXAdapter interfaces */ + public void macosx_file_handler(String path) { + CommandGraph(new File(path)); + } + + public void macosx_quit_handler() { + System.exit(0); + } + + public void macosx_preferences_handler() { + Preferences(); + } + public MicroPeak() { ++number_of_windows; + register_for_macosx_events(); + AltosUIPreferences.set_component(this); container = getContentPane(); @@ -230,6 +251,10 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene fileMenu.add(exitAction); exitAction.addActionListener(this); + JButton downloadButton = new JButton ("Download"); + downloadButton.addActionListener(this); + menuBar.add(downloadButton); + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override