| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1d02336 commit ccaa58f
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -143,7 +143,6 @@ public void actionPerformed(ActionEvent e) { | |||
| 143 | 143 | // get a wide name in there before getPreferredSize() is called | |
| 144 | 144 | fontSelectionBox = new JComboBox<String>(new String[] { Toolkit.getMonoFontName() }); | |
| 145 | 145 | fontSelectionBox.setToolTipText(fontTip); | |
| 146 | - //updateDisplayList(); | ||
| 147 | 146 | fontSelectionBox.setEnabled(false); // don't enable until fonts are loaded | |
| 148 | 147 | ||
| 149 | 148 | ||
@@ -317,17 +316,18 @@ public void stateChanged(ChangeEvent e) { | |||
| 317 | 316 | ||
| 318 | 317 | // Run sketches on display [ 1 ] | |
| 319 | 318 | ||
| 320 | - JLabel displayLabel = new JLabel(Language.text("preferences.run_sketches_on_display")+": "); | ||
| 319 | + JLabel displayLabel = new JLabel(Language.text("preferences.run_sketches_on_display") + ": "); | ||
| 321 | 320 | final String tip = "<html>" + Language.text("preferences.run_sketches_on_display.tip"); | |
| 322 | 321 | displayLabel.setToolTipText(tip); | |
| 323 | 322 | displaySelectionBox = new JComboBox<String>(); | |
| 324 | 323 | updateDisplayList(); // needs to happen here for getPreferredSize() | |
| 325 | 324 | ||
| 325 | + | ||
| 326 | 326 | // [ ] Automatically associate .pde files with Processing | |
| 327 | 327 | ||
| 328 | - autoAssociateBox = | ||
| 329 | - new JCheckBox(Language.text("preferences.automatically_associate_pde_files")); | ||
| 330 | - autoAssociateBox.setVisible(false); | ||
| 328 | + autoAssociateBox = | ||
| 329 | + new JCheckBox(Language.text("preferences.automatically_associate_pde_files")); | ||
| 330 | + autoAssociateBox.setVisible(false); | ||
| 331 | 331 | ||
| 332 | 332 | ||
| 333 | 333 | // More preferences are in the ... | |
@@ -577,17 +577,21 @@ protected void applyFrame() { | |||
| 577 | 577 | Language.saveLanguage(language); | |
| 578 | 578 | } | |
| 579 | 579 | ||
| 580 | - int oldDisplayIndex = Preferences.getInteger("run.display"); //$NON-NLS-1$ | ||
| 581 | - int displayIndex = 0; | ||
| 582 | - for (int d = 0; d < displaySelectionBox.getItemCount(); d++) { | ||
| 583 | - if (displaySelectionBox.getSelectedIndex() == d) { | ||
| 584 | - displayIndex = d; | ||
| 580 | + // The preference will have already been reset when the window was created | ||
| 581 | + if (displaySelectionBox.isEnabled()) { | ||
| 582 | + int oldDisplayNum = Preferences.getInteger("run.display"); | ||
| 583 | + int displayNum = -1; | ||
| 584 | + for (int d = 0; d < displaySelectionBox.getItemCount(); d++) { | ||
| 585 | + if (displaySelectionBox.getSelectedIndex() == d) { | ||
| 586 | + displayNum = d + 1; | ||
| 587 | + } | ||
| 585 | 588 | } | |
| 586 | - } | ||
| 587 | - if (oldDisplayIndex != displayIndex) { | ||
| 588 | - Preferences.setInteger("run.display", displayIndex); //$NON-NLS-1$ | ||
| 589 | - for (Editor editor : base.getEditors()) { | ||
| 590 | - editor.setSketchLocation(null); | ||
| 589 | + if ((displayNum != -1) && (displayNum != oldDisplayNum)) { | ||
| 590 | + Preferences.setInteger("run.display", displayNum); //$NON-NLS-1$ | ||
| 591 | + // Reset the location of the sketch, the window has changed | ||
| 592 | + for (Editor editor : base.getEditors()) { | ||
| 593 | + editor.setSketchLocation(null); | ||
| 594 | + } | ||
| 591 | 595 | } | |
| 592 | 596 | } | |
| 593 | 597 | ||
@@ -670,11 +674,14 @@ protected void showFrame() { | |||
| 670 | 674 | sketchbookLocationField.setText(Preferences.getSketchbookPath()); | |
| 671 | 675 | checkUpdatesBox.setSelected(Preferences.getBoolean("update.check")); //$NON-NLS-1$ | |
| 672 | 676 | ||
| 673 | - updateDisplayList(); | ||
| 677 | + int defaultDisplayNum = updateDisplayList(); | ||
| 674 | 678 | int displayNum = Preferences.getInteger("run.display"); //$NON-NLS-1$ | |
| 675 | - if (displayNum >= 0 && displayNum < displayCount) { | ||
| 676 | - displaySelectionBox.setSelectedIndex(displayNum); | ||
| 679 | + //if (displayNum > 0 && displayNum <= displayCount) { | ||
| 680 | + if (displayNum < 1 || displayNum > displayCount) { | ||
| 681 | + displayNum = defaultDisplayNum; | ||
| 682 | + Preferences.setInteger("run.display", displayNum); | ||
| 677 | 683 | } | |
| 684 | + displaySelectionBox.setSelectedIndex(displayNum-1); | ||
| 678 | 685 | ||
| 679 | 686 | // This takes a while to load, so run it from a separate thread | |
| 680 | 687 | //EventQueue.invokeLater(new Runnable() { | |
@@ -749,11 +756,15 @@ public void run() { | |||
| 749 | 756 | } | |
| 750 | 757 | ||
| 751 | 758 | ||
| 752 | - void updateDisplayList() { | ||
| 759 | + /** | ||
| 760 | + * @return the number (1..whatever, not 0-indexed) of the default display | ||
| 761 | + */ | ||
| 762 | + int updateDisplayList() { | ||
| 753 | 763 | GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); | |
| 754 | 764 | GraphicsDevice defaultDevice = ge.getDefaultScreenDevice(); | |
| 755 | 765 | GraphicsDevice[] devices = ge.getScreenDevices(); | |
| 756 | 766 | ||
| 767 | + int defaultNum = -1; | ||
| 757 | 768 | displayCount = devices.length; | |
| 758 | 769 | String[] items = new String[displayCount]; | |
| 759 | 770 | for (int i = 0; i < displayCount; i++) { | |
@@ -762,6 +773,7 @@ void updateDisplayList() { | |||
| 762 | 773 | i + 1, mode.getWidth(), mode.getHeight()); | |
| 763 | 774 | if (devices[i] == defaultDevice) { | |
| 764 | 775 | title += " default"; | |
| 776 | + defaultNum = i + 1; | ||
| 765 | 777 | } | |
| 766 | 778 | items[i] = title; | |
| 767 | 779 | } | |
@@ -771,5 +783,6 @@ void updateDisplayList() { | |||
| 771 | 783 | if (displayCount == 1) { | |
| 772 | 784 | displaySelectionBox.setEnabled(false); | |
| 773 | 785 | } | |
| 786 | + return defaultNum; | ||
| 774 | 787 | } | |
| 775 | 788 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9655,8 +9655,10 @@ static public int blendColor(int c1, int c2, int mode) { | |||
| 9655 | 9655 | ||
| 9656 | 9656 | ||
| 9657 | 9657 | void frameMoved(int x, int y) { | |
| 9658 | - System.err.println(EXTERNAL_MOVE + " " + x + " " + y); | ||
| 9659 | - System.err.flush(); // doesn't seem to help or hurt | ||
| 9658 | + if (!fullScreen) { | ||
| 9659 | + System.err.println(EXTERNAL_MOVE + " " + x + " " + y); | ||
| 9660 | + System.err.flush(); // doesn't seem to help or hurt | ||
| 9661 | + } | ||
| 9660 | 9662 | } | |
| 9661 | 9663 | ||
| 9662 | 9664 | ||
@@ -9818,7 +9820,7 @@ static public void runSketch(final String[] args, | |||
| 9818 | 9820 | int stopColor = 0xff808080; | |
| 9819 | 9821 | boolean hideStop = false; | |
| 9820 | 9822 | ||
| 9821 | - int displayIndex = -1; // use default | ||
| 9823 | + int displayNum = -1; // use default | ||
| 9822 | 9824 | // boolean fullScreen = false; | |
| 9823 | 9825 | boolean present = false; | |
| 9824 | 9826 | // boolean spanDisplays = false; | |
@@ -9838,8 +9840,8 @@ static public void runSketch(final String[] args, | |||
| 9838 | 9840 | editorLocation = parseInt(split(value, ',')); | |
| 9839 | 9841 | ||
| 9840 | 9842 | } else if (param.equals(ARGS_DISPLAY)) { | |
| 9841 | - displayIndex = parseInt(value, -1); | ||
| 9842 | - if (displayIndex == -1) { | ||
| 9843 | + displayNum = parseInt(value, -1); | ||
| 9844 | + if (displayNum == -1) { | ||
| 9843 | 9845 | System.err.println("Could not parse " + value + " for " + ARGS_DISPLAY); | |
| 9844 | 9846 | } | |
| 9845 | 9847 | ||
@@ -9926,6 +9928,10 @@ static public void runSketch(final String[] args, | |||
| 9926 | 9928 | } | |
| 9927 | 9929 | } | |
| 9928 | 9930 | ||
| 9931 | + // Set the suggested display that's coming from the command line | ||
| 9932 | + // (and most likely, from the PDE's preference setting). | ||
| 9933 | + sketch.display = displayNum; | ||
| 9934 | + | ||
| 9929 | 9935 | // Call the settings() method which will give us our size() call | |
| 9930 | 9936 | // try { | |
| 9931 | 9937 | sketch.handleSettings(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -398,6 +398,7 @@ public void initFrame(PApplet sketch) {/*, int backgroundColor, | |||
| 398 | 398 | GraphicsEnvironment.getLocalGraphicsEnvironment(); | |
| 399 | 399 | ||
| 400 | 400 | int displayNum = sketch.sketchDisplay(); | |
| 401 | + // System.out.println("display from sketch is " + displayNum); | ||
| 401 | 402 | if (displayNum > 0) { // if -1, use the default device | |
| 402 | 403 | GraphicsDevice[] devices = environment.getScreenDevices(); | |
| 403 | 404 | if (displayNum <= devices.length) { | |
@@ -694,6 +695,7 @@ public void placeWindow(int[] location, int[] editorLocation) { | |||
| 694 | 695 | int contentW = Math.max(sketchWidth, MIN_WINDOW_WIDTH); | |
| 695 | 696 | int contentH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT); | |
| 696 | 697 | ||
| 698 | + // Ignore previous sketch placement when dealing with full screen | ||
| 697 | 699 | if (sketch.sketchFullScreen()) { | |
| 698 | 700 | location = null; | |
| 699 | 701 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -153,6 +153,7 @@ public VirtualMachine vm() { | |||
| 153 | 153 | public boolean launchVirtualMachine(boolean presenting) { | |
| 154 | 154 | String[] vmParams = getMachineParams(); | |
| 155 | 155 | String[] sketchParams = getSketchParams(presenting); | |
| 156 | + // PApplet.printArray(sketchParams); | ||
| 156 | 157 | int port = 8000 + (int) (Math.random() * 1000); | |
| 157 | 158 | String portStr = String.valueOf(port); | |
| 158 | 159 | ||
@@ -308,7 +309,7 @@ protected String[] getSketchParams(boolean presenting) { | |||
| 308 | 309 | } else { | |
| 309 | 310 | params.add("processing.core.PApplet"); | |
| 310 | 311 | ||
| 311 | - // get the stored device index (starts at 0) | ||
| 312 | + // get the stored device index (starts at 1) | ||
| 312 | 313 | int runDisplay = Preferences.getInteger("run.display"); | |
| 313 | 314 | ||
| 314 | 315 | // If there was a saved location (this guy has been run more than once) | |
@@ -327,17 +328,23 @@ protected String[] getSketchParams(boolean presenting) { | |||
| 327 | 328 | ||
| 328 | 329 | // Make sure the display set in Preferences actually exists | |
| 329 | 330 | GraphicsDevice runDevice = editorDevice; | |
| 330 | - if (runDisplay >= 0 && runDisplay < devices.length) { | ||
| 331 | - runDevice = devices[runDisplay]; | ||
| 331 | + if (runDisplay > 0 && runDisplay <= devices.length) { | ||
| 332 | + runDevice = devices[runDisplay-1]; | ||
| 332 | 333 | } else { | |
| 334 | + // If a bad display is selected, use the same display as the editor | ||
| 335 | + if (runDisplay > 0) { // don't complain about -1 or 0 | ||
| 336 | + System.err.println("Display " + runDisplay + " not available."); | ||
| 337 | + } | ||
| 333 | 338 | runDevice = editorDevice; | |
| 334 | 339 | for (int i = 0; i < devices.length; i++) { | |
| 335 | 340 | if (devices[i] == runDevice) { | |
| 336 | - runDisplay = i; | ||
| 341 | + // Wasn't setting the pref to avoid screwing things up with | ||
| 342 | + // something temporary. But not setting it makes debugging one's | ||
| 343 | + // setup just too damn weird, so changing that behavior. | ||
| 344 | + runDisplay = i + 1; | ||
| 345 | + System.err.println("Setting 'Run Sketches on Display' preference to display " + runDisplay); | ||
| 346 | + Preferences.setInteger("run.display", runDisplay); | ||
| 337 | 347 | break; | |
| 338 | - // Don't set the pref, might be a temporary thing. Users can | ||
| 339 | - // open/close Preferences to reset the device themselves. | ||
| 340 | - // Preferences.setInteger("run.display", runDisplay); | ||
| 341 | 348 | } | |
| 342 | 349 | } | |
| 343 | 350 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,8 @@ X https://github.com/processing/processing/issues/2843 | |||
| 26 | 26 | o Update Windows icons for multiple sizes, implement them in the PDE | |
| 27 | 27 | o http://code.google.com/p/processing/issues/detail?id=632 | |
| 28 | 28 | X closed during the 2.x cycle | |
| 29 | + X try to clean up the Recent menu with the home icon | ||
| 30 | + _ make sure it doesn't break on Windows | ||
| 29 | 31 | ||
| 30 | 32 | contribs | |
| 31 | 33 | X several Greek translation updates | |
| Back | FazBrowse Home | New Git URL |
0 commit comments