From 2e403ae88df77c5876392d8b1eaf2fdd7a077fb2 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 30 Apr 2013 12:30:24 -0400 Subject: [PATCH] holy hell, let's burn this place down --- app/src/processing/app/Base.java | 39 ++-------- app/src/processing/app/EditorHeader.java | 70 +++++++++--------- app/src/processing/app/EditorStatus.java | 4 +- app/src/processing/app/EditorToolbar.java | 55 ++++++-------- app/src/processing/app/Mode.java | 8 +- app/src/processing/app/Toolkit.java | 29 +++----- .../processing/app/macosx/ThinkDifferent.java | 3 +- app/src/processing/mode/java/JavaEditor.java | 2 +- .../Contents/Resources/processing.icns | Bin 105417 -> 216919 bytes build/shared/lib/preferences.txt | 8 +- build/windows/launcher/about.bmp | Bin 428456 -> 456056 bytes build/windows/launcher/application.ico | Bin 363246 -> 184531 bytes core/src/processing/core/PApplet.java | 2 +- .../Contents/Resources/sketch.icns | Bin 68094 -> 174666 bytes 14 files changed, 91 insertions(+), 129 deletions(-) mode change 100755 => 100644 build/macosx/template.app/Contents/Resources/processing.icns mode change 100755 => 100644 build/windows/launcher/about.bmp diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index e25350f4b..b096c4295 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -1500,35 +1500,12 @@ public class Base { // ................................................................. - /** - * Show the About box. - */ - public void handleAbout() { - final Image image = Toolkit.getLibImage("about.jpg", activeEditor); - final Window window = new Window(activeEditor) { - public void paint(Graphics g) { - g.drawImage(image, 0, 0, null); - - Graphics2D g2 = (Graphics2D) g; - g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); - - g.setFont(new Font("SansSerif", Font.PLAIN, 11)); - g.setColor(Color.white); - g.drawString(Base.VERSION_NAME, 50, 30); - } - }; - window.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - window.dispose(); - } - }); - int w = image.getWidth(activeEditor); - int h = image.getHeight(activeEditor); - Dimension screen = Toolkit.getScreenSize(); - window.setBounds((screen.width-w)/2, (screen.height-h)/2, w, h); - window.setVisible(true); - } +// /** +// * Show the About box. +// */ +// static public void handleAbout() { +// new About(activeEditor); +// } /** @@ -2371,8 +2348,8 @@ public class Base { */ return new File(processingRoot, name); } - - + + // /** // * Get an image associated with the current color theme. // * @deprecated diff --git a/app/src/processing/app/EditorHeader.java b/app/src/processing/app/EditorHeader.java index 576011e20..d9c32660d 100644 --- a/app/src/processing/app/EditorHeader.java +++ b/app/src/processing/app/EditorHeader.java @@ -76,10 +76,10 @@ public class EditorHeader extends JComponent { static final int UNSELECTED = 0; static final int SELECTED = 1; - static final String WHERE[] = { "left", "mid", "right" }; //, "menu" }; - static final int LEFT = 0; - static final int MIDDLE = 1; - static final int RIGHT = 2; +// static final String WHERE[] = { "left", "mid", "right" }; //, "menu" }; +// static final int LEFT = 0; +// static final int MIDDLE = 1; +// static final int RIGHT = 2; // static final int MENU = 3; static final int PIECE_WIDTH = 4; @@ -88,7 +88,7 @@ public class EditorHeader extends JComponent { static final int ARROW_WIDTH = 14; static final int ARROW_HEIGHT = 14; - Image tabArrow; + static Image tabArrow; // @@ -153,39 +153,41 @@ public class EditorHeader extends JComponent { } - protected String tabFile(int status, int where) { - return "theme/tab-" + STATUS[status] + "-" + WHERE[where]; - } +// protected String tabFile(int status, int where) { +// return "theme/tab-" + STATUS[status] + "-" + WHERE[where]; +// } public void updateMode() { Mode mode = editor.getMode(); - int res = Toolkit.isRetina() ? 2 : 1; +// int res = Toolkit.isRetina() ? 2 : 1; +// String suffix = "-2x.png"; // wishful thinking +// // Some modes may not have a 2x version. If a mode doesn't have a 1x +// // version, this will cause an error... they should always have 1x. +// if (res == 2) { +// if (!mode.getContentFile(tabFile(0, 0) + suffix).exists()) { +// res = 1; +// } +// } +// if (res == 1) { +// suffix = ".png"; +// if (!mode.getContentFile(tabFile(0, 0) + suffix).exists()) { +// suffix = ".gif"; +// } +// } +// +// pieces = new Image[STATUS.length][WHERE.length]; +// for (int status = 0; status < STATUS.length; status++) { +// for (int where = 0; where < WHERE.length; where++) { +// //String filename = "theme/tab-" + STATUS[i] + "-" + WHERE[j] + ".gif"; +// pieces[status][where] = mode.loadImage(tabFile(status, where) + suffix); +// } +// } - String suffix = "-2x.png"; // wishful thinking - // Some modes may not have a 2x version. If a mode doesn't have a 1x - // version, this will cause an error... they should always have 1x. - if (res == 2) { - if (!mode.getContentFile(tabFile(0, 0) + suffix).exists()) { - res = 1; - } + if (tabArrow == null) { + String suffix = Toolkit.highResDisplay() ? "-2x.png" : ".png"; + tabArrow = Toolkit.getLibImage("tab-arrow" + suffix); } - if (res == 1) { - suffix = ".png"; - if (!mode.getContentFile(tabFile(0, 0) + suffix).exists()) { - suffix = ".gif"; - } - } - - pieces = new Image[STATUS.length][WHERE.length]; - for (int status = 0; status < STATUS.length; status++) { - for (int where = 0; where < WHERE.length; where++) { - //String filename = "theme/tab-" + STATUS[i] + "-" + WHERE[j] + ".gif"; - pieces[status][where] = mode.loadImage(tabFile(status, where) + suffix); - } - } - - tabArrow = mode.loadImage("theme/tab-arrow" + suffix); backgroundColor = mode.getColor("header.bgcolor"); textColor[SELECTED] = mode.getColor("header.text.selected.color"); @@ -223,7 +225,7 @@ public class EditorHeader extends JComponent { sizeH = size.height; imageW = sizeW; imageH = sizeH; - if (Toolkit.isRetina()) { + if (Toolkit.highResDisplay()) { offscreen = createImage(imageW*2, imageH*2); } else { offscreen = createImage(imageW, imageH); @@ -237,7 +239,7 @@ public class EditorHeader extends JComponent { Graphics2D g2 = (Graphics2D) g; - if (Toolkit.isRetina()) { + if (Toolkit.highResDisplay()) { // scale everything 2x, will be scaled down when drawn to the screen g2.scale(2, 2); } else { diff --git a/app/src/processing/app/EditorStatus.java b/app/src/processing/app/EditorStatus.java index 4ed14b377..361db92d9 100644 --- a/app/src/processing/app/EditorStatus.java +++ b/app/src/processing/app/EditorStatus.java @@ -184,7 +184,7 @@ public class EditorStatus extends JPanel { sizeW = size.width; sizeH = size.height; setButtonBounds(); - if (Toolkit.isRetina()) { + if (Toolkit.highResDisplay()) { offscreen = createImage(sizeW*2, sizeH*2); } else { offscreen = createImage(sizeW, sizeH); @@ -194,7 +194,7 @@ public class EditorStatus extends JPanel { Graphics g = offscreen.getGraphics(); Graphics2D g2 = (Graphics2D) g; - if (Toolkit.isRetina()) { + if (Toolkit.highResDisplay()) { g2.scale(2, 2); } else { g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, diff --git a/app/src/processing/app/EditorToolbar.java b/app/src/processing/app/EditorToolbar.java index e2a5a2633..46ee93088 100644 --- a/app/src/processing/app/EditorToolbar.java +++ b/app/src/processing/app/EditorToolbar.java @@ -42,7 +42,7 @@ public abstract class EditorToolbar extends JComponent implements MouseInputList 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. */ + /** Size (both width and height) of the buttons in the source image. */ static final int BUTTON_IMAGE_SIZE = 33; static final int INACTIVE = 0; @@ -58,21 +58,8 @@ public abstract class EditorToolbar extends JComponent implements MouseInputList Color bgcolor; -// static Image[][] buttonImages; -// int currentRollover; protected Button rollover; -// int buttonCount; - /** Current state for this button */ -// int[] state; // = new int[BUTTON_COUNT]; - /** Current image for this button's state */ -// Image[] stateImage; -// int which[]; // mapping indices to implementation - -// int x1[], x2[]; - static final int TOP = 2; - static final int BOTTOM = BUTTON_HEIGHT; - Font statusFont; Color statusColor; @@ -82,19 +69,18 @@ public abstract class EditorToolbar extends JComponent implements MouseInputList Color modeButtonColor; Font modeTextFont; Color modeTextColor; - String modeTitle; // = "JAVA"; //"Java"; -// String modeTitle = "ANDROID"; //"Java"; + String modeTitle; int modeX1, modeY1; int modeX2, modeY2; JMenu modeMenu; protected ArrayList