GeezerVison is showing github.com — change Messages.loge() to Messages.err(), additional cleanup · D-I-R-M/processing4@0419b1f
File treeExpand file treeCollapse file tree Open diff view settings java/src/processing/mode/java
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: app/src/processing/app/Base.java +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -191,7 +191,7 @@ static private void createAndShowGUI(String[] args) { | 191 | 191 | Platform.setLookAndFeel(); | 192 | 192 | Platform.setInterfaceZoom(); | 193 | 193 | } catch (Exception e) { | 194 | | - Messages.loge("Error while setting up the interface", e); //$NON-NLS-1$ | | 194 | + Messages.err("Error while setting up the interface", e); //$NON-NLS-1$ | 195 | 195 | } | 196 | 196 |
| 197 | 197 | // long t3 = System.currentTimeMillis(); | @@ -315,7 +315,7 @@ static private void checkDriverBug() { | 315 | 315 | } | 316 | 316 | } | 317 | 317 | } catch (Exception e) { | 318 | | - Messages.loge("Problem checking NVIDIA driver", e); | | 318 | + Messages.err("Problem checking NVIDIA driver", e); | 319 | 319 | } | 320 | 320 | }).start(); | 321 | 321 | } | @@ -748,19 +748,19 @@ public void rebuildToolList() { | 748 | 748 | } catch (VerifyError | AbstractMethodError ve) { | 749 | 749 | System.err.println("\"" + tool.getMenuTitle() + "\" is not " + | 750 | 750 | "compatible with this version of Processing"); | 751 | | - Messages.loge("Incompatible Tool found during tool.init()", ve); | | 751 | + Messages.err("Incompatible Tool found during tool.init()", ve); | 752 | 752 |
| 753 | 753 | } catch (NoSuchMethodError nsme) { | 754 | 754 | System.err.println("\"" + tool.getMenuTitle() + "\" is not " + | 755 | 755 | "compatible with this version of Processing"); | 756 | 756 | System.err.println("The " + nsme.getMessage() + " method no longer exists."); | 757 | | - Messages.loge("Incompatible Tool found during tool.init()", nsme); | | 757 | + Messages.err("Incompatible Tool found during tool.init()", nsme); | 758 | 758 |
| 759 | 759 | } catch (NoClassDefFoundError ncdfe) { | 760 | 760 | System.err.println("\"" + tool.getMenuTitle() + "\" is not " + | 761 | 761 | "compatible with this version of Processing"); | 762 | 762 | System.err.println("The " + ncdfe.getMessage() + " class is no longer available."); | 763 | | - Messages.loge("Incompatible Tool found during tool.init()", ncdfe); | | 763 | + Messages.err("Incompatible Tool found during tool.init()", ncdfe); | 764 | 764 |
| 765 | 765 | } catch (Error | Exception e) { | 766 | 766 | System.err.println("An error occurred inside \"" + tool.getMenuTitle() + "\""); | @@ -858,7 +858,7 @@ JMenuItem createToolItem(final Tool tool) { //, Map<String, JMenuItem> toolItems | 858 | 858 | Messages.showWarning("Tool out of date", | 859 | 859 | tool.getMenuTitle() + " is not compatible with this version of Processing.\n" + | 860 | 860 | "Try updating the Mode or contact its author for a new version.", ne); | 861 | | - Messages.loge("Incompatible tool found during tool.run()", ne); | | 861 | + Messages.err("Incompatible tool found during tool.run()", ne); | 862 | 862 | item.setEnabled(false); | 863 | 863 |
| 864 | 864 | } catch (Exception ex) { | |
Collapse file Copy file name to clipboardExpand all lines: app/src/processing/app/Messages.java +15-29Lines changed: 15 additions & 29 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 29 | 29 | import javax.swing.JFrame; | 30 | 30 | import javax.swing.JOptionPane; | 31 | 31 |
| 32 | | -import processing.app.ui.Editor; | 33 | | - | 34 | 32 | public class Messages { | 35 | 33 | /** | 36 | 34 | * "No cookie for you" type messages. Nothing fatal or all that | @@ -190,26 +188,14 @@ static public void showTrace(String title, String message, | 190 | 188 |
| 191 | 189 |
| 192 | 190 |
| | 191 | + /* | 193 | 192 | // incomplete | 194 | 193 | static public int showYesNoCancelQuestion(Editor editor, String title, | 195 | 194 | String primary, String secondary) { | 196 | 195 | if (!Platform.isMacOS()) { | 197 | | - int result = | 198 | | - JOptionPane.showConfirmDialog(null, primary + "\n" + secondary, title, | 199 | | - JOptionPane.YES_NO_CANCEL_OPTION, | 200 | | - JOptionPane.QUESTION_MESSAGE); | 201 | | - return result; | 202 | | -// if (result == JOptionPane.YES_OPTION) { | 203 | | -// | 204 | | -// } else if (result == JOptionPane.NO_OPTION) { | 205 | | -// return true; // ok to continue | 206 | | -// | 207 | | -// } else if (result == JOptionPane.CANCEL_OPTION) { | 208 | | -// return false; | 209 | | -// | 210 | | -// } else { | 211 | | -// throw new IllegalStateException(); | 212 | | -// } | | 196 | + return JOptionPane.showConfirmDialog(null, primary + "\n" + secondary, title, | | 197 | + JOptionPane.YES_NO_CANCEL_OPTION, | | 198 | + JOptionPane.QUESTION_MESSAGE); | 213 | 199 |
| 214 | 200 | } else { | 215 | 201 | // Pane formatting adapted from the Quaqua guide | @@ -236,8 +222,7 @@ static public int showYesNoCancelQuestion(Editor editor, String title, | 236 | 222 |
| 237 | 223 | // on macosx, setting the destructive property places this option | 238 | 224 | // away from the others at the lefthand side | 239 | | - pane.putClientProperty("Quaqua.OptionPane.destructiveOption", | 240 | | - Integer.valueOf(2)); | | 225 | + pane.putClientProperty("Quaqua.OptionPane.destructiveOption", 2); | 241 | 226 |
| 242 | 227 | JDialog dialog = pane.createDialog(editor, null); | 243 | 228 | dialog.setVisible(true); | @@ -254,6 +239,7 @@ static public int showYesNoCancelQuestion(Editor editor, String title, | 254 | 239 | } | 255 | 240 | } | 256 | 241 | } | | 242 | + */ | 257 | 243 |
| 258 | 244 |
| 259 | 245 | static public int showYesNoQuestion(Frame editor, String title, | @@ -347,19 +333,19 @@ static public void logf(String message, Object... args) { | 347 | 333 | } | 348 | 334 |
| 349 | 335 |
| 350 | | - static public void loge(String message, Throwable e) { | 351 | | - if (Base.DEBUG) { | 352 | | - if (message != null) { | 353 | | - System.err.println(message); | 354 | | - } | 355 | | - e.printStackTrace(); | 356 | | - } | | 336 | + static public void err(String message) { | | 337 | + err(message, null); | 357 | 338 | } | 358 | 339 |
| 359 | 340 |
| 360 | | - static public void loge(String message) { | | 341 | + static public void err(String message, Throwable e) { | 361 | 342 | if (Base.DEBUG) { | 362 | | - System.err.println(message); | | 343 | + if (message != null) { | | 344 | + System.err.println(message); | | 345 | + } | | 346 | + if (e != null) { | | 347 | + e.printStackTrace(); | | 348 | + } | 363 | 349 | } | 364 | 350 | } | 365 | 351 | } |
Collapse file Copy file name to clipboardExpand all lines: app/src/processing/app/Mode.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1023,7 +1023,7 @@ public void prepareExportFolder(File targetFolder) { | 1023 | 1023 | // Create a fresh output folder (needed before preproc is run next) | 1024 | 1024 | if (!targetFolder.exists()) { | 1025 | 1025 | if (!targetFolder.mkdirs()) { | 1026 | | - Messages.loge("Could not create " + targetFolder); | | 1026 | + Messages.err("Could not create " + targetFolder); | 1027 | 1027 | } | 1028 | 1028 | } | 1029 | 1029 | } | |
Collapse file Copy file name to clipboardExpand all lines: app/src/processing/app/Settings.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -88,7 +88,7 @@ public void load(File additions) { | 88 | 88 | } | 89 | 89 | } | 90 | 90 | } else { | 91 | | - Messages.loge(additions + " could not be read"); | | 91 | + Messages.err(additions + " could not be read"); | 92 | 92 | } | 93 | 93 |
| 94 | 94 | // check for platform-specific properties in the defaults | |
Collapse file Copy file name to clipboardExpand all lines: app/src/processing/app/SingleInstance.java +3-4Lines changed: 3 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -47,7 +47,6 @@ public class SingleInstance { | 47 | 47 | * Returns true if there's an instance of Processing already running. | 48 | 48 | * Will not return true unless this code was able to successfully | 49 | 49 | * contact the already running instance to have it launch sketches. | 50 | | - * @param filename Path to the PDE file that was opened, null if double-clicked | 51 | 50 | * @return true if successfully launched on the other instance | 52 | 51 | */ | 53 | 52 | static boolean alreadyRunning(String[] args) { | @@ -108,14 +107,14 @@ public void run() { | 108 | 107 | } | 109 | 108 | // } | 110 | 109 | } catch (IOException e) { | 111 | | - Messages.loge("SingleInstance error while listening", e); | | 110 | + Messages.err("SingleInstance error while listening", e); | 112 | 111 | } | 113 | 112 | } | 114 | 113 | } | 115 | 114 | }, "SingleInstance Server").start(); | 116 | 115 |
| 117 | 116 | } catch (IOException e) { | 118 | | - Messages.loge("Could not create single instance server.", e); | | 117 | + Messages.err("Could not create single instance server.", e); | 119 | 118 | } | 120 | 119 | } | 121 | 120 |
| @@ -143,7 +142,7 @@ static boolean sendArguments(String[] args) { //, long timeout) { | 143 | 142 | return true; | 144 | 143 | } | 145 | 144 | } catch (IOException e) { | 146 | | - Messages.loge("Error sending commands to other instance", e); | | 145 | + Messages.err("Error sending commands to other instance", e); | 147 | 146 | } | 148 | 147 | Messages.log("Processing is not already running (or could not connect)"); | 149 | 148 | return false; | |
Collapse file Copy file name to clipboardExpand all lines: app/src/processing/app/Util.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -74,7 +74,7 @@ static public byte[] loadBytesRaw(File file) throws IOException { | 74 | 74 | */ | 75 | 75 | static public StringDict readSettings(File inputFile) { | 76 | 76 | if (!inputFile.exists()) { | 77 | | - Messages.loge(inputFile + " does not exist inside readSettings()"); | | 77 | + Messages.err(inputFile + " does not exist inside readSettings()"); | 78 | 78 | return null; | 79 | 79 | } | 80 | 80 | String lines[] = PApplet.loadStrings(inputFile); | |
Collapse file Copy file name to clipboardExpand all lines: app/src/processing/app/contrib/ModeContribution.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -66,7 +66,7 @@ static public ModeContribution load(Base base, File folder, | 66 | 66 | // For the built-in modes, don't print the exception, just log it | 67 | 67 | // for debugging. This should be impossible for most users to reach, | 68 | 68 | // but it helps us load experimental mode when it's available. | 69 | | - Messages.loge("ModeContribution.load() failed for " + searchName, err); | | 69 | + Messages.err("ModeContribution.load() failed for " + searchName, err); | 70 | 70 | } | 71 | 71 | } | 72 | 72 | return null; | |
Collapse file Copy file name to clipboardExpand all lines: app/src/processing/app/syntax/JEditTextArea.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -2332,7 +2332,7 @@ public void mouseDragged(MouseEvent evt) { | 2332 | 2332 | try { | 2333 | 2333 | select(getMarkPosition(), xyToOffset(evt.getX(), evt.getY())); | 2334 | 2334 | } catch (ArrayIndexOutOfBoundsException e) { | 2335 | | - Messages.loge("xToOffset problem", e); | | 2335 | + Messages.err("xToOffset problem", e); | 2336 | 2336 | } | 2337 | 2337 | } else { | 2338 | 2338 | int line = yToLine(evt.getY()); | |
Collapse file Copy file name to clipboardExpand all lines: app/src/processing/app/ui/Editor.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -2410,7 +2410,7 @@ protected void handleOpenInternal(String path) throws EditorException { | 2410 | 2410 |
| 2411 | 2411 | // remove the original file, so user doesn't get confused | 2412 | 2412 | if (!origPdeFile.delete()) { | 2413 | | - Messages.loge("Could not delete " + origPdeFile); | | 2413 | + Messages.err("Could not delete " + origPdeFile); | 2414 | 2414 | } | 2415 | 2415 |
| 2416 | 2416 | // update with the new path | |
Collapse file Copy file name to clipboardExpand all lines: app/src/processing/app/ui/PreferencesFrame.java +13-14Lines changed: 13 additions & 14 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -160,6 +160,12 @@ public PreferencesFrame(Base base) { | 160 | 160 | consoleFontSizeField = new JComboBox<>(FONT_SIZES); | 161 | 161 | consoleFontSizeField.setSelectedItem(Preferences.getInteger("console.font.size")); | 162 | 162 |
| | 163 | + // Sizing is screwed up on macOS, bug has been open since 2017 | | 164 | + // https://github.com/processing/processing4/issues/232 | | 165 | + // https://bugs.openjdk.java.net/browse/JDK-8179076 | | 166 | + fontSizeField.setEditable(true); | | 167 | + consoleFontSizeField.setEditable(true); | | 168 | + | 163 | 169 |
| 164 | 170 | // Interface scale: [ 100% ] (requires restart of Processing) | 165 | 171 |
| @@ -507,23 +513,16 @@ public void windowClosing(WindowEvent e) { | 507 | 513 | frame.pack(); | 508 | 514 | frame.setLocationRelativeTo(null); | 509 | 515 |
| 510 | | - // Workaround for OS X, which breaks the layout when these are set earlier | 511 | | - // https://github.com/processing/processing/issues/3212 | 512 | | - fontSizeField.setEditable(true); | 513 | | - consoleFontSizeField.setEditable(true); | 514 | | - | 515 | 516 | // handle window closing commands for ctrl/cmd-W or hitting ESC. | 516 | | - | 517 | 517 | pain.addKeyListener(new KeyAdapter() { | 518 | | - public void keyPressed(KeyEvent e) { | 519 | | - //System.out.println(e); | 520 | | - KeyStroke wc = Toolkit.WINDOW_CLOSE_KEYSTROKE; | 521 | | - if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) || | 522 | | - (KeyStroke.getKeyStrokeForEvent(e).equals(wc))) { | 523 | | - disposeFrame(); | 524 | | - } | | 518 | + public void keyPressed(KeyEvent e) { | | 519 | + KeyStroke wc = Toolkit.WINDOW_CLOSE_KEYSTROKE; | | 520 | + if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) || | | 521 | + (KeyStroke.getKeyStrokeForEvent(e).equals(wc))) { | | 522 | + disposeFrame(); | 525 | 523 | } | 526 | | - }); | | 524 | + } | | 525 | + }); | 527 | 526 | } | 528 | 527 |
| 529 | 528 |
| |
|