From 669cde8a87d88ceae89e369c1d38b88c9f8198cf Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 25 Dec 2012 14:19:19 -0800 Subject: Move libaltos to top level This will let it be shared by the new MicroPeak gui Signed-off-by: Keith Packard --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index bee9480d..e3b1185f 100644 --- a/configure.ac +++ b/configure.ac @@ -149,7 +149,8 @@ altoslib/Makefile altosui/Makefile altosui/AltosVersion.java altosui/Info.plist -altosui/libaltos/Makefile +libaltos/Makefile +micropeak/Makefile altosdroid/Makefile altosdroid/local.properties ao-tools/Makefile -- cgit v1.2.3 From 03496dc47372c40f7faae1766b0e729a1feeab7c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 31 Dec 2012 11:32:56 -0800 Subject: Create altosuilib to share code between altosui and micropeak Need to convert altosui to using it, but that shouldn't be hard Signed-off-by: Keith Packard --- Makefile.am | 2 +- altosuilib/AltosConfigureUI.java | 393 ++++++++++++++++++++++++++++++ altosuilib/AltosFontListener.java | 22 ++ altosuilib/AltosUIDialog.java | 59 +++++ altosuilib/AltosUIFrame.java | 82 +++++++ altosuilib/AltosUILib.java | 93 +++++++ altosuilib/AltosUIListener.java | 22 ++ altosuilib/AltosUIPreferences.java | 180 ++++++++++++++ altosuilib/AltosUIPreferencesBackend.java | 101 ++++++++ altosuilib/AltosUIVersion.java.in | 22 ++ altosuilib/AltosUnitsListener.java | 22 ++ altosuilib/Makefile.am | 41 ++++ configure.ac | 2 + 13 files changed, 1040 insertions(+), 1 deletion(-) create mode 100644 altosuilib/AltosConfigureUI.java create mode 100644 altosuilib/AltosFontListener.java create mode 100644 altosuilib/AltosUIDialog.java create mode 100644 altosuilib/AltosUIFrame.java create mode 100644 altosuilib/AltosUILib.java create mode 100644 altosuilib/AltosUIListener.java create mode 100644 altosuilib/AltosUIPreferences.java create mode 100644 altosuilib/AltosUIPreferencesBackend.java create mode 100644 altosuilib/AltosUIVersion.java.in create mode 100644 altosuilib/AltosUnitsListener.java create mode 100644 altosuilib/Makefile.am (limited to 'configure.ac') diff --git a/Makefile.am b/Makefile.am index 2e45aff0..e8945d90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS=src doc altoslib libaltos altosui ao-tools ao-utils altosdroid +SUBDIRS=src doc altoslib libaltos altosuilib altosui ao-tools ao-utils altosdroid EXTRA_DIST = ChangeLog diff --git a/altosuilib/AltosConfigureUI.java b/altosuilib/AltosConfigureUI.java new file mode 100644 index 00000000..a4b644bf --- /dev/null +++ b/altosuilib/AltosConfigureUI.java @@ -0,0 +1,393 @@ +/* + * Copyright © 2010 Keith Packard + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib; + +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import javax.swing.*; +import javax.swing.event.*; + +class DelegatingRenderer implements ListCellRenderer { + + // ... + public static void install(JComboBox comboBox) { + DelegatingRenderer renderer = new DelegatingRenderer(comboBox); + renderer.initialise(); + comboBox.setRenderer(renderer); + } + + // ... + private final JComboBox comboBox; + + // ... + private ListCellRenderer delegate; + + // ... + private DelegatingRenderer(JComboBox comboBox) { + this.comboBox = comboBox; + } + + // ... + private void initialise() { + delegate = new JComboBox().getRenderer(); + comboBox.addPropertyChangeListener("UI", new PropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent evt) { + delegate = new JComboBox().getRenderer(); + } + }); + } + + // ... + public Component getListCellRendererComponent(JList list, + Object value, int index, boolean isSelected, boolean cellHasFocus) { + + return delegate.getListCellRendererComponent(list, + ((UIManager.LookAndFeelInfo) value).getName(), + index, isSelected, cellHasFocus); + } +} + +public class AltosConfigureUI + extends AltosUIDialog + implements DocumentListener +{ + JFrame owner; + Container pane; + + JRadioButton enable_voice; + JButton test_voice; + JButton close; + + JButton configure_log; + JTextField log_directory; + + JLabel callsign_label; + JTextField callsign_value; + + JRadioButton imperial_units; + + JLabel font_size_label; + JComboBox font_size_value; + + JLabel look_and_feel_label; + JComboBox look_and_feel_value; + + JRadioButton serial_debug; + + JButton manage_bluetooth; + JButton manage_frequencies; + + int row; + + final static String[] font_size_names = { "Small", "Medium", "Large" }; + + /* DocumentListener interface methods */ + public void changedUpdate(DocumentEvent e) { + if (callsign_value != null) + AltosUIPreferences.set_callsign(callsign_value.getText()); + } + + public void insertUpdate(DocumentEvent e) { + changedUpdate(e); + } + + public void removeUpdate(DocumentEvent e) { + changedUpdate(e); + } + + public GridBagConstraints constraints (int x, int width, int fill) { + GridBagConstraints c = new GridBagConstraints(); + Insets insets = new Insets(4, 4, 4, 4); + + c.insets = insets; + c.fill = fill; + if (width == 3) + c.anchor = GridBagConstraints.CENTER; + else + c.anchor = GridBagConstraints.WEST; + c.gridx = x; + c.gridwidth = width; + c.gridy = row; + return c; + } + + public GridBagConstraints constraints(int x, int width) { + return constraints(x, width, GridBagConstraints.NONE); + } + + public void add_voice() { +// GridBagConstraints c = new GridBagConstraints(); +// +// /* Voice settings */ +// c.gridx = 0; +// c.gridy = row; +// c.gridwidth = 1; +// c.fill = GridBagConstraints.NONE; +// c.anchor = GridBagConstraints.WEST; +// pane.add(new JLabel("Voice"), c); +// +// enable_voice = new JRadioButton("Enable", AltosUIPreferences.voice()); +// enable_voice.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// JRadioButton item = (JRadioButton) e.getSource(); +// boolean enabled = item.isSelected(); +// AltosUIPreferences.set_voice(enabled); +// if (enabled) +// voice.speak_always("Enable voice."); +// else +// voice.speak_always("Disable voice."); +// } +// }); +// c.gridx = 1; +// c.gridy = row; +// c.gridwidth = 1; +// c.weightx = 1; +// c.fill = GridBagConstraints.NONE; +// c.anchor = GridBagConstraints.WEST; +// pane.add(enable_voice, c); +// enable_voice.setToolTipText("Enable/Disable all audio in-flight announcements"); +// +// c.gridx = 2; +// c.gridy = row++; +// c.gridwidth = 1; +// c.weightx = 1; +// c.fill = GridBagConstraints.NONE; +// c.anchor = GridBagConstraints.EAST; +// test_voice = new JButton("Test Voice"); +// test_voice.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// voice.speak("That's one small step for man; one giant leap for mankind."); +// } +// }); +// pane.add(test_voice, c); +// test_voice.setToolTipText("Play a stock audio clip to check volume"); +// row++; + } + + public void add_log_dir() { + /* Log directory settings */ + pane.add(new JLabel("Log Directory"), constraints(0, 1)); + + configure_log = new JButton(AltosUIPreferences.logdir().getPath()); + configure_log.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + AltosUIPreferences.ConfigureLog(); + configure_log.setText(AltosUIPreferences.logdir().getPath()); + } + }); + pane.add(configure_log, constraints(1, 2)); + configure_log.setToolTipText("Which directory flight logs are stored in"); + row++; + } + + public void add_callsign() { +// /* Callsign setting */ +// pane.add(new JLabel("Callsign"), constraints(0, 1)); +// +// callsign_value = new JTextField(AltosUIPreferences.callsign()); +// callsign_value.getDocument().addDocumentListener(this); +// callsign_value.setToolTipText("Callsign sent in packet mode"); +// pane.add(callsign_value, constraints(1, 2, GridBagConstraints.BOTH)); +// row++; + } + + public void add_units() { + /* Imperial units setting */ + pane.add(new JLabel("Imperial Units"), constraints(0, 1)); + + imperial_units = new JRadioButton("Enable", AltosUIPreferences.imperial_units()); + imperial_units.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + JRadioButton item = (JRadioButton) e.getSource(); + boolean enabled = item.isSelected(); + AltosUIPreferences.set_imperial_units(enabled); + } + }); + imperial_units.setToolTipText("Use Imperial units instead of metric"); + pane.add(imperial_units, constraints(1, 2)); + row++; + } + + public void add_font_size() { + /* Font size setting */ + pane.add(new JLabel("Font size"), constraints(0, 1)); + + font_size_value = new JComboBox(font_size_names); + int font_size = AltosUIPreferences.font_size(); + font_size_value.setSelectedIndex(font_size - AltosUILib.font_size_small); + font_size_value.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + int size = font_size_value.getSelectedIndex() + AltosUILib.font_size_small; + + AltosUIPreferences.set_font_size(size); + } + }); + pane.add(font_size_value, constraints(1, 2, GridBagConstraints.BOTH)); + font_size_value.setToolTipText("Font size used in telemetry window"); + row++; + } + + public void add_look_and_feel() { + /* Look & Feel setting */ + pane.add(new JLabel("Look & feel"), constraints(0, 1)); + + /* + class LookAndFeelRenderer extends BasicComboBoxRenderer implements ListCellRenderer { + + public LookAndFeelRenderer() { + super(); + } + + public Component getListCellRendererComponent( + JList list, + Object value, + int index, + boolean isSelected, + boolean cellHasFocus) + { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + setText(((UIManager.LookAndFeelInfo) value).getName()); + return this; + } + } + */ + + final UIManager.LookAndFeelInfo[] look_and_feels = UIManager.getInstalledLookAndFeels(); + + look_and_feel_value = new JComboBox(look_and_feels); + + DelegatingRenderer.install(look_and_feel_value); + + String look_and_feel = AltosUIPreferences.look_and_feel(); + for (int i = 0; i < look_and_feels.length; i++) + if (look_and_feel.equals(look_and_feels[i].getClassName())) + look_and_feel_value.setSelectedIndex(i); + + look_and_feel_value.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + int id = look_and_feel_value.getSelectedIndex(); + + AltosUIPreferences.set_look_and_feel(look_and_feels[id].getClassName()); + } + }); + pane.add(look_and_feel_value, constraints(1, 2, GridBagConstraints.BOTH)); + look_and_feel_value.setToolTipText("Look&feel used for new windows"); + row++; + } + + public void add_serial_debug() { + GridBagConstraints c = new GridBagConstraints(); + + /* Serial debug setting */ + pane.add(new JLabel("Serial Debug"), constraints(0, 1)); + + serial_debug = new JRadioButton("Enable", AltosUIPreferences.serial_debug()); + serial_debug.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + JRadioButton item = (JRadioButton) e.getSource(); + boolean enabled = item.isSelected(); + AltosUIPreferences.set_serial_debug(enabled); + } + }); + serial_debug.setToolTipText("Enable/Disable USB I/O getting sent to the console"); + } + + public void add_bluetooth() { +// GridBagConstraints c = new GridBagConstraints(); +// c.gridx = 1; +// c.gridy = row++; +// c.gridwidth = 3; +// c.fill = GridBagConstraints.NONE; +// c.anchor = GridBagConstraints.WEST; +// pane.add(serial_debug, c); +// +// manage_bluetooth = new JButton("Manage Bluetooth"); +// manage_bluetooth.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// AltosBTManage.show(owner, AltosBTKnown.bt_known()); +// } +// }); +// c.gridx = 0; +// c.gridy = row; +// c.gridwidth = 2; +// c.fill = GridBagConstraints.NONE; +// c.anchor = GridBagConstraints.WEST; +// pane.add(manage_bluetooth, c); + } + + public void add_frequencies() { +// GridBagConstraints c = new GridBagConstraints(); +// manage_frequencies = new JButton("Manage Frequencies"); +// manage_frequencies.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// AltosConfigFreqUI.show(owner); +// } +// }); +// manage_frequencies.setToolTipText("Configure which values are shown in frequency menus"); +// c.gridx = 2; +// c.gridx = 2; +// c.gridy = row++; +// c.gridwidth = 2; +// c.fill = GridBagConstraints.NONE; +// c.anchor = GridBagConstraints.WEST; +// pane.add(manage_frequencies, c); + } + + public AltosConfigureUI(JFrame in_owner) { + super(in_owner, "Configure AltosUI", false); + + owner = in_owner; + pane = getContentPane(); + pane.setLayout(new GridBagLayout()); + + row = 0; + + /* Nice label at the top */ + pane.add(new JLabel ("Configure AltOS UI"), + constraints(0, 3)); + row++; + + pane.add(new JLabel (String.format("AltOS version %s", AltosUIVersion.version)), + constraints(0, 3)); + row++; + + add_voice(); + add_log_dir(); + add_callsign(); + add_units(); + add_font_size(); + add_look_and_feel(); + add_bluetooth(); + add_frequencies(); + + /* And a close button at the bottom */ + close = new JButton("Close"); + close.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + setVisible(false); + } + }); + pane.add(close, constraints(0, 3)); + + pack(); + setLocationRelativeTo(owner); + setVisible(true); + } +} diff --git a/altosuilib/AltosFontListener.java b/altosuilib/AltosFontListener.java new file mode 100644 index 00000000..ef543264 --- /dev/null +++ b/altosuilib/AltosFontListener.java @@ -0,0 +1,22 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib; + +public interface AltosFontListener { + void font_size_changed(int font_size); +} diff --git a/altosuilib/AltosUIDialog.java b/altosuilib/AltosUIDialog.java new file mode 100644 index 00000000..c0c33ba6 --- /dev/null +++ b/altosuilib/AltosUIDialog.java @@ -0,0 +1,59 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +class AltosUIDialogListener extends WindowAdapter { + public void windowClosing (WindowEvent e) { + AltosUIPreferences.unregister_ui_listener((AltosUIDialog) e.getWindow()); + } +} + +public class AltosUIDialog extends JDialog implements AltosUIListener { + + public void ui_changed(String look_and_feel) { + SwingUtilities.updateComponentTreeUI(this); + this.pack(); + } + + public AltosUIDialog() { + AltosUIPreferences.register_ui_listener(this); + addWindowListener(new AltosUIDialogListener()); + } + + public AltosUIDialog(Frame frame, String label, boolean modal) { + super(frame, label, modal); + AltosUIPreferences.register_ui_listener(this); + addWindowListener(new AltosUIDialogListener()); + } + + public AltosUIDialog(Dialog dialog, String label, boolean modal) { + super(dialog, label, modal); + AltosUIPreferences.register_ui_listener(this); + addWindowListener(new AltosUIDialogListener()); + } + + public AltosUIDialog(Frame frame, boolean modal) { + super(frame, modal); + AltosUIPreferences.register_ui_listener(this); + addWindowListener(new AltosUIDialogListener()); + } +} diff --git a/altosuilib/AltosUIFrame.java b/altosuilib/AltosUIFrame.java new file mode 100644 index 00000000..409aea2e --- /dev/null +++ b/altosuilib/AltosUIFrame.java @@ -0,0 +1,82 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.*; + +class AltosUIFrameListener extends WindowAdapter { + public void windowClosing (WindowEvent e) { + AltosUIPreferences.unregister_ui_listener((AltosUIFrame) e.getWindow()); + } +} + +public class AltosUIFrame extends JFrame implements AltosUIListener { + + public void ui_changed(String look_and_feel) { + SwingUtilities.updateComponentTreeUI(this); + this.pack(); + } + + static String[] altos_icon_names = { + "/altus-metrum-16.png", + "/altus-metrum-32.png", + "/altus-metrum-48.png", + "/altus-metrum-64.png", + "/altus-metrum-128.png", + "/altus-metrum-256.png" + }; + + static public String[] icon_names; + + static public void set_icon_names(String[] new_icon_names) { icon_names = new_icon_names; } + + public String[] icon_names() { + if (icon_names == null) + set_icon_names(altos_icon_names); + return icon_names; + } + + public void set_icon() { + ArrayList icons = new ArrayList(); + String[] icon_names = icon_names(); + + for (int i = 0; i < icon_names.length; i++) { + java.net.URL imgURL = AltosUIFrame.class.getResource(icon_names[i]); + if (imgURL != null) + icons.add(new ImageIcon(imgURL).getImage()); + } + setIconImages(icons); + } + + + public AltosUIFrame() { + AltosUIPreferences.register_ui_listener(this); + addWindowListener(new AltosUIFrameListener()); + set_icon(); + } + + public AltosUIFrame(String name) { + super(name); + AltosUIPreferences.register_ui_listener(this); + addWindowListener(new AltosUIFrameListener()); + set_icon(); + } +} diff --git a/altosuilib/AltosUILib.java b/altosuilib/AltosUILib.java new file mode 100644 index 00000000..717678ba --- /dev/null +++ b/altosuilib/AltosUILib.java @@ -0,0 +1,93 @@ +/* + * Copyright © 2010 Keith Packard + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib; + +import java.awt.*; +import libaltosJNI.*; + +import org.altusmetrum.AltosLib.*; + +public class AltosUILib extends AltosLib { + + static final int tab_elt_pad = 5; + + static Font label_font; + static Font value_font; + static Font status_font; + static Font table_label_font; + static Font table_value_font; + + final static int font_size_small = 1; + final static int font_size_medium = 2; + final static int font_size_large = 3; + + static void set_fonts(int size) { + int brief_size; + int table_size; + int status_size; + + switch (size) { + case font_size_small: + brief_size = 16; + status_size = 18; + table_size = 11; + break; + default: + case font_size_medium: + brief_size = 22; + status_size = 24; + table_size = 14; + break; + case font_size_large: + brief_size = 26; + status_size = 30; + table_size = 17; + break; + } + label_font = new Font("Dialog", Font.PLAIN, brief_size); + value_font = new Font("Monospaced", Font.PLAIN, brief_size); + status_font = new Font("SansSerif", Font.BOLD, status_size); + table_label_font = new Font("SansSerif", Font.PLAIN, table_size); + table_value_font = new Font("Monospaced", Font.PLAIN, table_size); + } + + static final int text_width = 20; + + static public boolean initialized = false; + static public boolean loaded_library = false; + + public static boolean load_library() { + if (!initialized) { + try { + System.loadLibrary("altos"); + libaltos.altos_init(); + loaded_library = true; + } catch (UnsatisfiedLinkError e) { + try { + System.loadLibrary("altos64"); + libaltos.altos_init(); + loaded_library = true; + } catch (UnsatisfiedLinkError e2) { + loaded_library = false; + } + } + initialized = true; + } + return loaded_library; + } +} diff --git a/altosuilib/AltosUIListener.java b/altosuilib/AltosUIListener.java new file mode 100644 index 00000000..f4127f58 --- /dev/null +++ b/altosuilib/AltosUIListener.java @@ -0,0 +1,22 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib; + +public interface AltosUIListener { + public void ui_changed(String look_and_feel); +} diff --git a/altosuilib/AltosUIPreferences.java b/altosuilib/AltosUIPreferences.java new file mode 100644 index 00000000..485cb582 --- /dev/null +++ b/altosuilib/AltosUIPreferences.java @@ -0,0 +1,180 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib; + +import java.io.*; +import java.util.*; +import java.awt.Component; +import javax.swing.*; +import org.altusmetrum.AltosLib.*; + +public class AltosUIPreferences extends AltosPreferences { + + /* font size preferences name */ + final static String fontSizePreference = "FONT-SIZE"; + + /* Look&Feel preference name */ + final static String lookAndFeelPreference = "LOOK-AND-FEEL"; + + /* UI Component to pop dialogs up */ + static Component component; + + static LinkedList font_listeners; + + static int font_size = AltosUILib.font_size_medium; + + static LinkedList ui_listeners; + + static String look_and_feel = null; + + /* Serial debug */ + public static boolean serial_debug; + + public static void init() { + AltosPreferences.init(new AltosUIPreferencesBackend()); + + font_listeners = new LinkedList(); + + font_size = backend.getInt(fontSizePreference, AltosUILib.font_size_medium); + AltosUILib.set_fonts(font_size); + look_and_feel = backend.getString(lookAndFeelPreference, UIManager.getSystemLookAndFeelClassName()); + + ui_listeners = new LinkedList(); + serial_debug = backend.getBoolean(serialDebugPreference, false); + AltosLink.set_debug(serial_debug); + } + + static { init(); } + + public static void set_component(Component in_component) { + component = in_component; + } + + private static boolean check_dir(File dir) { + if (!dir.exists()) { + if (!dir.mkdirs()) { + JOptionPane.showMessageDialog(component, + dir.getName(), + "Cannot create directory", + JOptionPane.ERROR_MESSAGE); + return false; + } + } else if (!dir.isDirectory()) { + JOptionPane.showMessageDialog(component, + dir.getName(), + "Is not a directory", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + /* Configure the log directory. This is where all telemetry and eeprom files + * will be written to, and where replay will look for telemetry files + */ + public static void ConfigureLog() { + JFileChooser logdir_chooser = new JFileChooser(logdir.getParentFile()); + + logdir_chooser.setDialogTitle("Configure Data Logging Directory"); + logdir_chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + if (logdir_chooser.showDialog(component, "Select Directory") == JFileChooser.APPROVE_OPTION) { + File dir = logdir_chooser.getSelectedFile(); + if (check_dir(dir)) + set_logdir(dir); + } + } + public static int font_size() { + synchronized (backend) { + return font_size; + } + } + + static void set_fonts() { + } + + public static void set_font_size(int new_font_size) { + synchronized (backend) { + font_size = new_font_size; + backend.putInt(fontSizePreference, font_size); + flush_preferences(); + AltosUILib.set_fonts(font_size); + for (AltosFontListener l : font_listeners) + l.font_size_changed(font_size); + } + } + + public static void register_font_listener(AltosFontListener l) { + synchronized (backend) { + font_listeners.add(l); + } + } + + public static void unregister_font_listener(AltosFontListener l) { + synchronized (backend) { + font_listeners.remove(l); + } + } + + public static void set_look_and_feel(String new_look_and_feel) { + try { + UIManager.setLookAndFeel(new_look_and_feel); + } catch (Exception e) { + } + synchronized(backend) { + look_and_feel = new_look_and_feel; + backend.putString(lookAndFeelPreference, look_and_feel); + flush_preferences(); + for (AltosUIListener l : ui_listeners) + l.ui_changed(look_and_feel); + } + } + + public static String look_and_feel() { + synchronized (backend) { + return look_and_feel; + } + } + + public static void register_ui_listener(AltosUIListener l) { + synchronized(backend) { + ui_listeners.add(l); + } + } + + public static void unregister_ui_listener(AltosUIListener l) { + synchronized (backend) { + ui_listeners.remove(l); + } + } + public static void set_serial_debug(boolean new_serial_debug) { + AltosLink.set_debug(new_serial_debug); + synchronized (backend) { + serial_debug = new_serial_debug; + backend.putBoolean(serialDebugPreference, serial_debug); + flush_preferences(); + } + } + + public static boolean serial_debug() { + synchronized (backend) { + return serial_debug; + } + } + +} diff --git a/altosuilib/AltosUIPreferencesBackend.java b/altosuilib/AltosUIPreferencesBackend.java new file mode 100644 index 00000000..c6c05e55 --- /dev/null +++ b/altosuilib/AltosUIPreferencesBackend.java @@ -0,0 +1,101 @@ +/* + * Copyright © 2012 Mike Beattie + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib; + +import java.io.File; +import java.util.prefs.*; +import org.altusmetrum.AltosLib.*; +import javax.swing.filechooser.FileSystemView; + +public class AltosUIPreferencesBackend implements AltosPreferencesBackend { + + private Preferences _preferences = null; + + public AltosUIPreferencesBackend() { + _preferences = Preferences.userRoot().node("/org/altusmetrum/altosui"); + } + + public AltosUIPreferencesBackend(Preferences in_preferences) { + _preferences = in_preferences; + } + + public String getString(String key, String def) { + return _preferences.get(key, def); + } + public void putString(String key, String value) { + _preferences.put(key, value); + } + + public int getInt(String key, int def) { + return _preferences.getInt(key, def); + } + public void putInt(String key, int value) { + _preferences.putInt(key, value); + } + + public double getDouble(String key, double def) { + return _preferences.getDouble(key, def); + } + public void putDouble(String key, double value) { + _preferences.putDouble(key, value); + } + + public boolean getBoolean(String key, boolean def) { + return _preferences.getBoolean(key, def); + } + public void putBoolean(String key, boolean value) { + _preferences.putBoolean(key, value); + } + + public boolean nodeExists(String key) { + try { + return _preferences.nodeExists(key); + } catch (BackingStoreException be) { + return false; + } + } + + public AltosPreferencesBackend node(String key) { + return new AltosUIPreferencesBackend(_preferences.node(key)); + } + + public String[] keys() { + try { + return _preferences.keys(); + } catch (BackingStoreException be) { + return null; + } + } + + public void remove(String key) { + _preferences.remove(key); + } + + public void flush() { + try { + _preferences.flush(); + } catch (BackingStoreException ee) { + System.err.printf("Cannot save preferences\n"); + } + } + + public File homeDirectory() { + /* Use the file system view default directory */ + return FileSystemView.getFileSystemView().getDefaultDirectory(); + } +} diff --git a/altosuilib/AltosUIVersion.java.in b/altosuilib/AltosUIVersion.java.in new file mode 100644 index 00000000..6fb3b38b --- /dev/null +++ b/altosuilib/AltosUIVersion.java.in @@ -0,0 +1,22 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib; + +public class AltosUIVersion { + public final static String version = "@VERSION@"; +} diff --git a/altosuilib/AltosUnitsListener.java b/altosuilib/AltosUnitsListener.java new file mode 100644 index 00000000..22c66cd4 --- /dev/null +++ b/altosuilib/AltosUnitsListener.java @@ -0,0 +1,22 @@ +/* + * Copyright © 2012 Keith Packard + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altosuilib; + +public interface AltosUnitsListener { + public void units_changed(); +} diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am new file mode 100644 index 00000000..26aee7c4 --- /dev/null +++ b/altosuilib/Makefile.am @@ -0,0 +1,41 @@ +AM_JAVACFLAGS=-encoding UTF-8 -Xlint:deprecation + +JAVAROOT=bin + +CLASSPATH_ENV=mkdir -p $(JAVAROOT); CLASSPATH="bin:../altoslib/*:../libaltos:$(FREETTS)/*:/usr/share/java/*" + +SRC=. +BIN=bin/org/altusmetrum/AltosUILib + +AltosUILibdir = $(datadir)/java + +AltosUILib_JAVA = \ + AltosConfigureUI.java \ + AltosFontListener.java \ + AltosUIDialog.java \ + AltosUIFrame.java \ + AltosUILib.java \ + AltosUIListener.java \ + AltosUIPreferencesBackend.java \ + AltosUIPreferences.java \ + AltosUIVersion.java \ + AltosUnitsListener.java + +JAR=AltosUILib.jar + +all-local: $(JAR) + +clean-local: + -rm -rf bin $(JAR) + +install-AltosUILibJAVA: $(JAR) + @$(NORMAL_INSTALL) + test -z "$(AltosUILibdir)" || $(MKDIR_P) "$(DESTDIR)$(AltosUILibdir)" + echo " $(INSTALL_DATA)" "$<" "'$(DESTDIR)$(AltosUILibdir)/$(JAR)"; \ + $(INSTALL_DATA) "$<" "$(DESTDIR)$(AltosUILibdir)" + +bin: + mkdir -p bin + +$(JAR): classAltosUILib.stamp + jar cf $@ -C bin org diff --git a/configure.ac b/configure.ac index 55dd20ec..6ad2591c 100644 --- a/configure.ac +++ b/configure.ac @@ -146,6 +146,8 @@ AM_CONDITIONAL([LIBSTLINK], [test x$HAVE_STLINK != xno]) AC_OUTPUT([ Makefile altoslib/Makefile +altosuilib/Makefile +altosuilib/AltosUIVersion.java altosui/Makefile altosui/AltosVersion.java altosui/Info.plist -- cgit v1.2.3 From 3ac109132d1878abbd277ae21215716326404781 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 1 Jan 2013 18:20:23 -0800 Subject: Build installable versions of MicroPeak GUI Makes windows/mac/linux versions. Windows version appears to work on Wine at least. Signed-off-by: Keith Packard --- configure.ac | 1 + icon/altus-metrum.ico | Bin 15086 -> 285478 bytes icon/micro-peak.ico | Bin 0 -> 285478 bytes micropeak/Info.plist.in | 45 ++++++++ micropeak/Makefile.am | 79 ++++++++++++- .../Contents/MacOS/JavaApplicationStub | Bin 0 -> 61296 bytes micropeak/MicroPeak.app/Contents/PkgInfo | 1 + .../Contents/Resources/AltosUIIcon.icns | Bin 0 -> 129010 bytes micropeak/micropeak-fat | 4 + micropeak/micropeak-windows.nsi | 123 +++++++++++++++++++++ 10 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 icon/micro-peak.ico create mode 100644 micropeak/Info.plist.in create mode 100755 micropeak/MicroPeak.app/Contents/MacOS/JavaApplicationStub create mode 100644 micropeak/MicroPeak.app/Contents/PkgInfo create mode 100644 micropeak/MicroPeak.app/Contents/Resources/AltosUIIcon.icns create mode 100755 micropeak/micropeak-fat create mode 100644 micropeak/micropeak-windows.nsi (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 6ad2591c..312f9678 100644 --- a/configure.ac +++ b/configure.ac @@ -153,6 +153,7 @@ altosui/AltosVersion.java altosui/Info.plist libaltos/Makefile micropeak/Makefile +micropeak/Info.plist altosdroid/Makefile altosdroid/local.properties ao-tools/Makefile diff --git a/icon/altus-metrum.ico b/icon/altus-metrum.ico index e32b4f1e..bedf04ef 100644 Binary files a/icon/altus-metrum.ico and b/icon/altus-metrum.ico differ diff --git a/icon/micro-peak.ico b/icon/micro-peak.ico new file mode 100644 index 00000000..b672aa04 Binary files /dev/null and b/icon/micro-peak.ico differ diff --git a/micropeak/Info.plist.in b/micropeak/Info.plist.in new file mode 100644 index 00000000..d3c17a49 --- /dev/null +++ b/micropeak/Info.plist.in @@ -0,0 +1,45 @@ + + + + + CFBundleName + MicroPeak + CFBundleVersion + @VERSION@ + CFBundleAllowMixedLocalizations + true + CFBundleExecutable + JavaApplicationStub + CFBundleDevelopmentRegion + English + CFBundlePackageType + APPL + CFBundleIdentifier + org.altusmetrum.altosui + CFBundleSignature + Altu + CFBundleGetInfoString + MicroPeak UI version @VERSION@ + CFBundleInfoDictionaryVersion + 6.0 + CFBundleIconFile + MicroPeak.icns + Java + + MainClass + org.altusmetrum.micropeak.MicroPeak + JVMVersion + 1.5+ + ClassPath + + $JAVAROOT/micropeak.jar + + VMOptions + + -Xms512M + -Xmx512M + -Dosgi.clean=true + + + + diff --git a/micropeak/Makefile.am b/micropeak/Makefile.am index a54b78a5..2dd9c69c 100644 --- a/micropeak/Makefile.am +++ b/micropeak/Makefile.am @@ -34,6 +34,7 @@ FATJAR=micropeak-fat.jar LIBALTOS= \ libaltos.so \ libaltos.dylib \ + altos64.dll \ altos.dll ALTOSLIB_CLASS=\ @@ -61,15 +62,58 @@ ICONJAR= -C $(ICONDIR) micropeak-16.png \ -C $(ICONDIR) micropeak-128.png \ -C $(ICONDIR) micropeak-256.png +WINDOWS_ICON=$(ICONDIR)/micro-peak.ico + all-local: micropeak-test $(JAR) clean-local: -rm -rf classes $(JAR) $(FATJAR) \ + $(LINUX_DIST) $(MACOSX_DIST) windows $(WINDOWS_DIST) \ $(ALTOSLIB_CLASS) \ $(ALTOSUILIB_CLASS) \ $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt \ micropeak micropeak-test macosx linux windows +LINUX_DIST=MicroPeak-Linux-$(VERSION).tar.bz2 +MACOSX_DIST=MicroPeak-Mac-$(VERSION).zip +WINDOWS_DIST=MicroPeak-Windows-$(VERSION_DASH).exe + +FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) + +LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) +LINUX_EXTRA=micropeak-fat + +MACOSX_INFO_PLIST=Info.plist +MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) + +WINDOWS_FILES=$(FAT_FILES) altos.dll altos64.dll $(top_srcdir)/telemetrum.inf $(WINDOWS_ICON) + +if FATINSTALL + +FATTARGET=$(FATDIR)/$(VERSION) + +LINUX_DIST_TARGET=$(FATTARGET)/$(LINUX_DIST) +MACOSX_DIST_TARGET=$(FATTARGET)/$(MACOSX_DIST) +WINDOWS_DIST_TARGET=$(FATTARGET)/$(WINDOWS_DIST) + +fat: $(LINUX_DIST_TARGET) $(MACOSX_DIST_TARGET) $(WINDOWS_DIST_TARGET) + +$(LINUX_DIST_TARGET): $(LINUX_DIST) + mkdir -p $(FATTARGET) + cp -p $< $@ + +$(MACOSX_DIST_TARGET): $(MACOSX_DIST) + mkdir -p $(FATTARGET) + cp -p $< $@ + +$(WINDOWS_DIST_TARGET): $(WINDOWS_DIST) + mkdir -p $(FATTARGET) + cp -p $< $@ + +else +fat: $(LINUX_DIST) $(MACOSX_DIST) $(WINDOWS_DIST) +endif + micropeak: Makefile echo "#!/bin/sh" > $@ echo 'exec java -cp "$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar" -Djava.library.path="$(altoslibdir)" -jar "$(micropeakdir)/micropeak.jar" "$$@"' >> $@ @@ -80,6 +124,12 @@ micropeak-test: Makefile echo 'exec java -cp "./*:../libaltos/*:$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar" -Djava.library.path="../libaltos/.libs" -jar micropeak.jar "$$@"' >> $@ chmod +x $@ +install-micropeakJAVA: micropeak.jar + @$(NORMAL_INSTALL) + test -z "$(micropeakdir)" || $(MKDIR_P) "$(DESTDIR)$(micropeakdir)" + echo " $(INSTALL_DATA)" "$<" "'$(DESTDIR)$(micropeakdir)/micropeak.jar'"; \ + $(INSTALL_DATA) "$<" "$(DESTDIR)$(micropeakdir)" + $(JAR): classmicropeak.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) jar cfm $@ Manifest.txt \ $(ICONJAR) \ @@ -92,7 +142,6 @@ $(FATJAR): classmicropeak.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_ -C classes org \ -C ../libaltos libaltosJNI - libaltos.so: build-libaltos -rm -f "$@" $(LN_S) ../libaltos/.libs/"$@" . @@ -139,6 +188,34 @@ $(JCOMMON_CLASS): -rm -f "$@" $(LN_S) "$(JCOMMON)"/"$@" . +$(LINUX_DIST): $(LINUX_FILES) $(LINUX_EXTRA) + -rm -f $@ + -rm -rf linux + mkdir -p linux/MicroPeak + cp -p $(LINUX_FILES) linux/MicroPeak + cp -p micropeak-fat linux/MicroPeak/micropeak + chmod +x linux/MicroPeak/micropeak + tar cjf $@ -C linux MicroPeak + +$(MACOSX_DIST): $(MACOSX_FILES) + -rm -f $@ + -rm -rf macosx + mkdir macosx + cp -a MicroPeak.app macosx/ + cp -p Info.plist macosx/MicroPeak.app/Contents + mkdir -p macosx/MicroPeak macosx/MicroPeak.app/Contents/Resources/Java + cp -p $(FATJAR) macosx/MicroPeak.app/Contents/Resources/Java/micropeak.jar + cp -p libaltos.dylib macosx/MicroPeak.app/Contents/Resources/Java + cp -p $(ALTOSLIB_CLASS) macosx/MicroPeak.app/Contents/Resources/Java + cp -p $(ALTOSUILIB_CLASS) macosx/MicroPeak.app/Contents/Resources/Java + cp -p $(JFREECHART_CLASS) macosx/MicroPeak.app/Contents/Resources/Java + cp -p $(JCOMMON_CLASS) macosx/MicroPeak.app/Contents/Resources/Java + cd macosx && zip -r ../$@ MicroPeak.app MicroPeak + +$(WINDOWS_DIST): $(WINDOWS_FILES) micropeak-windows.nsi + -rm -f $@ + makensis -Omicropeak-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" micropeak-windows.nsi + Manifest.txt: Makefile echo 'Main-Class: org.altusmetrum.micropeak.MicroPeak' > $@ echo "Class-Path: AltosLib.jar AltosUILib.jar $(JCOMMON)/jcommon.jar $(JFREECHART)/jfreechart.jar" >> $@ diff --git a/micropeak/MicroPeak.app/Contents/MacOS/JavaApplicationStub b/micropeak/MicroPeak.app/Contents/MacOS/JavaApplicationStub new file mode 100755 index 00000000..c661d3e1 Binary files /dev/null and b/micropeak/MicroPeak.app/Contents/MacOS/JavaApplicationStub differ diff --git a/micropeak/MicroPeak.app/Contents/PkgInfo b/micropeak/MicroPeak.app/Contents/PkgInfo new file mode 100644 index 00000000..8a43480f --- /dev/null +++ b/micropeak/MicroPeak.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLAM.O diff --git a/micropeak/MicroPeak.app/Contents/Resources/AltosUIIcon.icns b/micropeak/MicroPeak.app/Contents/Resources/AltosUIIcon.icns new file mode 100644 index 00000000..fe49f362 Binary files /dev/null and b/micropeak/MicroPeak.app/Contents/Resources/AltosUIIcon.icns differ diff --git a/micropeak/micropeak-fat b/micropeak/micropeak-fat new file mode 100755 index 00000000..ace7548d --- /dev/null +++ b/micropeak/micropeak-fat @@ -0,0 +1,4 @@ +#!/bin/sh +me=`which "$0"` +dir=`dirname "$me"` +exec java -cp "$dir/*" -Djava.library.path="$dir" -jar "$dir"/micropeak-fat.jar "$@" diff --git a/micropeak/micropeak-windows.nsi b/micropeak/micropeak-windows.nsi new file mode 100644 index 00000000..425048bd --- /dev/null +++ b/micropeak/micropeak-windows.nsi @@ -0,0 +1,123 @@ +!addplugindir Instdrv/NSIS/Plugins +; Definitions for Java 1.6 Detection +!define JRE_VERSION "1.6" +!define JRE_ALTERNATE "1.7" +!define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=52247&/jre-6u27-windows-i586-p.exe" +!define PRODUCT_NAME "Altus Metrum Windows Software" + +Name "Altus Metrum MicroPeak Installer" + +; Default install directory +InstallDir "$PROGRAMFILES\AltusMetrum" + +; Tell the installer where to re-install a new version +InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir" + +LicenseText "GNU General Public License Version 2" +LicenseData "../COPYING" + +; Need admin privs for Vista or Win7 +RequestExecutionLevel admin + +ShowInstDetails Show + +ComponentText "Altus Metrum MicroPeak Software Installer" + +Function GetJRE + MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION} 32-bit, it will now \ + be downloaded and installed" + + StrCpy $2 "$TEMP\Java Runtime Environment.exe" + nsisdl::download /TIMEOUT=30000 ${JRE_URL} $2 + Pop $R0 ;Get the return value + StrCmp $R0 "success" +3 + MessageBox MB_OK "Download failed: $R0" + Quit + ExecWait $2 + Delete $2 +FunctionEnd + + +Function DetectJRE + ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \ + "CurrentVersion" + StrCmp $2 ${JRE_VERSION} done + + StrCmp $2 ${JRE_ALTERNATE} done + + Call GetJRE + + done: +FunctionEnd + +; Pages to present + +Page license +Page components +Page directory +Page instfiles + +UninstPage uninstConfirm +UninstPage instfiles + +; And the stuff to install + +Section "MicroPeak Application" + Call DetectJRE + + SetOutPath $INSTDIR + + File "micropeak-fat.jar" + File "AltosLib.jar" + File "AltosUILib.jar" + File "jfreechart.jar" + File "jcommon.jar" + + File "*.dll" + + File "../icon/*.ico" + + CreateShortCut "$SMPROGRAMS\MicroPeak.lnk" "$SYSDIR\javaw.exe" "-jar micropeak-fat.jar" "$INSTDIR\micro-peak.ico" +SectionEnd + +Section "MicroPeak Desktop Shortcut" + CreateShortCut "$DESKTOP\MicroPeak.lnk" "$INSTDIR\micropeak-fat.jar" "" "$INSTDIR\micro-peak.ico" +SectionEnd + +Section "Documentation" + + SetOutPath $INSTDIR + + File "../doc/micropeak.pdf" +SectionEnd + +Section "Uninstaller" + + ; Deal with the uninstaller + + SetOutPath $INSTDIR + + ; Write the install path to the registry + WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR" + + ; Write the uninstall keys for windows + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"' + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1" + + WriteUninstaller "uninstall.exe" +SectionEnd + +Section "Uninstall" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" + DeleteRegKey HKLM "Software\AltusMetrum" + + Delete "$INSTDIR\*.*" + RMDir "$INSTDIR" + + ; Remove shortcuts, if any + Delete "$SMPROGRAMS\MicroPeak.lnk" + Delete "$DESKTOP\MicroPeak.lnk" + +SectionEnd -- cgit v1.2.3 From 605b752080827bb59fcff5af9f1eab9fd5dad76b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jan 2013 09:09:10 -0800 Subject: altosui: Remove AltosVersion.java Version data now stored in AltosUIVersion.java Signed-off-by: Keith Packard --- altosui/AltosVersion.java.in | 22 ---------------------- altosui/Makefile.am | 1 - configure.ac | 1 - 3 files changed, 24 deletions(-) delete mode 100644 altosui/AltosVersion.java.in (limited to 'configure.ac') diff --git a/altosui/AltosVersion.java.in b/altosui/AltosVersion.java.in deleted file mode 100644 index b0b3c0cf..00000000 --- a/altosui/AltosVersion.java.in +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -package altosui; - -public class AltosVersion { - public final static String version = "@VERSION@"; -} diff --git a/altosui/Makefile.am b/altosui/Makefile.am index 494539ae..b3aa1f55 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -87,7 +87,6 @@ altosui_JAVA = \ AltosGraphTime.java \ AltosGraphUI.java \ AltosDataChooser.java \ - AltosVersion.java \ AltosVoice.java \ $(altosui_BT) diff --git a/configure.ac b/configure.ac index 312f9678..ee685344 100644 --- a/configure.ac +++ b/configure.ac @@ -149,7 +149,6 @@ altoslib/Makefile altosuilib/Makefile altosuilib/AltosUIVersion.java altosui/Makefile -altosui/AltosVersion.java altosui/Info.plist libaltos/Makefile micropeak/Makefile -- cgit v1.2.3