protected String[] getMachineParams() { ArrayList<String> params = new ArrayList<String>(); // params.add("-Xint"); // interpreted mode // params.add("-Xprof"); // profiler // params.add("-Xaprof"); // allocation profiler // params.add("-Xrunhprof:cpu=samples"); // old-style profiler // TODO change this to use run.args = true, run.args.0, run.args.1, etc. // so that spaces can be included in the arg names String options = Preferences.get("run.options"); if (options.length() > 0) { String pieces[] = PApplet.split(options, ' '); for (int i = 0; i < pieces.length; i++) { String p = pieces[i].trim(); if (p.length() > 0) { params.add(p); } } } // params.add("-Djava.ext.dirs=nuffing"); if (Preferences.getBoolean("run.options.memory")) { params.add("-Xms" + Preferences.get("run.options.memory.initial") + "m"); params.add("-Xmx" + Preferences.get("run.options.memory.maximum") + "m"); } if (Base.isMacOS()) { params.add("-Xdock:name=" + build.getSketchClassName()); // params.add("-Dcom.apple.mrj.application.apple.menu.about.name=" + // sketch.getMainClassName()); } // sketch.libraryPath might be "" // librariesClassPath will always have sep char prepended params.add( "-Djava.library.path=" + build.getJavaLibraryPath() + File.pathSeparator + System.getProperty("java.library.path")); params.add("-cp"); params.add(build.getClassPath()); // params.add(sketch.getClassPath() + // File.pathSeparator + // Base.librariesClassPath); // enable assertions // http://dev.processing.org/bugs/show_bug.cgi?id=1188 params.add("-ea"); // PApplet.println(PApplet.split(sketch.classPath, ':')); String outgoing[] = new String[params.size()]; params.toArray(outgoing); // PApplet.println(outgoing); // PApplet.println(PApplet.split(outgoing[0], ":")); // PApplet.println(); // PApplet.println("class path"); // PApplet.println(PApplet.split(outgoing[2], ":")); return outgoing; // return (String[]) params.toArray(); // System.out.println("sketch class path"); // PApplet.println(PApplet.split(sketch.classPath, ';')); // System.out.println(); // System.out.println("libraries class path"); // PApplet.println(PApplet.split(Base.librariesClassPath, ';')); // System.out.println(); }
protected String[] getSketchParams(boolean presenting) { ArrayList<String> params = new ArrayList<String>(); // It's dangerous to add your own main() to your code, // but if you've done it, we'll respect your right to hang yourself. // http://processing.org/bugs/bugzilla/1446.html if (build.getFoundMain()) { params.add(build.getSketchClassName()); } else { params.add("processing.core.PApplet"); // get the stored device index (starts at 0) int runDisplay = Preferences.getInteger("run.display"); // If there was a saved location (this guy has been run more than once) // then the location will be set to the last position of the sketch window. // This will be passed to the PApplet runner using something like // --location=30,20 // Otherwise, the editor location will be passed, and the applet will // figure out where to place itself based on the editor location. // --editor-location=150,20 if (editor != null) { // if running processing-cmd, don't do placement GraphicsDevice editorDevice = editor.getGraphicsConfiguration().getDevice(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] devices = ge.getScreenDevices(); // Make sure the display set in Preferences actually exists GraphicsDevice runDevice = editorDevice; if (runDisplay >= 0 && runDisplay < devices.length) { runDevice = devices[runDisplay]; } else { runDevice = editorDevice; for (int i = 0; i < devices.length; i++) { if (devices[i] == runDevice) { runDisplay = i; break; // Don't set the pref, might be a temporary thing. Users can // open/close Preferences to reset the device themselves. // Preferences.setInteger("run.display", runDisplay); } } } Point windowLocation = editor.getSketchLocation(); // if (windowLocation != null) { // // could check to make sure the sketch location is on the device // // that's specified in Preferences, but that's going to be annoying // // if you move a sketch to another window, then it keeps jumping // // back to the specified window. //// Rectangle screenRect = //// runDevice.getDefaultConfiguration().getBounds(); // } if (windowLocation == null) { if (editorDevice == runDevice) { // If sketches are to be shown on the same display as the editor, // provide the editor location so the sketch's main() can place it. Point editorLocation = editor.getLocation(); params.add( PApplet.ARGS_EDITOR_LOCATION + "=" + editorLocation.x + "," + editorLocation.y); } else { // The sketch's main() will set a location centered on the new // display. It has to happen in main() because the width/height // of the sketch are not known here. // Set a location centered on the other display // Rectangle screenRect = // runDevice.getDefaultConfiguration().getBounds(); // int runX = // params.add(PApplet.ARGS_LOCATION + "=" + runX + "," + runY); } } else { params.add(PApplet.ARGS_LOCATION + "=" + windowLocation.x + "," + windowLocation.y); } params.add(PApplet.ARGS_EXTERNAL); } params.add(PApplet.ARGS_DISPLAY + "=" + runDisplay); if (presenting) { params.add(PApplet.ARGS_FULL_SCREEN); // if (Preferences.getBoolean("run.present.exclusive")) { // params.add(PApplet.ARGS_EXCLUSIVE); // } params.add(PApplet.ARGS_STOP_COLOR + "=" + Preferences.get("run.present.stop.color")); params.add(PApplet.ARGS_BGCOLOR + "=" + Preferences.get("run.present.bgcolor")); } params.add(build.getSketchClassName()); params.add(PApplet.ARGS_SKETCH_FOLDER + "=" + build.getSketchPath()); // Adding sketch path in the end coz it's likely to // contain spaces and things go wrong on UNIX systems. } // String outgoing[] = new String[params.size()]; // params.toArray(outgoing); // return outgoing; return params.toArray(new String[0]); }
protected String[] getSketchParams(boolean presenting) { ArrayList<String> params = new ArrayList<String>(); // It's dangerous to add your own main() to your code, // but if you've done it, we'll respect your right to hang yourself. // http://processing.org/bugs/bugzilla/1446.html if (build.getFoundMain()) { params.add(build.getSketchClassName()); } else { params.add("processing.core.PApplet"); // get the stored device index (starts at 1) int runDisplay = Preferences.getInteger("run.display"); // If there was a saved location (this guy has been run more than once) // then the location will be set to the last position of the sketch window. // This will be passed to the PApplet runner using something like // --location=30,20 // Otherwise, the editor location will be passed, and the applet will // figure out where to place itself based on the editor location. // --editor-location=150,20 if (editor != null) { // if running processing-cmd, don't do placement GraphicsDevice editorDevice = editor.getGraphicsConfiguration().getDevice(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] devices = ge.getScreenDevices(); // Make sure the display set in Preferences actually exists GraphicsDevice runDevice = editorDevice; if (runDisplay > 0 && runDisplay <= devices.length) { runDevice = devices[runDisplay - 1]; } else { // If a bad display is selected, use the same display as the editor if (runDisplay > 0) { // don't complain about -1 or 0 System.err.println("Display " + runDisplay + " not available."); } runDevice = editorDevice; for (int i = 0; i < devices.length; i++) { if (devices[i] == runDevice) { // Wasn't setting the pref to avoid screwing things up with // something temporary. But not setting it makes debugging one's // setup just too damn weird, so changing that behavior. runDisplay = i + 1; System.err.println( "Setting 'Run Sketches on Display' preference to display " + runDisplay); Preferences.setInteger("run.display", runDisplay); break; } } } Point windowLocation = editor.getSketchLocation(); // if (windowLocation != null) { // // could check to make sure the sketch location is on the device // // that's specified in Preferences, but that's going to be annoying // // if you move a sketch to another window, then it keeps jumping // // back to the specified window. //// Rectangle screenRect = //// runDevice.getDefaultConfiguration().getBounds(); // } if (windowLocation == null) { if (editorDevice == runDevice) { // If sketches are to be shown on the same display as the editor, // provide the editor location so the sketch's main() can place it. Point editorLocation = editor.getLocation(); params.add( PApplet.ARGS_EDITOR_LOCATION + "=" + editorLocation.x + "," + editorLocation.y); } else { // The sketch's main() will set a location centered on the new // display. It has to happen in main() because the width/height // of the sketch are not known here. // Set a location centered on the other display // Rectangle screenRect = // runDevice.getDefaultConfiguration().getBounds(); // int runX = // params.add(PApplet.ARGS_LOCATION + "=" + runX + "," + runY); } } else { params.add(PApplet.ARGS_LOCATION + "=" + windowLocation.x + "," + windowLocation.y); } params.add(PApplet.ARGS_EXTERNAL); } params.add(PApplet.ARGS_DISPLAY + "=" + runDisplay); if (presenting) { params.add(PApplet.ARGS_PRESENT); // if (Preferences.getBoolean("run.present.exclusive")) { // params.add(PApplet.ARGS_EXCLUSIVE); // } params.add(PApplet.ARGS_STOP_COLOR + "=" + Preferences.get("run.present.stop.color")); params.add(PApplet.ARGS_WINDOW_COLOR + "=" + Preferences.get("run.present.bgcolor")); } // There was a PDE X hack that put this after the class name, but it was // removed for 3.0a6 because it would break the args passed to sketches. params.add(PApplet.ARGS_SKETCH_FOLDER + "=" + build.getSketchPath()); params.add(build.getSketchClassName()); } // String outgoing[] = new String[params.size()]; // params.toArray(outgoing); // return outgoing; return params.toArray(new String[0]); }