From 2d907da8ca12916665bb4e7443523ed9798149b5 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sun, 7 Aug 2022 22:10:11 -0400 Subject: [PATCH] cleaning todo notes and purging "applet" mentions --- core/src/processing/core/PApplet.java | 273 +++---------------------- core/src/processing/core/PSurface.java | 4 +- todo.txt | 12 +- 3 files changed, 32 insertions(+), 257 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index b5b960d9c..4d36f4d98 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -658,7 +658,7 @@ public class PApplet implements PConstants { public boolean focused = false; /** - * Time in milliseconds when the applet was started. + * Time in milliseconds when the sketch was started. *

* Used by the millis() function. */ @@ -716,16 +716,16 @@ public class PApplet implements PConstants { /** * Position of the upper left-hand corner of the editor window - * that launched this applet. + * that launched this sketch. */ static public final String ARGS_EDITOR_LOCATION = "--editor-location"; static public final String ARGS_EXTERNAL = "--external"; /** - * Location for where to position the applet window on screen. + * Location for where to position the sketch window on screen. *

- * This is used by the editor to when saving the previous applet + * This is used by the editor to when saving the previous sketch * location, or could be used by other classes to launch at a * specific position on-screen. */ @@ -768,7 +768,7 @@ public class PApplet implements PConstants { static public final String EXTERNAL_STOP = "__STOP__"; /** - * When run externally to a PDE Editor, this is sent by the applet + * When run externally to a PDE Editor, this is sent by the sketch * whenever the window is moved. *

* This is used so that the editor can re-open the sketch window @@ -1239,16 +1239,9 @@ public class PApplet implements PConstants { /** - * Called by the browser or applet viewer to inform this applet that it - * should start its execution. It is called after the init method and - * each time the applet is revisited in a Web page. - *

- * Called explicitly via the first call to PApplet.paint(), because - * PAppletGL needs to have a usable screen before getting things rolling. + * Called by the application context to start running (or resume) the sketch. */ public void start() { -// paused = false; // unpause the thread // removing for 3.0a5, don't think we want this here - resume(); handleMethods("resume"); surface.resumeThread(); @@ -1256,44 +1249,14 @@ public class PApplet implements PConstants { /** - * Called by the browser or applet viewer to inform - * this applet that it should stop its execution. - *

- * Unfortunately, there are no guarantees from the Java spec - * when or if stop() will be called (i.e. on browser quit, - * or when moving between web pages), and it's not always called. + * Called by the application context to stop running (or pause) the sketch. */ public void stop() { - // this used to shut down the sketch, but that code has - // been moved to destroy/dispose() - -// if (paused) { -// synchronized (pauseObject) { -// try { -// pauseObject.wait(); -// } catch (InterruptedException e) { -// // waiting for this interrupt on a start() (resume) call -// } -// } -// } - - //paused = true; // causes animation thread to sleep // 3.0a5 pause(); handleMethods("pause"); // calling this down here, since it's another thread it's safer to call // pause() and the registered pause methods first. surface.pauseThread(); - - // actual pause will happen in the run() method - -// synchronized (pauseObject) { -// debug("stop() calling pauseObject.wait()"); -// try { -// pauseObject.wait(); -// } catch (InterruptedException e) { -// // waiting for this interrupt on a start() (resume) call -// } -// } } @@ -1313,23 +1276,6 @@ public class PApplet implements PConstants { public void resume() { } -// /** -// * Called by the browser or applet viewer to inform this applet -// * that it is being reclaimed and that it should destroy -// * any resources that it has allocated. -// *

-// * destroy() supposedly gets called as the applet viewer -// * is shutting down the applet. stop() is called -// * first, and then destroy() to really get rid of things. -// * no guarantees on when they're run (on browser quit, or -// * when moving between pages), though. -// */ -// @Override -// public void destroy() { -// this.dispose(); -// } - - ////////////////////////////////////////////////////////////// @@ -2871,7 +2817,7 @@ public class PApplet implements PConstants { * keyReleased with key == CODED and keyCode == SHIFT * (note there is no keyTyped) * - * 6. Pressing the tab key in an applet with Java 1.4 will + * 6. Pressing the tab key in a Component with Java 1.4 will * normally do nothing, but PApplet dynamically shuts * this behavior off if Java 1.4 is in use (tested 1.4.2_05 Windows). * Java 1.1 (Microsoft VM) passes the TAB key through normally. @@ -2974,7 +2920,7 @@ public class PApplet implements PConstants { /** * * Returns the number of milliseconds (thousandths of a second) since - * starting an applet. This information is often used for timing animation + * starting the sketch. This information is often used for timing animation * sequences. * * @@ -2985,7 +2931,7 @@ public class PApplet implements PConstants { * * @webref input:time date * @webBrief Returns the number of milliseconds (thousandths of a second) since - * starting an applet + * the sketch started. * @see PApplet#second() * @see PApplet#minute() * @see PApplet#hour() @@ -3192,12 +3138,6 @@ public class PApplet implements PConstants { * Links to a webpage either in the same window or in a new window. The * complete URL must be specified. * - *

Advanced

- * Link to an external page without all the muss. - *

- * When run with an applet, uses the browser to open the url, - * for applications, attempts to launch a browser with the url. - * * @param url the complete URL, as a String in quotes */ public void link(String url) { @@ -3491,8 +3431,8 @@ public class PApplet implements PConstants { /** - * Function for an applet/application to kill itself and - * display an error. Mostly this is here to be improved later. + * Function for an application to kill itself and display an error. + * Mostly this is here to be improved later. */ public void die(String what) { dispose(); @@ -3563,11 +3503,7 @@ public class PApplet implements PConstants { * they have in mind when cleaning up. */ public void exitActual() { - try { - System.exit(0); - } catch (SecurityException e) { - // don't care about applet security exceptions - } + System.exit(0); } @@ -3718,12 +3654,7 @@ public class PApplet implements PConstants { /** */ public void saveFrame() { - try { - g.save(savePath("screen-" + nf(frameCount, 4) + ".tif")); - } catch (SecurityException se) { - System.err.println("Can't use saveFrame() when running in a browser, " + - "unless using a signed applet."); - } + g.save(savePath("screen-" + nf(frameCount, 4) + ".tif")); } @@ -3763,12 +3694,7 @@ public class PApplet implements PConstants { * ".tga", ".jpg", or ".png" */ public void saveFrame(String filename) { - try { - g.save(savePath(insertFrame(filename))); - } catch (SecurityException se) { - System.err.println("Can't use saveFrame() when running in a browser, " + - "unless using a signed applet."); - } + g.save(savePath(insertFrame(filename))); } @@ -4214,7 +4140,7 @@ public class PApplet implements PConstants { // MATH // lots of convenience methods for math with floats. - // doubles are overkill for processing applets, and casting + // doubles are overkill for processing sketches, and casting // things all the time is annoying, thus the functions below. /** @@ -6041,21 +5967,6 @@ public class PApplet implements PConstants { } - /* - static public void selectInput(String prompt, String callbackMethod, - File file, Object callbackObject, Frame parent, - PApplet sketch) { - selectImpl(prompt, callbackMethod, file, callbackObject, parent, FileDialog.LOAD, sketch); - } - - - static public void selectInput(String prompt, String callbackMethod, - File file, Object callbackObject, Frame parent) { - selectImpl(prompt, callbackMethod, file, callbackObject, parent, FileDialog.LOAD, null); - } - */ - - /** * Opens a platform-specific file chooser dialog to select a file for output. * After the selection is made, the selected File will be passed to the @@ -6085,77 +5996,6 @@ public class PApplet implements PConstants { } - /* - static public void selectOutput(String prompt, String callbackMethod, - File file, Object callbackObject, Frame parent) { - selectImpl(prompt, callbackMethod, file, callbackObject, parent, FileDialog.SAVE, null); - } - - - static public void selectOutput(String prompt, String callbackMethod, - File file, Object callbackObject, Frame parent, - PApplet sketch) { - selectImpl(prompt, callbackMethod, file, callbackObject, parent, FileDialog.SAVE, sketch); - } - - - // Will remove the 'sketch' parameter once we get an upstream JOGL fix - // https://github.com/processing/processing/issues/3831 - static protected void selectImpl(final String prompt, - final String callbackMethod, - final File defaultSelection, - final Object callbackObject, - final Frame parentFrame, - final int mode, - final PApplet sketch) { - EventQueue.invokeLater(new Runnable() { - public void run() { - File selectedFile = null; - - boolean hide = (sketch != null) && - (sketch.g instanceof PGraphicsOpenGL) && (platform == WINDOWS); - if (hide) sketch.surface.setVisible(false); - - if (useNativeSelect) { - FileDialog dialog = new FileDialog(parentFrame, prompt, mode); - if (defaultSelection != null) { - dialog.setDirectory(defaultSelection.getParent()); - dialog.setFile(defaultSelection.getName()); - } - - dialog.setVisible(true); - String directory = dialog.getDirectory(); - String filename = dialog.getFile(); - if (filename != null) { - selectedFile = new File(directory, filename); - } - - } else { - JFileChooser chooser = new JFileChooser(); - chooser.setDialogTitle(prompt); - if (defaultSelection != null) { - chooser.setSelectedFile(defaultSelection); - } - - int result = -1; - if (mode == FileDialog.SAVE) { - result = chooser.showSaveDialog(parentFrame); - } else if (mode == FileDialog.LOAD) { - result = chooser.showOpenDialog(parentFrame); - } - if (result == JFileChooser.APPROVE_OPTION) { - selectedFile = chooser.getSelectedFile(); - } - } - - if (hide) sketch.surface.setVisible(true); - selectCallback(selectedFile, callbackMethod, callbackObject); - } - }); - } - */ - - /** * Opens a platform-specific file chooser dialog to select a folder. * After the selection is made, the selection will be passed to the @@ -6186,68 +6026,6 @@ public class PApplet implements PConstants { } - /* - static public void selectFolder(final String prompt, - final String callbackMethod, - final File defaultSelection, - final Object callbackObject, - final Frame parentFrame) { - selectFolder(prompt, callbackMethod, defaultSelection, callbackObject, parentFrame, null); - } - - - // Will remove the 'sketch' parameter once we get an upstream JOGL fix - // https://github.com/processing/processing/issues/3831 - static public void selectFolder(final String prompt, - final String callbackMethod, - final File defaultSelection, - final Object callbackObject, - final Frame parentFrame, - final PApplet sketch) { - EventQueue.invokeLater(new Runnable() { - public void run() { - File selectedFile = null; - - boolean hide = (sketch != null) && - (sketch.g instanceof PGraphicsOpenGL) && (platform == WINDOWS); - if (hide) sketch.surface.setVisible(false); - - if (platform == MACOS && useNativeSelect != false) { - FileDialog fileDialog = - new FileDialog(parentFrame, prompt, FileDialog.LOAD); - if (defaultSelection != null) { - fileDialog.setDirectory(defaultSelection.getAbsolutePath()); - } - System.setProperty("apple.awt.fileDialogForDirectories", "true"); - fileDialog.setVisible(true); - System.setProperty("apple.awt.fileDialogForDirectories", "false"); - String filename = fileDialog.getFile(); - if (filename != null) { - selectedFile = new File(fileDialog.getDirectory(), fileDialog.getFile()); - } - } else { - checkLookAndFeel(); - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setDialogTitle(prompt); - fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - if (defaultSelection != null) { - fileChooser.setCurrentDirectory(defaultSelection); - } - - int result = fileChooser.showOpenDialog(parentFrame); - if (result == JFileChooser.APPROVE_OPTION) { - selectedFile = fileChooser.getSelectedFile(); - } - } - - if (hide) sketch.surface.setVisible(true); - selectCallback(selectedFile, callbackMethod, callbackObject); - } - }); - } - */ - - static public void selectCallback(File selectedFile, String callbackMethod, Object callbackObject) { @@ -6619,7 +6397,7 @@ public class PApplet implements PConstants { * methods to take more control of how the stream is read. *

* If the requested item doesn't exist, null is returned. - * (Prior to 0096, die() would be called, killing the applet) + * (Prior to 0096, die() would be called, killing the sketch) *

* For 0096+, the "data" folder is exported intact with subfolders, * and openStream() properly handles subdirectories from the data folder @@ -6800,8 +6578,7 @@ public class PApplet implements PConstants { } try { - // attempt to load from a local file, used when running as - // an application, or as a signed applet + // attempt to load from a local file try { // first try to catch any security exceptions try { return new FileInputStream(dataPath(filename)); @@ -7542,10 +7319,6 @@ public class PApplet implements PConstants { * passed in. External libraries should use this function to save to * the sketch folder. *

- * Note that when running as an applet inside a web browser, - * the sketchPath will be set to null, because security restrictions - * prevent applets from accessing that information. - *

* This will also cause an error if the sketch is not inited properly, * meaning that init() was never called on the PApplet when hosted * my some other main() or by other code. For proper use of init(), @@ -7575,12 +7348,12 @@ public class PApplet implements PConstants { /** - * Returns a path inside the applet folder to save to. Like sketchPath(), + * Returns a path adjacent the application to save to. Like sketchPath(), * but creates any in-between folders so that things save properly. *

* All saveXxxx() functions use the path to the sketch folder, rather than * its data folder. Once exported, the data folder will be found inside the - * jar file of the exported application or applet. In this case, it's not + * jar file of the exported application. In this case, it's not * possible to save data into the jar file, because it will often be running * from a server, or marked in-use if running from a local file system. * With this in mind, saving to the data path doesn't make sense anyway. @@ -10135,7 +9908,7 @@ public class PApplet implements PConstants { *

    * Parameters useful for launching or also used by the PDE:
    *
-   * --location=x,y         Upper left-hand corner of where the applet
+   * --location=x,y         Upper left-hand corner of where the sketch
    *                        should appear on screen. If not used,
    *                        the default is to center on the main screen.
    *
@@ -10172,10 +9945,10 @@ public class PApplet implements PConstants {
    *
    * Parameters used by Processing when running via the PDE
    *
-   * --external             set when the applet is being used by the PDE
+   * --external             set when the sketch is being used by the PDE
    *
    * --editor-location=x,y  position of the upper left-hand corner of the
-   *                        editor window, for placement of applet window
+   *                        editor window, for placement of sketch window
    *
    * All parameters *after* the sketch class name are passed to the sketch
    * itself and available from its 'args' array while the sketch is running.
diff --git a/core/src/processing/core/PSurface.java b/core/src/processing/core/PSurface.java
index 6bea0ce9f..4a74c2754 100644
--- a/core/src/processing/core/PSurface.java
+++ b/core/src/processing/core/PSurface.java
@@ -3,7 +3,7 @@
 /*
   Part of the Processing project - http://processing.org
 
-  Copyright (c) 2014-15 The Processing Foundation
+  Copyright (c) 2014-22 The Processing Foundation
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -26,7 +26,7 @@ import java.io.File;
 
 public interface PSurface {
   /**
-   * Minimum dimensions for the window holding an applet. This varies between
+   * Minimum dimensions for the window holding a sketch. This varies between
    * platforms, Mac OS X 10.3 (confirmed with 10.7 and Java 6) can do any
    * height but requires at least 128 pixels width. Windows XP has another
    * set of limitations. And for all I know, Linux probably allows window
diff --git a/todo.txt b/todo.txt
index 0f40bd324..7706da17e 100755
--- a/todo.txt
+++ b/todo.txt
@@ -271,6 +271,13 @@ o make sure there aren't library jar files named the same thing
 o   i.e. if one library has db.jar, then that's gonna kill another db.jar
 o   when the files are copied over
 X   other issues filed for this
+X manager huh
+X   highlight color seems to be incorrect?
+o   after installing, the item in the manager list doesn't change color
+o 'recent' menu doesn't respect examples folder of other p5 versions
+o   could write that into the file, that it's an example
+o   or write the path as shown in the PDE to the file as simpler
+X   oh well; want folks using the latest anyway
 
 fonts
 X fonts are still really ugly (on non-retina)
@@ -526,9 +533,6 @@ _   https://github.com/processing/processing/issues/533
 
 PDE / Editor
 
-_ 'recent' menu doesn't respect examples folder of other p5 versions
-_   could write that into the file, that it's an example
-_   or write the path as shown in the PDE to the file as simpler
 _ 'recent' menu paths can get enormous
 _ active editor not being set null
 _   in Base.nextEditorLocation(), changed to "editors.size() == 0"
@@ -762,8 +766,6 @@ _ check with Casey about coloring for error messages
 _ test on Windows and Linux
 _ font size for "Downloading" on progress bar is too large
 _   but changing the size breaks the vertical centering
-_ highlight color seems to be incorrect?
-_ after installing, the item in the manager list doesn't change color
 _ wheel mouse is super jumpy
 _   something about unit increment in ContributionListPanel
 _ arrow keys up/down move scroll bar, not selection