diff --git a/app/src/processing/app/ui/Editor.java b/app/src/processing/app/ui/Editor.java index 0fbd5b1ea..8da45570c 100644 --- a/app/src/processing/app/ui/Editor.java +++ b/app/src/processing/app/ui/Editor.java @@ -956,7 +956,8 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItem(Language.text("menu.edit.comment_uncomment"), '/'); + item = Toolkit.newJMenuItem(Language.text("menu.edit.comment_uncomment"), + Language.text("menu.edit.comment_uncomment.keystroke")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleCommentUncomment(); @@ -964,7 +965,9 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItem("\u2192 "+Language.text("menu.edit.increase_indent"), ']'); + item = Toolkit.newJMenuItem("\u2192 " + Language.text("menu.edit.increase_indent"), + Language.text("menu.edit.increase_indent.keystroke")); + item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleIndentOutdent(true); @@ -972,7 +975,8 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItem("\u2190 "+Language.text("menu.edit.decrease_indent"), '['); + item = Toolkit.newJMenuItem("\u2190 " + Language.text("menu.edit.decrease_indent"), + Language.text("menu.edit.decrease_indent.keystroke")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleIndentOutdent(false); diff --git a/app/src/processing/app/ui/EditorHeader.java b/app/src/processing/app/ui/EditorHeader.java index 7fba02d21..32a4cc7ea 100644 --- a/app/src/processing/app/ui/EditorHeader.java +++ b/app/src/processing/app/ui/EditorHeader.java @@ -498,7 +498,8 @@ public class EditorHeader extends JComponent { if (Platform.isLinux()) { item = Toolkit.newJMenuItem(prevTab, KeyEvent.VK_PAGE_UP); } else { - item = Toolkit.newJMenuItemAlt(prevTab, KeyEvent.VK_LEFT); + //item = Toolkit.newJMenuItemAlt(prevTab, KeyEvent.VK_LEFT); + item = Toolkit.newJMenuItem(prevTab, Language.text("editor.header.previous_tab.keystroke")); } action = new AbstractAction() { @Override @@ -510,7 +511,8 @@ public class EditorHeader extends JComponent { if (Platform.isLinux()) { keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, Toolkit.SHORTCUT_KEY_MASK); } else { - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Toolkit.SHORTCUT_ALT_KEY_MASK); + //keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Toolkit.SHORTCUT_ALT_KEY_MASK); + keyStroke = KeyStroke.getKeyStroke(Language.text("editor.header.previous_tab.keystroke")); } inputMap.put(keyStroke, mapKey); actionMap.put(mapKey, action); @@ -521,7 +523,8 @@ public class EditorHeader extends JComponent { if (Platform.isLinux()) { item = Toolkit.newJMenuItem(nextTab, KeyEvent.VK_PAGE_DOWN); } else { - item = Toolkit.newJMenuItemAlt(nextTab, KeyEvent.VK_RIGHT); + //item = Toolkit.newJMenuItemAlt(nextTab, KeyEvent.VK_RIGHT); + item = Toolkit.newJMenuItem(nextTab, Language.text("editor.header.next_tab.keystroke")); } action = new AbstractAction() { @Override @@ -533,7 +536,8 @@ public class EditorHeader extends JComponent { if (Platform.isLinux()) { keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, Toolkit.SHORTCUT_KEY_MASK); } else { - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Toolkit.SHORTCUT_ALT_KEY_MASK); + //keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Toolkit.SHORTCUT_ALT_KEY_MASK); + keyStroke = KeyStroke.getKeyStroke(Language.text("editor.header.next_tab.keystroke")); } inputMap.put(keyStroke, mapKey); actionMap.put(mapKey, action); diff --git a/app/src/processing/app/ui/Toolkit.java b/app/src/processing/app/ui/Toolkit.java index 8dedc57f1..b49987a46 100644 --- a/app/src/processing/app/ui/Toolkit.java +++ b/app/src/processing/app/ui/Toolkit.java @@ -131,6 +131,29 @@ public class Toolkit { } + /** + * Create a menu item and set its KeyStroke by name (so it can be stored + * in the language settings or the preferences. Syntax is here: + * https://docs.oracle.com/javase/8/docs/api/javax/swing/KeyStroke.html#getKeyStroke-java.lang.String- + * @param sequence the name, as outlined by the KeyStroke API + * @param fallback what to use if getKeyStroke() comes back null + */ + static public JMenuItem newJMenuItem(String title, + String sequence) { + JMenuItem menuItem = new JMenuItem(title); + KeyStroke ks = KeyStroke.getKeyStroke(sequence); + if (ks != null) { + menuItem.setAccelerator(ks); + + } else { + System.err.println("'" + sequence + "' is not understood, " + + "pleae re-read the Java reference for KeyStroke"); + //ks = KeyStroke.getKeyStroke(fallback); + } + return menuItem; + } + + /** * @param action: use an Action, which sets the title, reaction * and enabled-ness all by itself. diff --git a/build/shared/lib/languages/PDE.properties b/build/shared/lib/languages/PDE.properties index 37b191509..e45b698db 100644 --- a/build/shared/lib/languages/PDE.properties +++ b/build/shared/lib/languages/PDE.properties @@ -40,8 +40,11 @@ menu.edit.paste = Paste menu.edit.select_all = Select All menu.edit.auto_format = Auto Format menu.edit.comment_uncomment = Comment/Uncomment +menu.edit.comment_uncomment.keystroke = meta pressed SLASH menu.edit.increase_indent = Increase Indent +menu.edit.increase_indent.keystroke = meta pressed CLOSE_BRACKET menu.edit.decrease_indent = Decrease Indent +menu.edit.decrease_indent.keystroke = meta pressed OPEN_BRACKET menu.edit.find = Find... menu.edit.find_next = Find Next menu.edit.find_previous = Find Previous @@ -77,8 +80,11 @@ menu.debug.toggle_breakpoint = Toggle Breakpoint # --- # used for both menus and toolbars menu.debug.step = Step +menu.debug.step.keystroke = meta pressed J menu.debug.step_into = Step Into +menu.debug.step.keystroke = shift meta pressed J menu.debug.step_out = Step Out +menu.debug.step.keystroke = meta alt pressed J menu.debug.continue = Continue # --- #menu.debug.print_stack_trace = Print Stack Trace diff --git a/java/src/processing/mode/java/JavaEditor.java b/java/src/processing/mode/java/JavaEditor.java index 209a1e427..53723ff02 100644 --- a/java/src/processing/mode/java/JavaEditor.java +++ b/java/src/processing/mode/java/JavaEditor.java @@ -1384,7 +1384,8 @@ public class JavaEditor extends Editor { // }); // debugMenu.add(item); - item = Toolkit.newJMenuItem(Language.text("menu.debug.step"), KeyEvent.VK_J); + item = Toolkit.newJMenuItem(Language.text("menu.debug.step"), + Language.text("menu.debug.step.keystroke")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleStep(0); @@ -1393,7 +1394,8 @@ public class JavaEditor extends Editor { debugMenu.add(item); item.setEnabled(false); - item = Toolkit.newJMenuItemShift(Language.text("menu.debug.step_into"), KeyEvent.VK_J); + item = Toolkit.newJMenuItem(Language.text("menu.debug.step_into"), + Language.text("menu.debug.step_into.keystroke")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleStep(ActionEvent.SHIFT_MASK); @@ -1402,7 +1404,8 @@ public class JavaEditor extends Editor { debugMenu.add(item); item.setEnabled(false); - item = Toolkit.newJMenuItemAlt(Language.text("menu.debug.step_out"), KeyEvent.VK_J); + item = Toolkit.newJMenuItem(Language.text("menu.debug.step_out"), + Language.text("menu.debug.step_out.keystroke")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleStep(ActionEvent.ALT_MASK); diff --git a/todo.txt b/todo.txt index 58570a6c1..d06337277 100755 --- a/todo.txt +++ b/todo.txt @@ -13,6 +13,35 @@ X text("test", 10, 10); is still slow with lots of fonts X https://bugs.openjdk.java.net/browse/JDK-8179209 X added a note to the Known Issues section in the Changes wiki X update the about screen to 2019 +o report of a library or tool (probably includes 2.x? 1.x?) breaking things +o NoSuchFieldError: useNativeSelect +X https://github.com/processing/processing/issues/4821 +X closed, no response + + +shortcuts +X problems with non-US keyboards and some shortcuts +X https://github.com/processing/processing/issues/2199 +_ Determine new keyboard shortcut for Step Out +_ https://github.com/processing/processing/issues/3538 + +# Comment/Uncomment, Increase Indent, Decrease Indent +menu.edit.comment_uncomment.keystroke = meta pressed SLASH +menu.edit.increase_indent.keystroke = meta pressed CLOSE_BRACKET +menu.edit.decrease_indent.keystroke = meta pressed OPEN_BRACKET +# inside Editor.java + +# Previous Tab, Next Tab (ignored on Linux, which is Page Up and Page Down) +editor.header.previous_tab.keystroke = meta alt pressed LEFT +editor.header.next_tab.keystroke = meta alt pressed RIGHT +# inside EditorHeader.java + +# Step, Step Into, and Step Out +menu.debug.step.keystroke = meta pressed J +menu.debug.step_into.keystroke = shift meta pressed J +menu.debug.step_out.keystroke = meta alt pressed J +# inside JavaEditor.java + fixed earlier X Could not initialize class com.sun.jna.Native on startup (Windows) @@ -20,6 +49,8 @@ X https://github.com/processing/processing/issues/4929 X closed earlier; fixed as best we could X sharing usage metrics about libraries X https://github.com/processing/processing/issues/4708 +X Determine shortcut for Export vs Use Selection for Find +X https://github.com/processing/processing/issues/2985 contrib X Updated russian translation, now can choose russian in preferences @@ -31,9 +62,9 @@ X https://github.com/processing/processing/issues/5246 X https://github.com/processing/processing/pull/5654 X console hiding button X https://github.com/processing/processing/pull/5115 -_ NullPointerException in Contribution Manager -_ https://github.com/processing/processing/issues/5524 -_ https://github.com/processing/processing/pull/5742 +X NullPointerException in Contribution Manager when installing +X https://github.com/processing/processing/issues/5524 +X https://github.com/processing/processing/pull/5742 jakub X Fix sketch exception getting hidden by warning @@ -51,13 +82,14 @@ _ Find in Reference disabled for various keywords (draw, for, if, catch, while) _ https://github.com/processing/processing/issues/5562 _ https://github.com/processing/processing/pull/5642 _ discuss with Casey -_ Welcome screen doesn't size properly for HiDPI screens -_ https://github.com/processing/processing/issues/4896 -nasty ones + +high-ish _ errors inside setup() aren't coming through at all? _ seen in Eclipse; have to turn on the debugger +_ Welcome screen doesn't size properly for HiDPI screens +_ https://github.com/processing/processing/issues/4896 manager @@ -100,16 +132,22 @@ _ clean Windows temp folders _ https://github.com/processing/processing/issues/1896 +modes _ sketch.properties not being written if initial mode is p5.js? _ when creating a sketch within non-Java mode, should write the settings file _ so that it re-loads in the proper environment _ remove sketch.properties when moving back to the default? _ or can we not do this, because it's used to set the 'next' mode +_ allow modes to specify their own base file name +_ need to move "is this a sketch?" handling into Mode +_ fix extension check for other modes +_ https://github.com/processing/processing/issues/3980 + +sketch/launching _ what to double-click when opening p5 projects _ lack of a project file makes this a pain _ dropping a sketch folder onto the PDE should also be implemented - _ some type of sketch archive format for posting examples (.psk?) _ would be nice to open a sketch directly from a zip file _ https://github.com/processing/processing/issues/73 @@ -140,15 +178,6 @@ _ implement simple table for prefs? _ "error during export" message, but no error message contents come through _ e.g. https://github.com/processing/processing/issues/4792 -_ report of a library or tool (probably includes 2.x? 1.x?) breaking things -_ NoSuchFieldError: useNativeSelect -_ https://github.com/processing/processing/issues/4821 - -_ allow modes to specify their own base file name -_ need to move "is this a sketch?" handling into Mode -_ fix extension check for other modes -_ https://github.com/processing/processing/issues/3980 - _ did we lose settings.path because it was too buggy? _ https://github.com/processing/processing/issues/3948 @@ -200,19 +229,11 @@ _ https://github.com/processing/processing/issues/4353#issuecomment-237715947 medium _ detect changes in case with libraries _ https://github.com/processing/processing/issues/4507 -_ make when opening new editor window, open on the same display as current +_ when opening new editor window, open on the same display as current _ https://github.com/processing/processing/issues/4526 _ Library path mismatch between processing-java and export _ https://github.com/processing/processing/issues/4493 -shortcuts -_ problems with non-US keyboards and some shortcuts -_ https://github.com/processing/processing/issues/2199 -_ Determine shortcut for Export vs Use Selection for Find -_ https://github.com/processing/processing/issues/2985 -_ Determine new keyboard shortcut for Step Out -_ https://github.com/processing/processing/issues/3538 - needs more review _ createPreprocessor() added to JavaEditor, creating a mess