mirror of
https://github.com/processing/processing4.git
synced 2026-05-31 04:28:06 +02:00
Merge branch 'master' into tree_listener_parameter
This commit is contained in:
@@ -76,3 +76,9 @@ fabric.properties
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
# testing boogers
|
||||
bin-test
|
||||
|
||||
# dated folders
|
||||
/19*
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
This is an experimental fork to attempt the move to JDK 11. Because that's a major, API-breaking change, it would be Processing 4.
|
||||
This is an experimental fork to attempt the move to JDK 11. Because that's a major, API-breaking change, it would be Processing 4.
|
||||
|
||||
I'm working with Sam Pottinger to incorporate [his changes](https://github.com/sampottinger/processing) to see if that can be the basis for this new release. Getting things moved to OpenJDK 11 will help the longevity of the project.
|
||||
|
||||
**It's not clear if we'll ship an actual Processing 4.0**, since I have less free time than ever, and very little development help. If you'd like to help, contribute bug fixes.
|
||||
**It's not clear if we'll ship an actual Processing 4.0**, since I have less free time than ever, and very little development help. If you'd like to help, contribute bug fixes.
|
||||
|
||||
Ben Fry, 4 October 2019
|
||||
Ben Fry, 4 October 2019
|
||||
|
||||
---
|
||||
|
||||
## API changes
|
||||
|
||||
As with all releases, I'll do everything possible to avoid breaking API. However, there will still be tweaks that have to be made. We'll try to keep them minor.
|
||||
|
||||
* `Base.defaultFileMenu` is now `protected` instead of `static public`
|
||||
+6
-3
@@ -1,13 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/AdoptOpenJDK 11 [11.0.4]">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/processing-core"/>
|
||||
<classpathentry kind="lib" path="lib/jna.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jna-platform.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/ant.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/ant-launcher.jar"/>
|
||||
<classpathentry kind="lib" path="test/lib/junit-4.8.1.jar"/>
|
||||
<classpathentry kind="lib" path="/processing-core/apple.jar"/>
|
||||
<classpathentry kind="lib" path="/processing4-core/library-test/junit-4.8.1.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -6,9 +6,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
@@ -22,6 +22,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
@@ -64,6 +65,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
@@ -93,7 +95,8 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||
|
||||
@@ -56,9 +56,9 @@ import processing.data.StringList;
|
||||
public class Base {
|
||||
// Added accessors for 0218 because the UpdateCheck class was not properly
|
||||
// updating the values, due to javac inlining the static final values.
|
||||
static private final int REVISION = 270;
|
||||
static private final int REVISION = 1270;
|
||||
/** This might be replaced by main() if there's a lib/version.txt file. */
|
||||
static private String VERSION_NAME = "0270"; //$NON-NLS-1$
|
||||
static private String VERSION_NAME = "1270"; //$NON-NLS-1$
|
||||
/** Set true if this a proper release rather than a numbered revision. */
|
||||
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ public class Base {
|
||||
Collections.synchronizedList(new ArrayList<Editor>());
|
||||
protected Editor activeEditor;
|
||||
/** A lone file menu to be used when all sketch windows are closed. */
|
||||
static public JMenu defaultFileMenu;
|
||||
protected JMenu defaultFileMenu;
|
||||
|
||||
/**
|
||||
* Starts with the last mode used with the environment,
|
||||
@@ -437,6 +437,49 @@ public class Base {
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
/**
|
||||
* Limited file menu to be used on OS X when no sketches are open.
|
||||
*/
|
||||
public JMenu initDefaultFileMenu() {
|
||||
defaultFileMenu = new JMenu(Language.text("menu.file"));
|
||||
|
||||
JMenuItem item = Toolkit.newJMenuItem(Language.text("menu.file.new"), 'N');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleNew();
|
||||
}
|
||||
});
|
||||
defaultFileMenu.add(item);
|
||||
|
||||
item = Toolkit.newJMenuItem(Language.text("menu.file.open"), 'O');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleOpenPrompt();
|
||||
}
|
||||
});
|
||||
defaultFileMenu.add(item);
|
||||
|
||||
item = Toolkit.newJMenuItemShift(Language.text("menu.file.sketchbook"), 'K');
|
||||
item.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getNextMode().showSketchbookFrame();
|
||||
}
|
||||
});
|
||||
defaultFileMenu.add(item);
|
||||
|
||||
item = Toolkit.newJMenuItemShift(Language.text("menu.file.examples"), 'O');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
thinkDifferentExamples();
|
||||
}
|
||||
});
|
||||
defaultFileMenu.add(item);
|
||||
|
||||
return defaultFileMenu;
|
||||
}
|
||||
|
||||
|
||||
void buildCoreModes() {
|
||||
Mode javaMode =
|
||||
ModeContribution.load(this, Platform.getContentFile("modes/java"),
|
||||
|
||||
@@ -404,17 +404,17 @@ public class Preferences {
|
||||
|
||||
|
||||
/**
|
||||
* Check for a 3.0 sketchbook location, and if none exists,
|
||||
* try to grab it from the 2.0 sketchbook location.
|
||||
* Check for a 4.0 sketchbook location, and if none exists,
|
||||
* try to grab it from the 3.0 sketchbook location.
|
||||
* @return true if a location was found and the pref didn't exist
|
||||
*/
|
||||
static protected boolean checkSketchbookPref() {
|
||||
// If a 3.0 sketchbook location has never been inited
|
||||
// If a 4.0 sketchbook location has never been inited
|
||||
if (getSketchbookPath() == null) {
|
||||
String twoPath = get("sketchbook.path");
|
||||
// If they've run the 2.0 version, start with that location
|
||||
if (twoPath != null) {
|
||||
setSketchbookPath(twoPath);
|
||||
String threePath = get("sketchbook.path.three"); //$NON-NLS-1$
|
||||
// If they've run the 3.0 version, start with that location
|
||||
if (threePath != null) {
|
||||
setSketchbookPath(threePath);
|
||||
return true; // save the sketchbook right away
|
||||
}
|
||||
// Otherwise it'll be null, and reset properly by Base
|
||||
@@ -424,16 +424,16 @@ public class Preferences {
|
||||
|
||||
|
||||
static public String getOldSketchbookPath() {
|
||||
return get("sketchbook.path");
|
||||
}
|
||||
|
||||
|
||||
static public String getSketchbookPath() {
|
||||
return get("sketchbook.path.three"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
static public String getSketchbookPath() {
|
||||
return get("sketchbook.path.four"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
static protected void setSketchbookPath(String path) {
|
||||
set("sketchbook.path.three", path); //$NON-NLS-1$
|
||||
set("sketchbook.path.four", path); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class DefaultPlatform {
|
||||
|
||||
|
||||
public interface CLibrary extends Library {
|
||||
CLibrary INSTANCE = (CLibrary)Native.loadLibrary("c", CLibrary.class);
|
||||
CLibrary INSTANCE = Native.loadLibrary("c", CLibrary.class);
|
||||
int setenv(String name, String value, int overwrite);
|
||||
String getenv(String name);
|
||||
int unsetenv(String name);
|
||||
|
||||
@@ -27,7 +27,6 @@ import java.awt.Desktop;
|
||||
import java.awt.Toolkit;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.Messages;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.platform.DefaultPlatform;
|
||||
import processing.core.PApplet;
|
||||
|
||||
@@ -28,29 +28,20 @@ import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import com.apple.eio.FileManager;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.Messages;
|
||||
import processing.app.platform.DefaultPlatform;
|
||||
import processing.app.ui.About;
|
||||
|
||||
|
||||
/**
|
||||
* Platform handler for Mac OS X.
|
||||
* Platform handler for macOS.
|
||||
*/
|
||||
public class MacPlatform extends DefaultPlatform {
|
||||
|
||||
// Removing for 2.0b8 because Quaqua doesn't have OS X 10.8 version.
|
||||
/*
|
||||
public void setLookAndFeel() throws Exception {
|
||||
// Use the Quaqua L & F on OS X to make JFileChooser less awful
|
||||
UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");
|
||||
// undo quaqua trying to fix the margins, since we've already
|
||||
// hacked that in, bit by bit, over the years
|
||||
UIManager.put("Component.visualMargin", new Insets(1, 1, 1, 1));
|
||||
}
|
||||
*/
|
||||
|
||||
public void saveLanguage(String language) {
|
||||
String[] cmdarray = new String[]{
|
||||
"defaults", "write",
|
||||
@@ -67,35 +58,42 @@ public class MacPlatform extends DefaultPlatform {
|
||||
|
||||
public void initBase(Base base) {
|
||||
super.initBase(base);
|
||||
|
||||
final Desktop desktop = Desktop.getDesktop();
|
||||
|
||||
System.setProperty("apple.laf.useScreenMenuBar", "true");
|
||||
ThinkDifferent.init(base);
|
||||
/*
|
||||
try {
|
||||
String name = "processing.app.macosx.ThinkDifferent";
|
||||
Class osxAdapter = ClassLoader.getSystemClassLoader().loadClass(name);
|
||||
|
||||
Class[] defArgs = { Base.class };
|
||||
Method registerMethod = osxAdapter.getDeclaredMethod("register", defArgs);
|
||||
if (registerMethod != null) {
|
||||
Object[] args = { this };
|
||||
registerMethod.invoke(osxAdapter, args);
|
||||
// Set the menu bar to be used when nothing else is open.
|
||||
JMenuBar defaultMenuBar = new JMenuBar();
|
||||
JMenu fileMenu = base.initDefaultFileMenu();
|
||||
defaultMenuBar.add(fileMenu);
|
||||
desktop.setDefaultMenuBar(defaultMenuBar);
|
||||
|
||||
desktop.setAboutHandler((event) -> {
|
||||
new About(null);
|
||||
});
|
||||
|
||||
desktop.setPreferencesHandler((event) -> {
|
||||
base.handlePrefs();
|
||||
});
|
||||
|
||||
desktop.setOpenFileHandler((event) -> {
|
||||
for (File file : event.getFiles()) {
|
||||
base.handleOpen(file.getAbsolutePath());
|
||||
}
|
||||
} catch (NoClassDefFoundError e) {
|
||||
// This will be thrown first if the OSXAdapter is loaded on a system without the EAWT
|
||||
// because OSXAdapter extends ApplicationAdapter in its def
|
||||
System.err.println("This version of Mac OS X does not support the Apple EAWT." +
|
||||
"Application Menu handling has been disabled (" + e + ")");
|
||||
});
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
// This shouldn't be reached; if there's a problem with the OSXAdapter
|
||||
// we should get the above NoClassDefFoundError first.
|
||||
System.err.println("This version of Mac OS X does not support the Apple EAWT. " +
|
||||
"Application Menu handling has been disabled (" + e + ")");
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception while loading BaseOSX:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
desktop.setPrintFileHandler((event) -> {
|
||||
// TODO not yet implemented
|
||||
});
|
||||
|
||||
desktop.setQuitHandler((event, quitResponse) -> {
|
||||
if (base.handleQuit()) {
|
||||
quitResponse.performQuit();
|
||||
} else {
|
||||
quitResponse.cancelQuit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -106,30 +104,9 @@ public class MacPlatform extends DefaultPlatform {
|
||||
|
||||
public File getDefaultSketchbookFolder() throws Exception {
|
||||
return new File(getDocumentsFolder(), "Processing");
|
||||
/*
|
||||
// looking for /Users/blah/Documents/Processing
|
||||
try {
|
||||
Class clazz = Class.forName("processing.app.BaseMacOS");
|
||||
Method m = clazz.getMethod("getDocumentsFolder", new Class[] { });
|
||||
String documentsPath = (String) m.invoke(null, new Object[] { });
|
||||
sketchbookFolder = new File(documentsPath, "Processing");
|
||||
|
||||
} catch (Exception e) {
|
||||
sketchbookFolder = promptSketchbookLocation();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * Moves the specified File object (which might be a file or folder)
|
||||
// * to the trash.
|
||||
// */
|
||||
// public boolean deleteFile(File file) throws IOException {
|
||||
// return FileManager.moveToTrash(file);
|
||||
// }
|
||||
|
||||
|
||||
public void openURL(String url) throws Exception {
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(url));
|
||||
@@ -145,64 +122,23 @@ public class MacPlatform extends DefaultPlatform {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public void openURL(String url) throws Exception {
|
||||
if (PApplet.javaVersion < 1.6f) {
|
||||
if (url.startsWith("http://")) {
|
||||
// formerly com.apple.eio.FileManager.openURL(url);
|
||||
// but due to deprecation, instead loading dynamically
|
||||
try {
|
||||
Class<?> eieio = Class.forName("com.apple.eio.FileManager");
|
||||
Method openMethod =
|
||||
eieio.getMethod("openURL", new Class[] { String.class });
|
||||
openMethod.invoke(null, new Object[] { url });
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
// Assume this is a file instead, and just open it.
|
||||
// Extension of http://dev.processing.org/bugs/show_bug.cgi?id=1010
|
||||
processing.core.PApplet.open(url);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Class<?> desktopClass = Class.forName("java.awt.Desktop");
|
||||
Method getMethod = desktopClass.getMethod("getDesktop");
|
||||
Object desktop = getMethod.invoke(null, new Object[] { });
|
||||
|
||||
// for Java 1.6, replacing with java.awt.Desktop.browse()
|
||||
// and java.awt.Desktop.open()
|
||||
if (url.startsWith("http://")) { // browse to a location
|
||||
Method browseMethod =
|
||||
desktopClass.getMethod("browse", new Class[] { URI.class });
|
||||
browseMethod.invoke(desktop, new Object[] { new URI(url) });
|
||||
} else { // open a file
|
||||
Method openMethod =
|
||||
desktopClass.getMethod("open", new Class[] { File.class });
|
||||
openMethod.invoke(desktop, new Object[] { new File(url) });
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean openFolderAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void openFolder(File file) throws Exception {
|
||||
//openURL(file.getAbsolutePath()); // handles char replacement, etc
|
||||
processing.core.PApplet.open(file.getAbsolutePath());
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
// TODO I suspect this won't work much longer, since access to the user's
|
||||
// home directory seems verboten on more recent macOS versions [fry 191008]
|
||||
protected String getLibraryFolder() throws FileNotFoundException {
|
||||
return System.getProperty("user.home") + "/Library";
|
||||
}
|
||||
|
||||
|
||||
// see notes on getLibraryFolder()
|
||||
protected String getDocumentsFolder() throws FileNotFoundException {
|
||||
return System.getProperty("user.home") + "/Documents";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// Some of these are supposedly constants in com.apple.eio.FileManager,
|
||||
// however they don't seem to link properly from Eclipse.
|
||||
|
||||
@@ -237,4 +173,5 @@ public class MacPlatform extends DefaultPlatform {
|
||||
protected String getDocumentsFolder() throws FileNotFoundException {
|
||||
return FileManager.findFolder(kUserDomain, kDocumentsFolderType);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,222 +0,0 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2012-2014 The Processing Foundation
|
||||
Copyright (c) 2007-2012 Ben Fry and Casey Reas
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2, as published by the Free Software Foundation.
|
||||
|
||||
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.platform;
|
||||
|
||||
import java.awt.event.*;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import com.apple.eawt.Application;
|
||||
|
||||
import processing.app.*;
|
||||
import processing.app.ui.About;
|
||||
import processing.app.ui.Toolkit;
|
||||
|
||||
|
||||
/**
|
||||
* Deal with issues related to thinking differently. This handles the basic
|
||||
* Mac OS X menu commands (and apple events) for open, about, prefs, etc.
|
||||
*
|
||||
* As of 0140, this code need not be built on platforms other than OS X,
|
||||
* because of the new platform structure which isolates through reflection.
|
||||
*
|
||||
* Rewritten for 0232 to remove deprecation issues, per the message
|
||||
* <a href="http://lists.apple.com/archives/java-dev/2012/Jan/msg00101.html">here</a>.
|
||||
* (We're able to do this now because we're dropping older Java versions.)
|
||||
*/
|
||||
public class ThinkDifferent {
|
||||
|
||||
// pseudo-singleton model; no point in making multiple instances
|
||||
// of the EAWT application or our adapter
|
||||
private static ThinkDifferent adapter;
|
||||
// http://developer.apple.com/documentation/Java/Reference/1.4.2/appledoc/api/com/apple/eawt/Application.html
|
||||
private static Application application;
|
||||
|
||||
// reference to the app where the existing quit, about, prefs code is
|
||||
//private Base base;
|
||||
|
||||
|
||||
static protected void init(final Base base) {
|
||||
if (application == null) {
|
||||
application = Application.getApplication();
|
||||
}
|
||||
if (adapter == null) {
|
||||
adapter = new ThinkDifferent(); //base);
|
||||
}
|
||||
|
||||
setHandler(application, "setAboutHandler", (proxy, method, args) -> {
|
||||
new About(null);
|
||||
return null;
|
||||
});
|
||||
|
||||
setHandler(application, "setPreferencesHandler", (proxy, method, args) -> {
|
||||
base.handlePrefs();
|
||||
return null;
|
||||
});
|
||||
|
||||
setHandler(application, "setOpenFileHandler", (proxy, method, args) -> {
|
||||
Method m = args[0].getClass().getMethod("getFiles");
|
||||
for (File file : (List<File>) m.invoke(args[0])) {
|
||||
base.handleOpen(file.getAbsolutePath());
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
setHandler(application, "setPrintFileHandler", (proxy, method, args) -> {
|
||||
// TODO not yet implemented
|
||||
return null;
|
||||
});
|
||||
|
||||
setHandler(application, "setQuitHandler", (proxy, method, args) -> {
|
||||
if (base.handleQuit()) {
|
||||
args[1].getClass().getMethod("performQuit").invoke(args[1]);
|
||||
} else {
|
||||
args[1].getClass().getMethod("cancelQuit").invoke(args[1]);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
// Set the menubar to be used when nothing else is open.
|
||||
JMenuBar defaultMenuBar = new JMenuBar();
|
||||
JMenu fileMenu = buildFileMenu(base);
|
||||
defaultMenuBar.add(fileMenu);
|
||||
// This is kind of a gross way to do this, but the alternatives? Hrm.
|
||||
Base.defaultFileMenu = fileMenu;
|
||||
|
||||
// if (PApplet.javaVersion <= 1.6f) { // doesn't work on Oracle's Java
|
||||
try {
|
||||
application.setDefaultMenuBar(defaultMenuBar);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(); // oh well, never mind
|
||||
}
|
||||
// } else {
|
||||
// // The douchebags at Oracle didn't feel that a working f*king menubar
|
||||
// // on OS X was important enough to make it into the 7u40 release.
|
||||
// //http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8007267
|
||||
// // It languished in the JDK 8 source and has been backported for 7u60:
|
||||
// //http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8022667
|
||||
//
|
||||
// JFrame offscreen = new JFrame();
|
||||
// offscreen.setUndecorated(true);
|
||||
// offscreen.setJMenuBar(defaultMenuBar);
|
||||
// Dimension screen = Toolkit.getScreenSize();
|
||||
// offscreen.setLocation(screen.width, screen.height);
|
||||
// offscreen.setVisible(true);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// public ThinkDifferent(Base base) {
|
||||
// this.base = base;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Sets a handler on an instance of {@link Application}, taking into account JVM version
|
||||
* differences.
|
||||
*
|
||||
* @param app an instance of {@link Application}
|
||||
* @param name the "set handler" method name
|
||||
* @param handler the handler
|
||||
*/
|
||||
private static void setHandler(Application app, String name, InvocationHandler handler) {
|
||||
// Determine which version of com.apple.eawt.Application to use and pass it a handler of the
|
||||
// appropriate type
|
||||
Method[] methods = app.getClass().getMethods();
|
||||
for (Method m : methods) {
|
||||
if (!name.equals(m.getName())) {
|
||||
continue;
|
||||
}
|
||||
if (m.getParameterCount() != 1) {
|
||||
continue;
|
||||
}
|
||||
Class paramType = m.getParameterTypes()[0];
|
||||
try {
|
||||
// Allow a null handler
|
||||
Object proxy = null;
|
||||
if (handler != null) {
|
||||
proxy = Proxy.newProxyInstance(
|
||||
paramType.getClassLoader(), new Class<?>[] { paramType }, handler);
|
||||
}
|
||||
m.invoke(app, proxy);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// TODO: Print error?: method doesn't take an interface, etc.
|
||||
} catch (IllegalAccessException ex) {
|
||||
// TODO: Print error?: Other method invocation problem
|
||||
} catch (InvocationTargetException ex) {
|
||||
ex.getCause().printStackTrace();
|
||||
// TODO: Print ex.getCause() a different way?
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gimpy file menu to be used on OS X when no sketches are open.
|
||||
*/
|
||||
static protected JMenu buildFileMenu(final Base base) {
|
||||
JMenuItem item;
|
||||
JMenu fileMenu = new JMenu(Language.text("menu.file"));
|
||||
|
||||
item = Toolkit.newJMenuItem(Language.text("menu.file.new"), 'N');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
base.handleNew();
|
||||
}
|
||||
});
|
||||
fileMenu.add(item);
|
||||
|
||||
item = Toolkit.newJMenuItem(Language.text("menu.file.open"), 'O');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
base.handleOpenPrompt();
|
||||
}
|
||||
});
|
||||
fileMenu.add(item);
|
||||
|
||||
item = Toolkit.newJMenuItemShift(Language.text("menu.file.sketchbook"), 'K');
|
||||
item.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
base.getNextMode().showSketchbookFrame();
|
||||
}
|
||||
});
|
||||
fileMenu.add(item);
|
||||
|
||||
item = Toolkit.newJMenuItemShift(Language.text("menu.file.examples"), 'O');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
base.thinkDifferentExamples();
|
||||
}
|
||||
});
|
||||
fileMenu.add(item);
|
||||
|
||||
return fileMenu;
|
||||
}
|
||||
}
|
||||
@@ -28,11 +28,8 @@ import java.io.UnsupportedEncodingException;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.platform.win32.Shell32Util;
|
||||
import com.sun.jna.platform.win32.ShlObj;
|
||||
import com.sun.jna.win32.StdCallLibrary;
|
||||
import com.sun.jna.win32.W32APIOptions;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.Messages;
|
||||
@@ -563,7 +560,7 @@ public class WindowsPlatform extends DefaultPlatform {
|
||||
static WinLibC getLibC() {
|
||||
if (clib == null) {
|
||||
try {
|
||||
clib = (WinLibC) Native.loadLibrary("msvcrt", WinLibC.class);
|
||||
clib = Native.loadLibrary("msvcrt", WinLibC.class);
|
||||
} catch (UnsatisfiedLinkError ule) {
|
||||
Messages.showTrace("JNA Error",
|
||||
"JNA could not be loaded. Please report here:\n" +
|
||||
|
||||
@@ -1336,12 +1336,12 @@ public class JEditTextArea extends JComponent
|
||||
* @param startOffset The offset to apply before the text will be drawn.
|
||||
* @return The width of the input segment in pixels with fractional character widths considered.
|
||||
*/
|
||||
private int getTabbedTextWidth(Segment s, FontMetrics metrics, float x, TabExpander expander,
|
||||
int startOffset) {
|
||||
private int getTabbedTextWidth(Segment s, FontMetrics metrics, float x,
|
||||
TabExpander expander, int startOffset) {
|
||||
float additionalOffset =
|
||||
getPartialPixelWidth(metrics, x, expander, startOffset) * s.length();
|
||||
|
||||
float additionalOffset = getPartialPixelWidth(metrics, x, expander, startOffset) * s.length();
|
||||
|
||||
return (int) Math.round(
|
||||
return Math.round(
|
||||
Utilities.getTabbedTextWidth(s, metrics, x, expander, startOffset) + additionalOffset
|
||||
);
|
||||
}
|
||||
@@ -1369,14 +1369,9 @@ public class JEditTextArea extends JComponent
|
||||
// See https://github.com/sampottinger/processing/issues/103
|
||||
// Requires reference not object equality check
|
||||
if (candidateMetrics != cachedPartialPixelWidthFont) {
|
||||
float withFractional = Utilities.getTabbedTextWidth(
|
||||
TEST_SEGMENT,
|
||||
candidateMetrics,
|
||||
x,
|
||||
expander,
|
||||
startOffset
|
||||
);
|
||||
|
||||
float withFractional =
|
||||
Utilities.getTabbedTextWidth(TEST_SEGMENT, candidateMetrics,
|
||||
x, expander, startOffset);
|
||||
int withoutFractional = (int) withFractional;
|
||||
|
||||
partialPixelWidth = withFractional - withoutFractional;
|
||||
@@ -2486,7 +2481,7 @@ public class JEditTextArea extends JComponent
|
||||
|
||||
|
||||
private void doSingleClick(MouseEvent evt, int line, int offset, int dot) {
|
||||
if ((evt.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
|
||||
if (evt.isShiftDown()) {
|
||||
select(getMarkPosition(),dot);
|
||||
} else {
|
||||
setCaretPosition(dot);
|
||||
|
||||
@@ -264,9 +264,8 @@ public abstract class Editor extends JFrame implements RunnerListener {
|
||||
textarea.setHorizontalOffset(JEditTextArea.leftHandGutter);
|
||||
|
||||
{ // Hack: add Numpad Slash as alternative shortcut for Comment/Uncomment
|
||||
int modifiers = Toolkit.awtToolkit.getMenuShortcutKeyMask();
|
||||
KeyStroke keyStroke =
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_DIVIDE, modifiers);
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_DIVIDE, Toolkit.SHORTCUT_KEY_MASK);
|
||||
final String ACTION_KEY = "COMMENT_UNCOMMENT_ALT";
|
||||
textarea.getInputMap().put(keyStroke, ACTION_KEY);
|
||||
textarea.getActionMap().put(ACTION_KEY, new AbstractAction() {
|
||||
@@ -459,7 +458,6 @@ public abstract class Editor extends JFrame implements RunnerListener {
|
||||
return !sketch.isReadOnly();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean importData(TransferHandler.TransferSupport support) {
|
||||
int successful = 0;
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ implements MouseListener, MouseMotionListener, ActionListener {
|
||||
protected boolean pressed;
|
||||
protected boolean selected;
|
||||
protected boolean rollover;
|
||||
// protected JLabel rolloverLabel;
|
||||
protected boolean shift;
|
||||
|
||||
protected Image enabledImage;
|
||||
@@ -55,7 +54,6 @@ implements MouseListener, MouseMotionListener, ActionListener {
|
||||
protected Image gradient;
|
||||
|
||||
protected EditorToolbar toolbar;
|
||||
// protected Mode mode;
|
||||
|
||||
|
||||
public EditorButton(EditorToolbar parent, String name, String title) {
|
||||
@@ -128,50 +126,8 @@ implements MouseListener, MouseMotionListener, ActionListener {
|
||||
}
|
||||
|
||||
|
||||
// public String toString() {
|
||||
// switch (this) {
|
||||
// case DISABLED: return "disabled";
|
||||
// case ENABLED: return "enabled";
|
||||
// case SELECTED: return "selected";
|
||||
// case ROLLOVER: return "rollover";
|
||||
// case PRESSED: return "pressed";
|
||||
//
|
||||
//// for (State bs : State.values()) {
|
||||
//// Image image = mode.loadImage(bs.getFilename(name));
|
||||
//// if (image != null) {
|
||||
//// imageMap.put(bs, image);
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// enabled = true;
|
||||
//// //updateState();
|
||||
//// setState(State.ENABLED);
|
||||
// }
|
||||
|
||||
|
||||
// public void setReverse() {
|
||||
// gradient = mode.makeGradient("reversed", DIM, DIM);
|
||||
// }
|
||||
|
||||
|
||||
// public void setGradient(Image gradient) {
|
||||
// this.gradient = gradient;
|
||||
// }
|
||||
|
||||
|
||||
// public void setRolloverLabel(JLabel label) {
|
||||
// rolloverLabel = label;
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
// if (isEnabled()) {
|
||||
// shift = e.isShiftDown();
|
||||
// actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
|
||||
// null, e.getModifiers()));
|
||||
// }
|
||||
}
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
|
||||
public boolean isShiftDown() {
|
||||
@@ -181,12 +137,17 @@ implements MouseListener, MouseMotionListener, ActionListener {
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
setPressed(true);
|
||||
|
||||
// Need to fire here (or on mouse up) because mouseClicked()
|
||||
// Using mousePressed() (or mouseReleased()) because mouseClicked()
|
||||
// won't be fired if the user nudges the mouse while clicking.
|
||||
// https://github.com/processing/processing/issues/3529
|
||||
setPressed(true);
|
||||
|
||||
shift = e.isShiftDown();
|
||||
|
||||
// It looks like ActionEvent expects old-style modifiers,
|
||||
// so the e.getModifiers() call here may be correct.
|
||||
// TODO Look into how this is getting used in Modes,
|
||||
// and either update or add ignore to the deprecation [fry 191008]
|
||||
actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
|
||||
null, e.getModifiers()));
|
||||
}
|
||||
@@ -211,25 +172,6 @@ implements MouseListener, MouseMotionListener, ActionListener {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) { }
|
||||
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
updateRollover(e);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
System.out.println(e);
|
||||
updateRollover(e);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public String getRolloverText(InputEvent e) {
|
||||
if (e.isShiftDown()) {
|
||||
return titleShift;
|
||||
@@ -240,42 +182,15 @@ implements MouseListener, MouseMotionListener, ActionListener {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public void updateRollover(InputEvent e) {
|
||||
if (rolloverLabel != null) {
|
||||
if (e.isShiftDown()) {
|
||||
rolloverLabel.setText(titleShift);
|
||||
} else if (e.isAltDown()) {
|
||||
rolloverLabel.setText(titleAlt);
|
||||
} else {
|
||||
rolloverLabel.setText(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
toolbar.setRollover(this, e);
|
||||
/*
|
||||
rollover = true;
|
||||
updateRollover(e);
|
||||
repaint();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
toolbar.setRollover(null, e);
|
||||
/*
|
||||
rollover = false;
|
||||
if (rolloverLabel != null) {
|
||||
rolloverLabel.setText("");
|
||||
}
|
||||
repaint();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -289,11 +204,6 @@ implements MouseListener, MouseMotionListener, ActionListener {
|
||||
|
||||
abstract public void actionPerformed(ActionEvent e);
|
||||
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// // To be overridden by all subclasses
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
@@ -311,58 +221,4 @@ implements MouseListener, MouseMotionListener, ActionListener {
|
||||
public Dimension getMaximumSize() {
|
||||
return getPreferredSize();
|
||||
}
|
||||
|
||||
|
||||
// public Image getImage() {
|
||||
// return imageMap.get(state);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//// protected void updateState() {
|
||||
//// state = ButtonState.ENABLED;
|
||||
//// }
|
||||
//
|
||||
//
|
||||
// public void setEnabled(boolean enabled) {
|
||||
// this.enabled = enabled;
|
||||
// if (enabled) {
|
||||
// if (state == State.DISABLED) {
|
||||
// setState(State.ENABLED);
|
||||
// }
|
||||
// } else {
|
||||
// if (state == State.ENABLED) {
|
||||
// setState(State.DISABLED);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public void setState(State state) {
|
||||
// this.state = state;
|
||||
// }
|
||||
|
||||
|
||||
// public enum State {
|
||||
// DISABLED, ENABLED, SELECTED, ROLLOVER, PRESSED;
|
||||
//
|
||||
// /**
|
||||
// * @param name the root name
|
||||
// * @return
|
||||
// */
|
||||
// public String getFilename(String name) {
|
||||
// final int res = Toolkit.highResDisplay() ? 2 : 1;
|
||||
// return name + "-" + toString() + "-" + res + "x.png";
|
||||
// }
|
||||
//
|
||||
// public String toString() {
|
||||
// switch (this) {
|
||||
// case DISABLED: return "disabled";
|
||||
// case ENABLED: return "enabled";
|
||||
// case SELECTED: return "selected";
|
||||
// case ROLLOVER: return "rollover";
|
||||
// case PRESSED: return "pressed";
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public class Toolkit {
|
||||
|
||||
/** Command on Mac OS X, Ctrl on Windows and Linux */
|
||||
static final int SHORTCUT_KEY_MASK =
|
||||
awtToolkit.getMenuShortcutKeyMask();
|
||||
awtToolkit.getMenuShortcutKeyMaskEx();
|
||||
/** Command-Option on Mac OS X, Ctrl-Alt on Windows and Linux */
|
||||
static final int SHORTCUT_ALT_KEY_MASK =
|
||||
ActionEvent.ALT_MASK | SHORTCUT_KEY_MASK;
|
||||
@@ -178,8 +178,7 @@ public class Toolkit {
|
||||
*/
|
||||
static public JMenuItem newJMenuItem(String title, int what) {
|
||||
JMenuItem menuItem = new JMenuItem(title);
|
||||
int modifiers = awtToolkit.getMenuShortcutKeyMask();
|
||||
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
|
||||
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_KEY_MASK));
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
@@ -190,8 +189,7 @@ public class Toolkit {
|
||||
*/
|
||||
static public JMenuItem newJMenuItem(Action action, int what) {
|
||||
JMenuItem menuItem = new JMenuItem(action);
|
||||
int modifiers = awtToolkit.getMenuShortcutKeyMask();
|
||||
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
|
||||
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_KEY_MASK));
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
@@ -201,9 +199,7 @@ public class Toolkit {
|
||||
*/
|
||||
static public JMenuItem newJMenuItemShift(String title, int what) {
|
||||
JMenuItem menuItem = new JMenuItem(title);
|
||||
int modifiers = awtToolkit.getMenuShortcutKeyMask();
|
||||
modifiers |= ActionEvent.SHIFT_MASK;
|
||||
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
|
||||
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_SHIFT_KEY_MASK));
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
@@ -213,9 +209,7 @@ public class Toolkit {
|
||||
*/
|
||||
static public JMenuItem newJMenuItemShift(Action action, int what) {
|
||||
JMenuItem menuItem = new JMenuItem(action);
|
||||
int modifiers = awtToolkit.getMenuShortcutKeyMask();
|
||||
modifiers |= ActionEvent.SHIFT_MASK;
|
||||
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
|
||||
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_SHIFT_KEY_MASK));
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
@@ -235,8 +229,7 @@ public class Toolkit {
|
||||
|
||||
static public JCheckBoxMenuItem newJCheckBoxMenuItem(String title, int what) {
|
||||
JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(title);
|
||||
int modifiers = awtToolkit.getMenuShortcutKeyMask();
|
||||
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
|
||||
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_KEY_MASK));
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
@@ -326,7 +319,7 @@ public class Toolkit {
|
||||
if (fmTmp == null) return; // All null menuitems; would fail.
|
||||
final FontMetrics fm = fmTmp; // Hack for accessing variable in comparator.
|
||||
|
||||
final Comparator<Character> charComparator = new Comparator<Character>() {
|
||||
final Comparator<Character> charComparator = new Comparator<>() {
|
||||
char[] baddies = "qypgjaeiouQAEIOU".toCharArray();
|
||||
public int compare(Character ch1, Character ch2) {
|
||||
// Discriminates against descenders for readability, per MS
|
||||
@@ -699,8 +692,7 @@ public class Toolkit {
|
||||
root.registerKeyboardAction(disposer, stroke,
|
||||
JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
|
||||
int modifiers = awtToolkit.getMenuShortcutKeyMask();
|
||||
stroke = KeyStroke.getKeyStroke('W', modifiers);
|
||||
stroke = KeyStroke.getKeyStroke('W', SHORTCUT_KEY_MASK);
|
||||
root.registerKeyboardAction(disposer, stroke,
|
||||
JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
}
|
||||
|
||||
+1
-3
@@ -1,8 +1,6 @@
|
||||
work
|
||||
javadoc
|
||||
|
||||
jre/bin-test
|
||||
macosx/jdk-*
|
||||
macosx/javafx-sdk-11.0.2
|
||||
macosx/jdk-0u4.tgz
|
||||
macosx/jdk-11.0.4+11
|
||||
macosx/jfx-11.0.2.zip
|
||||
|
||||
+3
-2
@@ -1,14 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/AdoptOpenJDK 11 [11.0.4]">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="library/jogl-all.jar"/>
|
||||
<classpathentry kind="lib" path="library/gluegen-rt.jar"/>
|
||||
<classpathentry kind="lib" path="apple.jar"/>
|
||||
<classpathentry kind="lib" path="library/javafx.graphics.jar"/>
|
||||
<classpathentry kind="lib" path="library/javafx.base.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JavaFX11"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -7,9 +7,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
@@ -23,6 +23,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
|
||||
@@ -66,6 +67,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
@@ -97,7 +99,8 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||
|
||||
Binary file not shown.
@@ -18,8 +18,6 @@
|
||||
</target>
|
||||
|
||||
<path id="classpath.base">
|
||||
<!-- kinda gross, but if not using the JDT, this just ignored anyway -->
|
||||
<pathelement location="apple.jar" />
|
||||
<pathelement location="library/jogl-all.jar" />
|
||||
<pathelement location="library/gluegen-rt.jar" />
|
||||
<pathelement location="library/javafx-swt.jar" />
|
||||
@@ -61,7 +59,6 @@
|
||||
</or>
|
||||
</condition>
|
||||
|
||||
<!-- link against apple.jar for the ThinkDifferent class -->
|
||||
<mkdir dir="@{destdir}" />
|
||||
<javac source="11"
|
||||
target="11"
|
||||
|
||||
@@ -425,7 +425,7 @@ public class PSurfaceAWT extends PSurfaceNone {
|
||||
sketch.displayWidth = screenRect.width;
|
||||
sketch.displayHeight = screenRect.height;
|
||||
|
||||
windowScaleFactor = PApplet.platform == PConstants.MACOSX ?
|
||||
windowScaleFactor = PApplet.platform == PConstants.MACOS ?
|
||||
1 : sketch.pixelDensity;
|
||||
|
||||
sketchWidth = sketch.sketchWidth() * windowScaleFactor;
|
||||
@@ -565,7 +565,7 @@ public class PSurfaceAWT extends PSurfaceNone {
|
||||
// Workaround for apparent Java bug on OS X?
|
||||
// https://github.com/processing/processing/issues/3472
|
||||
if (cursorVisible &&
|
||||
(PApplet.platform == PConstants.MACOSX) &&
|
||||
(PApplet.platform == PConstants.MACOS) &&
|
||||
(cursorType != PConstants.ARROW)) {
|
||||
hideCursor();
|
||||
showCursor();
|
||||
@@ -588,7 +588,7 @@ public class PSurfaceAWT extends PSurfaceNone {
|
||||
public void setIcon(PImage image) {
|
||||
Image awtImage = (Image) image.getNative();
|
||||
|
||||
if (PApplet.platform != PConstants.MACOSX) {
|
||||
if (PApplet.platform != PConstants.MACOS) {
|
||||
frame.setIconImage(awtImage);
|
||||
|
||||
} else {
|
||||
@@ -623,12 +623,12 @@ public class PSurfaceAWT extends PSurfaceNone {
|
||||
protected void setProcessingIcon(Frame frame) {
|
||||
// On OS X, this only affects what shows up in the dock when minimized.
|
||||
// So replacing it is actually a step backwards. Brilliant.
|
||||
if (PApplet.platform != PConstants.MACOSX) {
|
||||
if (PApplet.platform != PConstants.MACOS) {
|
||||
//Image image = Toolkit.getDefaultToolkit().createImage(ICON_IMAGE);
|
||||
//frame.setIconImage(image);
|
||||
try {
|
||||
if (iconImages == null) {
|
||||
iconImages = new ArrayList<Image>();
|
||||
iconImages = new ArrayList<>();
|
||||
final int[] sizes = { 16, 32, 48, 64, 128, 256, 512 };
|
||||
|
||||
for (int sz : sizes) {
|
||||
@@ -1475,7 +1475,7 @@ public class PSurfaceAWT extends PSurfaceNone {
|
||||
public void setCursor(int kind) {
|
||||
// Swap the HAND cursor because MOVE doesn't seem to be available on OS X
|
||||
// https://github.com/processing/processing/issues/2358
|
||||
if (PApplet.platform == PConstants.MACOSX && kind == PConstants.MOVE) {
|
||||
if (PApplet.platform == PConstants.MACOS && kind == PConstants.MOVE) {
|
||||
kind = PConstants.HAND;
|
||||
}
|
||||
canvas.setCursor(Cursor.getPredefinedCursor(kind));
|
||||
|
||||
@@ -155,7 +155,7 @@ public class PApplet implements PConstants {
|
||||
String osname = System.getProperty("os.name");
|
||||
|
||||
if (osname.indexOf("Mac") != -1) {
|
||||
platform = MACOSX;
|
||||
platform = MACOS;
|
||||
|
||||
} else if (osname.indexOf("Windows") != -1) {
|
||||
platform = WINDOWS;
|
||||
@@ -981,7 +981,7 @@ public class PApplet implements PConstants {
|
||||
// be called, conjuring up the demons of various rendering configurations.
|
||||
settings();
|
||||
|
||||
if (display == SPAN && platform == MACOSX) {
|
||||
if (display == SPAN && platform == MACOS) {
|
||||
// Make sure "Displays have separate Spaces" is unchecked
|
||||
// in System Preferences > Mission Control
|
||||
Process p = exec("defaults", "read", "com.apple.spaces", "spans-displays");
|
||||
@@ -1158,7 +1158,7 @@ public class PApplet implements PConstants {
|
||||
* @param display the display number to check
|
||||
*/
|
||||
public int displayDensity(int display) {
|
||||
if (PApplet.platform == PConstants.MACOSX) {
|
||||
if (PApplet.platform == PConstants.MACOS) {
|
||||
// This should probably be reset each time there's a display change.
|
||||
// A 5-minute search didn't turn up any such event in the Java 7 API.
|
||||
// Also, should we use the Toolkit associated with the editor window?
|
||||
@@ -2696,7 +2696,7 @@ public class PApplet implements PConstants {
|
||||
int button = event.getButton();
|
||||
|
||||
// If running on Mac OS, allow ctrl-click as right mouse.
|
||||
if (PApplet.platform == PConstants.MACOSX && event.getButton() == PConstants.LEFT) {
|
||||
if (PApplet.platform == PConstants.MACOS && event.getButton() == PConstants.LEFT) {
|
||||
if (action == MouseEvent.PRESS && event.isControlDown()) {
|
||||
macosxLeftButtonWithCtrlPressed = true;
|
||||
}
|
||||
@@ -3037,8 +3037,8 @@ public class PApplet implements PConstants {
|
||||
// embedded inside an application that has its own close behavior.
|
||||
if (external &&
|
||||
event.getKeyCode() == 'W' &&
|
||||
((event.isMetaDown() && platform == MACOSX) ||
|
||||
(event.isControlDown() && platform != MACOSX))) {
|
||||
((event.isMetaDown() && platform == MACOS) ||
|
||||
(event.isControlDown() && platform != MACOS))) {
|
||||
// Can't use this native stuff b/c the native event might be NEWT
|
||||
// if (external && event.getNative() instanceof java.awt.event.KeyEvent &&
|
||||
// ((java.awt.event.KeyEvent) event.getNative()).getModifiers() ==
|
||||
@@ -3504,7 +3504,7 @@ public class PApplet implements PConstants {
|
||||
// in the user.dir part of the url
|
||||
params = new String[] { "cmd", "/c" };
|
||||
|
||||
} else if (platform == MACOSX) {
|
||||
} else if (platform == MACOS) {
|
||||
params = new String[] { "open" };
|
||||
|
||||
} else if (platform == LINUX) {
|
||||
@@ -3841,7 +3841,7 @@ public class PApplet implements PConstants {
|
||||
handleMethods("dispose");
|
||||
}
|
||||
|
||||
if (platform == MACOSX) {
|
||||
if (platform == MACOS) {
|
||||
try {
|
||||
final String td = "processing.core.ThinkDifferent";
|
||||
final Class<?> thinkDifferent = getClass().getClassLoader().loadClass(td);
|
||||
@@ -6678,7 +6678,7 @@ public class PApplet implements PConstants {
|
||||
(sketch.g instanceof PGraphicsOpenGL) && (platform == WINDOWS);
|
||||
if (hide) sketch.surface.setVisible(false);
|
||||
|
||||
if (platform == MACOSX && useNativeSelect != false) {
|
||||
if (platform == MACOS && useNativeSelect != false) {
|
||||
FileDialog fileDialog =
|
||||
new FileDialog(parentFrame, prompt, FileDialog.LOAD);
|
||||
if (defaultSelection != null) {
|
||||
@@ -7967,7 +7967,7 @@ public class PApplet implements PConstants {
|
||||
|
||||
// Workaround for bug in Java for OS X from Oracle (7u51)
|
||||
// https://github.com/processing/processing/issues/2181
|
||||
if (platform == MACOSX) {
|
||||
if (platform == MACOS) {
|
||||
if (jarPath.contains("Contents/Java/")) {
|
||||
String appPath = jarPath.substring(0, jarPath.indexOf(".app") + 4);
|
||||
File containingFolder = new File(appPath).getParentFile();
|
||||
@@ -9258,7 +9258,7 @@ public class PApplet implements PConstants {
|
||||
static Pattern matchPattern(String regexp) {
|
||||
Pattern p = null;
|
||||
if (matchPatterns == null) {
|
||||
matchPatterns = new LinkedHashMap<String, Pattern>(16, 0.75f, true) {
|
||||
matchPatterns = new LinkedHashMap<>(16, 0.75f, true) {
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Map.Entry<String, Pattern> eldest) {
|
||||
// Limit the number of match patterns at 10 most recently used
|
||||
@@ -10857,7 +10857,7 @@ public class PApplet implements PConstants {
|
||||
}
|
||||
}
|
||||
|
||||
if (platform == MACOSX) {
|
||||
if (platform == MACOS) {
|
||||
try {
|
||||
final String td = "processing.core.ThinkDifferent";
|
||||
Class<?> thinkDifferent =
|
||||
@@ -11077,7 +11077,7 @@ public class PApplet implements PConstants {
|
||||
|
||||
/** Convenience method, should only be called by PSurface subclasses. */
|
||||
static public void hideMenuBar() {
|
||||
if (PApplet.platform == PConstants.MACOSX) {
|
||||
if (PApplet.platform == PConstants.MACOS) {
|
||||
// Call some native code to remove the menu bar on OS X. Not necessary
|
||||
// on Linux and Windows, who are happy to make full screen windows.
|
||||
japplemenubar.JAppleMenuBar.hide();
|
||||
|
||||
@@ -80,9 +80,13 @@ public interface PConstants {
|
||||
|
||||
static final int OTHER = 0;
|
||||
static final int WINDOWS = 1;
|
||||
static final int MACOSX = 2;
|
||||
static final int MACOS = 2;
|
||||
static final int LINUX = 3;
|
||||
|
||||
/** @deprecated Marketers gonna market, use {@link #MACOS} */
|
||||
@Deprecated
|
||||
static final int MACOSX = 2;
|
||||
|
||||
static final String[] platformNames = {
|
||||
"other", "windows", "macosx", "linux"
|
||||
};
|
||||
|
||||
@@ -914,7 +914,7 @@ public class PFont implements PConstants {
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
fonts = ge.getAllFonts();
|
||||
|
||||
if (PApplet.platform == PConstants.MACOSX) {
|
||||
if (PApplet.platform == PConstants.MACOS) {
|
||||
fontDifferent = new HashMap<>();
|
||||
for (Font font : fonts) {
|
||||
// No need to use getPSName() anymore because getName()
|
||||
@@ -936,7 +936,7 @@ public class PFont implements PConstants {
|
||||
* See: <a href="https://github.com/processing/processing/issues/5481">issue #5481</a>
|
||||
*/
|
||||
static public Font findFont(String name) {
|
||||
if (PApplet.platform == PConstants.MACOSX) {
|
||||
if (PApplet.platform == PConstants.MACOS) {
|
||||
loadFonts();
|
||||
Font maybe = fontDifferent.get(name);
|
||||
if (maybe != null) {
|
||||
|
||||
@@ -22,11 +22,13 @@
|
||||
|
||||
package processing.core;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Desktop;
|
||||
import java.awt.Image;
|
||||
import java.awt.Taskbar;
|
||||
|
||||
|
||||
/**
|
||||
* Deal with issues related to Mac OS window behavior.
|
||||
* Deal with issues related to macOS application behavior.
|
||||
*
|
||||
* We have to register a quit handler to safely shut down the sketch,
|
||||
* otherwise OS X will just kill the sketch when a user hits Cmd-Q.
|
||||
@@ -37,15 +39,15 @@ import java.awt.*;
|
||||
* <a href="https://github.com/processing/processing/issues/3301">3301</a>.
|
||||
*/
|
||||
public class ThinkDifferent {
|
||||
|
||||
private static Desktop desktop;
|
||||
private static Taskbar taskbar;
|
||||
static private Desktop desktop;
|
||||
static private Taskbar taskbar;
|
||||
|
||||
// True if user has tried to quit once. Prevents us from canceling the quit
|
||||
// call if the sketch is held up for some reason, like an exception that's
|
||||
// managed to put the sketch in a bad state.
|
||||
static boolean attemptedQuit;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the sketch with the quit handler.
|
||||
*
|
||||
@@ -70,6 +72,7 @@ public class ThinkDifferent {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the quit handler.
|
||||
*/
|
||||
@@ -77,44 +80,36 @@ public class ThinkDifferent {
|
||||
getDesktop().setQuitHandler(null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via reflection from PSurfaceAWT and others, set the dock icon image.
|
||||
*
|
||||
* @param image The image to provide for Processing icon.
|
||||
*/
|
||||
static public void setIconImage(Image image) {
|
||||
getTaskbar().setIconImage(image);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the taskbar where OS visual settings can be provided.
|
||||
*
|
||||
* @return Cached taskbar singleton instance.
|
||||
*/
|
||||
static private Taskbar getTaskbar() {
|
||||
if (taskbar == null) {
|
||||
taskbar = Taskbar.getTaskbar();
|
||||
}
|
||||
|
||||
return taskbar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the desktop where OS behavior can be provided.
|
||||
*
|
||||
* @return Cached desktop singleton instance.
|
||||
*/
|
||||
static private Desktop getDesktop() {
|
||||
if (desktop == null) {
|
||||
desktop = Desktop.getDesktop();
|
||||
}
|
||||
|
||||
return desktop;
|
||||
}
|
||||
|
||||
|
||||
// Instead, just use Application.getApplication() inside your app
|
||||
// static public Application getApplication() {
|
||||
// return desktop;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class PSurfaceFX implements PSurface {
|
||||
|
||||
//addEventHandler(eventType, eventHandler);
|
||||
|
||||
EventHandler<MouseEvent> mouseHandler = new EventHandler<MouseEvent>() {
|
||||
EventHandler<MouseEvent> mouseHandler = new EventHandler<>() {
|
||||
public void handle(MouseEvent e) {
|
||||
fxMouseEvent(e);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public class PSurfaceFX implements PSurface {
|
||||
}
|
||||
});
|
||||
|
||||
EventHandler<KeyEvent> keyHandler = new EventHandler<KeyEvent>() {
|
||||
EventHandler<KeyEvent> keyHandler = new EventHandler<>() {
|
||||
public void handle(KeyEvent e) {
|
||||
fxKeyEvent(e);
|
||||
}
|
||||
@@ -248,12 +248,11 @@ public class PSurfaceFX implements PSurface {
|
||||
|
||||
// See JEP 263
|
||||
float renderScale = Screen.getMainScreen().getRecommendedOutputScaleX();
|
||||
if (PApplet.platform == PConstants.MACOSX) {
|
||||
if (PApplet.platform == PConstants.MACOS) {
|
||||
for (Screen s : Screen.getScreens()) {
|
||||
renderScale = Math.max(renderScale, s.getRecommendedOutputScaleX());
|
||||
}
|
||||
}
|
||||
float uiScale = Screen.getMainScreen().getRecommendedOutputScaleX();
|
||||
if (sketch.pixelDensity == 2 && renderScale < 2) {
|
||||
sketch.pixelDensity = 1;
|
||||
sketch.g.pixelDensity = 1;
|
||||
@@ -338,7 +337,7 @@ public class PSurfaceFX implements PSurface {
|
||||
|
||||
// Workaround for https://bugs.openjdk.java.net/browse/JDK-8136495
|
||||
// https://github.com/processing/processing/issues/3823
|
||||
if ((PApplet.platform == PConstants.MACOSX ||
|
||||
if ((PApplet.platform == PConstants.MACOS ||
|
||||
PApplet.platform == PConstants.LINUX) &&
|
||||
PApplet.javaVersionName.compareTo("1.8.0_60") >= 0 &&
|
||||
PApplet.javaVersionName.compareTo("1.8.0_72") < 0) {
|
||||
@@ -940,7 +939,6 @@ public class PSurfaceFX implements PSurface {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private int getKeyCode(KeyEvent fxEvent) {
|
||||
if (fxEvent.getEventType() == KeyEvent.KEY_TYPED) {
|
||||
return 0;
|
||||
@@ -957,7 +955,6 @@ public class PSurfaceFX implements PSurface {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private char getKeyChar(KeyEvent fxEvent) {
|
||||
KeyCode kc = fxEvent.getCode();
|
||||
|
||||
|
||||
@@ -165,6 +165,17 @@ public abstract class PGL {
|
||||
protected boolean usingFrontTex = false;
|
||||
protected boolean needSepFrontTex = false;
|
||||
|
||||
/**
|
||||
* Defines if FBO Layer is allowed in the given environment.
|
||||
* Using FBO can cause a fatal error during runtime for
|
||||
* Intel HD Graphics 3000 chipsets (commonly used on older MacBooks)
|
||||
* <a href="https://github.com/processing/processing/issues/4104">#4104</a>
|
||||
* The value remains as 'true' unless set false during init.
|
||||
* TODO There's already code in here to enable/disable the FBO properly,
|
||||
* this should be making use of that mechanism instead. [fry 191007]
|
||||
*/
|
||||
protected boolean fboAllowed = true;
|
||||
|
||||
// ........................................................
|
||||
|
||||
// Texture rendering
|
||||
@@ -852,10 +863,12 @@ public abstract class PGL {
|
||||
saveFirstFrame();
|
||||
}
|
||||
|
||||
if (!clearColor && 0 < sketch.frameCount || !sketch.isLooping()) {
|
||||
enableFBOLayer();
|
||||
if (SINGLE_BUFFERED) {
|
||||
createFBOLayer();
|
||||
if (fboAllowed) {
|
||||
if (!clearColor && 0 < sketch.frameCount || !sketch.isLooping()) {
|
||||
enableFBOLayer();
|
||||
if (SINGLE_BUFFERED) {
|
||||
createFBOLayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package processing.opengl;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Point;
|
||||
@@ -35,6 +36,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -109,6 +111,7 @@ public class PSurfaceJOGL implements PSurface {
|
||||
|
||||
protected boolean external = false;
|
||||
|
||||
|
||||
public PSurfaceJOGL(PGraphics graphics) {
|
||||
this.graphics = graphics;
|
||||
this.pgl = (PJOGL) ((PGraphicsOpenGL)graphics).pgl;
|
||||
@@ -174,7 +177,24 @@ public class PSurfaceJOGL implements PSurface {
|
||||
awtDisplayDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
|
||||
}
|
||||
|
||||
displayRect = awtDisplayDevice.getDefaultConfiguration().getBounds();
|
||||
GraphicsConfiguration config = awtDisplayDevice.getDefaultConfiguration();
|
||||
displayRect = config.getBounds();
|
||||
|
||||
/** See explanation at {@link PGL#fboAllowed} in PGL */
|
||||
if (PApplet.platform == PConstants.MACOS) {
|
||||
try {
|
||||
Class<?> cglClass = Class.forName("sun.java2d.opengl.CGLGraphicsConfig");
|
||||
Method cglMethod = cglClass.getMethod("getContextCapabilities");
|
||||
Class<?> ctcClass = Class.forName("sun.java2d.pipe.hw.ContextCapabilities");
|
||||
Method ctcMethod = ctcClass.getMethod("getAdapterId");
|
||||
Object cglInstance = cglClass.cast(config);
|
||||
Object ctcInstance = cglMethod.invoke(cglInstance);
|
||||
Object idInstance = ctcMethod.invoke(ctcInstance);
|
||||
if (String.valueOf(idInstance).contains("Intel HD Graphics 3000")) {
|
||||
pgl.fboAllowed = false;
|
||||
}
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +277,7 @@ public class PSurfaceJOGL implements PSurface {
|
||||
// window = GLWindow.create(displayDevice.getScreen(), pgl.getCaps());
|
||||
// }
|
||||
|
||||
windowScaleFactor = PApplet.platform == PConstants.MACOSX ?
|
||||
windowScaleFactor = PApplet.platform == PConstants.MACOS ?
|
||||
1 : sketch.pixelDensity;
|
||||
|
||||
boolean spanDisplays = sketch.sketchDisplay() == PConstants.SPAN;
|
||||
@@ -321,7 +341,7 @@ public class PSurfaceJOGL implements PSurface {
|
||||
sketch.setSize(sketchWidth, sketchHeight);
|
||||
|
||||
float[] reqSurfacePixelScale;
|
||||
if (graphics.is2X() && PApplet.platform == PConstants.MACOSX) {
|
||||
if (graphics.is2X() && PApplet.platform == PConstants.MACOS) {
|
||||
// Retina
|
||||
reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE,
|
||||
ScalableSurface.AUTOMAX_PIXELSCALE };
|
||||
@@ -777,7 +797,7 @@ public class PSurfaceJOGL implements PSurface {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (PApplet.platform == PConstants.MACOSX) {
|
||||
if (PApplet.platform == PConstants.MACOS) {
|
||||
return getCurrentPixelScale();
|
||||
}
|
||||
|
||||
@@ -900,7 +920,7 @@ public class PSurfaceJOGL implements PSurface {
|
||||
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
|
||||
pgl.resetFBOLayer();
|
||||
pgl.getGL(drawable);
|
||||
float scale = PApplet.platform == PConstants.MACOSX ?
|
||||
float scale = PApplet.platform == PConstants.MACOS ?
|
||||
getCurrentPixelScale() : getPixelScale();
|
||||
setSize((int) (w / scale), (int) (h / scale));
|
||||
}
|
||||
@@ -1044,7 +1064,7 @@ public class PSurfaceJOGL implements PSurface {
|
||||
}
|
||||
|
||||
int scale;
|
||||
if (PApplet.platform == PConstants.MACOSX) {
|
||||
if (PApplet.platform == PConstants.MACOS) {
|
||||
scale = (int) getCurrentPixelScale();
|
||||
} else {
|
||||
scale = (int) getPixelScale();
|
||||
|
||||
+13
-2
@@ -1,5 +1,10 @@
|
||||
0270 (3.5.4 or 3.6)
|
||||
_ size() issues on Mojave?
|
||||
1270 (4.x alpha)
|
||||
X check for disabling FBO code (fixes Intel HD 3000)
|
||||
X https://github.com/processing/processing/issues/4104
|
||||
X https://github.com/processing/processing/pull/5881
|
||||
|
||||
|
||||
_ size() issues on Mojave? (3.4 works, 3.5.3 does not)
|
||||
_ https://github.com/processing/processing/issues/5791
|
||||
_ use exit event to set mouseY to 0 on macOS
|
||||
_ https://github.com/processing/processing/pull/5796/files
|
||||
@@ -7,8 +12,14 @@ _ https://github.com/processing/processing/pull/5796/files
|
||||
_ possible fix for precision issues with PDF
|
||||
_ https://github.com/processing/processing/issues/5801#issuecomment-466632459
|
||||
|
||||
_ simple rotateZ() fix
|
||||
_ https://github.com/processing/processing/pull/5821
|
||||
_ https://github.com/processing/processing/issues/5770
|
||||
|
||||
|
||||
high-ish
|
||||
_ Update isAccessible() in Table to use JDK 11 reflection methods
|
||||
_ https://github.com/processing/processing4/issues/3
|
||||
_ add separator option to loadTable()
|
||||
_ https://github.com/processing/processing/issues/5068
|
||||
_ make setting the window icon automatic, based on files in local dirs
|
||||
|
||||
+7
-5
@@ -2,11 +2,16 @@
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="generated"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/processing4-app"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/processing4-core"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/AdoptOpenJDK 11 [11.0.4]">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="mode/antlr-4.7.2-complete.jar"/>
|
||||
<classpathentry kind="lib" path="mode/classpath-explorer-1.0.jar"/>
|
||||
<classpathentry kind="lib" path="mode/com.ibm.icu.jar"/>
|
||||
<classpathentry kind="lib" path="mode/jdi.jar"/>
|
||||
<classpathentry kind="lib" path="mode/jdimodel.jar"/>
|
||||
<classpathentry kind="lib" path="mode/jdtCompilerAdapter.jar"/>
|
||||
<classpathentry kind="lib" path="mode/jsoup-1.7.1.jar"/>
|
||||
<classpathentry kind="lib" path="mode/org.eclipse.core.contenttype.jar"/>
|
||||
@@ -20,8 +25,5 @@
|
||||
<classpathentry kind="lib" path="mode/org.eclipse.text.jar"/>
|
||||
<classpathentry kind="lib" path="mode/org.netbeans.swing.outline.jar"/>
|
||||
<classpathentry kind="lib" path="test/lib/junit-4.8.1.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/processing-app"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/processing-core"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
||||
+2
-2
@@ -54,13 +54,13 @@
|
||||
<pathelement location="../app/lib/apple.jar" />
|
||||
<pathelement location="../app/lib/jna.jar" />
|
||||
<pathelement location="../app/lib/jna-platform.jar" />
|
||||
|
||||
<pathelement location="mode/antlr-4.7.2-complete.jar" />
|
||||
<pathelement location="mode/classpath-explorer-1.0.jar" />
|
||||
<pathelement location="mode/jsoup-1.7.1.jar" />
|
||||
<pathelement location="mode/org.netbeans.swing.outline.jar" />
|
||||
<pathelement location="mode/jdi.jar" />
|
||||
<pathelement location="mode/jdimodel.jar" />
|
||||
<pathelement location="mode/com.ibm.icu.jar" />
|
||||
|
||||
<pathelement location="mode/org.eclipse.core.contenttype.jar" />
|
||||
<pathelement location="mode/org.eclipse.core.jobs.jar" />
|
||||
<pathelement location="mode/org.eclipse.core.resources.jar" />
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2012-15 The Processing Foundation
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
Copyright (c) 2008-12 Ben Fry and Casey Reas
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -42,8 +42,6 @@ import processing.mode.java.runner.Runner;
|
||||
|
||||
/**
|
||||
* Class to handle running Processing from the command line.
|
||||
*
|
||||
* @author fry
|
||||
*/
|
||||
public class Commander implements RunnerListener {
|
||||
static final String helpArg = "--help";
|
||||
@@ -65,7 +63,6 @@ public class Commander implements RunnerListener {
|
||||
static final int BUILD = 1;
|
||||
static final int RUN = 2;
|
||||
static final int PRESENT = 3;
|
||||
// static final int EXPORT_APPLET = 4;
|
||||
static final int EXPORT = 4;
|
||||
|
||||
Sketch sketch;
|
||||
@@ -74,19 +71,6 @@ public class Commander implements RunnerListener {
|
||||
PrintStream systemErr;
|
||||
|
||||
|
||||
static public void main(String[] args) {
|
||||
// Do this early so that error messages go to the console
|
||||
Base.setCommandLine();
|
||||
// init the platform so that prefs and other native code is ready to go
|
||||
Platform.init();
|
||||
// make sure a full JDK is installed
|
||||
//Base.initRequirements();
|
||||
|
||||
// launch command line handler
|
||||
new Commander(args);
|
||||
}
|
||||
|
||||
|
||||
public Commander(String[] args) {
|
||||
String sketchPath = null;
|
||||
File sketchFolder = null;
|
||||
@@ -152,7 +136,6 @@ public class Commander implements RunnerListener {
|
||||
embedJava = false;
|
||||
|
||||
} else if (arg.startsWith(platformArg)) {
|
||||
// complainAndQuit("The --platform option has been removed from Processing 2.1.", false);
|
||||
String platformStr = arg.substring(platformArg.length());
|
||||
platform = Platform.getIndex(platformStr);
|
||||
if (platform == -1) {
|
||||
@@ -160,17 +143,6 @@ public class Commander implements RunnerListener {
|
||||
"'windows', 'macosx', or 'linux'.", true);
|
||||
}
|
||||
|
||||
} else if (arg.startsWith(bitsArg)) {
|
||||
complainAndQuit("The --bits option has been removed.", false);
|
||||
// String bitsStr = arg.substring(bitsArg.length());
|
||||
// if (bitsStr.equals("32")) {
|
||||
// platformBits = 32;
|
||||
// } else if (bitsStr.equals("64")) {
|
||||
// platformBits = 64;
|
||||
// } else {
|
||||
// complainAndQuit("Bits should be either 32 or 64, not " + bitsStr, true);
|
||||
// }
|
||||
|
||||
} else if (arg.startsWith(sketchArg)) {
|
||||
sketchPath = arg.substring(sketchArg.length());
|
||||
sketchFolder = new File(sketchPath);
|
||||
@@ -199,13 +171,6 @@ public class Commander implements RunnerListener {
|
||||
}
|
||||
String[] sketchArgs = PApplet.subset(args, argOffset);
|
||||
|
||||
// if ((outputPath == null) &&
|
||||
// (task == PREPROCESS || task == BUILD ||
|
||||
// task == RUN || task == PRESENT)) {
|
||||
// complainAndQuit("An output path must be specified when using " +
|
||||
// preprocArg + ", " + buildArg + ", " +
|
||||
// runArg + ", or " + presentArg + ".");
|
||||
// }
|
||||
if (task == HELP) {
|
||||
printCommandLine(systemOut);
|
||||
System.exit(0);
|
||||
@@ -256,8 +221,6 @@ public class Commander implements RunnerListener {
|
||||
|
||||
boolean success = false;
|
||||
|
||||
// JavaMode javaMode =
|
||||
// new JavaMode(null, Base.getContentFile("modes/java"));
|
||||
JavaMode javaMode = (JavaMode)
|
||||
ModeContribution.load(null, Platform.getContentFile("modes/java"),
|
||||
"processing.mode.java.JavaMode").getMode();
|
||||
@@ -389,9 +352,6 @@ public class Commander implements RunnerListener {
|
||||
out.println("--no-java Do not embed Java. Use at your own risk!");
|
||||
out.println("--platform Specify the platform (export to application only).");
|
||||
out.println(" Should be one of 'windows', 'macosx', or 'linux'.");
|
||||
// out.println("--bits Must be specified if libraries are used that are");
|
||||
// out.println(" 32- or 64-bit specific such as the OpenGL library.");
|
||||
// out.println(" Otherwise specify 0 or leave it out.");
|
||||
|
||||
out.println();
|
||||
out.println("The --build, --run, --present, or --export must be the final parameter");
|
||||
@@ -406,22 +366,31 @@ public class Commander implements RunnerListener {
|
||||
|
||||
|
||||
@Override
|
||||
public void startIndeterminate() {
|
||||
}
|
||||
public void startIndeterminate() { }
|
||||
|
||||
|
||||
@Override
|
||||
public void stopIndeterminate() {
|
||||
}
|
||||
public void stopIndeterminate() { }
|
||||
|
||||
|
||||
@Override
|
||||
public void statusHalt() {
|
||||
}
|
||||
public void statusHalt() { }
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isHalted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static public void main(String[] args) {
|
||||
// Do this early so that error messages go to the console
|
||||
Base.setCommandLine();
|
||||
|
||||
// init the platform so that prefs and other native code is ready to go
|
||||
Platform.init();
|
||||
|
||||
// launch command line handler
|
||||
new Commander(args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,6 @@ import java.io.*;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
|
||||
//import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
|
||||
//import org.eclipse.jdt.core.compiler.CompilationProgress;
|
||||
|
||||
|
||||
public class Compiler {
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
package processing.mode.java;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
@@ -231,20 +230,12 @@ public class JavaBuild {
|
||||
outputFolder.mkdirs();
|
||||
// Base.openFolder(outputFolder);
|
||||
final File java = new File(outputFolder, sketch.getName() + ".java");
|
||||
final PrintWriter stream = new PrintWriter(new FileWriter(java, StandardCharsets.UTF_8));
|
||||
final PrintWriter stream = PApplet.createWriter(java);
|
||||
try {
|
||||
result = preprocessor.write(
|
||||
stream,
|
||||
bigCode.toString(),
|
||||
codeFolderPackages
|
||||
);
|
||||
result = preprocessor.write(stream, bigCode.toString(), codeFolderPackages);
|
||||
} finally {
|
||||
stream.close();
|
||||
}
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
fnfe.printStackTrace();
|
||||
String msg = "Build folder disappeared or could not be written";
|
||||
throw new SketchException(msg);
|
||||
} catch (SketchException pe) {
|
||||
// RunnerExceptions are caught here and re-thrown, so that they don't
|
||||
// get lost in the more general "Exception" handler below.
|
||||
@@ -582,7 +573,7 @@ public class JavaBuild {
|
||||
|
||||
if (Library.hasMultipleArch(platform, importedLibraries)) {
|
||||
// Don't try to export 32-bit on macOS, because it doesn't exist.
|
||||
if (platform != PConstants.MACOSX) {
|
||||
if (platform != PConstants.MACOS) {
|
||||
// export the 32-bit version
|
||||
folder = new File(sketch.getFolder(), "application." + platformName + "32");
|
||||
if (!exportApplication(folder, platform, "32", embedJava && (bits == 32) && ("x86".equals(arch) || "i386".equals(arch)))) {
|
||||
@@ -657,7 +648,7 @@ public class JavaBuild {
|
||||
File dotAppFolder = null;
|
||||
String jvmRuntime = "";
|
||||
String jdkPath = null;
|
||||
if (exportPlatform == PConstants.MACOSX) {
|
||||
if (exportPlatform == PConstants.MACOS) {
|
||||
dotAppFolder = new File(destFolder, sketch.getName() + ".app");
|
||||
|
||||
File contentsOrig = new File(Platform.getJavaHome(), "../../../..");
|
||||
@@ -760,10 +751,10 @@ public class JavaBuild {
|
||||
// the folder inside the .app package, while Linux and Windows will have a
|
||||
// 'data' folder next to 'lib'.
|
||||
if (sketch.hasDataFolder()) {
|
||||
if (exportPlatform == PConstants.MACOSX) {
|
||||
Util.copyDir(sketch.getDataFolder(), new File(jarFolder, "data"));
|
||||
if (exportPlatform == PConstants.MACOS) {
|
||||
Util.copyDir(sketch.getDataFolder(), new File(jarFolder, "data"));
|
||||
} else {
|
||||
Util.copyDir(sketch.getDataFolder(), new File(destFolder, "data"));
|
||||
Util.copyDir(sketch.getDataFolder(), new File(destFolder, "data"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -820,7 +811,7 @@ public class JavaBuild {
|
||||
/// create platform-specific CLASSPATH based on included jars
|
||||
|
||||
String exportClassPath = null;
|
||||
if (exportPlatform == PConstants.MACOSX) {
|
||||
if (exportPlatform == PConstants.MACOS) {
|
||||
exportClassPath = "$JAVAROOT/" + jarList.join(":$JAVAROOT/");
|
||||
} else if (exportPlatform == PConstants.WINDOWS) {
|
||||
exportClassPath = jarList.join(",");
|
||||
@@ -854,7 +845,7 @@ public class JavaBuild {
|
||||
|
||||
/// macosx: write out Info.plist (template for classpath, etc)
|
||||
|
||||
if (exportPlatform == PConstants.MACOSX) {
|
||||
if (exportPlatform == PConstants.MACOS) {
|
||||
StringBuilder runOptionsXML = new StringBuilder();
|
||||
for (String opt : runOptions) {
|
||||
runOptionsXML.append(" <string>");
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
Copyright (c) 2004-12 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 version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
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.mode.java;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -1098,7 +1121,7 @@ public class JavaEditor extends Editor {
|
||||
if (!tweak) {
|
||||
runtime = jmode.handleLaunch(sketch, listener, present);
|
||||
} else {
|
||||
runtime = jmode.handleTweak(sketch, listener);
|
||||
runtime = jmode.handleTweak(sketch, listener, JavaEditor.this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2012-15 The Processing Foundation
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
Copyright (c) 2004-12 Ben Fry and Casey Reas
|
||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||
|
||||
@@ -24,15 +24,15 @@
|
||||
|
||||
package processing.mode.java;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Arrays;
|
||||
|
||||
import processing.app.Preferences;
|
||||
import processing.app.Sketch;
|
||||
import processing.app.syntax.*;
|
||||
import processing.app.syntax.JEditTextArea;
|
||||
import processing.app.syntax.PdeInputHandler;
|
||||
import processing.app.ui.Editor;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
/**
|
||||
* Filters key events for tab expansion/indent/etc. This is very old code
|
||||
@@ -41,9 +41,9 @@ import java.util.Arrays;
|
||||
*/
|
||||
public class JavaInputHandler extends PdeInputHandler {
|
||||
|
||||
/** ctrl-alt on windows and linux, cmd-alt on mac os x */
|
||||
static final int CTRL_ALT = ActionEvent.ALT_MASK |
|
||||
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
|
||||
// /** ctrl-alt on windows and linux, cmd-alt on mac os x */
|
||||
// static final int CTRL_ALT = ActionEvent.ALT_MASK |
|
||||
// Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
|
||||
|
||||
|
||||
public JavaInputHandler(Editor editor) {
|
||||
@@ -66,7 +66,8 @@ public class JavaInputHandler extends PdeInputHandler {
|
||||
Sketch sketch = editor.getSketch();
|
||||
JEditTextArea textarea = editor.getTextArea();
|
||||
|
||||
if ((event.getModifiers() & InputEvent.META_MASK) != 0) {
|
||||
if (event.isMetaDown()) {
|
||||
//if ((event.getModifiers() & InputEvent.META_MASK) != 0) {
|
||||
//event.consume(); // does nothing
|
||||
return false;
|
||||
}
|
||||
@@ -76,8 +77,8 @@ public class JavaInputHandler extends PdeInputHandler {
|
||||
sketch.setModified(true);
|
||||
}
|
||||
|
||||
if ((code == KeyEvent.VK_UP) &&
|
||||
((event.getModifiers() & InputEvent.CTRL_MASK) != 0)) {
|
||||
if ((code == KeyEvent.VK_UP) && event.isControlDown()) {
|
||||
//((event.getModifiers() & InputEvent.CTRL_MASK) != 0)) {
|
||||
// back up to the last empty line
|
||||
char contents[] = textarea.getText().toCharArray();
|
||||
//int origIndex = textarea.getCaretPosition() - 1;
|
||||
@@ -104,7 +105,8 @@ public class JavaInputHandler extends PdeInputHandler {
|
||||
// if the first char, index will be -2
|
||||
if (index < 0) index = 0;
|
||||
|
||||
if ((event.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
|
||||
//if ((event.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
|
||||
if (event.isShiftDown()) {
|
||||
textarea.setSelectionStart(caretIndex);
|
||||
textarea.setSelectionEnd(index);
|
||||
} else {
|
||||
@@ -113,8 +115,8 @@ public class JavaInputHandler extends PdeInputHandler {
|
||||
event.consume();
|
||||
// return true;
|
||||
|
||||
} else if ((code == KeyEvent.VK_DOWN) &&
|
||||
((event.getModifiers() & InputEvent.CTRL_MASK) != 0)) {
|
||||
} else if ((code == KeyEvent.VK_DOWN) && event.isControlDown()) {
|
||||
//((event.getModifiers() & InputEvent.CTRL_MASK) != 0)) {
|
||||
char contents[] = textarea.getText().toCharArray();
|
||||
int caretIndex = textarea.getCaretPosition();
|
||||
|
||||
@@ -136,7 +138,8 @@ public class JavaInputHandler extends PdeInputHandler {
|
||||
index++;
|
||||
}
|
||||
|
||||
if ((event.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
|
||||
//if ((event.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
|
||||
if (event.isShiftDown()) {
|
||||
textarea.setSelectionStart(caretIndex);
|
||||
textarea.setSelectionEnd(index);
|
||||
} else {
|
||||
@@ -146,7 +149,8 @@ public class JavaInputHandler extends PdeInputHandler {
|
||||
// return true;
|
||||
|
||||
} else if (c == 9) {
|
||||
if ((event.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
|
||||
//if ((event.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
|
||||
if (event.isShiftDown()) {
|
||||
// if shift is down, the user always expects an outdent
|
||||
// http://code.google.com/p/processing/issues/detail?id=458
|
||||
editor.handleOutdent();
|
||||
@@ -317,7 +321,8 @@ public class JavaInputHandler extends PdeInputHandler {
|
||||
public boolean handleTyped(KeyEvent event) {
|
||||
char c = event.getKeyChar();
|
||||
|
||||
if ((event.getModifiers() & InputEvent.CTRL_MASK) != 0) {
|
||||
//if ((event.getModifiers() & InputEvent.CTRL_MASK) != 0) {
|
||||
if (event.isControlDown()) { // TODO true on typed? [fry 191007]
|
||||
// on linux, ctrl-comma (prefs) being passed through to the editor
|
||||
if (c == KeyEvent.VK_COMMA) {
|
||||
event.consume();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2010-11 Ben Fry and Casey Reas
|
||||
Copyright (c) 2012-15 The Processing Foundation
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
@@ -37,6 +37,7 @@ import processing.app.*;
|
||||
import processing.app.ui.Editor;
|
||||
import processing.app.ui.EditorException;
|
||||
import processing.app.ui.EditorState;
|
||||
|
||||
import processing.mode.java.runner.Runner;
|
||||
import processing.mode.java.tweak.SketchParser;
|
||||
|
||||
@@ -140,10 +141,8 @@ public class JavaMode extends Mode {
|
||||
|
||||
/** Start a sketch in tweak mode */
|
||||
public Runner handleTweak(Sketch sketch,
|
||||
RunnerListener listener) throws SketchException {
|
||||
// final boolean present) throws SketchException {
|
||||
final JavaEditor editor = (JavaEditor) listener;
|
||||
|
||||
RunnerListener listener,
|
||||
JavaEditor editor) throws SketchException {
|
||||
// first try to build the unmodified code
|
||||
JavaBuild build = new JavaBuild(sketch);
|
||||
// String appletClassName = build.build(false);
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
package processing.mode.java;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -131,7 +130,7 @@ public class JavaToolbar extends EditorToolbar {
|
||||
|
||||
@Override
|
||||
public void handleRun(int modifiers) {
|
||||
boolean shift = (modifiers & InputEvent.SHIFT_MASK) != 0;
|
||||
boolean shift = (modifiers & ActionEvent.SHIFT_MASK) != 0;
|
||||
if (shift) {
|
||||
jeditor.handlePresent();
|
||||
} else {
|
||||
|
||||
@@ -1790,7 +1790,7 @@ public class CompletionGenerator {
|
||||
|
||||
// Now parse the expression into an ASTNode object
|
||||
ASTNode nearestNode;
|
||||
ASTParser parser = ASTParser.newParser(AST.JLS8);
|
||||
ASTParser parser = ASTParser.newParser(AST.JLS11);
|
||||
parser.setKind(ASTParser.K_EXPRESSION);
|
||||
parser.setSource(phrase.toCharArray());
|
||||
ASTNode testnode = parser.createAST(null);
|
||||
|
||||
@@ -8,8 +8,6 @@ import processing.app.Problem;
|
||||
import processing.app.ui.Editor;
|
||||
import processing.mode.java.preproc.issue.PdePreprocessIssue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Factory which helps create {Problem}s during preprocessing.
|
||||
|
||||
@@ -20,22 +20,31 @@ along with this program; if not, write to the Free Software Foundation, Inc.
|
||||
|
||||
package processing.mode.java.pdex.util;
|
||||
|
||||
import com.google.classpath.ClassPathFactory;
|
||||
import processing.app.*;
|
||||
import processing.mode.java.JavaMode;
|
||||
import processing.mode.java.pdex.ImportStatement;
|
||||
import processing.mode.java.pdex.PreprocessedSketch;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.classpath.ClassPathFactory;
|
||||
|
||||
import processing.app.Library;
|
||||
import processing.app.Messages;
|
||||
import processing.app.Sketch;
|
||||
import processing.app.SketchException;
|
||||
import processing.app.Util;
|
||||
import processing.mode.java.JavaMode;
|
||||
import processing.mode.java.pdex.ImportStatement;
|
||||
import processing.mode.java.pdex.PreprocessedSketch;
|
||||
|
||||
|
||||
/**
|
||||
* Builder which generates runtime paths using a series of caches.
|
||||
|
||||
@@ -662,10 +662,8 @@ public class Runner implements MessageConsumer {
|
||||
|
||||
|
||||
protected Connector findConnector(String connectorName) {
|
||||
// List connectors =
|
||||
// com.sun.jdi.Bootstrap.virtualMachineManager().allConnectors();
|
||||
List<Connector> connectors =
|
||||
org.eclipse.jdi.Bootstrap.virtualMachineManager().allConnectors();
|
||||
com.sun.jdi.Bootstrap.virtualMachineManager().allConnectors();
|
||||
|
||||
// // debug: code to list available connectors
|
||||
// Iterator iter2 = connectors.iterator();
|
||||
|
||||
@@ -23,6 +23,7 @@ package processing.mode.java.tweak;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -171,7 +172,7 @@ public class Handle {
|
||||
|
||||
} else if ("float".equals(type)) {
|
||||
BigDecimal bd = new BigDecimal(value.floatValue());
|
||||
bd = bd.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP);
|
||||
bd = bd.setScale(decimalPlaces, RoundingMode.HALF_UP);
|
||||
newValue = bd.floatValue();
|
||||
strNewValue = String.format(Locale.US, textFormat, newValue.floatValue());
|
||||
}
|
||||
|
||||
@@ -1,10 +1,34 @@
|
||||
0270 (3.5.4 or 3.6)
|
||||
1270 (4.x alpha)
|
||||
X use ctrl-page up/down for tabs on Windows
|
||||
X https://github.com/processing/processing/issues/5794
|
||||
X fix potential highlighting issue that wasn't selecting portions of text
|
||||
X update AppBundler to use newer SDK, recompile
|
||||
X edit build.xml files and appbundler to preserve more attributes
|
||||
|
||||
after the JDK 11 update
|
||||
X use a new pref for the sketchbook folder location for 4.x
|
||||
X finish porting ThinkDifferent to use Desktop APIs
|
||||
X http://openjdk.java.net/jeps/272
|
||||
X also roll it into MacPlatform, since less platform-specific code needed
|
||||
_ Implement reliable getLibraryFolder() and getDocumentsFolder() methods in MacPlatform
|
||||
_ https://github.com/processing/processing4/issues/9
|
||||
|
||||
major updates for JDK 11 et al
|
||||
X https://github.com/processing/processing4/pull/1
|
||||
_ go through the comment w/ the various bugs that can be closed
|
||||
_ remove jdk.hash from build.xml
|
||||
_ need to make sure the downloader isn't relying on it
|
||||
_ clean up naming for build/macosx/jdk-0u1.tgz and build/macosx/jdk-11.0.1+13/
|
||||
_ fix "WARNING: Illegal reflective access by processing.app.ui.Toolkit to field sun.awt.CGraphicsDevice.scale" warning on startup
|
||||
|
||||
contribs
|
||||
X tweak mode not working
|
||||
X https://github.com/processing/processing/issues/5805
|
||||
X https://github.com/processing/processing/pull/5909
|
||||
|
||||
_ selecting a sketch in the Sketch menu no longer opens its window
|
||||
_ https://github.com/processing/processing/issues/5882
|
||||
|
||||
_ windows anti-malware leaves browser stuck at 100%
|
||||
_ https://github.com/processing/processing/issues/5893
|
||||
|
||||
@@ -13,8 +37,9 @@ _ https://github.com/processing/processing/issues/5482
|
||||
_ https://github.com/processing/processing/issues/5916
|
||||
_ https://github.com/processing/processing/issues/5823
|
||||
|
||||
fork issues
|
||||
_ processing-sam/build/macosx/jdk-0u1_macosx_64.tgz
|
||||
quick fixes
|
||||
_ rename-variable menu allows Java identifiers
|
||||
_ https://github.com/processing/processing/pull/5906
|
||||
|
||||
from Casey
|
||||
_ Issue with https and downloading the binaries, +Checksums?
|
||||
|
||||
Reference in New Issue
Block a user