Splashscreen

This commit is contained in:
Federico Fissore 2015-03-11 16:26:59 +01:00
parent af3c2bd1f6
commit 2a0bc2bfca
10 changed files with 125 additions and 16 deletions

6
.gitignore vendored
View File

@ -21,7 +21,8 @@ build/windows/libastylej*
build/windows/arduino-*.zip build/windows/arduino-*.zip
build/windows/dist/*.tar.gz build/windows/dist/*.tar.gz
build/windows/dist/*.tar.bz2 build/windows/dist/*.tar.bz2
build/windows/launch4j-* build/windows/launch4j-*.tgz
build/windows/launch4j-*.zip
build/windows/launcher/launch4j build/windows/launcher/launch4j
build/windows/WinAVR-*.zip build/windows/WinAVR-*.zip
build/macosx/arduino-*.zip build/macosx/arduino-*.zip
@ -44,8 +45,5 @@ test-bin
.idea .idea
.DS_Store .DS_Store
.directory .directory
build/windows/launch4j-*
build/windows/launcher/launch4j
build/windows/WinAVR-*.zip
hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/passwords.h hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/passwords.h
avr-toolchain-*.zip avr-toolchain-*.zip

View File

@ -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);
}
}

View File

@ -23,6 +23,7 @@
package processing.app; package processing.app;
import cc.arduino.packages.DiscoveryManager; import cc.arduino.packages.DiscoveryManager;
import cc.arduino.view.SplashScreenHelper;
import processing.app.debug.TargetBoard; import processing.app.debug.TargetBoard;
import processing.app.debug.TargetPackage; import processing.app.debug.TargetPackage;
import processing.app.debug.TargetPlatform; import processing.app.debug.TargetPlatform;
@ -56,6 +57,7 @@ import static processing.app.I18n._;
public class Base { public class Base {
static private boolean commandLine; static private boolean commandLine;
public static SplashScreenHelper splashScreenHelper;
// A single instance of the preferences window // A single instance of the preferences window
Preferences preferencesFrame; Preferences preferencesFrame;
@ -87,6 +89,8 @@ public class Base {
System.setProperty("awt.useSystemAAFontSettings", "on"); System.setProperty("awt.useSystemAAFontSettings", "on");
System.setProperty("swing.aatext", "true"); System.setProperty("swing.aatext", "true");
splashScreenHelper = new SplashScreenHelper(SplashScreen.getSplashScreen());
BaseNoGui.initLogger(); BaseNoGui.initLogger();
BaseNoGui.notifier = new GUIUserNotifier(); BaseNoGui.notifier = new GUIUserNotifier();
@ -221,8 +225,10 @@ public class Base {
} }
} }
splashScreenHelper.splashText(_("Initializing packages..."));
BaseNoGui.initPackages(); BaseNoGui.initPackages();
splashScreenHelper.splashText(_("Preparing boards..."));
// Setup board-dependent variables. // Setup board-dependent variables.
onBoardOrPortChange(); onBoardOrPortChange();
@ -263,6 +269,7 @@ public class Base {
Preferences.save(); Preferences.save();
if (parser.isVerifyOrUploadMode()) { if (parser.isVerifyOrUploadMode()) {
splashScreenHelper.close();
// Set verbosity for command line build // Set verbosity for command line build
Preferences.set("build.verbose", "" + parser.isDoVerboseBuild()); Preferences.set("build.verbose", "" + parser.isDoVerboseBuild());
Preferences.set("upload.verbose", "" + parser.isDoVerboseUpload()); Preferences.set("upload.verbose", "" + parser.isDoVerboseUpload());
@ -290,6 +297,8 @@ public class Base {
System.exit(0); System.exit(0);
} }
else if (parser.isGuiMode()) { else if (parser.isGuiMode()) {
splashScreenHelper.splashText(_("Starting..."));
// Check if there were previously opened sketches to be restored // Check if there were previously opened sketches to be restored
restoreSketches(); restoreSketches();

View File

@ -302,6 +302,7 @@
<option value="-Xms128M"/> <option value="-Xms128M"/>
<option value="-Xmx512M"/> <option value="-Xmx512M"/>
<option value="-splash:$APP_ROOT/Contents/Java/lib/splash.png"/>
<bundledocument extensions="ino,c,cpp,h" <bundledocument extensions="ino,c,cpp,h"
icon="macosx/template.app/Contents/Resources/pde.icns" icon="macosx/template.app/Contents/Resources/pde.icns"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
CURDIR=`pwd` CURDIR=`pwd`
APPDIR="$(dirname -- "$(readlink -f -- "${0}")" )" APPDIR="$(dirname -- "$(readlink -f -- "${0}")" )"
@ -20,5 +20,11 @@ export LD_LIBRARY_PATH
export PATH="${APPDIR}/java/bin:${PATH}" export PATH="${APPDIR}/java/bin:${PATH}"
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base --curdir $CURDIR "$@" if [[ "$@" == *"--upload"* || "$@" == *"--upload"* || "$@" == *"--get-pref"* ]] ; then
SPLASH=""
else
SPLASH="-splash:./lib/splash.png"
fi
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel $SPLASH processing.app.Base --curdir $CURDIR "$@"

View File

@ -87,6 +87,9 @@
<key>MainClass</key> <key>MainClass</key>
<string>processing.app.Base</string> <string>processing.app.Base</string>
<key>SplashFile</key>
<string>$APP_PACKAGE/Contents/Resources/Java/lib/splash.png</string>
<key>JVMVersion</key> <key>JVMVersion</key>
<string>1.6*</string> <string>1.6*</string>

BIN
build/shared/lib/splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -4,6 +4,7 @@ ARDUINO 1.6.2
[ide] [ide]
* In platform.txt, pre and post build hooks can now be specified. Example: recipe.hooks.prebuild.0.pattern=echo "Hello {build.source.path}". Thanks @Wackerbarth * In platform.txt, pre and post build hooks can now be specified. Example: recipe.hooks.prebuild.0.pattern=echo "Hello {build.source.path}". Thanks @Wackerbarth
* Windows and MacOSX JVM Xmx halved to 512M * Windows and MacOSX JVM Xmx halved to 512M
* Introduced starting splashscreen with progress status: will be used for notifying user of long running startup tasks
ARDUINO 1.6.1 - 2015.03.10 ARDUINO 1.6.1 - 2015.03.10

View File

@ -29,21 +29,16 @@
</classPath> </classPath>
<jre> <jre>
<path>java</path> <path>java</path>
<minVersion>1.6.0</minVersion> <minVersion>1.8.0</minVersion>
<maxVersion></maxVersion> <maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference> <jdkPreference>preferJre</jdkPreference>
<opt>-splash:./lib/splash.png</opt>
</jre> </jre>
<splash>
<file>about.bmp</file>
<waitForWindow>true</waitForWindow>
<timeout>60</timeout>
<timeoutErr>true</timeoutErr>
</splash>
<messages> <messages>
<startupErr>An error occurred while starting the application.</startupErr> <startupErr>An error occurred while starting the application.</startupErr>
<bundledJreErr>This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.</bundledJreErr> <bundledJreErr>This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.</bundledJreErr>
<jreVersionErr>This application requires at least Java Development Kit</jreVersionErr> <jreVersionErr>This application requires at least Java Development Kit</jreVersionErr>
<launcherErr>The registry refers to a nonexistent Java Development Kit installation or the runtime is corrupted.</launcherErr> <launcherErr>The registry refers to a nonexistent Java Development Kit installation or the runtime is corrupted.</launcherErr>
<instanceAlreadyExistsMsg>An application instance is already running.</instanceAlreadyExistsMsg> <instanceAlreadyExistsMsg>An application instance is already running.</instanceAlreadyExistsMsg>
</messages> </messages>
</launch4jConfig> </launch4jConfig>

View File

@ -29,7 +29,7 @@
</classPath> </classPath>
<jre> <jre>
<path>java</path> <path>java</path>
<minVersion>1.6.0</minVersion> <minVersion>1.8.0</minVersion>
<maxVersion></maxVersion> <maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference> <jdkPreference>preferJre</jdkPreference>
</jre> </jre>