From ac3f093b76e5a5a907dc9b5f9c650e3dfd1a12a0 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Thu, 18 Aug 2011 14:54:42 -0400 Subject: [PATCH] Revert "Added Schematic view (from wiring)." This reverts commit ccb318c2abd193269236141324d04e421a50e44e. --- app/src/processing/app/Base.java | 11 - app/src/processing/app/Editor.java | 26 +-- app/src/processing/app/EditorToolbar.java | 45 ++-- app/src/processing/app/Schematics.java | 273 ---------------------- build/shared/lib/theme/buttons.gif | Bin 3513 -> 3331 bytes 5 files changed, 14 insertions(+), 341 deletions(-) delete mode 100644 app/src/processing/app/Schematics.java diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 97e9f57e1..036cb4f5a 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -436,17 +436,6 @@ public class Base { // ................................................................. - /** Command on Mac OS X, Ctrl on Windows and Linux */ - static final int SHORTCUT_KEY_MASK = - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); - /** Command-W on Mac OS X, Ctrl-W on Windows and Linux */ - static final KeyStroke WINDOW_CLOSE_KEYSTROKE = - KeyStroke.getKeyStroke('W', SHORTCUT_KEY_MASK); - /** Command-Option on Mac OS X, Ctrl-Alt on Windows and Linux */ - static final int SHORTCUT_ALT_KEY_MASK = ActionEvent.ALT_MASK | - Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); - - // Because of variations in native windowing systems, no guarantees about // changes to the focused and active Windows can be made. Developers must // never assume that this Window is the focused or active Window until this diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 177fc8527..fa0544a1e 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -99,8 +99,6 @@ public class Editor extends JFrame implements RunnerListener { static SerialMenuListener serialMenuListener; static SerialMonitor serialMonitor; - Schematics schematics; - EditorHeader header; EditorStatus status; EditorConsole console; @@ -627,16 +625,6 @@ public class Editor extends JFrame implements RunnerListener { // } // }); // sketchMenu.add(item); - - sketchMenu.addSeparator(); - - item = new JMenuItem("Show schematics"); - item.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - handleSchematics(); - } - }); - sketchMenu.add(item); sketchMenu.addSeparator(); @@ -1906,6 +1894,7 @@ public class Editor extends JFrame implements RunnerListener { return sketchWindowLocation; } + /** * Implements Sketch → Stop, or pressing Stop on the toolbar. */ @@ -1922,19 +1911,6 @@ public class Editor extends JFrame implements RunnerListener { } - public void handleSchematics() { // called by menu or buttons - //String s = sketch.getFolder().getAbsolutePath() + File.separator + sketch.getName() + ".png"; - File file = new File(sketch.getFolder(), sketch.getName() + ".png"); - if (file.exists()) { - if (schematics == null) - schematics = new Schematics(file); - schematics.showFrame(this); - } else { - statusNotice("This sketch doesn't include schematics"); - } - } - - /** * Deactivate the Run button. This is called by Runner to notify that the * sketch has stopped running, usually in response to an error (or maybe diff --git a/app/src/processing/app/EditorToolbar.java b/app/src/processing/app/EditorToolbar.java index 1f3a68231..9d7a5fc13 100644 --- a/app/src/processing/app/EditorToolbar.java +++ b/app/src/processing/app/EditorToolbar.java @@ -37,7 +37,7 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key /** Rollover titles for each button. */ static final String title[] = { - "Verify", "Upload", "New", "Open", "Save", "Show Schematics", "Serial Monitor" + "Verify", "Upload", "New", "Open", "Save", "Serial Monitor" }; /** Titles for each button when the shift key is pressed. */ @@ -56,20 +56,18 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key static final int BUTTON_IMAGE_SIZE = 33; - static final int RUN = 0; - static final int EXPORT = 1; + static final int RUN = 0; + static final int EXPORT = 1; - static final int NEW = 2; - static final int OPEN = 3; - static final int SAVE = 4; - static final int SCHEMATICS = 5; + static final int NEW = 2; + static final int OPEN = 3; + static final int SAVE = 4; - static final int SERIAL = 6; + static final int SERIAL = 5; static final int INACTIVE = 0; static final int ROLLOVER = 1; static final int ACTIVE = 2; - static final int DISABLED = 3; Editor editor; @@ -110,7 +108,6 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key which[buttonCount++] = NEW; which[buttonCount++] = OPEN; which[buttonCount++] = SAVE; - which[buttonCount++] = SCHEMATICS; which[buttonCount++] = SERIAL; currentRollover = -1; @@ -261,9 +258,8 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key for (int i = 0; i < buttonCount; i++) { if ((y > y1) && (x > x1[i]) && (y < y2) && (x < x2[i])) { - if (state[i] != DISABLED) { - return i; - } + //System.out.println("sel is " + i); + return i; } } return -1; @@ -271,12 +267,10 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key private void setState(int slot, int newState, boolean updateAfter) { - if (state[slot]!=DISABLED) { - state[slot] = newState; - stateImage[slot] = buttonImages[which[slot]][newState]; - if (updateAfter) { - repaint(); - } + state[slot] = newState; + stateImage[slot] = buttonImages[which[slot]][newState]; + if (updateAfter) { + repaint(); } } @@ -344,10 +338,6 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key editor.handleExport(e.isShiftDown()); break; - case SCHEMATICS: - editor.handleSchematics(); - break; - case SERIAL: editor.handleSerial(); break; @@ -381,15 +371,6 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key } - public void disable(int what) { - if (buttonImages != null && which!=null && state!=null && stateImage!=null) { - state[what] = DISABLED; - stateImage[what] = buttonImages[which[what]][INACTIVE]; - repaint(); - } - } - - public Dimension getPreferredSize() { return getMinimumSize(); } diff --git a/app/src/processing/app/Schematics.java b/app/src/processing/app/Schematics.java deleted file mode 100644 index c29d01663..000000000 --- a/app/src/processing/app/Schematics.java +++ /dev/null @@ -1,273 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* - Part of the Wiring project - http://wiring.org.co - - Copyright (c) 2009-11 Hernando Barragan - - 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 java.io.*; - -import javax.swing.*; - -public class Schematics extends JFrame { - private static final long serialVersionUID = 3254345343658939796L; - - // prompt text stuff - Image image; - - int diagramX = 0, diagramY = 0; - - int x1, y1, x2, y2; - - static final String PROMPT_CLOSE = "Close"; - - static final String PROMPT_RESETVIEW = "Reset"; - - /** - * Standardized width for buttons. Mac OS X 10.3 wants 70 as its default, - * Windows XP needs 66, and my Ubuntu machine needs 80+, so 80 seems proper. - */ - static public int BUTTON_WIDTH = 80; - - /** - * Standardized button height. Mac OS X 10.3 (Java 1.4) wants 29, presumably - * because it now includes the blue border, where it didn't in Java 1.3. - * Windows XP only wants 23 (not sure what default Linux would be). Because of - * the disparity, on Mac OS X, it will be set inside a static block. - */ - static public int BUTTON_HEIGHT = 24; - - // indents and spacing standards. these probably need to be modified - // per platform as well, since macosx is so huge, windows is smaller, - // and linux is all over the map - - static final int GUI_BIG = 13; - - static final int GUI_BETWEEN = 10; - - static final int GUI_SMALL = 6; - - // gui elements - - int wide, high; - - JLabel label; - - JLabel labelBack; - - JButton resetButton; - - JButton closeButton; - - // the calling editor, so updates can be applied - - Editor editor; - - public Schematics(File path) { - super("Schematics"); - - image = Toolkit.getDefaultToolkit().createImage(path.getAbsolutePath()); - - // dialog = new JFrame("Schematics"); - setResizable(true); - // setBackground(Color.white); - // dialog.setContentPane(new JLabel(new ImageIcon(image))); - - Container pain = getContentPane(); - - pain.setBackground(Color.white); - pain.setLayout(null); - - int top = GUI_BIG; - int left = GUI_BIG; - int right = 0; - - // to override bug on OSX setting the JFrame background color - labelBack = new JLabel(); - - label = new JLabel(new ImageIcon(image)); - // System.out.println(label.getPreferredSize()); - Dimension d = label.getPreferredSize(); - label.addMouseMotionListener(new MouseMotionListener() { - public void mouseDragged(MouseEvent e) { - // Base.openFolder(Base.getSettingsFolder()); - x2 = e.getX(); - y2 = e.getY(); - diagramX += x2 - x1; - diagramY += y2 - y1; - Dimension d = label.getPreferredSize(); - Dimension d1 = getSize(); - diagramX = Math.max(d1.width - (d.width + GUI_BIG), diagramX); - diagramX = Math.min(GUI_BIG, diagramX); - diagramY = Math - .max( - d1.height - - (d.height + GUI_BIG + GUI_BETWEEN + BUTTON_HEIGHT - + GUI_BIG + GUI_BIG), diagramY); - diagramY = Math.min(GUI_BIG, diagramY); - label.setBounds(diagramX, diagramY, d.width, d.height); - // System.out.println("dragging"); - } - - public void mouseMoved(MouseEvent e) { - } - }); - - label.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - x1 = e.getX(); - y1 = e.getY(); - // System.out.println("pressed at "+x1+" "+y1); - } - - public void mouseEntered(MouseEvent e) { - } - - public void mouseExited(MouseEvent e) { - } - }); - - label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - pain.add(label); - label.setBounds(left, top, d.width, d.height); - - right = Math.max(right, left + d.width); - top += d.height; // + GUI_SMALL; - - resetButton = new JButton(PROMPT_RESETVIEW); - resetButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - diagramX = GUI_BIG; - diagramY = GUI_BIG; - Dimension d = label.getPreferredSize(); - label.setBounds(diagramX, diagramY, d.width, d.height); - } - }); - - pain.add(resetButton); - BUTTON_HEIGHT = resetButton.getPreferredSize().height; - - int h = right - (BUTTON_WIDTH + GUI_SMALL + BUTTON_WIDTH); - resetButton.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT); - h += BUTTON_WIDTH + GUI_SMALL; - - // h = right - (BUTTON_WIDTH + GUI_SMALL + BUTTON_WIDTH); - // h += BUTTON_WIDTH + GUI_SMALL; - - closeButton = new JButton(PROMPT_CLOSE); - closeButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - disposeFrame(); - } - }); - pain.add(closeButton); - closeButton.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT); - - top += BUTTON_HEIGHT + GUI_BETWEEN; - - // finish up - - wide = right + GUI_BIG; - high = top + GUI_SMALL; - - // closing the window is same as hitting close button - - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - disposeFrame(); - } - }); - - ActionListener disposer = new ActionListener() { - public void actionPerformed(ActionEvent actionEvent) { - disposeFrame(); - } - }; - - Base.registerWindowCloseKeys(getRootPane(), disposer); - if (!Base.isMacOS()) - Base.setIcon(this); - - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - setLocation((screen.width - wide) / 2, (screen.height - high) / 2); - - pack(); // get insets - Insets insets = getInsets(); - setSize(Math.min(screen.width, wide + insets.left + insets.right), Math - .min(screen.height, high + insets.top + insets.bottom)); - - labelBack.setOpaque(true); - labelBack.setBackground(Color.white); - labelBack.setBounds(0, 0, screen.width, screen.height); - pain.add(labelBack); - - getContentPane().setBackground(Color.white); - // handle window closing commands for ctrl/cmd-W or hitting ESC. - addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent e) { - Dimension d = getSize(); - int top = d.height - (BUTTON_HEIGHT + GUI_BETWEEN + GUI_BIG + GUI_BIG); - int left = GUI_BIG; - int right = Math.max(0, d.width - (left + GUI_BIG)); - int h = right - (BUTTON_WIDTH + GUI_SMALL + BUTTON_WIDTH); - resetButton.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT); - h += BUTTON_WIDTH + GUI_SMALL; - closeButton.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT); - } - }); - - pain.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent e) { - // System.out.println(e); - KeyStroke wc = Base.WINDOW_CLOSE_KEYSTROKE; - if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) - || (KeyStroke.getKeyStrokeForEvent(e).equals(wc))) { - disposeFrame(); - } - } - }); - } - - public Dimension getPreferredSize() { - return new Dimension(wide, high); - } - - // ................................................................. - - /** - * Close the window after an OK or Cancel. - */ - protected void disposeFrame() { - editor.toolbar.deactivate(EditorToolbar.SCHEMATICS); - dispose(); - } - - protected void applyFrame() { - - } - - protected void showFrame(Editor editor) { - this.editor = editor; - setVisible(true); - } - -} diff --git a/build/shared/lib/theme/buttons.gif b/build/shared/lib/theme/buttons.gif index f0a9c89e0c02936b7640e07d643c3452c90fa3f2..4de0905d23dec4147b7d56b70b3a91950cd355e9 100644 GIT binary patch delta 2877 zcmc(bi9Ztz1IK5^=9(>Mj@d{kk0TX1YBoks(j-R+Id;&ah?yL-%a$TaIdbQTr-zUy zOkpV0(luiW&yQAcvDZgQ=lIxt-YZQnf`iioZ!(jh z`AJwjZZ(mQs8D@<$R&2m^Q@x;ls^`p=+HEA@Q#cM{rFVuw!4GO_wAW17qgw&9G|G2 z?|HkDqgH^ih?7|OaXjhgZU&7QQPC5_@n7Xpco=8 zG}{Fj;6X1}Ua087*ZQmn@uH#Sy`=TwbLUz`ic{JA4ZwlapV;y1%m2Yngx2DB`uy*l z{IOW8jNa_XJ;mQzd335ByL6@FSA(Ze=2wSj0htkij{VC){4FLFFb8H)TS zKEQ2b-%h2yZa~UvG~2mQSD2aHU_f>gzy)oQY%p<2&Vh=V@~BIa@4)U(#J970SLj23 zmPwN}I-#4e1oMD0IZ1zRmO!qaE&h!90jvYsB7t!73IMJ&4O}`F47Y(5E2y4#o>!_* z@OPtKhV(#EmCNxr|5DLc81!`#=tif5;ei0*B-eRtIP;7#0H(rtC8+6OcKWAc#Pe7T z5SC|`EmAxrK58~%(fFKRRsV?gY<;?gOMXpFv3(CaA?xe6u(x~*GD^u`mAx* z+1-jQ$swLvIE_geP|4wd_*zt+oq?&of(bj=KngFbTujeQ+a{nwyp+o3(l z&i%$Px5Xn;=v33v#z#~ej7#AVatECX=j7L&*Ix|)v=7+rsVy%J2eOD(yaTYpo!aENN7FR#cg^Y za~tM8*&*lsG6X^Mor0-5)~8=g0%~-Py>g^?Dv6!(P(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