diff --git a/.gitignore b/.gitignore index f61a9a6d4..8ea034871 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,8 @@ build/windows/libastylej* build/windows/arduino-*.zip build/windows/dist/*.tar.gz build/windows/dist/*.tar.bz2 -build/windows/launch4j-* +build/windows/launch4j-*.tgz +build/windows/launch4j-*.zip build/windows/launcher/launch4j build/windows/WinAVR-*.zip build/macosx/arduino-*.zip @@ -44,8 +45,5 @@ test-bin .idea .DS_Store .directory -build/windows/launch4j-* -build/windows/launcher/launch4j -build/windows/WinAVR-*.zip hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/passwords.h avr-toolchain-*.zip diff --git a/app/src/cc/arduino/view/SplashScreenHelper.java b/app/src/cc/arduino/view/SplashScreenHelper.java new file mode 100644 index 000000000..8b450515f --- /dev/null +++ b/app/src/cc/arduino/view/SplashScreenHelper.java @@ -0,0 +1,96 @@ +/* + * This file is part of Arduino. + * + * Code inspired by this tutorial http://wiki.netbeans.org/Splash_Screen_Beginner_Tutorial. License says "You may modify and use it as you wish." + * + * Copyright 2015 Arduino LLC (http://www.arduino.cc/) + * + * Arduino 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + */ + +package cc.arduino.view; + +import java.awt.*; +import java.awt.geom.Rectangle2D; +import java.util.Map; + +public class SplashScreenHelper { + + private final Map desktopHints; + private SplashScreen splash; + private Rectangle2D.Double splashTextArea; + private Graphics2D splashGraphics; + + public SplashScreenHelper(SplashScreen splash) { + this.splash = splash; + Toolkit tk = Toolkit.getDefaultToolkit(); + desktopHints = (Map) tk.getDesktopProperty("awt.font.desktophints"); + } + + public void splashText(String str) { + if (splash == null) { + printText(str); + return; + } + if (!splash.isVisible()) { + return; + } + + if (splashTextArea == null) { + // stake out some area for our status information + splashTextArea = new Rectangle2D.Double(0, 300, 520, 30); + + // create the Graphics environment for drawing status info + splashGraphics = splash.createGraphics(); + + if (desktopHints != null) { + splashGraphics.addRenderingHints(desktopHints); + } + } + + // erase the last status text + splashGraphics.setPaint(new Color(245, 245, 245)); + splashGraphics.fill(splashTextArea); + + // draw the text + splashGraphics.setPaint(Color.BLACK); + FontMetrics metrics = splashGraphics.getFontMetrics(); + splashGraphics.drawString(str, (int) splashTextArea.getX() + 10, (int) splashTextArea.getY() + (30 - metrics.getHeight()) + 4); + + // make sure it's displayed + splash.update(); + } + + public void close() { + if (splash == null) { + return; + } + splash.close(); + } + + public void printText(String str) { + System.out.println(str); + } + +} diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 029188bac..ad5705838 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -23,6 +23,7 @@ package processing.app; import cc.arduino.packages.DiscoveryManager; +import cc.arduino.view.SplashScreenHelper; import processing.app.debug.TargetBoard; import processing.app.debug.TargetPackage; import processing.app.debug.TargetPlatform; @@ -56,6 +57,7 @@ import static processing.app.I18n._; public class Base { static private boolean commandLine; + public static SplashScreenHelper splashScreenHelper; // A single instance of the preferences window Preferences preferencesFrame; @@ -87,6 +89,8 @@ public class Base { System.setProperty("awt.useSystemAAFontSettings", "on"); System.setProperty("swing.aatext", "true"); + splashScreenHelper = new SplashScreenHelper(SplashScreen.getSplashScreen()); + BaseNoGui.initLogger(); BaseNoGui.notifier = new GUIUserNotifier(); @@ -221,8 +225,10 @@ public class Base { } } + splashScreenHelper.splashText(_("Initializing packages...")); BaseNoGui.initPackages(); - + splashScreenHelper.splashText(_("Preparing boards...")); + // Setup board-dependent variables. onBoardOrPortChange(); @@ -263,6 +269,7 @@ public class Base { Preferences.save(); if (parser.isVerifyOrUploadMode()) { + splashScreenHelper.close(); // Set verbosity for command line build Preferences.set("build.verbose", "" + parser.isDoVerboseBuild()); Preferences.set("upload.verbose", "" + parser.isDoVerboseUpload()); @@ -290,6 +297,8 @@ public class Base { System.exit(0); } else if (parser.isGuiMode()) { + splashScreenHelper.splashText(_("Starting...")); + // Check if there were previously opened sketches to be restored restoreSketches(); diff --git a/build/build.xml b/build/build.xml index f4b10486f..4e594f225 100644 --- a/build/build.xml +++ b/build/build.xml @@ -302,6 +302,7 @@