diff --git a/VRGNYMusicLights/Librairies/Linux/i686-unknown-linux-gnu/librxtxParallel.so b/VRGNYMusicLights/Librairies/Linux/i686-unknown-linux-gnu/librxtxParallel.so new file mode 100644 index 0000000..476313f Binary files /dev/null and b/VRGNYMusicLights/Librairies/Linux/i686-unknown-linux-gnu/librxtxParallel.so differ diff --git a/VRGNYMusicLights/Librairies/Linux/i686-unknown-linux-gnu/librxtxSerial.so b/VRGNYMusicLights/Librairies/Linux/i686-unknown-linux-gnu/librxtxSerial.so new file mode 100644 index 0000000..e60c5e6 Binary files /dev/null and b/VRGNYMusicLights/Librairies/Linux/i686-unknown-linux-gnu/librxtxSerial.so differ diff --git a/VRGNYMusicLights/Librairies/Linux/ia64-unkown-linux-gnu/librxtxSerial.so b/VRGNYMusicLights/Librairies/Linux/ia64-unkown-linux-gnu/librxtxSerial.so new file mode 100644 index 0000000..916db00 Binary files /dev/null and b/VRGNYMusicLights/Librairies/Linux/ia64-unkown-linux-gnu/librxtxSerial.so differ diff --git a/VRGNYMusicLights/Librairies/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so b/VRGNYMusicLights/Librairies/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so new file mode 100644 index 0000000..eba4e0e Binary files /dev/null and b/VRGNYMusicLights/Librairies/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so differ diff --git a/VRGNYMusicLights/Librairies/Mac_OS_X/README b/VRGNYMusicLights/Librairies/Mac_OS_X/README new file mode 100644 index 0000000..8803841 --- /dev/null +++ b/VRGNYMusicLights/Librairies/Mac_OS_X/README @@ -0,0 +1,4 @@ +Wed Mar 1 12:05:10 MST 2006 +We forgot to update the Mac OS X binary. Previously, it was an old version +(RXTX-2.1-7pre20). This has now been corrected. + diff --git a/VRGNYMusicLights/Librairies/Mac_OS_X/librxtxSerial.jnilib b/VRGNYMusicLights/Librairies/Mac_OS_X/librxtxSerial.jnilib new file mode 100644 index 0000000..2d3f20d Binary files /dev/null and b/VRGNYMusicLights/Librairies/Mac_OS_X/librxtxSerial.jnilib differ diff --git a/VRGNYMusicLights/Librairies/RXTXcomm.jar b/VRGNYMusicLights/Librairies/RXTXcomm.jar new file mode 100644 index 0000000..e1e7503 Binary files /dev/null and b/VRGNYMusicLights/Librairies/RXTXcomm.jar differ diff --git a/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc32-sun-solaris2.8/librxtxSerial-2.1-7.so b/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc32-sun-solaris2.8/librxtxSerial-2.1-7.so new file mode 100644 index 0000000..24d2190 Binary files /dev/null and b/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc32-sun-solaris2.8/librxtxSerial-2.1-7.so differ diff --git a/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc32-sun-solaris2.8/librxtxSerial.so b/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc32-sun-solaris2.8/librxtxSerial.so new file mode 100644 index 0000000..24d2190 Binary files /dev/null and b/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc32-sun-solaris2.8/librxtxSerial.so differ diff --git a/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc64-sun-solaris2.8/librxtxSerial-2.1-7.so b/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc64-sun-solaris2.8/librxtxSerial-2.1-7.so new file mode 100644 index 0000000..e38d78e Binary files /dev/null and b/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc64-sun-solaris2.8/librxtxSerial-2.1-7.so differ diff --git a/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc64-sun-solaris2.8/librxtxSerial.so b/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc64-sun-solaris2.8/librxtxSerial.so new file mode 100644 index 0000000..e38d78e Binary files /dev/null and b/VRGNYMusicLights/Librairies/Solaris/sparc-solaris/sparc64-sun-solaris2.8/librxtxSerial.so differ diff --git a/VRGNYMusicLights/Librairies/Windows/i368-mingw32/README b/VRGNYMusicLights/Librairies/Windows/i368-mingw32/README new file mode 100644 index 0000000..2b2ea6c --- /dev/null +++ b/VRGNYMusicLights/Librairies/Windows/i368-mingw32/README @@ -0,0 +1,3 @@ +Wed Mar 1 12:01:05 MST 2006 +rxtxSerial.dll had to be recomopiled to link in missing native methods. + diff --git a/VRGNYMusicLights/Librairies/Windows/i368-mingw32/rxtxParallel.dll b/VRGNYMusicLights/Librairies/Windows/i368-mingw32/rxtxParallel.dll new file mode 100644 index 0000000..c1bdfce Binary files /dev/null and b/VRGNYMusicLights/Librairies/Windows/i368-mingw32/rxtxParallel.dll differ diff --git a/VRGNYMusicLights/Librairies/Windows/i368-mingw32/rxtxSerial.dll b/VRGNYMusicLights/Librairies/Windows/i368-mingw32/rxtxSerial.dll new file mode 100644 index 0000000..c0e6b58 Binary files /dev/null and b/VRGNYMusicLights/Librairies/Windows/i368-mingw32/rxtxSerial.dll differ diff --git a/VRGNYMusicLights/RxTx INSTALL GUIDE b/VRGNYMusicLights/RxTx INSTALL GUIDE new file mode 100644 index 0000000..6b4c71d --- /dev/null +++ b/VRGNYMusicLights/RxTx INSTALL GUIDE @@ -0,0 +1,57 @@ +Trent Here. I do those ugly brown pages at rxtx.org. Documentation is not +what I do well :) So please help me when you see problems or something is +confusing. + +For more information provided by end users please visit the rxtx wiki at +http://rxtx.qbang.org/wiki. This is also where you can help. + +Short Install Instructions + +Windows + +RXTXcomm.jar goes in \jre\lib\ext (under java) +rxtxSerial.dll goes in \jre\bin + +Mac OS X (x86 and ppc) (there is an Installer with the source) + +RXTXcomm.jar goes in /Library/Java/Extensions +librxtxSerial.jnilib goes in /Library/Java/Extensions +Run fixperm.sh thats in the directory. Fix perms is in the Mac_OS_X +subdirectory. + +Linux (only x86, x86_64, ia64 here but more in the ToyBox) + +RXTXcomm.jar goes in /jre/lib/ext (under java) +librxtxSerial.so goes in /jre/lib/[machine type] (i386 for instance) +Make sure the user is in group lock or uucp so lockfiles work. + +Solaris (sparc only so far) + +RXTXcomm.jar goes in /jre/lib/ext (under java) +librxtxSerial.so goes in /jre/lib/[machine type] +Make sure the user is in group uucp so lockfiles work. + + + + +A person is added to group lock or uucp by editing /etc/groups. Distributions +have various tools but this works: + +lock:x:54: becomes: +lock:x:53:jarvi,taj + +Now jarvi and taj are in group lock. + +Also make sure jarvi and taj have read and write permissions on the port. + + + + +If there are problems please help each other on the wiki and ask questions +on the mail-list. User contributed changes will be used here in the next +release. If you don't like the documentation, you can improve it. + + +-- +Trent Jarvi +tjarvi@qbang.org diff --git a/VRGNYMusicLights/Sources/AnimationPlayer.java b/VRGNYMusicLights/Sources/AnimationPlayer.java new file mode 100644 index 0000000..74dca73 --- /dev/null +++ b/VRGNYMusicLights/Sources/AnimationPlayer.java @@ -0,0 +1,68 @@ +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JPanel; + +public class AnimationPlayer extends JPanel implements ActionListener { + private static final long serialVersionUID = 1L; + + private JButton backward; + private JButton stop; + private JButton play; + private JButton pause; + private JButton forward; + + public AnimationPlayer() { this(BoxLayout.LINE_AXIS); } + public AnimationPlayer(int direction) { + setLayout(new BoxLayout(this, direction)); + + add(Box.createHorizontalGlue()); + + // backward button + backward = new JButton(new ImageIcon(getClass().getResource("/icons/backward.png"))); + backward.addActionListener(this); + add(backward); + + // stop button + stop = new JButton(new ImageIcon(getClass().getResource("/icons/stop.png"))); + stop.addActionListener(this); + add(stop); + + // play button + play = new JButton(new ImageIcon(getClass().getResource("/icons/play.png"))); + play.addActionListener(this); + add(play); + + // pause button + pause = new JButton(new ImageIcon(getClass().getResource("/icons/pause.png"))); + pause.addActionListener(this); + add(pause); + + // forward button + forward = new JButton(new ImageIcon(getClass().getResource("/icons/forward.png"))); + forward.addActionListener(this); + add(forward); + + add(Box.createHorizontalGlue()); + } + + @Override + public void actionPerformed(ActionEvent e) { + // TODO player actions + if(e.getSource() == backward) { + + }else if(e.getSource() == stop) { + + }else if(e.getSource() == play) { + + }else if(e.getSource() == pause) { + + }else if(e.getSource() == forward) { + + } + } +} diff --git a/VRGNYMusicLights/Sources/Interface.java b/VRGNYMusicLights/Sources/Interface.java new file mode 100644 index 0000000..ca80079 --- /dev/null +++ b/VRGNYMusicLights/Sources/Interface.java @@ -0,0 +1,58 @@ +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +import javax.swing.BoxLayout; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; + +public class Interface extends JFrame{ + private static final long serialVersionUID = 1L; + private static final Font titleFont = new Font(new JLabel().getFont().getName(), Font.BOLD, 14); + private static final Font defaultFont = new Font(new JLabel().getFont().getName(), Font.PLAIN, new JLabel().getFont().getSize()); + + public Interface(final Runnable executeOnClose) { + super("VRGNYMusicLights"); + //this.actionList = actionList; + setResizable(false); + populateWindow(); + pack(); + setLocationRelativeTo(null); // center window + + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + if(executeOnClose != null) + executeOnClose.run(); + dispose(); + } + }); + } + + private void populateWindow() { + JPanel mainPanel = new JPanel(new BorderLayout()); + addPlayPanel(mainPanel); + add(mainPanel); + } + + private void addPlayPanel(JPanel parent) { + JPanel playPanel = new JPanel(new BorderLayout()); + + // title + JLabel title = new JLabel("Player :"); + title.setFont(titleFont); + playPanel.add(title, BorderLayout.NORTH); + + // lights + playPanel.add(new LightCanvasJPanel(), BorderLayout.CENTER); + + // controls + AnimationPlayer animPlayer = new AnimationPlayer(); + animPlayer.setAlignmentX(CENTER_ALIGNMENT); + playPanel.add(animPlayer, BorderLayout.SOUTH); + + parent.add(playPanel, BorderLayout.SOUTH); + } +} diff --git a/VRGNYMusicLights/Sources/InvalidPatternException.java b/VRGNYMusicLights/Sources/InvalidPatternException.java new file mode 100644 index 0000000..2aaaaf1 --- /dev/null +++ b/VRGNYMusicLights/Sources/InvalidPatternException.java @@ -0,0 +1,8 @@ + +public class InvalidPatternException extends RuntimeException { + private static final long serialVersionUID = 1L; + + public InvalidPatternException() { + super("Invalid pattern given. Length must be equal to 4."); + } +} diff --git a/VRGNYMusicLights/Sources/LightCanvasJPanel.java b/VRGNYMusicLights/Sources/LightCanvasJPanel.java new file mode 100644 index 0000000..56a58fe --- /dev/null +++ b/VRGNYMusicLights/Sources/LightCanvasJPanel.java @@ -0,0 +1,51 @@ +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; + +import javax.swing.JPanel; + +public class LightCanvasJPanel extends JPanel { + public static final double[][] DEFAULT_LIGHT_COORDS = new double[][] { + {0, 0} , {0.2, 0} , {0.4, 0} , {0.6 , 0}, {0.8, 0} , {1, 0} , + {0, 0.2}, {0.2, 0.2}, {0.4, 0.2}, {0.6, 0.2}, {0.8, 0.2}, {1, 0.2}, + {0, 0.4}, {0.2, 0.4}, {0.4, 0.4}, {0.6, 0.4}, {0.8, 0.4}, {1, 0.4}, + {0, 0.6}, {0.2, 0.6}, {0.4, 0.6}, {0.6, 0.6}, {0.8, 0.6}, {1, 0.6}, + {0, 0.8}, {0.2, 0.8}, {0.4, 0.8}, {0.6, 0.8}, {0.8, 0.8}, {1, 0.8}, + {0, 1} , {0.2, 1} , {0.4, 1} , {0.6, 1} , {0.8, 1} , {1, 1} , + }; + + private static final long serialVersionUID = 1L; + private static final int WIDTH = 320; // = 300 + padding * 2 + private static final int HEIGHT = 220; // = 200 + padding * 2 + private static final int LIGHT_RADIUS = 4; + private static final int PADDING = 10; + private double[][] lightsCoords; + + /** + * @param lightCoords : double[LightID][X = 0, Y = 1] = coordinates as a percentage [0, 1] + */ + public LightCanvasJPanel() {this(DEFAULT_LIGHT_COORDS);} + public LightCanvasJPanel(double[][] lightsCoords) { + this.lightsCoords = lightsCoords; + setPreferredSize(new Dimension(WIDTH, HEIGHT)); + } + + @Override + protected void paintComponent(Graphics g) { + // background + g.setColor(Color.WHITE); + g.fillRect(0, 0, WIDTH, HEIGHT); + + // lights + if(lightsCoords == null) return; + g.setColor(Color.BLACK); + for(double[] light : lightsCoords) { + if(light.length != 2) + throw new MalformedCoordinates(); + int centerX = (int) (light[0] * (WIDTH - PADDING * 2)) + PADDING; + int centerY = (int) (light[1] * (HEIGHT - PADDING * 2)) + PADDING; + + g.fillOval(centerX - LIGHT_RADIUS, centerY - LIGHT_RADIUS, LIGHT_RADIUS * 2, LIGHT_RADIUS * 2); + } + } +} diff --git a/VRGNYMusicLights/Sources/Main.java b/VRGNYMusicLights/Sources/Main.java new file mode 100644 index 0000000..3e656b6 --- /dev/null +++ b/VRGNYMusicLights/Sources/Main.java @@ -0,0 +1,30 @@ + +/* TODO list : + * - keyboard listener for animation player (play / pause = space, forward = semicolon, backward = comma, stop = backspace) + */ +public class Main { + public static void main(String[] args) throws InterruptedException { + /* FIXME interface testing in progress + + String serialPort = null; + try { + serialPort = SerialPortChooserDialog.showSerialPortChooserDialog(); + } catch (NoSerialPortException e) { + JOptionPane.showMessageDialog(null, "No serial port available !", "Error", JOptionPane.ERROR_MESSAGE); + System.exit(-1); + } + if(serialPort == null) System.exit(-1); + + final SerialCom serialCom = new SerialCom(serialPort); + // arduino need time before accepting serial data + Thread.sleep(1000);*/ + + Interface i = new Interface(new Runnable() { + @Override + public void run() { + //serialCom.close(); + } + }); + i.setVisible(true); + } +} diff --git a/VRGNYMusicLights/Sources/MalformedCoordinates.java b/VRGNYMusicLights/Sources/MalformedCoordinates.java new file mode 100644 index 0000000..dceeb29 --- /dev/null +++ b/VRGNYMusicLights/Sources/MalformedCoordinates.java @@ -0,0 +1,8 @@ + +public class MalformedCoordinates extends RuntimeException { + private static final long serialVersionUID = 1L; + + public MalformedCoordinates() { + super("Wrong format of coordinates given"); + } +} diff --git a/VRGNYMusicLights/Sources/Music.java b/VRGNYMusicLights/Sources/Music.java new file mode 100644 index 0000000..d489d01 --- /dev/null +++ b/VRGNYMusicLights/Sources/Music.java @@ -0,0 +1,16 @@ + +public class Music { + private MusicPattern pattern; + private MusicPath path; + private long startDelai; // in ms + private long length; // in ms + + public Music(MusicPattern pattern, MusicPath path, long startDelai, long length) { + this.pattern = pattern; + this.path = path; + this.startDelai = startDelai; + this.length = length; + + //call MusicPath transform() + } +} diff --git a/VRGNYMusicLights/Sources/MusicList.java b/VRGNYMusicLights/Sources/MusicList.java new file mode 100644 index 0000000..c6ffa45 --- /dev/null +++ b/VRGNYMusicLights/Sources/MusicList.java @@ -0,0 +1,11 @@ +import java.util.ArrayList; + +public class MusicList { + private ArrayList musics; + private SerialCom serialCom; + + public MusicList(SerialCom serialCom) { + this.serialCom = serialCom; + musics = new ArrayList<>(); + } +} diff --git a/VRGNYMusicLights/Sources/MusicPath.java b/VRGNYMusicLights/Sources/MusicPath.java new file mode 100644 index 0000000..8921d8a --- /dev/null +++ b/VRGNYMusicLights/Sources/MusicPath.java @@ -0,0 +1,20 @@ + +public class MusicPath { + private static final int VERTICAL_DOWN = 0; + private static final int VERTICAL_UP = 1; + private static final int HORIZONTAL_DOWN = 2; + private static final int HORIZONTAL_UP = 3; + private static final int DIAGONAL_TOP_RIGHT_DOWN_LEFT = 4; + private static final int DIAGONAL_TOP_LEFT_DOWN_RIGHT = 5; + private static final int CENTER_OUT = 6; + private static final int CENTER_IN = 7; + + private int animation; + + public MusicPath(int animation) { + this.animation = animation; + } + + // TODO transform music according to animation + // what format ? int[nled][pattern] (ms) ? +} diff --git a/VRGNYMusicLights/Sources/MusicPattern.java b/VRGNYMusicLights/Sources/MusicPattern.java new file mode 100644 index 0000000..c6269b1 --- /dev/null +++ b/VRGNYMusicLights/Sources/MusicPattern.java @@ -0,0 +1,16 @@ + +public class MusicPattern { + /* Pattern definition : + * 0 : low time + * 1 : rise time + * 2 : high time + * 3 : fall time + */ + private int[] pattern; // in ms + + public MusicPattern(int[] pattern) { + if(pattern.length != 4) + throw new InvalidPatternException(); + this.pattern = pattern; + } +} diff --git a/VRGNYMusicLights/Sources/NoSerialPortException.java b/VRGNYMusicLights/Sources/NoSerialPortException.java new file mode 100644 index 0000000..c29ea0c --- /dev/null +++ b/VRGNYMusicLights/Sources/NoSerialPortException.java @@ -0,0 +1,8 @@ + +public class NoSerialPortException extends Exception { + private static final long serialVersionUID = 1L; + + public NoSerialPortException() { + super("No serial port available !"); + } +} diff --git a/VRGNYMusicLights/Sources/SerialCom.java b/VRGNYMusicLights/Sources/SerialCom.java new file mode 100644 index 0000000..3c265ea --- /dev/null +++ b/VRGNYMusicLights/Sources/SerialCom.java @@ -0,0 +1,82 @@ +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Enumeration; + +import gnu.io.CommPortIdentifier; +import gnu.io.PortInUseException; +import gnu.io.SerialPort; +import gnu.io.UnsupportedCommOperationException; + +public class SerialCom { + private static final int DATA_RATE = 9600; + private static final int TIME_OUT = 2000; + private static final int BUFFER_SIZE = 1024; + + private SerialPort serialPort; + private InputStream input; + private OutputStream output; + + public SerialCom(int portNumberWindows) { this("COM" + String.valueOf(portNumberWindows)); } + public SerialCom(String portName) { + CommPortIdentifier portId = null; + Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); + + // Search for serial port + while (portEnum.hasMoreElements()) { + CommPortIdentifier currPortId = (CommPortIdentifier) portEnum.nextElement(); + if (currPortId.getName().equals(portName)) { + portId = currPortId; + break; + } + } + if (portId == null) + throw new SerialComPortException(portName); + + // open connection + try { + serialPort = (SerialPort) portId.open(this.getClass().getName(), TIME_OUT); + serialPort.setSerialPortParams(DATA_RATE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); + + input = serialPort.getInputStream(); + output = serialPort.getOutputStream(); + } catch (IOException + | UnsupportedCommOperationException + | PortInUseException e) { + throw new SerialComPortException(portName); + } + } + + public void close() { + try { + input.close(); + output.close(); + } catch (IOException e) { + e.printStackTrace(); + } + serialPort.removeEventListener(); + serialPort.close(); + } + public void send(byte[] bytes) { + try { + this.output.write(bytes); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public byte[] recieve() { + byte[] buffer = new byte[BUFFER_SIZE]; + int len = -1; + + try { len = this.input.read(buffer); } + catch (IOException e) { return null; } + + if(len == -1 || len == 0) + return null; + byte[] data = new byte[len]; + for(int i=0; i portNames; + private String choosedPort = null; + + private JList list; + private JButton ok; + private JButton cancel; + + private SerialPortChooserDialog() { + Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); + portNames = new ArrayList<>(); + + while (portEnum.hasMoreElements()) { + CommPortIdentifier currPortId = (CommPortIdentifier) portEnum.nextElement(); + portNames.add(currPortId.getName()); + } + + onlyOneChoice = portNames.size() <= 1; + emptyChoice = portNames.size() == 0; + if(onlyOneChoice || emptyChoice) + return; + + // JDialog creation + JPanel mainPanel = new JPanel(new BorderLayout()); + setModal(true); + setTitle("Serial port chooser"); + + // title + mainPanel.add(new JLabel("Choose a serial port : "), BorderLayout.NORTH); + + // list ports + DefaultListModel listModel = new DefaultListModel<>(); + for(String str : portNames) + listModel.addElement(str); + list = new JList<>(listModel); + list.addListSelectionListener(this); + list.setVisibleRowCount(3); + list.setLayoutOrientation(JList.VERTICAL); + list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + JScrollPane scrollPane = new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setPreferredSize(new Dimension(200, 100)); + mainPanel.add(scrollPane, BorderLayout.CENTER); + + // buttons ok / cancel + JPanel borderLayoutPanel = new JPanel(new BorderLayout()); + JPanel buttonsLayout = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 3)); + ok = new JButton("Ok"); + cancel = new JButton("Cancel"); + ok.addActionListener(this); + cancel.addActionListener(this); + ok.setEnabled(false); + buttonsLayout.add(cancel); + buttonsLayout.add(ok); + borderLayoutPanel.add(buttonsLayout, BorderLayout.EAST); + mainPanel.add(borderLayoutPanel, BorderLayout.SOUTH); + + // padding + JPanel padding = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5)); + padding.add(mainPanel); + add(padding); + + setResizable(false); + pack(); + setLocationRelativeTo(null); + setVisible(true); + } + + public static String showSerialPortChooserDialog() throws NoSerialPortException { + SerialPortChooserDialog dialog = new SerialPortChooserDialog(); + if(dialog.emptyChoice) + throw new NoSerialPortException(); + if(dialog.onlyOneChoice) + return dialog.portNames.get(0); + return dialog.choosedPort; + } + + @Override + public void actionPerformed(ActionEvent e) { + if(e.getSource() == ok) { + choosedPort = list.getSelectedValue(); + dispose(); + } else if(e.getSource() == cancel) { + dispose(); + } + } + + @Override + public void valueChanged(ListSelectionEvent e) { + if(e.getSource() == list) { + ok.setEnabled(list.getSelectedIndex() != -1); + } + } +} diff --git a/VRGNYMusicLights/Sources/icons/backward.png b/VRGNYMusicLights/Sources/icons/backward.png new file mode 100644 index 0000000..afe80fa Binary files /dev/null and b/VRGNYMusicLights/Sources/icons/backward.png differ diff --git a/VRGNYMusicLights/Sources/icons/forward.png b/VRGNYMusicLights/Sources/icons/forward.png new file mode 100644 index 0000000..d5a9a81 Binary files /dev/null and b/VRGNYMusicLights/Sources/icons/forward.png differ diff --git a/VRGNYMusicLights/Sources/icons/pause.png b/VRGNYMusicLights/Sources/icons/pause.png new file mode 100644 index 0000000..5cdd300 Binary files /dev/null and b/VRGNYMusicLights/Sources/icons/pause.png differ diff --git a/VRGNYMusicLights/Sources/icons/play.png b/VRGNYMusicLights/Sources/icons/play.png new file mode 100644 index 0000000..38c4f20 Binary files /dev/null and b/VRGNYMusicLights/Sources/icons/play.png differ diff --git a/VRGNYMusicLights/Sources/icons/stop.png b/VRGNYMusicLights/Sources/icons/stop.png new file mode 100644 index 0000000..9e5f9a2 Binary files /dev/null and b/VRGNYMusicLights/Sources/icons/stop.png differ -- libgit2 0.21.2