diff --git a/app/build.xml b/app/build.xml old mode 100644 new mode 100755 index 458df0698fd..8b830779789 --- a/app/build.xml +++ b/app/build.xml @@ -44,7 +44,7 @@ encoding="UTF-8" includeAntRuntime="false" debug="true" - classpath="../core/core.jar; ${env.JAVA_HOME}/lib/tools.jar; lib/ant.jar; lib/ant-launcher.jar; lib/apple.jar; lib/ecj.jar; lib/jna.jar; lib/RXTXcomm.jar" /> + classpath="../core/core.jar; ${env.JAVA_HOME}/lib/tools.jar; lib/ant.jar; lib/ant-launcher.jar; lib/apple.jar; lib/ecj.jar; lib/jna.jar; lib/RXTXcomm.jar; lib/jfreechart.jar; lib/jcommon.jar; lib/iText.jar; lib/swtgraphics2d.jar; lib/servlet.jar; lib/jfreechart-swt.jar; lib/gnujaxp.jar" /> diff --git a/app/lib/RXTXcomm.jar b/app/lib/RXTXcomm.jar old mode 100644 new mode 100755 diff --git a/app/lib/antlr.jar b/app/lib/antlr.jar old mode 100644 new mode 100755 diff --git a/app/lib/ecj.jar b/app/lib/ecj.jar old mode 100644 new mode 100755 diff --git a/app/lib/gnujaxp.jar b/app/lib/gnujaxp.jar new file mode 100644 index 00000000000..573f8fe0fa2 Binary files /dev/null and b/app/lib/gnujaxp.jar differ diff --git a/app/lib/iText.jar b/app/lib/iText.jar new file mode 100644 index 00000000000..f28be38e38c Binary files /dev/null and b/app/lib/iText.jar differ diff --git a/app/lib/jcommon.jar b/app/lib/jcommon.jar new file mode 100644 index 00000000000..4cd680744b4 Binary files /dev/null and b/app/lib/jcommon.jar differ diff --git a/app/lib/jfreechart-experimental.jar b/app/lib/jfreechart-experimental.jar new file mode 100644 index 00000000000..3de3560d611 Binary files /dev/null and b/app/lib/jfreechart-experimental.jar differ diff --git a/app/lib/jfreechart-swt.jar b/app/lib/jfreechart-swt.jar new file mode 100644 index 00000000000..8193fc9eb1b Binary files /dev/null and b/app/lib/jfreechart-swt.jar differ diff --git a/app/lib/jfreechart.jar b/app/lib/jfreechart.jar new file mode 100644 index 00000000000..83c6993181b Binary files /dev/null and b/app/lib/jfreechart.jar differ diff --git a/app/lib/jna.jar b/app/lib/jna.jar old mode 100644 new mode 100755 diff --git a/app/lib/junit.jar b/app/lib/junit.jar new file mode 100644 index 00000000000..674d71e89ea Binary files /dev/null and b/app/lib/junit.jar differ diff --git a/app/lib/servlet.jar b/app/lib/servlet.jar new file mode 100644 index 00000000000..d368d0f6d37 Binary files /dev/null and b/app/lib/servlet.jar differ diff --git a/app/lib/swtgraphics2d.jar b/app/lib/swtgraphics2d.jar new file mode 100644 index 00000000000..678393c976f Binary files /dev/null and b/app/lib/swtgraphics2d.jar differ diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java old mode 100644 new mode 100755 index dd6ad561448..84ef21200aa --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -99,6 +99,7 @@ public class Editor extends JFrame implements RunnerListener { static SerialMenuListener serialMenuListener; static SerialMonitor serialMonitor; + static GraphMonitor graphMonitor; EditorHeader header; EditorStatus status; @@ -200,7 +201,10 @@ public void windowDeactivated(WindowEvent e) { serialMonitor = new SerialMonitor(Preferences.get("serial.port")); serialMonitor.setIconImage(getIconImage()); } - + if(graphMonitor == null){ + graphMonitor = new GraphMonitor(Preferences.get("serial.port")); + graphMonitor.setIconImage(getIconImage()); + } buildMenuBar(); // For rev 0120, placing things inside a JPanel @@ -950,6 +954,10 @@ protected void selectSerialPort(String name) { serialMonitor.closeSerialPort(); serialMonitor.setVisible(false); serialMonitor = new SerialMonitor(Preferences.get("serial.port")); + graphMonitor.closeSerialPort(); + graphMonitor.setVisible(false); + graphMonitor = new GraphMonitor(Preferences.get("serial.port")); + //System.out.println("set to " + get("serial.port")); } @@ -2391,7 +2399,8 @@ public void run() { try { serialMonitor.closeSerialPort(); serialMonitor.setVisible(false); - + graphMonitor.closeSerialPort(); + graphMonitor.setVisible(false); uploading = true; boolean success = sketch.exportApplet(true); @@ -2465,7 +2474,16 @@ public void handleSerial() { statusError(e); } } - + public void handleGraph(){ + if (uploading) return; + try{ + graphMonitor.openSerialPort(); + graphMonitor.setVisible(true); + } catch(SerialException e){ + statusError(e); + } + + } protected void handleBurnBootloader() { console.clear(); diff --git a/app/src/processing/app/EditorToolbar.java b/app/src/processing/app/EditorToolbar.java old mode 100644 new mode 100755 index 6b04aa2d98f..d363035e67c --- a/app/src/processing/app/EditorToolbar.java +++ b/app/src/processing/app/EditorToolbar.java @@ -37,12 +37,12 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key /** Rollover titles for each button. */ static final String title[] = { - "Verify", "Upload", "New", "Open", "Save", "Serial Monitor" + "Verify", "Upload", "New", "Open", "Save", "Serial Monitor" , "graph" }; /** Titles for each button when the shift key is pressed. */ static final String titleShift[] = { - "Verify", "Upload Using Programmer", "New Editor Window", "Open in Another Window", "Save", "Serial Monitor" + "Verify", "Upload Using Programmer", "New Editor Window", "Open in Another Window", "Save", "Serial Monitor" , "graph" }; static final int BUTTON_COUNT = title.length; @@ -64,7 +64,8 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key static final int SAVE = 4; static final int SERIAL = 5; - + static final int GRAPH = 6; + static final int INACTIVE = 0; static final int ROLLOVER = 1; static final int ACTIVE = 2; @@ -108,8 +109,9 @@ public EditorToolbar(Editor editor, JMenu menu) { which[buttonCount++] = NEW; which[buttonCount++] = OPEN; which[buttonCount++] = SAVE; - which[buttonCount++] = SERIAL; + which[buttonCount++] = SERIAL; + which[buttonCount++] = GRAPH; currentRollover = -1; bgcolor = Theme.getColor("buttons.bgcolor"); @@ -172,8 +174,12 @@ public void paintComponent(Graphics screen) { } // Serial button must be on the right - x1[SERIAL] = width - BUTTON_WIDTH - 14; - x2[SERIAL] = width - 14; + x1[GRAPH] = width - BUTTON_WIDTH - 14;//change this to the graph button and add the serial button to the left of the graph button(2*BUTTON_WIDTH for SERIAL) + x2[GRAPH] = width - 14; + + x1[SERIAL] = width - 2*BUTTON_WIDTH - 14;//change this to the graph button and add the serial button to the left of the graph button(2*BUTTON_WIDTH for SERIAL) + x2[SERIAL] = width - BUTTON_WIDTH-14; + } Graphics g = offscreen.getGraphics(); g.setColor(bgcolor); //getBackground()); @@ -200,8 +206,8 @@ public void paintComponent(Graphics screen) { if (currentRollover != -1) { int statusY = (BUTTON_HEIGHT + g.getFontMetrics().getAscent()) / 2; String status = shiftPressed ? titleShift[currentRollover] : title[currentRollover]; - if (currentRollover != SERIAL) - g.drawString(status, (buttonCount-1) * BUTTON_WIDTH + 3 * BUTTON_GAP, statusY); + if (currentRollover != SERIAL && currentRollover!= GRAPH) + g.drawString(status, (buttonCount-2) * BUTTON_WIDTH + 3 * BUTTON_GAP, statusY); else { int statusX = x1[SERIAL] - BUTTON_GAP; statusX -= g.getFontMetrics().stringWidth(status); @@ -351,6 +357,10 @@ public void mousePressed(MouseEvent e) { case SERIAL: editor.handleSerial(); break; + case GRAPH: + editor.handleGraph(); + break; + } } diff --git a/app/src/processing/app/Graph.java b/app/src/processing/app/Graph.java new file mode 100644 index 00000000000..9a2bb3c32e8 --- /dev/null +++ b/app/src/processing/app/Graph.java @@ -0,0 +1,48 @@ +package processing.app; +//import processing.core.*; + +import processing.app.debug.MessageConsumer; + + +import java.io.*; +import java.util.*; +import org.jfree.chart.*; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartPanel; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.NumberTickUnit; +import org.jfree.chart.axis.TickUnits; +import org.jfree.chart.axis.ValueAxis; +import org.jfree.chart.plot.DatasetRenderingOrder; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; +import org.jfree.chart.renderer.xy.XYStepRenderer; +import org.jfree.data.time.Millisecond; +import org.jfree.data.time.TimeTableXYDataset; + + +public class Graph { + + private TimeTableXYDataset data; + private String name; + public Graph(){ + data = new TimeTableXYDataset(); + name="a"; + } + public void add(Millisecond y, int x){ + data.add(y,x,name); + } + public void reset(){ + // data=null; //does not work :S + // data=new TimeTableXYDataset(); + } + public ChartPanel panel(){ + JFreeChart chart = ChartFactory.createXYLineChart(null, null, null, + data, PlotOrientation.VERTICAL, + false, false, false); + ChartPanel panel = new ChartPanel(chart); + + return panel; + } +} diff --git a/app/src/processing/app/GraphMonitor.java b/app/src/processing/app/GraphMonitor.java new file mode 100644 index 00000000000..4659d7661d6 --- /dev/null +++ b/app/src/processing/app/GraphMonitor.java @@ -0,0 +1,231 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + 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; 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 + 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 +*/ +//TODO: change to Graphmonitor it is still a copy of serialmonitor, also create 1 virtual class for handling serial displaying. +package processing.app; + +import processing.app.debug.MessageConsumer; +import processing.core.*; + +import java.awt.*; +import java.util.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import javax.swing.text.*; +import org.jfree.chart.*; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartPanel; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.NumberTickUnit; +import org.jfree.chart.axis.TickUnits; +import org.jfree.chart.axis.ValueAxis; +import org.jfree.chart.plot.DatasetRenderingOrder; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; +import org.jfree.chart.renderer.xy.XYStepRenderer; +import org.jfree.data.time.Millisecond; +import org.jfree.data.time.TimeTableXYDataset; +public class GraphMonitor extends JFrame implements MessageConsumer { + private Serial serial; + private String port; + private JTextArea textArea; + private JTextArea graphArea; + private JScrollPane scrollPane; + private JScrollPane graphScrollPane; + private GraphToolbar toolbar; + private JTextField textField; + private JButton sendButton; + private JCheckBox autoscrollBox; + private JComboBox lineEndings; + private JComboBox serialRates; + private int serialRate; + private boolean start=false; + private long starttime; + private LinkedList stringdata; + private Graph graph; + private int hz=1000; + public GraphMonitor(String port) { + super(port); + + this.port = port; + graph= new Graph(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + closeSerialPort(); + } + }); + + // obvious, no? + KeyStroke wc = Editor.WINDOW_CLOSE_KEYSTROKE; + getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(wc, "close"); + getRootPane().getActionMap().put("close", new AbstractAction() { + public void actionPerformed(ActionEvent e) { + closeSerialPort(); + setVisible(false); + }}); + + getContentPane().setLayout(new BorderLayout()); + stringdata= new LinkedList(); + Font font = Theme.getFont("console.font"); + toolbar= new GraphToolbar(this,null); + textArea = new JTextArea(16, 10); + textArea.setEditable(false); + textArea.setFont(font); + // don't automatically update the caret. that way we can manually decide + // whether or not to do so based on the autoscroll checkbox. + ((DefaultCaret)textArea.getCaret()).setUpdatePolicy(DefaultCaret.NEVER_UPDATE); + textField = new JTextField(40); + textField.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + hz=1000/Integer.valueOf(textField.getText()).intValue(); + }}); + scrollPane = new JScrollPane(textArea); + JPanel pane = new JPanel(); + pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); + pane.setBorder(new EmptyBorder(4, 4, 4, 4)); + pane.add(graph.panel()); + pane.add(scrollPane); + getContentPane().add(toolbar,BorderLayout.NORTH); + getContentPane().add(pane, BorderLayout.CENTER); + getContentPane().add(textField, BorderLayout.SOUTH); + pack(); + + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + if (Preferences.get("last.screen.height") != null) { + // if screen size has changed, the window coordinates no longer + // make sense, so don't use them unless they're identical + int screenW = Preferences.getInteger("last.screen.width"); + int screenH = Preferences.getInteger("last.screen.height"); + if ((screen.width == screenW) && (screen.height == screenH)) { + String locationStr = Preferences.get("last.serial.location"); + if (locationStr != null) { + int[] location = PApplet.parseInt(PApplet.split(locationStr, ',')); + setPlacement(location); + } + } + } + } + + protected void setPlacement(int[] location) { + setBounds(location[0], location[1], location[2], location[3]); + } + + protected int[] getPlacement() { + int[] location = new int[4]; + + // Get the dimensions of the Frame + Rectangle bounds = getBounds(); + location[0] = bounds.x; + location[1] = bounds.y; + location[2] = bounds.width; + location[3] = bounds.height; + + return location; + } + + private void send(String s) { + if (serial != null) { + switch (lineEndings.getSelectedIndex()) { + case 1: s += "\n"; break; + case 2: s += "\r"; break; + case 3: s += "\r\n"; break; + } + serial.write(s); + } + } + + public void openSerialPort() throws SerialException { + if (serial != null) return; + + serial = new Serial(port, 9600); + serial.addListener(this); + } + + public void closeSerialPort() { + if (serial != null) { + int[] location = getPlacement(); + String locationStr = PApplet.join(PApplet.str(location), ","); + Preferences.set("last.serial.location", locationStr); + textArea.setText(""); + serial.dispose(); + serial = null; + } + } + + public void message(final String s) { + //System.err.println(serial.readString()); + SwingUtilities.invokeLater(new Runnable() {//TODO implement 2 arrays for x and y values + public void run() { + if (start) { + addtobuffer(s); + } + textArea.append(s); + textArea.setCaretPosition(textArea.getDocument().getLength()); + }}); + } + public void addtobuffer(String s){ + for (int i=0; i==(s.length()-1);i++ ) { + stringdata.add(s.charAt(i)); + } + + } + public void handleStart(){ + start=true; + starttime=System.currentTimeMillis(); + //serial.write("****"); + //graph.reset(); + if (textField.getText()!="") { + hz=1000/Integer.valueOf(textField.getText()).intValue(); + + } + } + public void handleStop(){ + start=false; + + //serial.write("****"); + parse(); + } + public void parse(){ + graph.reset(); + int count=0; + String number=""; + char c; + int isNumber=1; + while(stringdata.size()!=0){ + while(isNumber==1){ + c=stringdata.poll(); + if(Character.isDigit(c)){ + number +=c; + }else{ + isNumber=0; + } + } + if(number.length()>0){ + int temp= Integer.valueOf( number ).intValue(); + graph.add(new Millisecond(new Date(count*hz)),temp); + number=""; + count++; + } + isNumber=1; + } + //textArea.append("===="); + + } +} diff --git a/app/src/processing/app/GraphToolbar.java b/app/src/processing/app/GraphToolbar.java new file mode 100755 index 00000000000..95d24742061 --- /dev/null +++ b/app/src/processing/app/GraphToolbar.java @@ -0,0 +1,378 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-09 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + 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; 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 + 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 processing.app; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; +import javax.swing.event.*; + + +/** + * run/stop/etc buttons for the ide + */ +public class GraphToolbar extends JComponent implements MouseInputListener, KeyListener { + + /** Rollover titles for each button. */ + static final String title[] = { + "Start", "Stop", "Copy" + }; + + /** Titles for each button when the shift key is pressed. */ + static final String titleShift[] = { + "Start", "Stop", "Copy" + }; + + static final int BUTTON_COUNT = title.length; + /** Width of each toolbar button. */ + static final int BUTTON_WIDTH = 27; + /** Height of each toolbar button. */ + static final int BUTTON_HEIGHT = 32; + /** The amount of space between groups of buttons on the toolbar. */ + static final int BUTTON_GAP = 5; + /** Size of the button image being chopped up. */ + static final int BUTTON_IMAGE_SIZE = 33; + + + static final int START = 0; + static final int STOP = 1; + + static final int COPY = 2; + + static final int INACTIVE = 0; + static final int ROLLOVER = 1; + static final int ACTIVE = 2; + + GraphMonitor monitor; + + Image offscreen; + int width, height; + + Color bgcolor; + + static Image[][] buttonImages; + int currentRollover; + + JPopupMenu popup; + JMenu menu; + + int buttonCount; + int[] state = new int[BUTTON_COUNT]; + Image[] stateImage; + int which[]; // mapping indices to implementation + + int x1[], x2[]; + int y1, y2; + + Font statusFont; + Color statusColor; + + boolean shiftPressed; + + public GraphToolbar(GraphMonitor monitor, JMenu menu) { + this.monitor = monitor; + this.menu = menu; + + buttonCount = 0; + which = new int[BUTTON_COUNT]; + + //which[buttonCount++] = NOTHING; + which[buttonCount++] = START; + which[buttonCount++] = STOP; + which[buttonCount++] = COPY; + currentRollover = -1; + + bgcolor = Theme.getColor("buttons.bgcolor"); + statusFont = Theme.getFont("buttons.status.font"); + statusColor = Theme.getColor("buttons.status.color"); + + addMouseListener(this); + addMouseMotionListener(this); + } + + protected void loadButtons() { + Image allButtons = Base.getThemeImage("graph-buttons.gif", this); + buttonImages = new Image[BUTTON_COUNT][3]; + + for (int i = 0; i < BUTTON_COUNT; i++) { + for (int state = 0; state < 3; state++) { + Image image = createImage(BUTTON_WIDTH, BUTTON_HEIGHT); + Graphics g = image.getGraphics(); + g.drawImage(allButtons, + -(i*BUTTON_IMAGE_SIZE) - 3, + (-2 + state)*BUTTON_IMAGE_SIZE, null); + buttonImages[i][state] = image; + } + } + } + + @Override + public void paintComponent(Graphics screen) { + // this data is shared by all EditorToolbar instances + if (buttonImages == null) { + loadButtons(); + } + + // this happens once per instance of EditorToolbar + if (stateImage == null) { + state = new int[buttonCount]; + stateImage = new Image[buttonCount]; + for (int i = 0; i < buttonCount; i++) { + setState(i, INACTIVE, false); + } + y1 = 0; + y2 = BUTTON_HEIGHT; + x1 = new int[buttonCount]; + x2 = new int[buttonCount]; + } + + Dimension size = getSize(); + if ((offscreen == null) || + (size.width != width) || (size.height != height)) { + offscreen = createImage(size.width, size.height); + width = size.width; + height = size.height; + + int offsetX = 3; + for (int i = 0; i < buttonCount; i++) { + x1[i] = offsetX; + if (i == 2 || i == 6) x1[i] += BUTTON_GAP; + x2[i] = x1[i] + BUTTON_WIDTH; + offsetX = x2[i]; + } + + + } + Graphics g = offscreen.getGraphics(); + g.setColor(bgcolor); //getBackground()); + g.fillRect(0, 0, width, height); + + for (int i = 0; i < buttonCount; i++) { + g.drawImage(stateImage[i], x1[i], y1, null); + } + + g.setColor(statusColor); + g.setFont(statusFont); + + /* + // if i ever find the guy who wrote the java2d api, i will hurt him. + * + * whereas I love the Java2D API. --jdf. lol. + * + Graphics2D g2 = (Graphics2D) g; + FontRenderContext frc = g2.getFontRenderContext(); + float statusW = (float) statusFont.getStringBounds(status, frc).getWidth(); + float statusX = (getSize().width - statusW) / 2; + g2.drawString(status, statusX, statusY); + */ + if (currentRollover != -1) { + int statusY = (BUTTON_HEIGHT + g.getFontMetrics().getAscent()) / 2; + String status = shiftPressed ? titleShift[currentRollover] : title[currentRollover]; + g.drawString(status, (buttonCount) * BUTTON_WIDTH + 3 * BUTTON_GAP, statusY); + } + + screen.drawImage(offscreen, 0, 0, null); + + if (!isEnabled()) { + screen.setColor(new Color(0,0,0,100)); + screen.fillRect(0, 0, getWidth(), getHeight()); + } + } + + + public void mouseMoved(MouseEvent e) { + if (!isEnabled()) + return; + + // mouse events before paint(); + if (state == null) return; + + if (state[START] != INACTIVE) { + // avoid flicker, since there will probably be an update event + setState(START, INACTIVE, false); + } + handleMouse(e); + } + + + public void mouseDragged(MouseEvent e) { } + + + public void handleMouse(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + + if (currentRollover != -1) { + if ((x > x1[currentRollover]) && (y > y1) && + (x < x2[currentRollover]) && (y < y2)) { + return; + + } else { + setState(currentRollover, INACTIVE, true); + currentRollover = -1; + } + } + int sel = findSelection(x, y); + if (sel == -1) return; + + if (state[sel] != ACTIVE) { + setState(sel, ROLLOVER, true); + currentRollover = sel; + } + } + + + private int findSelection(int x, int y) { + // if app loads slowly and cursor is near the buttons + // when it comes up, the app may not have time to load + if ((x1 == null) || (x2 == null)) return -1; + + for (int i = 0; i < buttonCount; i++) { + if ((y > y1) && (x > x1[i]) && + (y < y2) && (x < x2[i])) { + //System.out.println("sel is " + i); + return i; + } + } + return -1; + } + + + private void setState(int slot, int newState, boolean updateAfter) { + state[slot] = newState; + stateImage[slot] = buttonImages[which[slot]][newState]; + if (updateAfter) { + repaint(); + } + } + + + public void mouseEntered(MouseEvent e) { + handleMouse(e); + } + + + public void mouseExited(MouseEvent e) { + // if the popup menu for is visible, don't register this, + // because the popup being set visible will fire a mouseExited() event + if ((popup != null) && popup.isVisible()) return; + + if (state[START] != INACTIVE) { + setState(START, INACTIVE, true); + } + handleMouse(e); + } + + int wasDown = -1; + + + public void mousePressed(MouseEvent e) { + + // jdf + if (!isEnabled()) + return; + + final int x = e.getX(); + final int y = e.getY(); + + int sel = findSelection(x, y); + ///if (sel == -1) return false; + if (sel == -1) return; + currentRollover = -1; + + switch (sel) { + case START: + monitor.handleStart(); + break; + + case STOP: + monitor.handleStop(); + break; + + case COPY: + break; + } + } + + + public void mouseClicked(MouseEvent e) { } + + + public void mouseReleased(MouseEvent e) { } + + + /** + * Set a particular button to be active. + */ + public void activate(int what) { + if (buttonImages != null) { + setState(what, ACTIVE, true); + } + } + + + /** + * Set a particular button to be active. + */ + public void deactivate(int what) { + if (buttonImages != null) { + setState(what, INACTIVE, true); + } + } + + + public Dimension getPreferredSize() { + return getMinimumSize(); + } + + + public Dimension getMinimumSize() { + return new Dimension((BUTTON_COUNT + 1)*BUTTON_WIDTH, BUTTON_HEIGHT); + } + + + public Dimension getMaximumSize() { + return new Dimension(3000, BUTTON_HEIGHT); + } + + + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_SHIFT) { + shiftPressed = true; + repaint(); +} + } + + + public void keyReleased(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_SHIFT) { + shiftPressed = false; + repaint(); + } + } + + + public void keyTyped(KeyEvent e) { } +} diff --git a/build/build.xml b/build/build.xml old mode 100644 new mode 100755 index c87c9617950..8c57c7064f9 --- a/build/build.xml +++ b/build/build.xml @@ -28,6 +28,13 @@ + + + + + + + diff --git a/build/macosx/template.app/Contents/Info.plist b/build/macosx/template.app/Contents/Info.plist index f8bfd32500b..b519d344547 100755 --- a/build/macosx/template.app/Contents/Info.plist +++ b/build/macosx/template.app/Contents/Info.plist @@ -74,7 +74,7 @@ - $JAVAROOT/pde.jar:$JAVAROOT/core.jar:$JAVAROOT/antlr.jar:$JAVAROOT/ecj.jar:$JAVAROOT/registry.jar:$JAVAROOT/quaqua.jar:$JAVAROOT/RXTXcomm.jar + $JAVAROOT/pde.jar:$JAVAROOT/core.jar:$JAVAROOT/antlr.jar:$JAVAROOT/ecj.jar:$JAVAROOT/registry.jar:$JAVAROOT/quaqua.jar:$JAVAROOT/RXTXcomm.jar:$JAVAROOT/jfreechart.jar:$JAVAROOT/jcommon.jar:$JAVAROOT/iText.jar:$JAVAROOT/swtgraphics2d.jar:$JAVAROOT/servlet.jar:$JAVAROOT/jfreechart-swt.jar:$JAVAROOT/gnujaxp.jar JVMArchs diff --git a/build/macosx/template.app/Contents/Resources/pde.icns b/build/macosx/template.app/Contents/Resources/pde.icns old mode 100644 new mode 100755 diff --git a/build/macosx/template.app/Contents/Resources/processing.icns b/build/macosx/template.app/Contents/Resources/processing.icns old mode 100644 new mode 100755 diff --git a/build/shared/lib/theme/buttons.gif b/build/shared/lib/theme/buttons.gif index 4de0905d23d..2422b4f2555 100644 Binary files a/build/shared/lib/theme/buttons.gif and b/build/shared/lib/theme/buttons.gif differ diff --git a/build/shared/lib/theme/graph-buttons.gif b/build/shared/lib/theme/graph-buttons.gif new file mode 100644 index 00000000000..f737ba47d07 Binary files /dev/null and b/build/shared/lib/theme/graph-buttons.gif differ diff --git a/build/windows/launcher/config.xml b/build/windows/launcher/config.xml index ba29d3a0673..617a7a4102e 100755 --- a/build/windows/launcher/config.xml +++ b/build/windows/launcher/config.xml @@ -20,6 +20,13 @@ lib/jna.jar lib/ecj.jar lib/RXTXcomm.jar + lib/jfreechart.jar + lib/iText.jar + lib/swtgraphics2d.jar + lib/servlet.jar + lib/jfreechart-swt.jar + lib/gnujaxp.jar + lib/jcommon.jar java