diff --git a/app/.settings/org.eclipse.ltk.core.refactoring.prefs b/app/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100644 index 000000000..b196c64a3 --- /dev/null +++ b/app/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/app/build.xml b/app/build.xml index 1dc84edc3..4122ed0e8 100755 --- a/app/build.xml +++ b/app/build.xml @@ -25,6 +25,7 @@ + @@ -49,6 +50,14 @@ message="Please build the core library first and make sure it sits in ../core/library/core.jar" /> + + + + + + + + diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index db6ed2383..233178ac0 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -46,9 +46,9 @@ import processing.mode.java.JavaMode; public class Base { // Added accessors for 0218 because the UpdateCheck class was not properly // updating the values, due to javac inlining the static final values. - static private final int REVISION = 229; + static private final int REVISION = 230; /** This might be replaced by main() if there's a lib/version.txt file. */ - static private String VERSION_NAME = "0229"; //$NON-NLS-1$ + static private String VERSION_NAME = "0230"; //$NON-NLS-1$ /** Set true if this a proper release rather than a numbered revision. */ // static private boolean RELEASE = false; @@ -170,7 +170,10 @@ public class Base { // Make sure a full JDK is installed initRequirements(); - + + // Load the languages + Language.init(); + // run static initialization that grabs all the prefs Preferences.init(); @@ -602,21 +605,21 @@ public class Base { } - /** - * The call has already checked to make sure this sketch is not modified, - * now change the mode. - */ + /** + * The call has already checked to make sure this sketch is not modified, + * now change the mode. + */ protected void changeMode(Mode mode) { if (activeEditor.getMode() != mode) { Sketch sketch = activeEditor.getSketch(); nextMode = mode; - + if (sketch.isUntitled()) { // If no changes have been made, just close and start fresh. // (Otherwise the editor would lose its 'untitled' status.) handleClose(activeEditor, true); handleNew(); - + } else { // If the current editor contains file extensions that the new mode can handle, then // write a sketch.properties file with the new mode specified, and reopen. @@ -833,7 +836,8 @@ public class Base { extensions.add(mode.getDefaultExtension()); } - final String prompt = "Open a Processing sketch..."; + + final String prompt = Language.text("open"); // don't use native dialogs on Linux (or anyone else w/ override) if (Preferences.getBoolean("chooser.files.native")) { //$NON-NLS-1$ @@ -928,7 +932,7 @@ public class Base { // Cycle through open windows to make sure that it's not already open. for (Editor editor : editors) { - // User may have double-clicked any PDE in the sketch folder, + // User may have double-clicked any PDE in the sketch folder, // so we have to check each open tab (not just the main one). // https://github.com/processing/processing/issues/2506 for (SketchCode tab : editor.getSketch().getCode()) { @@ -972,7 +976,7 @@ public class Base { editor = coreModes[0].createEditor(this, path, state); } } - + // Make sure that the sketch actually loaded Sketch sketch = editor.getSketch(); if (sketch == null) { @@ -2302,13 +2306,12 @@ public class Base { "b { font: 13pt \"Lucida Grande\" }"+ "p { font: 11pt \"Lucida Grande\"; margin-top: 8px; width: 300px }"+ " " + - "Do you want to save changes to this sketch
" + - " before closing?
" + - "

If you don't save, your changes will be lost.", + "" + Language.text("save.title") + "" + + "

" + Language.text("save.hint") + "

", JOptionPane.QUESTION_MESSAGE); String[] options = new String[] { - "Save", "Cancel", "Don't Save" + Language.text("save.btn.save"), Language.text("prompt.cancel"), Language.text("save.btn.dont_save") }; pane.setOptions(options); diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 480f79919..18aa9f26f 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -32,6 +32,7 @@ import java.awt.datatransfer.*; import java.awt.event.*; import java.awt.print.*; import java.io.*; +import java.nio.file.*; import java.util.*; import java.util.List; import java.util.Timer; @@ -419,7 +420,7 @@ public abstract class Editor extends JFrame implements RunnerListener { } modeMenu.addSeparator(); - JMenuItem addLib = new JMenuItem("Add Mode..."); + JMenuItem addLib = new JMenuItem(Language.text("toolbar.add_mode")); addLib.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { base.handleOpenModeManager(); @@ -587,9 +588,9 @@ public abstract class Editor extends JFrame implements RunnerListener { protected JMenu buildFileMenu(JMenuItem[] exportItems) { JMenuItem item; - JMenu fileMenu = new JMenu("File"); + JMenu fileMenu = new JMenu(Language.text("menu.file")); - item = Toolkit.newJMenuItem("New", 'N'); + item = Toolkit.newJMenuItem(Language.text("menu.file.new"), 'N'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { base.handleNew(); @@ -597,7 +598,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); fileMenu.add(item); - item = Toolkit.newJMenuItem("Open...", 'O'); + item = Toolkit.newJMenuItem(Language.text("menu.file.open"), 'O'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { base.handleOpenPrompt(); @@ -618,7 +619,7 @@ public abstract class Editor extends JFrame implements RunnerListener { fileMenu.add(sbMenu); // fileMenu.add(mode.getExamplesMenu()); - item = Toolkit.newJMenuItemShift("Examples...", 'O'); + item = Toolkit.newJMenuItemShift(Language.text("menu.file.examples"), 'O'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { mode.showExamplesFrame(); @@ -626,7 +627,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); fileMenu.add(item); - item = Toolkit.newJMenuItem("Close", 'W'); + item = Toolkit.newJMenuItem(Language.text("menu.file.close"), 'W'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { base.handleClose(Editor.this, false); @@ -634,7 +635,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); fileMenu.add(item); - item = Toolkit.newJMenuItem("Save", 'S'); + item = Toolkit.newJMenuItem(Language.text("menu.file.save"), 'S'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleSave(false); @@ -643,7 +644,7 @@ public abstract class Editor extends JFrame implements RunnerListener { // saveMenuItem = item; fileMenu.add(item); - item = Toolkit.newJMenuItemShift("Save As...", 'S'); + item = Toolkit.newJMenuItemShift(Language.text("menu.file.save_as"), 'S'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleSaveAs(); @@ -659,7 +660,7 @@ public abstract class Editor extends JFrame implements RunnerListener { } fileMenu.addSeparator(); - item = Toolkit.newJMenuItemShift("Page Setup", 'P'); + item = Toolkit.newJMenuItemShift(Language.text("menu.file.page_setup"), 'P'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handlePageSetup(); @@ -667,7 +668,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); fileMenu.add(item); - item = Toolkit.newJMenuItem("Print", 'P'); + item = Toolkit.newJMenuItem(Language.text("menu.file.print"), 'P'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handlePrint(); @@ -680,7 +681,7 @@ public abstract class Editor extends JFrame implements RunnerListener { if (!Base.isMacOS()) { fileMenu.addSeparator(); - item = Toolkit.newJMenuItem("Preferences", ','); + item = Toolkit.newJMenuItem(Language.text("menu.file.preferences"), ','); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { base.handlePrefs(); @@ -690,7 +691,7 @@ public abstract class Editor extends JFrame implements RunnerListener { fileMenu.addSeparator(); - item = Toolkit.newJMenuItem("Quit", 'Q'); + item = Toolkit.newJMenuItem(Language.text("menu.file.quit"), 'Q'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { base.handleQuit(); @@ -713,19 +714,19 @@ public abstract class Editor extends JFrame implements RunnerListener { protected JMenu buildEditMenu() { - JMenu menu = new JMenu("Edit"); + JMenu menu = new JMenu(Language.text("menu.edit")); JMenuItem item; - undoItem = Toolkit.newJMenuItem("Undo", 'Z'); + undoItem = Toolkit.newJMenuItem(Language.text("menu.edit.undo"), 'Z'); undoItem.addActionListener(undoAction = new UndoAction()); menu.add(undoItem); // Gotta follow them interface guidelines // http://code.google.com/p/processing/issues/detail?id=363 if (Base.isWindows()) { - redoItem = Toolkit.newJMenuItem("Redo", 'Y'); + redoItem = Toolkit.newJMenuItem(Language.text("menu.edit.redo"), 'Y'); } else { // Linux and OS X - redoItem = Toolkit.newJMenuItemShift("Redo", 'Z'); + redoItem = Toolkit.newJMenuItemShift(Language.text("menu.edit.redo"), 'Z'); } redoItem.addActionListener(redoAction = new RedoAction()); menu.add(redoItem); @@ -734,7 +735,7 @@ public abstract class Editor extends JFrame implements RunnerListener { // TODO "cut" and "copy" should really only be enabled // if some text is currently selected - item = Toolkit.newJMenuItem("Cut", 'X'); + item = Toolkit.newJMenuItem(Language.text("menu.edit.cut"), 'X'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleCut(); @@ -742,7 +743,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItem("Copy", 'C'); + item = Toolkit.newJMenuItem(Language.text("menu.edit.copy"), 'C'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textarea.copy(); @@ -750,7 +751,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItemShift("Copy as HTML", 'C'); + item = Toolkit.newJMenuItemShift(Language.text("menu.edit.copy_as_html"), 'C'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleCopyAsHTML(); @@ -758,7 +759,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItem("Paste", 'V'); + item = Toolkit.newJMenuItem(Language.text("menu.edit.paste"), 'V'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textarea.paste(); @@ -767,7 +768,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItem("Select All", 'A'); + item = Toolkit.newJMenuItem(Language.text("menu.edit.select_all"), 'A'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textarea.selectAll(); @@ -807,7 +808,7 @@ public abstract class Editor extends JFrame implements RunnerListener { menu.addSeparator(); - item = Toolkit.newJMenuItem("Auto Format", 'T'); + item = Toolkit.newJMenuItem(Language.text("menu.edit.auto_format"), 'T'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleAutoFormat(); @@ -815,7 +816,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItem("Comment/Uncomment", '/'); + item = Toolkit.newJMenuItem(Language.text("menu.edit.comment_uncomment"), '/'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleCommentUncomment(); @@ -823,7 +824,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItem("Increase Indent", ']'); + item = Toolkit.newJMenuItem(Language.text("menu.edit.increase_indent"), ']'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleIndentOutdent(true); @@ -831,7 +832,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItem("Decrease Indent", '['); + item = Toolkit.newJMenuItem(Language.text("menu.edit.decrease_indent"), '['); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleIndentOutdent(false); @@ -841,7 +842,7 @@ public abstract class Editor extends JFrame implements RunnerListener { menu.addSeparator(); - item = Toolkit.newJMenuItem("Find...", 'F'); + item = Toolkit.newJMenuItem(Language.text("menu.edit.find"), 'F'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (find == null) { @@ -855,7 +856,7 @@ public abstract class Editor extends JFrame implements RunnerListener { // TODO find next should only be enabled after a // search has actually taken place - item = Toolkit.newJMenuItem("Find Next", 'G'); + item = Toolkit.newJMenuItem(Language.text("menu.edit.find_next"), 'G'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (find != null) { @@ -865,7 +866,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); menu.add(item); - item = Toolkit.newJMenuItemShift("Find Previous", 'G'); + item = Toolkit.newJMenuItemShift(Language.text("menu.edit.find_previous"), 'G'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (find != null) { @@ -876,7 +877,7 @@ public abstract class Editor extends JFrame implements RunnerListener { menu.add(item); // For Arduino and Mac, this should be command-E, but that currently conflicts with Export Applet - item = Toolkit.newJMenuItemAlt("Use Selection for Find", 'F'); + item = Toolkit.newJMenuItemAlt(Language.text("menu.edit.use_selection_for_find"), 'F'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (find == null) { @@ -896,7 +897,7 @@ public abstract class Editor extends JFrame implements RunnerListener { protected JMenu buildSketchMenu(JMenuItem[] runItems) { JMenuItem item; - sketchMenu = new JMenu("Sketch"); + sketchMenu = new JMenu(Language.text("menu.sketch")); for (JMenuItem mi : runItems) { sketchMenu.add(mi); @@ -906,7 +907,7 @@ public abstract class Editor extends JFrame implements RunnerListener { sketchMenu.add(mode.getImportMenu()); - item = Toolkit.newJMenuItem("Show Sketch Folder", 'K'); + item = Toolkit.newJMenuItem(Language.text("menu.sketch.show_sketch_folder"), 'K'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Base.openFolder(sketch.getFolder()); @@ -915,7 +916,7 @@ public abstract class Editor extends JFrame implements RunnerListener { sketchMenu.add(item); item.setEnabled(Base.openFolderAvailable()); - item = new JMenuItem("Add File..."); + item = new JMenuItem(Language.text("menu.sketch.add_file")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { sketch.handleAddFile(); @@ -997,7 +998,7 @@ public abstract class Editor extends JFrame implements RunnerListener { public void rebuildToolMenu() { if (toolsMenu == null) { - toolsMenu = new JMenu("Tools"); + toolsMenu = new JMenu(Language.text("menu.tools")); } else { toolsMenu.removeAll(); } @@ -1011,7 +1012,7 @@ public abstract class Editor extends JFrame implements RunnerListener { addTools(toolsMenu, contribTools); toolsMenu.addSeparator(); - JMenuItem item = new JMenuItem("Add Tool..."); + JMenuItem item = new JMenuItem(Language.text("menu.tools.add_tool")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { base.handleOpenToolManager(); @@ -1265,7 +1266,7 @@ public abstract class Editor extends JFrame implements RunnerListener { class UndoAction extends AbstractAction { public UndoAction() { - super("Undo"); + super(Language.text("menu.edit.undo")); this.setEnabled(false); } @@ -1304,8 +1305,8 @@ public abstract class Editor extends JFrame implements RunnerListener { } else { this.setEnabled(false); undoItem.setEnabled(false); - undoItem.setText("Undo"); - putValue(Action.NAME, "Undo"); + undoItem.setText(Language.text("menu.edit.undo")); + putValue(Action.NAME, Language.text("menu.edit.undo")); // if (sketch != null) { // sketch.setModified(false); // 0107 // } @@ -1316,7 +1317,7 @@ public abstract class Editor extends JFrame implements RunnerListener { class RedoAction extends AbstractAction { public RedoAction() { - super("Redo"); + super(Language.text("menu.edit.redo")); this.setEnabled(false); } @@ -1350,8 +1351,8 @@ public abstract class Editor extends JFrame implements RunnerListener { } else { this.setEnabled(false); redoItem.setEnabled(false); - redoItem.setText("Redo"); - putValue(Action.NAME, "Redo"); + redoItem.setText(Language.text("menu.edit.redo")); + putValue(Action.NAME, Language.text("menu.edit.redo")); } } } @@ -2219,13 +2220,12 @@ public abstract class Editor extends JFrame implements RunnerListener { "b { font: 13pt \"Lucida Grande\" }"+ "p { font: 11pt \"Lucida Grande\"; margin-top: 8px }"+ " " + - "Do you want to save changes to this sketch
" + - " before closing?
" + - "

If you don't save, your changes will be lost.", + "" + Language.text("save.title") + "" + + "

" + Language.text("save.hint") + "

", JOptionPane.QUESTION_MESSAGE); String[] options = new String[] { - "Save", "Cancel", "Don't Save" + Language.text("save.btn.save"), Language.text("prompt.cancel"), Language.text("save.btn.dont_save") }; pane.setOptions(options); @@ -2360,6 +2360,10 @@ public abstract class Editor extends JFrame implements RunnerListener { Base.showWarning("Error", "Could not create the sketch.", e); return false; } + if (Preferences.getBoolean("editor.watcher")) { + initFileChangeListener(); + } + header.rebuild(); updateTitle(); // Disable untitled setting from previous document, if any @@ -2367,7 +2371,7 @@ public abstract class Editor extends JFrame implements RunnerListener { // Store information on who's open and running // (in case there's a crash or something that can't be recovered) -// base.storeSketches(); + // TODO this probably need not be here because of the Recent menu, right? Preferences.save(); // opening was successful @@ -2379,6 +2383,96 @@ public abstract class Editor extends JFrame implements RunnerListener { // return false; // } } + + + //set to true when the sketch is saved from inside processing + private boolean watcherSave; + private boolean watcherReloaded; + + //the key which is being used to poll the fs for changes + private WatchKey watcherKey = null; + + private void initFileChangeListener() { + try { + WatchService watchService = FileSystems.getDefault().newWatchService(); + Path folderPath = sketch.getFolder().toPath(); + watcherKey = folderPath.register(watchService, +// StandardWatchEventKinds.ENTRY_CREATE, +// StandardWatchEventKinds.ENTRY_DELETE, + StandardWatchEventKinds.ENTRY_MODIFY); + } catch (IOException e) { + e.printStackTrace(); + } + + final WatchKey finKey = watcherKey; + + // if the key is null for some reason, don't bother attaching + // a listener to it, they can deal without one + if (finKey != null) { + // the key can now be polled for changes in the files + addWindowFocusListener(new WindowFocusListener() { + @Override + public void windowGainedFocus(WindowEvent arg0) { + // check preference here for enabled or not? + + //if the directory was deleted, then don't scan + if (finKey.isValid()) { + List> events = finKey.pollEvents(); + processFileEvents(events); + } + } + + @Override + public void windowLostFocus(WindowEvent arg0){ + List> events = finKey.pollEvents(); + //don't ask to reload a file we saved + if (!watcherSave) { + processFileEvents(events); + } + watcherSave = false; + } + }); + } + } + + + /** + * Called when a file is changed. + * @param events the list of events that have occured in the sketch folder + */ + private void processFileEvents(List> events) { + watcherReloaded = false; + for (WatchEvent e : events) { + //the context is the name of the file inside the path + //due to some weird shit, if a file was editted in gedit, the context is .goutputstream-XXXXX + //this makes things.... complicated + //System.out.println(e.context()); + + //if we already reloaded in this cycle, then don't reload again + if (watcherReloaded){ + break; + } + if (e.kind().equals(StandardWatchEventKinds.ENTRY_MODIFY)) { +// Path p = (Path) e.context(); +// Path root = (Path) key.watchable(); +// Path path = root.resolve(p); + int response = + Base.showYesNoQuestion(Editor.this, "File Modified", + "A file has been modified externally", + "Would you like to reload the sketch?"); + if (response == 0) { + // reload the sketch + sketch.reload(); + header.rebuild(); + watcherReloaded = true; + } + } else { + // called when a file is created or deleted + // for now, do nothing + } + } + watcherSave = false; + } /** @@ -2411,6 +2505,7 @@ public abstract class Editor extends JFrame implements RunnerListener { public boolean handleSave(boolean immediately) { // handleStop(); // 0136 + watcherSave = true; if (sketch.isUntitled()) { return handleSaveAs(); // need to get the name, user might also cancel here @@ -2708,7 +2803,7 @@ public abstract class Editor extends JFrame implements RunnerListener { public TextAreaPopup() { JMenuItem item; - cutItem = new JMenuItem("Cut"); + cutItem = new JMenuItem(Language.text("menu.edit.cut")); cutItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleCut(); @@ -2716,7 +2811,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); this.add(cutItem); - copyItem = new JMenuItem("Copy"); + copyItem = new JMenuItem(Language.text("menu.edit.copy")); copyItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleCopy(); @@ -2724,7 +2819,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); this.add(copyItem); - discourseItem = new JMenuItem("Copy as HTML"); + discourseItem = new JMenuItem(Language.text("menu.edit.copy_as_html")); discourseItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleCopyAsHTML(); @@ -2732,7 +2827,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); this.add(discourseItem); - item = new JMenuItem("Paste"); + item = new JMenuItem(Language.text("menu.edit.paste")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handlePaste(); @@ -2740,7 +2835,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); this.add(item); - item = new JMenuItem("Select All"); + item = new JMenuItem(Language.text("menu.edit.select_all")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleSelectAll(); @@ -2750,7 +2845,7 @@ public abstract class Editor extends JFrame implements RunnerListener { this.addSeparator(); - item = new JMenuItem("Comment/Uncomment"); + item = new JMenuItem(Language.text("menu.edit.comment_uncomment")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleCommentUncomment(); @@ -2758,7 +2853,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); this.add(item); - item = new JMenuItem("Increase Indent"); + item = new JMenuItem(Language.text("menu.edit.increase_indent")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleIndentOutdent(true); @@ -2766,7 +2861,7 @@ public abstract class Editor extends JFrame implements RunnerListener { }); this.add(item); - item = new JMenuItem("Decrease Indent"); + item = new JMenuItem(Language.text("menu.edit.decrease_indent")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleIndentOutdent(false); @@ -2776,7 +2871,7 @@ public abstract class Editor extends JFrame implements RunnerListener { this.addSeparator(); - referenceItem = new JMenuItem("Find in Reference"); + referenceItem = new JMenuItem(Language.text("find_in_reference")); referenceItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleFindReference(); diff --git a/app/src/processing/app/EditorHeader.java b/app/src/processing/app/EditorHeader.java index 334d0e91d..671095f14 100644 --- a/app/src/processing/app/EditorHeader.java +++ b/app/src/processing/app/EditorHeader.java @@ -508,7 +508,7 @@ public class EditorHeader extends JComponent { */ //item = new JMenuItem("New Tab"); - item = Toolkit.newJMenuItemShift("New Tab", 'N'); + item = Toolkit.newJMenuItemShift(Language.text("editor.header.new_tab"), 'N'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { editor.getSketch().handleNewCode(); @@ -516,7 +516,7 @@ public class EditorHeader extends JComponent { }); menu.add(item); - item = new JMenuItem("Rename"); + item = new JMenuItem(Language.text("editor.header.rename")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { editor.getSketch().handleRenameCode(); @@ -530,16 +530,15 @@ public class EditorHeader extends JComponent { }); menu.add(item); - item = new JMenuItem("Delete"); + item = new JMenuItem(Language.text("editor.header.delete")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Sketch sketch = editor.getSketch(); if (!Base.isMacOS() && // ok on OS X editor.base.editors.size() == 1 && // mmm! accessor sketch.getCurrentCodeIndex() == 0) { - Base.showWarning("Yeah, no." , - "You can't delete the last tab " + - "of the last open sketch.", null); + Base.showWarning(Language.text("editor.header.delete.warning.title"), + Language.text("editor.header.delete.warning.text"), null); } else { editor.getSketch().handleDeleteCode(); } @@ -551,7 +550,7 @@ public class EditorHeader extends JComponent { // KeyEvent.VK_LEFT and VK_RIGHT will make Windows beep - item = new JMenuItem("Previous Tab"); + item = new JMenuItem(Language.text("editor.header.previous_tab")); KeyStroke ctrlAltLeft = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Toolkit.SHORTCUT_ALT_KEY_MASK); item.setAccelerator(ctrlAltLeft); @@ -565,7 +564,7 @@ public class EditorHeader extends JComponent { */ menu.add(item); - item = new JMenuItem("Next Tab"); + item = new JMenuItem(Language.text("editor.header.next_tab")); KeyStroke ctrlAltRight = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Toolkit.SHORTCUT_ALT_KEY_MASK); item.setAccelerator(ctrlAltRight); diff --git a/app/src/processing/app/FindReplace.java b/app/src/processing/app/FindReplace.java index 57c851dd7..de6e1b34a 100644 --- a/app/src/processing/app/FindReplace.java +++ b/app/src/processing/app/FindReplace.java @@ -64,15 +64,15 @@ public class FindReplace extends JFrame { public FindReplace(Editor editor) { - super("Find"); + super(Language.text("find")); setResizable(false); this.editor = editor; Container pain = getContentPane(); pain.setLayout(null); - JLabel findLabel = new JLabel("Find:"); - JLabel replaceLabel = new JLabel("Replace with:"); + JLabel findLabel = new JLabel(Language.text("find.find")); + JLabel replaceLabel = new JLabel(Language.text("find.replace_with")); Dimension labelDimension = replaceLabel.getPreferredSize(); pain.add(findLabel); @@ -85,7 +85,7 @@ public class FindReplace extends JFrame { if (findString != null) findField.setText(findString); if (replaceString != null) replaceField.setText(replaceString); - ignoreCaseBox = new JCheckBox("Ignore Case"); + ignoreCaseBox = new JCheckBox(Language.text("find.ignore_case")); ignoreCaseBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ignoreCase = ignoreCaseBox.isSelected(); @@ -94,7 +94,7 @@ public class FindReplace extends JFrame { ignoreCaseBox.setSelected(ignoreCase); pain.add(ignoreCaseBox); - allTabsBox = new JCheckBox("All Tabs"); + allTabsBox = new JCheckBox(Language.text("find.all_tabs")); allTabsBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { allTabs = allTabsBox.isSelected(); @@ -104,7 +104,7 @@ public class FindReplace extends JFrame { allTabsBox.setEnabled(true); pain.add(allTabsBox); - wrapAroundBox = new JCheckBox("Wrap Around"); + wrapAroundBox = new JCheckBox(Language.text("find.wrap_around")); wrapAroundBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { wrapAround = wrapAroundBox.isSelected(); @@ -116,11 +116,11 @@ public class FindReplace extends JFrame { JPanel buttons = new JPanel(); buttons.setLayout(new FlowLayout(FlowLayout.CENTER,BUTTON_GAP, 0)); - replaceAllButton = new JButton("Replace All"); - replaceButton = new JButton("Replace"); - replaceAndFindButton = new JButton("Replace & Find"); - previousButton = new JButton("Previous"); - findButton = new JButton("Find"); + replaceAllButton = new JButton(Language.text("find.btn.replace_all")); + replaceButton = new JButton(Language.text("find.btn.replace")); + replaceAndFindButton = new JButton(Language.text("find.btn.find_and_replace")); + previousButton = new JButton(Language.text("find.btn.previous")); + findButton = new JButton(Language.text("find.btn.find")); // ordering is different on mac versus pc if (Base.isMacOS()) { diff --git a/app/src/processing/app/Language.java b/app/src/processing/app/Language.java new file mode 100644 index 000000000..d98d2eaa4 --- /dev/null +++ b/app/src/processing/app/Language.java @@ -0,0 +1,163 @@ +package processing.app; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.util.HashMap; +import java.util.Locale; +import java.util.PropertyResourceBundle; +import java.util.ResourceBundle; + +import processing.core.PApplet; + +/** + * Internationalization (i18n) + * + * @author Darius Morawiec + */ +public class Language { + + private static Language instance = null; + private String language; + private HashMap languages; + private ResourceBundle bundle; + private static final String FILE = "processing.app.languages.PDE"; + + private Language() { + + // Get system language + this.language = Locale.getDefault().getLanguage(); + + // Set available languages + this.languages = new HashMap(); + + // Language code: + // http://en.wikipedia.org/wiki/ISO_639-1 + // http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes + + // en, English, English + this.languages.put(Locale.ENGLISH.getLanguage(), Locale.ENGLISH.getDisplayLanguage(Locale.ENGLISH)); + // de, German, Deutsch + this.languages.put(Locale.GERMAN.getLanguage(), Locale.GERMAN.getDisplayLanguage(Locale.GERMAN)); + // ja, Japanese + this.languages.put(Locale.JAPANESE.getLanguage(), Locale.JAPANESE.getDisplayLanguage(Locale.JAPANESE)); + + // Set default language + if (!this.languages.containsKey(this.language)) { + this.language = "en"; + } + + // Get saved language + try { + File file = Base.getContentFile("lib/language.txt"); + if (file.exists()) { + String language = PApplet.loadStrings(file)[0]; + language = language.trim().toLowerCase(); + if (!language.equals("")) { + this.language = language; + } else { + Base.saveFile(this.language, file); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + + // Get bundle with translations (processing.app.language.PDE) + this.bundle = ResourceBundle.getBundle(Language.FILE, new Locale(this.language), new UTF8Control()); + } + + /** + * Singleton constructor + * + * @return + */ + public static synchronized Language init() { + if (instance == null) { + instance = new Language(); + } + return instance; + } + + /** + * Get translation from bundles. + * + * @param text + * @return + */ + public static String text(String text) { + return init().bundle.getString(text); + } + + /** + * Get all available languages + * + * @return + */ + public static HashMap getLanguages() { + return init().languages; + } + + /** + * Get current language + * + * @return + */ + public static String getLanguage() { + return init().language; + } + + /** + * Set new language + * + * @param language + */ + public static void setLanguage(String language) { + try { + File file = Base.getContentFile("lib/language.txt"); + Base.saveFile(language, file); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Custom Control class for consitent encoding. + * http://stackoverflow.com/questions/4659929/how-to-use-utf-8-in-resource-properties-with-resourcebundle + */ + public class UTF8Control extends ResourceBundle.Control { + public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException,IOException { + // The below is a copy of the default implementation. + String bundleName = toBundleName(baseName, locale); + String resourceName = toResourceName(bundleName, "properties"); + ResourceBundle bundle = null; + InputStream stream = null; + if (reload) { + URL url = loader.getResource(resourceName); + if (url != null) { + URLConnection connection = url.openConnection(); + if (connection != null) { + connection.setUseCaches(false); + stream = connection.getInputStream(); + } + } + } else { + stream = loader.getResourceAsStream(resourceName); + } + if (stream != null) { + try { + // Only this line is changed to make it to read properties + // files as UTF-8. + bundle = new PropertyResourceBundle(new InputStreamReader(stream, "UTF-8")); + } finally { + stream.close(); + } + } + return bundle; + } + } + +} \ No newline at end of file diff --git a/app/src/processing/app/Mode.java b/app/src/processing/app/Mode.java index 5f0779e3d..666ec7f0d 100644 --- a/app/src/processing/app/Mode.java +++ b/app/src/processing/app/Mode.java @@ -423,13 +423,13 @@ public abstract class Mode { public void rebuildImportMenu() { //JMenu importMenu) { if (importMenu == null) { - importMenu = new JMenu("Import Library..."); + importMenu = new JMenu(Language.text("menu.library")); } else { //System.out.println("rebuilding import menu"); importMenu.removeAll(); } - JMenuItem addLib = new JMenuItem("Add Library..."); + JMenuItem addLib = new JMenuItem(Language.text("menu.library.add_library")); addLib.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { base.handleOpenLibraryManager(); @@ -453,7 +453,7 @@ public abstract class Mode { // } if (coreLibraries.size() == 0) { - JMenuItem item = new JMenuItem(getTitle() + " mode has no core libraries"); + JMenuItem item = new JMenuItem(getTitle() + " " + Language.text("menu.library.no_core_libraries")); item.setEnabled(false); importMenu.add(item); } else { @@ -467,7 +467,7 @@ public abstract class Mode { if (contribLibraries.size() != 0) { importMenu.addSeparator(); - JMenuItem contrib = new JMenuItem("Contributed"); + JMenuItem contrib = new JMenuItem(Language.text("menu.library.contributed")); contrib.setEnabled(false); importMenu.add(contrib); @@ -674,7 +674,7 @@ public abstract class Mode { public void showExamplesFrame() { if (examplesFrame == null) { - examplesFrame = new JFrame(getTitle() + " Examples"); + examplesFrame = new JFrame(getTitle() + " "+Language.text("menu.file.examples")); Toolkit.setIcon(examplesFrame); Toolkit.registerWindowCloseKeys(examplesFrame.getRootPane(), new ActionListener() { public void actionPerformed(ActionEvent e) { diff --git a/app/src/processing/app/Preferences.java b/app/src/processing/app/Preferences.java index b03a9b991..3b5f2a826 100644 --- a/app/src/processing/app/Preferences.java +++ b/app/src/processing/app/Preferences.java @@ -31,6 +31,8 @@ import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; +import processing.app.ColorChooser; +import processing.app.Language; import processing.core.*; @@ -65,22 +67,24 @@ public class Preferences { static final Integer[] FONT_SIZES = { 10, 12, 14, 18, 24, 36, 48 }; // what to call the feller + // had to rename this file because people were editing it + static final String DEFAULTS_FILE = "defaults.txt"; //$NON-NLS-1$ static final String PREFS_FILE = "preferences.txt"; //$NON-NLS-1$ // prompt text stuff - static final String PROMPT_YES = "Yes"; - static final String PROMPT_NO = "No"; - static final String PROMPT_CANCEL = "Cancel"; - static final String PROMPT_OK = "OK"; - static final String PROMPT_BROWSE = "Browse"; + static final String PROMPT_YES = Language.text("prompt.yes"); + static final String PROMPT_NO = Language.text("prompt.no"); + static final String PROMPT_CANCEL = Language.text("prompt.cancel"); + static final String PROMPT_OK = Language.text("prompt.ok"); + static final String PROMPT_BROWSE = Language.text("prompt.browse"); /** * Standardized width for buttons. Mac OS X 10.3 wants 70 as its default, * Windows XP needs 66, and my Ubuntu machine needs 80+, so 80 seems proper. */ - static public int BUTTON_WIDTH = 80; + static public int BUTTON_WIDTH = Integer.valueOf(Language.text("preferences.button.width")); /** * Standardized button height. Mac OS X 10.3 (Java 1.4) wants 29, @@ -131,6 +135,8 @@ public class Preferences { JCheckBox codeCompletionTriggerBox; JComboBox displaySelectionBox; + JComboBox languageSelectionBox; + int displayCount; String[] monoFontFamilies; @@ -142,8 +148,8 @@ public class Preferences { // data model - static HashMap defaults; - static HashMap table = new HashMap(); + static HashMap defaults; + static HashMap table = new HashMap(); static File preferencesFile; @@ -154,7 +160,7 @@ public class Preferences { try { // Name changed for 2.1b2 to avoid problems with users modifying or // replacing the file after doing a search for "preferences.txt". - load(Base.getLibStream("defaults.txt")); //$NON-NLS-1$ + load(Base.getLibStream(DEFAULTS_FILE)); } catch (Exception e) { Base.showError(null, "Could not read default settings.\n" + "You'll need to reinstall Processing.", e); @@ -226,7 +232,7 @@ public class Preferences { public Preferences(Base base) { this.base = base; //dialog = new JDialog(editor, "Preferences", true); - dialog = new JFrame("Preferences"); + dialog = new JFrame(Language.text("preferences")); dialog.setResizable(false); Container pain = dialog.getContentPane(); @@ -246,7 +252,7 @@ public class Preferences { // Sketchbook location: // [...............................] [ Browse ] - label = new JLabel("Sketchbook location:"); + label = new JLabel(Language.text("preferences.sketchbook_location")+":"); pain.add(label); d = label.getPreferredSize(); label.setBounds(left, top, d.width, d.height); @@ -260,7 +266,7 @@ public class Preferences { button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { File dflt = new File(sketchbookLocationField.getText()); - PApplet.selectFolder("Select new sketchbook location", + PApplet.selectFolder(Language.text("preferences.sketchbook_location.popup"), "sketchbookCallback", dflt, Preferences.this, dialog); } @@ -279,6 +285,32 @@ public class Preferences { right = Math.max(right, h + d2.width + GUI_BIG); top += vmax + GUI_BETWEEN; + + // Language: [ English ] (requires restart of Processing) + + Container languageBox = Box.createHorizontalBox(); + JLabel languageLabel = new JLabel(Language.text("preferences.language")+": "); + languageBox.add(languageLabel); + languageSelectionBox = new JComboBox(); + + HashMap languages = Language.getLanguages(); + String[] languageSelection = new String[languages.size()]; + languageSelection[0] = languages.get(Language.getLanguage()); + int i = 1; + for (Map.Entry lang : languages.entrySet()) { + if(!lang.getKey().equals(Language.getLanguage())){ + languageSelection[i++] = lang.getValue(); + } + } + languageSelectionBox.setModel(new DefaultComboBoxModel(languageSelection)); + languageBox.add(languageSelectionBox); + label = new JLabel(" ("+Language.text("preferences.requires_restart")+")"); + languageBox.add(label); + pain.add(languageBox); + d = languageBox.getPreferredSize(); + languageBox.setBounds(left, top, d.width, d.height); + top += d.height + GUI_BETWEEN; + // Editor and console font [ Source Code Pro ] @@ -291,7 +323,7 @@ public class Preferences { // updated in the background. Container fontBox = Box.createHorizontalBox(); - JLabel fontLabel = new JLabel("Editor and Console font "); + JLabel fontLabel = new JLabel(Language.text("preferences.editor_and_console_font")+": "); final String fontTip = "" + "Select the font used in the Editor and the Console.
" + "Only monospaced (fixed-width) fonts may be used,
" + @@ -316,16 +348,18 @@ public class Preferences { // Editor font size [ 12 ] Console font size [ 10 ] Container box = Box.createHorizontalBox(); - - label = new JLabel("Editor font size: "); + label = new JLabel(Language.text("preferences.editor_font_size")+": "); box.add(label); fontSizeField = new JComboBox(FONT_SIZES); +// fontSizeField = new JComboBox(FONT_SIZES); fontSizeField.setEditable(true); box.add(fontSizeField); box.add(Box.createHorizontalStrut(GUI_BETWEEN)); - label = new JLabel("Console font size: "); + label = new JLabel(Language.text("preferences.console_font_size")+": "); + box.add(label); +// consoleSizeField = new JComboBox(FONT_SIZES); consoleSizeField = new JComboBox(FONT_SIZES); consoleSizeField.setEditable(true); box.add(consoleSizeField); @@ -339,7 +373,7 @@ public class Preferences { Container colorBox = Box.createHorizontalBox(); - label = new JLabel("Background color when Presenting: "); + label = new JLabel(Language.text("preferences.background_color")+": "); colorBox.add(label); final String colorTip = "" @@ -449,11 +483,8 @@ public class Preferences { label = new JLabel("#"); colorBox.add(label); - colorBox.add(presentColorHex); - colorBox.add(Box.createHorizontalStrut(GUI_SMALL + 2 / 3 * GUI_SMALL)); - colorBox.add(presentColor); pain.add(colorBox); @@ -462,9 +493,10 @@ public class Preferences { top += d.height + GUI_BETWEEN; + // [ ] Use smooth text in editor window - - editorAntialiasBox = new JCheckBox("Use smooth text in editor window"); + + editorAntialiasBox = new JCheckBox(Language.text("preferences.use_smooth_text")); pain.add(editorAntialiasBox); d = editorAntialiasBox.getPreferredSize(); // adding +10 because ubuntu + jre 1.5 truncating items @@ -472,22 +504,25 @@ public class Preferences { right = Math.max(right, left + d.width); top += d.height + GUI_BETWEEN; - + // [ ] Enable complex text input (for Japanese et al, requires restart) inputMethodBox = - new JCheckBox("Enable complex text input " + - "(i.e. Japanese, requires restart of Processing)"); + new JCheckBox(Language.text("preferences.enable_complex_text_input")+ + " ("+Language.text("preferences.enable_complex_text_input_example")+ + ", "+Language.text("preferences.requires_restart")+")"); pain.add(inputMethodBox); d = inputMethodBox.getPreferredSize(); inputMethodBox.setBounds(left, top, d.width + 10, d.height); right = Math.max(right, left + d.width); top += d.height + GUI_BETWEEN; + // [ ] Continuously check for errors - PDE X errorCheckerBox = - new JCheckBox("Continuously check for errors"); + new JCheckBox(Language.text("preferences.continuously_check")); + pain.add(errorCheckerBox); d = errorCheckerBox.getPreferredSize(); errorCheckerBox.setBounds(left, top, d.width + 10, d.height); @@ -495,30 +530,33 @@ public class Preferences { //top += d.height + GUI_BETWEEN; int warningLeft = left + d.width; + // [ ] Show Warnings - PDE X warningsCheckerBox = - new JCheckBox("Show warnings"); + new JCheckBox(Language.text("preferences.show_warnings")); pain.add(warningsCheckerBox); d = warningsCheckerBox.getPreferredSize(); warningsCheckerBox.setBounds(warningLeft, top, d.width + 10, d.height); right = Math.max(right, warningLeft + d.width); top += d.height + GUI_BETWEEN; + // [ ] Enable Code Completion - PDE X codeCompletionBox = - new JCheckBox("Enable code completion"); + new JCheckBox(Language.text("preferences.code_completion")); pain.add(codeCompletionBox); d = codeCompletionBox.getPreferredSize(); codeCompletionBox.setBounds(left, top, d.width + 10, d.height); int toggleLeft = left + d.width; + // [ ] Toggle Code Completion Trigger - PDE X final String modifier = Base.isMacOS() ? "\u2318" : "Ctrl"; codeCompletionTriggerBox = - new JCheckBox("Trigger with " + modifier + "-space"); + new JCheckBox(Language.text("preferences.trigger_with")+" " + modifier + "-"+Language.text("preferences.cmd_space")); pain.add(codeCompletionTriggerBox); d = codeCompletionTriggerBox.getPreferredSize(); codeCompletionTriggerBox.setBounds(toggleLeft, top, d.width + 10, d.height); @@ -529,7 +567,7 @@ public class Preferences { // [ ] Increase maximum available memory to [______] MB Container memoryBox = Box.createHorizontalBox(); - memoryOverrideBox = new JCheckBox("Increase maximum available memory to "); + memoryOverrideBox = new JCheckBox(Language.text("preferences.increase_max_memory")+": "); memoryBox.add(memoryOverrideBox); memoryField = new JTextField(4); memoryBox.add(memoryField); @@ -543,7 +581,7 @@ public class Preferences { // [ ] Delete previous application folder on export deletePreviousBox = - new JCheckBox("Delete previous application folder on export"); + new JCheckBox(Language.text("preferences.delete_previous_folder_on_export")); pain.add(deletePreviousBox); d = deletePreviousBox.getPreferredSize(); deletePreviousBox.setBounds(left, top, d.width + 10, d.height); @@ -553,7 +591,8 @@ public class Preferences { // [ ] Hide tab/toolbar background image - whinyBox = new JCheckBox("Hide tab/toolbar background image (requires restart)"); + whinyBox = new JCheckBox(Language.text("preferences.hide_toolbar_background_image")+ + " ("+Language.text("preferences.requires_restart")+")"); pain.add(whinyBox); d = whinyBox.getPreferredSize(); whinyBox.setBounds(left, top, d.width + 10, d.height); @@ -563,7 +602,7 @@ public class Preferences { // [ ] Check for updates on startup - checkUpdatesBox = new JCheckBox("Check for updates on startup"); + checkUpdatesBox = new JCheckBox(Language.text("preferences.check_for_updates_on_startup")); pain.add(checkUpdatesBox); d = checkUpdatesBox.getPreferredSize(); checkUpdatesBox.setBounds(left, top, d.width + 10, d.height); @@ -574,12 +613,8 @@ public class Preferences { // Run sketches on display [ 1 ] Container displayBox = Box.createHorizontalBox(); - JLabel displayLabel = new JLabel("Run sketches on display "); - final String tip = "" + - "Sets the display where sketches are initially placed.
" + - "As usual, if the sketch window is moved, it will re-open
" + - "at the same location, however when running in present
" + - "(full screen) mode, this display will always be used."; + JLabel displayLabel = new JLabel(Language.text("preferences.run_sketches_on_display")+": "); + final String tip = "" + Language.text("preferences.run_sketches_on_display.tip"); displayLabel.setToolTipText(tip); displayBox.add(displayLabel); displaySelectionBox = new JComboBox(); @@ -589,13 +624,13 @@ public class Preferences { d = displayBox.getPreferredSize(); displayBox.setBounds(left, top, d.width, d.height); top += d.height + GUI_BETWEEN; - + // [ ] Automatically associate .pde files with Processing if (Base.isWindows()) { autoAssociateBox = - new JCheckBox("Automatically associate .pde files with Processing"); + new JCheckBox(Language.text("preferences.automatically_associate_pde_files")); pain.add(autoAssociateBox); d = autoAssociateBox.getPreferredSize(); autoAssociateBox.setBounds(left, top, d.width + 10, d.height); @@ -606,7 +641,7 @@ public class Preferences { // More preferences are in the ... - label = new JLabel("More preferences can be edited directly in the file"); + label = new JLabel(Language.text("preferences.file")+":"); pain.add(label); d = label.getPreferredSize(); label.setForeground(Color.gray); @@ -635,7 +670,7 @@ public class Preferences { right = Math.max(right, left + d.width); top += d.height; - label = new JLabel("(edit only when Processing is not running)"); + label = new JLabel("("+Language.text("preferences.file.hint")+")"); pain.add(label); d = label.getPreferredSize(); label.setForeground(Color.gray); @@ -770,7 +805,20 @@ public class Preferences { // setBoolean("editor.external", externalEditorBox.isSelected()); setBoolean("update.check", checkUpdatesBox.isSelected()); //$NON-NLS-1$ - + + // Save Language + HashMap languages = Language.getLanguages(); + String language = ""; + for (Map.Entry lang : languages.entrySet()) { + if( lang.getValue().equals( String.valueOf(languageSelectionBox.getSelectedItem()) ) ){ + language = lang.getKey().trim().toLowerCase(); + break; + } + } + if(!language.equals(Language.getLanguage()) && !language.equals("")){ + Language.setLanguage(language); + } + int oldDisplayIndex = getInteger("run.display"); //$NON-NLS-1$ int displayIndex = 0; for (int d = 0; d < displaySelectionBox.getItemCount(); d++) { diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 7c00152a3..d0a644c7c 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -806,7 +806,7 @@ public class Sketch { final String oldName2 = folder.getName(); // TODO rewrite this to use shared version from PApplet - final String PROMPT = "Save sketch folder as..."; + final String PROMPT = Language.text("save"); if (Preferences.getBoolean("chooser.files.native")) { // get new name for folder FileDialog fd = new FileDialog(editor, PROMPT, FileDialog.SAVE); @@ -1033,8 +1033,7 @@ public class Sketch { } // get a dialog, select a file to add to the sketch - String prompt = - "Select an image or other data file to copy to your sketch"; + String prompt = Language.text("file"); //FileDialog fd = new FileDialog(new Frame(), prompt, FileDialog.LOAD); FileDialog fd = new FileDialog(editor, prompt, FileDialog.LOAD); fd.setVisible(true); diff --git a/app/src/processing/app/contrib/ContributionManagerDialog.java b/app/src/processing/app/contrib/ContributionManagerDialog.java index 9d46e21cb..a4a4e4f70 100644 --- a/app/src/processing/app/contrib/ContributionManagerDialog.java +++ b/app/src/processing/app/contrib/ContributionManagerDialog.java @@ -60,7 +60,7 @@ public class ContributionManagerDialog { title = "Update Manager"; filter = ContributionType.createUpdateFilter(); } else { - title = type.getTitle() + " Manager"; + // title = type.getTitle() + " Manager"; filter = type.createFilter(); } contribListing = ContributionListing.getInstance(); @@ -151,7 +151,7 @@ public class ContributionManagerDialog { filterPanel.add(Box.createHorizontalStrut(6)); - JLabel categoryLabel = new JLabel("Category:"); + JLabel categoryLabel = new JLabel(Language.text("library.category")); filterPanel.add(categoryLabel); filterPanel.add(Box.createHorizontalStrut(5)); @@ -374,12 +374,13 @@ public class ContributionManagerDialog { class FilterField extends JTextField { - final static String filterHint = "Filter your search..."; + String filterHint; boolean showingHint; List filters; public FilterField () { - super(filterHint); + super(Language.text("library.filter_your_search")); + filterHint = Language.text("library.filter_your_search"); showingHint = true; filters = new ArrayList(); diff --git a/app/src/processing/app/languages/PDE.properties b/app/src/processing/app/languages/PDE.properties new file mode 100644 index 000000000..cf133b207 --- /dev/null +++ b/app/src/processing/app/languages/PDE.properties @@ -0,0 +1,214 @@ + + +# --------------------------------------- +# Language: English (en) (default) +# --------------------------------------- + + +# --------------------------------------- +# Menu + +# | File | Edit | Sketch | Library | Tools | Help | +# | File | +menu.file = File +menu.file.new = New +menu.file.open = Open... +menu.file.sketchbook = Sketchbook +menu.file.recent = Recent +menu.file.examples = Examples... +menu.file.close = Close +menu.file.save = Save +menu.file.save_as = Save As... +menu.file.export_application = Export Application... +menu.file.page_setup = Page Setup +menu.file.print = Print... +menu.file.preferences = Preferences... +menu.file.quit = Quit + +# | File | Edit | Sketch | Library | Tools | Help | +# | Edit | +menu.edit = Edit +menu.edit.undo = Undo +menu.edit.redo = Redo +menu.edit.cut = Cut +menu.edit.copy = Copy +menu.edit.copy_as_html = Copy as HTML +menu.edit.paste = Paste +menu.edit.select_all = Select All +menu.edit.auto_format = Auto Format +menu.edit.comment_uncomment = Comment/Uncomment +menu.edit.increase_indent = \u2192 Increase Indent +menu.edit.decrease_indent = \u2190 Decrease Indent +menu.edit.find = Find... +menu.edit.find_next = Find Next +menu.edit.find_previous = Find Previous +menu.edit.use_selection_for_find = Use Selection for Find + +# | File | Edit | Sketch | Library | Tools | Help | +# | Sketch | +menu.sketch = Sketch +menu.sketch.show_sketch_folder = Show Sketch Folder +menu.sketch.add_file = Add File... + +# | File | Edit | Sketch | Library | Tools | Help | +# | Library | +menu.library = Import Library... +menu.library.add_library = Add Library... +menu.library.contributed = Contributed +menu.library.no_core_libraries = mode has no core libraries + +# | File | Edit | Sketch | Library | Tools | Help | +# | Tools | +menu.tools = Tools +menu.tools.color_selector = Color Selector... +menu.tools.create_font = Create Font... +menu.tools.archive_sketch = Archive Sketch +menu.tools.fix_the_serial_lbrary = Fix the Serial Library +menu.tools.install_processing_java = Install "processing-java" +menu.tools.add_tool = Add Tool... + +# | File | Edit | Sketch | Library | Tools | Help | +# | Help | +menu.help = Help +menu.help.about = About Processing +menu.help.environment = Environment +menu.help.reference = Reference +menu.help.find_in_reference = Find in Reference +menu.help.online = Online +menu.help.getting_started = Getting Started +menu.help.getting_started.url = http://processing.org/learning/gettingstarted/ +menu.help.troubleshooting = Troubleshooting +menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting +menu.help.faq = Frequently Asked Questions +menu.help.faq.url = http://wiki.processing.org/w/FAQ +menu.help.foundation = The Processing Foundation +menu.help.foundation.url = http://processing.org/foundation/ +menu.help.visit = Visit Processing.org +menu.help.visit.url = http://processing.org/ + + +# --------------------------------------- +# Basics + +# Buttons +prompt.yes = Yes +prompt.no = No +prompt.cancel = Cancel +prompt.ok = OK +prompt.browse = Browse +prompt.export = Export + + +# --------------------------------------- +# Frames + +# Open (Frame) +open = Open a Processing sketch... + +# Save (Frame) +save = Save sketch folder as... +save.title = Do you want to save changes to this sketch
before closing? +save.hint = If you don't save, your changes will be lost. +save.btn.save = Save +save.btn.dont_save = Don't Save + +# Preferences (Frame) +preferences = Preferences +preferences.button.width = 80 +preferences.requires_restart = requires restart of Processing +preferences.sketchbook_location = Sketchook location +preferences.language = Language +preferences.editor_and_console_font = Editor and Console font +preferences.editor_font_size = Editor font size +preferences.console_font_size = Console font size +preferences.background_color = Background color when Presenting +preferences.use_smooth_text = Use smooth text in editor window +preferences.enable_complex_text_input = Enable complex text input +preferences.enable_complex_text_input_example = i.e. Japanese +preferences.continuously_check = Continuously check for errors +preferences.show_warnings = Show warnings +preferences.code_completion = Code completion +preferences.trigger_with = Trigger with +preferences.cmd_space = space +preferences.increase_max_memory = Increase maximum available memory to +preferences.delete_previous_folder_on_export = Delete previous folder on export +preferences.hide_toolbar_background_image = Hide tab/toolbar background image +preferences.check_for_updates_on_startup = Check for updates on startup +preferences.run_sketches_on_display = Run sketches on display +preferences.run_sketches_on_display.tip = \ +Sets the display where sketches are initially placed.
\ +As usual, if the sketch window is moved, it will re-open
\ +at the same location, however when running in present
\ +(full screen) mode, this display will always be used. +preferences.automatically_associate_pde_files = Automatically associate .pde files with Processing +preferences.launch_programs_in = Launch programs in +preferences.launch_programs_in.mode = mode +preferences.file = More preferences can be edited directly in the file +preferences.file.hint = edit only when Processing is not running + +# Sketchbook Location (Frame) +sketchbook_location = Select new sketchbook location + +# Export (Frame) +export = Export Options +export.platforms = Platforms +export.options = Options +export.options.fullscreen = Full Screen (Present mode) +export.options.show_stop_button = Show a Stop button +export.description.line1 = Export to Application creates double-clickable, +export.description.line2 = standalone applications for the selected plaforms. + +# Find (Frame) +find = Find +find.find = Find: +find.replace_with = Replace with: +find.ignore_case = Ignore Case +find.all_tabs = All Tabs +find.wrap_around = Wrap Around +find.btn.replace_all = Replace All +find.btn.replace = Replace +find.btn.find_and_replace = Find & Replace +find.btn.previous = Previous +find.btn.find = Find + +# Find in reference (Frame) +find_in_reference = Find in Reference + +# Library Manager (Frame) +library.category = Category: +library.filter_your_search = Filter your search... + +# File (Frame) +file = Select an image or other data file to copy to your sketch + +# Create Font (Frame) +create_font = Create Font + +# Color Selector (Frame) +color_selector = Color Selector + +# Archive Sketch (Frame) +archive_sketch = Archive sketch as... + + +# --------------------------------------- +# Toolbar + +# [Run/Present] [Stop] [New] [Open] [Save] +toolbar.run = Run +toolbar.present = Present +toolbar.stop = Stop +toolbar.new = New +toolbar.open = Open +toolbar.save = Save +toolbar.export_application = Export Application +toolbar.add_mode = Add mode... + +# [Tab1] [Tab2] [v] +editor.header.new_tab = New Tab +editor.header.rename = Rename +editor.header.delete = Delete +editor.header.previous_tab = Previous Tab +editor.header.next_tab = Next Tab +editor.header.delete.warning.title = Yeah, no. +editor.header.delete.warning.text = You can't delete the last tab of the last open sketch. \ No newline at end of file diff --git a/app/src/processing/app/languages/PDE_de.properties b/app/src/processing/app/languages/PDE_de.properties new file mode 100644 index 000000000..ce5aeb197 --- /dev/null +++ b/app/src/processing/app/languages/PDE_de.properties @@ -0,0 +1,204 @@ + + +# --------------------------------------- +# Language: German (Deutsch) (de) +# --------------------------------------- + + +# --------------------------------------- +# Menu + +# | File | Edit | Sketch | Library | Tools | Help | +# | File | +menu.file = Datei +menu.file.new = Neu +menu.file.open = Öffnen ... +menu.file.sketchbook = Sketchbook +menu.file.recent = Letzte Dateien öffnen +menu.file.examples = Beispiele ... +menu.file.close = Schließen +menu.file.save = Speichern +menu.file.save_as = Speichern unter ... +menu.file.export_application = Exportieren +menu.file.page_setup = Eine Kopie drucken +menu.file.print = Drucken ... +menu.file.preferences = Einstellungen ... +menu.file.quit = Beenden + +# | File | Edit | Sketch | Library | Tools | Help | +# | Edit | +menu.edit = Bearbeiten +menu.edit.undo = Rückgängig +menu.edit.redo = Wiederholen +menu.edit.cut = Ausschneiden +menu.edit.copy = Kopieren +menu.edit.copy_as_html = Kopieren als HTML +menu.edit.paste = Einfügen +menu.edit.select_all = Alle auswählen +menu.edit.auto_format = Autoformatierung +menu.edit.comment_uncomment = Ein- und Auskommentieren +menu.edit.increase_indent = \u2192 Ausrücken +menu.edit.decrease_indent = \u2190 Einrücken +menu.edit.find = Suchen ... +menu.edit.find_next = Weiter suchen +menu.edit.find_previous = Vorher suchen +menu.edit.use_selection_for_find = Suche in Auswahl + +# | File | Edit | Sketch | Library | Tools | Help | +# | Sketch | +menu.sketch = Sketch +menu.sketch.show_sketch_folder = Zeige Sketch Verzeichnis +menu.sketch.add_file = Datei hinzufügen ... + +# | File | Edit | Sketch | Library | Tools | Help | +# | Library | +menu.library = Library importieren... +menu.library.add_library = Library hinzufügen... +menu.library.contributed = Contributed +menu.library.no_core_libraries = Mode weist keine Kern-Libraries auf + +# | File | Edit | Sketch | Library | Tools | Help | +# | Tools | +menu.tools = Tools +menu.tools.color_selector = Farbauswahl ... +menu.tools.create_font = Schrift erstellen ... +menu.tools.archive_sketch = Sketch archivieren ... +menu.tools.fix_the_serial_lbrary = "Serial Library" beheben ... +menu.tools.install_processing_java = "processing-java" installieren ... +menu.tools.add_tool = Tool hinzufügen ... + +# | File | Edit | Sketch | Library | Tools | Help | +# | Help | +menu.help = Hilfe +menu.help.about = Über Processing +menu.help.environment = Entwicklungsumgebung +menu.help.reference = Referenz +menu.help.find_in_reference = Suche in Referenz +menu.help.online = Online +menu.help.getting_started = Erste Schritte +menu.help.troubleshooting = Fehlerbehandlung +menu.help.faq = Häufig gestellte Fragen +menu.help.foundation = "The Processing Foundation" +menu.help.visit = Processing.org besuchen + + +# --------------------------------------- +# Basics + +# Buttons +prompt.yes = Ja +prompt.no = Nein +prompt.cancel = Abbrechen +prompt.ok = Ok +prompt.browse = Durchsuchen +prompt.export = Exportieren + + +# --------------------------------------- +# Frames + +# Open (Frame) +open = Processing Sketch öffnen ... + +# Save (Frame) +save = Sketch speichern unter ... +save.title = Änderungen speichern? +save.hint = Wenn nicht, gehen alle Änderungen verloren. +save.btn.save = Speichern +save.btn.dont_save = Nicht speichern + +# Preferences (Frame) +preferences = Einstellungen +preferences.button.width = 110 +preferences.requires_restart = nach Neustart von Processing aktiv +preferences.sketchbook_location = Sketchbook Pfad +preferences.language = Sprache +preferences.editor_and_console_font = Editor und Konsolen Schriftart +preferences.editor_font_size = Editor Schriftgröße +preferences.console_font_size = Konsolen Schriftgröße +preferences.background_color = Hintergrundfarbe im Present Modus +preferences.use_smooth_text = Editor Textglättung +preferences.enable_complex_text_input = Komplexe Sprachen erlauben +preferences.enable_complex_text_input_example = z.B. Japanisch +preferences.continuously_check = Kontinuierliche Fehlererkennung +preferences.show_warnings = Zeige Warnungen +preferences.code_completion = Codevervollständigung +preferences.trigger_with = Trigger mit +preferences.cmd_space = Leerzeichen +preferences.increase_max_memory = Maximalen Speicher erhöhen auf +preferences.delete_previous_folder_on_export = Leere Verzeichnis beim Exportieren +preferences.hide_toolbar_background_image = Hintergrundgrafik der Toolbar ausblenden +preferences.check_for_updates_on_startup = Prüfung auf Updates bei Programmstart +preferences.run_sketches_on_display = Starte Sketch auf Bildschirm +preferences.automatically_associate_pde_files = Öffne .pde Dateien automatisch mit Processing +preferences.launch_programs_in = Anwendungen starten im +preferences.launch_programs_in.mode = Modus +preferences.file = Weitere Einstellungen können in der folgenden Datei bearbeitet werden +preferences.file.hint = Processing darf während der Bearbeitung nicht laufen + +# Sketchbook Location (Frame) +sketchbook_location = Neuen Sketchbook Pfad auswählen + +# Export (Frame) +export = Export Optionen +export.platforms = Plattformen +export.options = Optionen +export.options.fullscreen = Bildschirmfüllend (Present Mode) +export.options.show_stop_button = Sichtbarer Stopp Button +export.description.line1 = Exportierte Sketches sind ausführbare An- +export.description.line2 = wendungen für die ausgewählten Plattformen. + +# Find (Frame) +find = Suchen +find.find = Suche: +find.replace_with = Ersetzen durch: +find.ignore_case = Groß-/Kleinschreibung ignorieren +find.all_tabs = Alle Tabs +find.wrap_around = Nächsten Zeilen +find.btn.replace_all = Alle ersetzen +find.btn.replace = Ersetzen +find.btn.find_and_replace = Suchen & Ersetzen +find.btn.previous = Vorherige +find.btn.find = Suchen + +# Find in reference (Frame) +find_in_reference = Suche in Referenz + +# Library Manager (Frame) +library.category = Kategorie: +library.filter_your_search = Suche filtern ... + +# File (Frame) +file = Grafik oder andere Datei zum Sketch kopieren + +# Create Font (Frame) +create_font = Schrift erstellen + +# Color Selector (Frame) +color_selector = Farbauswahl + +# Archive Sketch (Frame) +archive_sketch = Sketch archivieren unter ... + + +# --------------------------------------- +# Toolbar + +# [Run/Present] [Stop] [New] [Open] [Save] +toolbar.run = Starten +toolbar.present = Starten in Vollbild +toolbar.stop = Stoppen +toolbar.new = Neu +toolbar.open = Öffnen +toolbar.save = Speichern +toolbar.export_application = Exportieren +toolbar.add_mode = Modus hinzufügen ... + +# [Tab1] [Tab2] [v] +editor.header.new_tab = Neuer Tab +editor.header.rename = Unbenennen +editor.header.delete = Löschen +editor.header.previous_tab = Nächster Tab +editor.header.next_tab = Vorheriger Tab +editor.header.delete.warning.title = Yeah, nein. +editor.header.delete.warning.text = Du kannst nicht den letzten Tab des letzten Sketches löschen. \ No newline at end of file diff --git a/app/src/processing/app/languages/PDE_en.properties b/app/src/processing/app/languages/PDE_en.properties new file mode 100644 index 000000000..a657df494 --- /dev/null +++ b/app/src/processing/app/languages/PDE_en.properties @@ -0,0 +1 @@ +# -> PDE.properties \ No newline at end of file diff --git a/app/src/processing/app/languages/PDE_ja.properties b/app/src/processing/app/languages/PDE_ja.properties new file mode 100644 index 000000000..15db2f96a --- /dev/null +++ b/app/src/processing/app/languages/PDE_ja.properties @@ -0,0 +1,215 @@ + + +# --------------------------------------- +# JAPANESE (ja) +# --------------------------------------- + + +# --------------------------------------- +# Menu + +# | File | Edit | Sketch | Library | Tools | Help | +# | File | +menu.file = ファイル +menu.file.new = 新規 +menu.file.open = 開く... +menu.file.sketchbook = スケッチブック +menu.file.recent = 最近開いたファイル +menu.file.examples = サンプル... +menu.file.close = 閉じる +menu.file.save = 保存 +menu.file.save_as = 名前を付けて保存... +menu.file.export_application = エクスポート +menu.file.page_setup = ページ設定 +menu.file.print = プリント +menu.file.preferences = 設定 +menu.file.quit = 終了 + +# | File | Edit | Sketch | Library | Tools | Help | +# | Edit | +menu.edit = 編集 +menu.edit.undo = 戻す +menu.edit.redo = やり直し +menu.edit.cut = 切り取り +menu.edit.copy = 複製 +menu.edit.copy_as_html = HTMLとしてコピー +menu.edit.paste = 貼り付け +menu.edit.select_all = すべて選択 +menu.edit.auto_format = 自動フォーマット +menu.edit.comment_uncomment = コメント/アンコメント +menu.edit.increase_indent = インデントを上げる +menu.edit.decrease_indent = インデントを下げる +menu.edit.find = 検索... +menu.edit.find_next = 次を探す +menu.edit.find_previous = 前を探す +menu.edit.use_selection_for_find = 選択を検索 + +# | File | Edit | Sketch | Library | Tools | Help | +# | Sketch | +menu.sketch = スケッチ +menu.sketch.show_sketch_folder = スケッチフォルダを開く +menu.sketch.add_file = ファイルを追加... + +# | File | Edit | Sketch | Library | Tools | Help | +# | Library | +menu.library = ライブラリのインポート... +menu.library.add_library = ライブラリの追加... +menu.library.contributed = 貢献 +menu.library.no_core_libraries = モードにコアライブラリがありません + +# | File | Edit | Sketch | Library | Tools | Help | +# | Tools | +menu.tools = ツール +menu.tools.create_font = フォント作成... +menu.tools.color_selector = 色選択 +menu.tools.archive_sketch = スケッチをアーカイブ +menu.tools.fix_the_serial_lbrary = シリアルライブラリを修正 +menu.tools.install_processing_java = "processing-java"をインストール +menu.tools.add_tool = ツールを追加... + +# | File | Edit | Sketch | Library | Tools | Help | +# | Help | +menu.help = ヘルプ +menu.help.about = About Processing +menu.help.environment = 環境 +menu.help.reference = 参照 +menu.help.find_in_reference = 参照から探す +menu.help.online = オンライン +menu.help.getting_started = はじめの一歩 +menu.help.getting_started.url = http://processing.org/learning/gettingstarted/ +menu.help.troubleshooting = 問題解決 +menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting +menu.help.faq = よくある質問 +menu.help.faq.url = http://wiki.processing.org/w/FAQ +menu.help.foundation = The Processing Foundation +menu.help.foundation.url = http://processing.org/foundation/ +menu.help.visit = Processing.orgを訪ねる +menu.help.visit.url = http://processing.org/ + + +# --------------------------------------- +# Basics + +# Buttons +prompt.yes = Yes +prompt.no = No +prompt.cancel = Cancel +prompt.ok = OK +prompt.browse = Browse +prompt.export = Export + + +# --------------------------------------- +# Frames + +# Open (Frame) +open = Open a Processing sketch... + +# Save (Frame) +save = Save sketch folder as... +save.title = Do you want to save changes to this sketch
before closing? +save.hint = If you don't save, your changes will be lost. +save.btn.save = Save +save.btn.dont_save = Don't Save + +# Preferences (Frame) +preferences = 設定 +preferences.button.width = 80 +preferences.requires_restart = Processingの再起動が必要です +preferences.sketchbook_location = スケッチブックの場所 +preferences.language = 言語 +preferences.editor_and_console_font = エディタ・コンソールフォント +preferences.editor_font_size = エディタフォントサイズ +preferences.console_font_size = コンソールフォントサイズ +preferences.background_color = プレゼンテーションの背景色 +preferences.use_smooth_text = エディタウィンドウでスムーズテキストを使う +preferences.enable_complex_text_input = 複雑なテキスト入力を有効にする +preferences.enable_complex_text_input_example = 例:日本語 +preferences.continuously_check = エラーのために継続的にチェックする +preferences.show_warnings = ワーニングを表示する +preferences.code_completion = コード補完 +preferences.trigger_with = 起動 +preferences.cmd_space = スペース +preferences.increase_max_memory = 有効な最大メモリを増やす +preferences.delete_previous_folder_on_export = エクスポート時に以前のフォルダを削除する +preferences.hide_toolbar_background_image = タブ/ツールバーの背景画像を隠す +preferences.check_for_updates_on_startup = 起動時にアップデートをチェックする +preferences.run_sketches_on_display = ディスプレイでスケッチを実行する +preferences.run_sketches_on_display.tip = \ +スケッチが最初に置かれるディスプレイをセットして下さい
\ +通常、スケッチウィンドウを動かすと、同じ位置に
\ +再び開かれますが、プレゼント(フルスクリーン)モードで
\ +実行している場合、このディスプレイが常に使用されます。 +preferences.automatically_associate_pde_files = 自動的に.pdeファイルをProcessingに関連付ける +preferences.launch_programs_in = プログラムを起動する +preferences.launch_programs_in.mode = モード +preferences.file = さらなる設定は次のファイルを直接編集することで可能です +preferences.file.hint = Processingが起動していない時のみ編集できます + +# Sketchbook Location (Frame) +preferences.sketchbook_location = スケッチブックの場所 + +# Export (Frame) +export = エクスポートオプション +export.platforms = プラットフォーム +export.options = オプション +export.options.fullscreen = フルスクリーン(プレゼンテーションモード) +export.options.show_stop_button = 停止ボタンを表示する +export.description.line1 = 選択されたプラットフォーム用のスタンドアロンの +export.description.line2 = アプリケーションとしてエクスポートします + +# Find (Frame) +find = 検索 +find.find = 検索: +find.replace_with = 置き換える: +find.ignore_case = ケースを無視 +find.all_tabs = すべてのタブ +find.wrap_around = 折り返し +find.btn.replace_all = すべて置換 +find.btn.replace = 置換 +find.btn.find_and_replace = 検索&置換 +find.btn.previous = 前 +find.btn.find = 検索 + +# Find in reference (Frame) +find_in_reference = リファレンスから探す + +# Library Manager (Frame) +library.category = カテゴリ: +library.filter_your_search = 検索をフィルタ... + +# File (Frame) +file = スケッチにコピーする画像やその他のデータファイルを選択して下さい + +# Create Font (Frame) +create_font = フォント作成 + +# Color Selector (Frame) +color_selector = 色選択 + +# Archive Sketch (Frame) +archive_sketch = スケッチをアーカイブする... + + +# --------------------------------------- +# Toolbar + +# [Run/Present] [Stop] [New] [Open] [Save] +# スケッチのメニュー部分は日本語が表示できないため、英語のままにする +toolbar.run = Run +toolbar.present = Present +toolbar.stop = Stop +toolbar.new = New +toolbar.open = Open +toolbar.save = Save +toolbar.export_application = Export Application +toolbar.add_mode = モードの追加... + +# [Tab1] [Tab2] [v] +editor.header.new_tab = 新規タブ +editor.header.rename = リネーム +editor.header.delete = 削除 +editor.header.previous_tab = 前のタブ +editor.header.next_tab = 次のタブ +editor.header.delete.warning.title = Yeah, no. +editor.header.delete.warning.text = 最後に開いたスケッチの最後のタブは削除できません diff --git a/app/src/processing/app/tools/Archiver.java b/app/src/processing/app/tools/Archiver.java index 4e34b9748..a10643649 100644 --- a/app/src/processing/app/tools/Archiver.java +++ b/app/src/processing/app/tools/Archiver.java @@ -44,7 +44,7 @@ public class Archiver implements Tool { public String getMenuTitle() { - return "Archive Sketch"; + return Language.text("menu.tools.archive_sketch"); } @@ -95,7 +95,7 @@ public class Archiver implements Tool { } while (newbie.exists()); // open up a prompt for where to save this fella - PApplet.selectOutput("Archive sketch as...", "fileSelected", newbie, this, editor); + PApplet.selectOutput(Language.text("archive_sketch"), "fileSelected", newbie, this, editor); } diff --git a/app/src/processing/app/tools/ColorSelector.java b/app/src/processing/app/tools/ColorSelector.java index 68bc92b68..59cce7760 100644 --- a/app/src/processing/app/tools/ColorSelector.java +++ b/app/src/processing/app/tools/ColorSelector.java @@ -47,11 +47,14 @@ public class ColorSelector implements Tool { public String getMenuTitle() { - return "Color Selector"; + return Language.text("menu.tools.color_selector"); } public void init(Editor editor) { + + // Language.text("color_selector") + if (selector == null) { selector = new ColorChooser(editor, false, Color.WHITE, "Copy", new ActionListener() { diff --git a/app/src/processing/app/tools/CreateFont.java b/app/src/processing/app/tools/CreateFont.java index 17d6cbc73..d119e76d3 100644 --- a/app/src/processing/app/tools/CreateFont.java +++ b/app/src/processing/app/tools/CreateFont.java @@ -74,12 +74,12 @@ public class CreateFont extends JFrame implements Tool { public CreateFont() { - super("Create Font"); + super(Language.text("create_font")); } public String getMenuTitle() { - return "Create Font..."; + return Language.text("menu.tools.create_font"); } diff --git a/app/src/processing/app/tools/InstallCommander.java b/app/src/processing/app/tools/InstallCommander.java index 3f5b47748..1967c4e30 100644 --- a/app/src/processing/app/tools/InstallCommander.java +++ b/app/src/processing/app/tools/InstallCommander.java @@ -29,6 +29,7 @@ import javax.swing.JOptionPane; import processing.app.Base; import processing.app.Editor; +import processing.app.Language; import processing.core.PApplet; @@ -37,7 +38,7 @@ public class InstallCommander implements Tool { public String getMenuTitle() { - return "Install “processing-java”"; + return Language.text("menu.tools.install_processing_java"); } diff --git a/app/src/processing/mode/java/JavaEditor.java b/app/src/processing/mode/java/JavaEditor.java index 270209ef2..2bdc199da 100644 --- a/app/src/processing/mode/java/JavaEditor.java +++ b/app/src/processing/mode/java/JavaEditor.java @@ -96,12 +96,12 @@ public class JavaEditor extends Editor { public JMenu buildHelpMenu() { // To deal with a Mac OS X 10.5 bug, add an extra space after the name // so that the OS doesn't try to insert its slow help menu. - JMenu menu = new JMenu("Help "); + JMenu menu = new JMenu(Language.text("menu.help")+" "); JMenuItem item; // macosx already has its own about menu if (!Base.isMacOS()) { - item = new JMenuItem("About Processing"); + item = new JMenuItem(Language.text("menu.help.about")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new About(JavaEditor.this); @@ -110,7 +110,7 @@ public class JavaEditor extends Editor { menu.add(item); } - item = new JMenuItem("Environment"); + item = new JMenuItem(Language.text("menu.help.environment")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showReference("environment" + File.separator + "index.html"); @@ -118,7 +118,7 @@ public class JavaEditor extends Editor { }); menu.add(item); - item = new JMenuItem("Reference"); + item = new JMenuItem(Language.text("menu.help.reference")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showReference("index.html"); @@ -126,7 +126,7 @@ public class JavaEditor extends Editor { }); menu.add(item); - item = Toolkit.newJMenuItemShift("Find in Reference", 'F'); + item = Toolkit.newJMenuItemShift(Language.text("menu.help.find_in_reference"), 'F'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (textarea.isSelectionActive()) { @@ -137,46 +137,46 @@ public class JavaEditor extends Editor { menu.add(item); menu.addSeparator(); - item = new JMenuItem("Online"); + item = new JMenuItem(Language.text("menu.help.online")); item.setEnabled(false); menu.add(item); - item = new JMenuItem("Getting Started"); + item = new JMenuItem(Language.text("menu.help.getting_started")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - Base.openURL("http://processing.org/learning/gettingstarted/"); + Base.openURL(Language.text("menu.help.getting_started.url")); } }); menu.add(item); - item = new JMenuItem("Troubleshooting"); + item = new JMenuItem(Language.text("menu.help.troubleshooting")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - Base.openURL("http://wiki.processing.org/w/Troubleshooting"); + Base.openURL(Language.text("menu.help.troubleshooting.url")); } }); menu.add(item); - item = new JMenuItem("Frequently Asked Questions"); + item = new JMenuItem(Language.text("menu.help.faq")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - Base.openURL("http://wiki.processing.org/w/FAQ"); + Base.openURL(Language.text("menu.help.faq.url")); } }); menu.add(item); - item = new JMenuItem("The Processing Foundation"); + item = new JMenuItem(Language.text("menu.help.foundation")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - Base.openURL("http://processing.org/foundation/"); + Base.openURL(Language.text("menu.help.foundation.url")); } }); menu.add(item); - item = new JMenuItem("Visit Processing.org"); + item = new JMenuItem(Language.text("menu.help.visit")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - Base.openURL("http://processing.org/"); + Base.openURL(Language.text("menu.help.visit.url")); } }); menu.add(item); @@ -260,8 +260,14 @@ public class JavaEditor extends Editor { panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(Box.createVerticalStrut(6)); - String line1 = "Export to Application creates double-clickable,"; - String line2 = "standalone applications for the selected plaforms."; +// Box panel = Box.createVerticalBox(); +// Box labelBox = Box.createHorizontalBox(); +// String msg = "Click Export to Application to create a standalone, " + +// "double-clickable application for the selected plaforms."; +// String msg = "Export to Application creates a standalone, \n" + +// "double-clickable application for the selected plaforms."; + String line1 = Language.text("export.description.line1"); + String line2 = Language.text("export.description.line2"); //String line2 = "standalone application for the current plaform."; JLabel label1 = new JLabel(line1, SwingConstants.CENTER); JLabel label2 = new JLabel(line2, SwingConstants.CENTER); @@ -316,20 +322,18 @@ public class JavaEditor extends Editor { platformPanel.add(macosxButton); platformPanel.add(Box.createHorizontalStrut(6)); platformPanel.add(linuxButton); - platformPanel.setBorder(new TitledBorder("Platforms")); + platformPanel.setBorder(new TitledBorder(Language.text("export.platforms"))); //Dimension goodIdea = new Dimension(wide, platformPanel.getPreferredSize().height); //platformPanel.setMaximumSize(goodIdea); // wide = Math.max(wide, platformPanel.getPreferredSize().width); platformPanel.setAlignmentX(Component.LEFT_ALIGNMENT); panel.add(platformPanel); int divWidth = platformPanel.getPreferredSize().width; - - // //int indent = new JCheckBox().getPreferredSize().width; int indent = 0; - final JCheckBox showStopButton = new JCheckBox("Show a Stop button"); + final JCheckBox showStopButton = new JCheckBox(Language.text("export.options.show_stop_button")); showStopButton.setSelected(Preferences.getBoolean("export.application.stop")); showStopButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { @@ -339,7 +343,8 @@ public class JavaEditor extends Editor { showStopButton.setEnabled(Preferences.getBoolean("export.application.fullscreen")); showStopButton.setBorder(new EmptyBorder(3, 13 + indent, 6, 13)); - final JCheckBox fullScreenButton = new JCheckBox("Full Screen (Present mode)"); + final JCheckBox fullScreenButton = new JCheckBox(Language.text("export.options.fullscreen")); + //fullscreenButton.setMnemonic(KeyEvent.VK_F); fullScreenButton.setSelected(Preferences.getBoolean("export.application.fullscreen")); fullScreenButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { @@ -530,7 +535,8 @@ public class JavaEditor extends Editor { // - String[] options = { "Export", "Cancel" }; + String[] options = { Language.text("prompt.export"), Language.text("prompt.cancel") }; + final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_NO_OPTION, @@ -538,7 +544,8 @@ public class JavaEditor extends Editor { options, options[0]); - final JDialog dialog = new JDialog(this, "Export Application", true); + + final JDialog dialog = new JDialog(this, Language.text("export"), true); dialog.setContentPane(optionPane); // System.out.println(optionPane.getLayout()); diff --git a/app/src/processing/mode/java/JavaToolbar.java b/app/src/processing/mode/java/JavaToolbar.java index 182e95c2b..7cf02a68b 100644 --- a/app/src/processing/mode/java/JavaToolbar.java +++ b/app/src/processing/mode/java/JavaToolbar.java @@ -27,6 +27,7 @@ import javax.swing.JPopupMenu; import processing.app.Base; import processing.app.Editor; import processing.app.EditorToolbar; +import processing.app.Language; public class JavaToolbar extends EditorToolbar { @@ -67,13 +68,13 @@ public class JavaToolbar extends EditorToolbar { static public String getTitle(int index, boolean shift) { switch (index) { - case RUN: return !shift ? "Run" : "Present"; - case STOP: return "Stop"; - case NEW: return "New"; - case OPEN: return "Open"; - case SAVE: return "Save"; + case RUN: return !shift ? Language.text("toolbar.run") : Language.text("toolbar.present"); + case STOP: return Language.text("toolbar.stop"); + case NEW: return Language.text("toolbar.new"); + case OPEN: return Language.text("toolbar.open"); + case SAVE: return Language.text("toolbar.save"); // case EXPORT: return !shift ? "Export Application" : "Export Applet"; - case EXPORT: return "Export Application"; + case EXPORT: return Language.text("toolbar.export_application"); } return null; } diff --git a/app/src/processing/mode/java/PdeKeyListener.java b/app/src/processing/mode/java/PdeKeyListener.java index c1ba6c30d..ec4655507 100644 --- a/app/src/processing/mode/java/PdeKeyListener.java +++ b/app/src/processing/mode/java/PdeKeyListener.java @@ -304,9 +304,11 @@ public class PdeKeyListener { //textarea.setSelectionStart(origIndex + 1); textarea.setSelectionEnd(textarea.getSelectionStop() - spaceCount); textarea.setSelectedText("\n"); + textarea.setCaretPosition(textarea.getCaretPosition() + extraCount + spaceCount); } else { String insertion = "\n" + spaces(spaceCount); textarea.setSelectedText(insertion); + textarea.setCaretPosition(textarea.getCaretPosition() + extraCount); } // not gonna bother handling more than one brace diff --git a/build/build.xml b/build/build.xml index 808195bde..0368af006 100755 --- a/build/build.xml +++ b/build/build.xml @@ -277,8 +277,8 @@ - - + + diff --git a/build/shared/lib/defaults.txt b/build/shared/lib/defaults.txt index ea9c388d2..a7e5706a8 100644 --- a/build/shared/lib/defaults.txt +++ b/build/shared/lib/defaults.txt @@ -159,6 +159,9 @@ editor.divider.size = 0 # but keeps it from being annoyingly obtrusive editor.divider.size.windows = 2 +# Whether to automatically reload modified tabs +editor.watcher = true + # Hide the background image. Gross because this is a pref that # really lives over in theme.txt but it's split here. buttons.hide.image = false @@ -349,4 +352,4 @@ pdex.ccEnabled=true pdex.dbgOutput=false pdex.errorCheckEnabled=true pdex.warningsEnabled=true -pdex.writeErrorLogs=false \ No newline at end of file +pdex.writeErrorLogs=false diff --git a/build/shared/lib/language.txt b/build/shared/lib/language.txt new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/build/shared/lib/language.txt @@ -0,0 +1 @@ + diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index d76ae25ee..1df71013d 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -1,10 +1,6 @@ -PROCESSING 3.0a2 (REV 0229) - ?? August 2014 +PROCESSING 3.0a2 (REV 0229) - 31 July 2014 - -[ fixes ] - -+ The Examples weren't included in 3.0a1. Oops. - https://github.com/processing/processing/issues/2652 +The 3.0 train gains steam and continues to hurtle down the track. [ changes ] @@ -24,6 +20,136 @@ PROCESSING 3.0a2 (REV 0229) - ?? August 2014 platform application export, that could cause sadness. To use the video library, use the "Add Library..." menu and select it from the list. ++ Added a new preference for the 3.0 sketchbook location, so that a separate + sketchbook (and with it, different Modes, Tools, and Libraries) can be + used with Processing 3.0 versus older versions of 2.x. + ++ Remove default menu bar hack for OS X + http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8022667 + ++ Move to native OS X full screen (supported in 10.7 and later) + https://github.com/processing/processing/issues/2641 + This allows us to remove native code for hiding the menu bar. + But it may introduce more quirks, we'll have to test it out. + + +[ fixes ] + ++ The Examples weren't included in 3.0a1. Oops. + https://github.com/processing/processing/issues/2652 + ++ Fix "No such file or directory" error when exporting on Mac OS X. + This bug actually meant that OS X apps weren't signed + https://github.com/processing/processing/issues/2614 + ++ Prevent opening sketches multiple times + https://github.com/processing/processing/issues/2506 + ++ Disable Mac OS X export button on other platforms + https://github.com/processing/processing/issues/2642 + ++ Removed duplicate 'fonts' folder in the download + ++ Removed welcome message from the sound library + ++ Get the 'modified' indicator working on OS X document windows again + https://github.com/processing/processing/issues/2194 + ++ Do bounds check on setVertex(PVector) + https://github.com/processing/processing/issues/2556 + ++ Using createGraphics() w/o begin/endDraw(), don't attempt drawing w/ image() + https://github.com/processing/processing/issues/2208 + + +[ the data classes ] + ++ Add copy() method to Table + ++ Return null from getString() with float and double values that are NaN. + Fixes how saveTable() works (writes blank entries instead of NaN). + ++ get(5) with an empty Int/Float/StringList was returning 0 + https://github.com/processing/processing/pull/2343 + ++ FloatDict and FloatList should always put NaN values at the end on sort. + ++ Add print() method to the various data types. + + +[ summer of code ] + ++ URL opening problem fixed by use of getCanonicalPath() on Windows + https://github.com/processing/processing/issues/2656 + ++ If Server constructor fails, throw an exception + https://github.com/processing/processing/issues/2604 + ++ Clear status messages in the Contribution Manager + https://github.com/processing/processing/pull/2667 + https://github.com/processing/processing/issues/2599 + ++ Add a progress bar for slow "Save As" (and "Add File") operations + http://code.google.com/p/processing/issues/detail?id=31 + https://github.com/processing/processing/issues/70 + https://github.com/processing/processing/pull/2370 + ++ NullPointerException in addBreakpointComments() when saving sketch + https://github.com/processing/processing/issues/2675 + ++ Run button was staying highlighted permanently + https://github.com/processing/processing/issues/2676 + ++ Dialog box for new tab/rename tab/sketch + https://github.com/processing/processing/issues/2431 + +X Fixed issue where the browser wasn't opening the reference properly + https://github.com/processing/processing/pull/2657 + + +[ you request, we pull ] + ++ Insert tabs properly when prefs set for tabs mode + https://github.com/processing/processing/pull/2607 + ++ Improve the appearance when using the Nimbus LAF + https://github.com/processing/processing/pull/2671 + ++ Implement A and a (elliptical arcs) + https://github.com/processing/processing/issues/169 + http://code.google.com/p/processing/issues/detail?id=130 + https://github.com/processing/processing/pull/2659 + ++ Fix typo in StringList.insert() + https://github.com/processing/processing/pull/2672 + https://github.com/processing/processing/issues/2548 + ++ PImage resize() causes images to not draw + https://github.com/processing/processing/issues/2228 + https://github.com/processing/processing/pull/2324 + + +[ fixed in earlier releases ] + ++ maxHeapSize typo in the build scripts + https://github.com/processing/processing/issues/2603 + ++ for() loop with nothing inside parens crashes Auto Format + https://github.com/processing/processing/issues/2141 + ++ Chinese text is overlapped in Processing 2.1 editor + https://github.com/processing/processing/issues/2173 + ++ Implement Windows menu in the PDE + https://github.com/processing/processing/issues/584 + ++ Default font fixes (merged for 2.2.1 or earlier) + https://github.com/processing/processing/issues/2331 + https://github.com/processing/processing/pull/2338 + ++ image resize() takes oddly long time + https://github.com/processing/processing/issues/5 + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . diff --git a/core/done.txt b/core/done.txt index 007c32e8b..3ebd45380 100644 --- a/core/done.txt +++ b/core/done.txt @@ -1,3 +1,51 @@ +0229 core (3.0a2) +X PImage resize() causes images to not draw +X https://github.com/processing/processing/issues/2228 +X https://github.com/processing/processing/pull/2324 +X move to native OS X full screen (gets rid of native code) +X https://github.com/processing/processing/issues/2641 +X do bounds check on setVertex(PVector) +X https://github.com/processing/processing/issues/2556 +X using createGraphics() w/o begin/endDraw(), don't attempt drawing w/ image() +X https://github.com/processing/processing/issues/2208 + +data +X add copy() method to Table +X return null from getString() on NaN float and double values +X affects how saveTable() works (writes blank entries instead of NaN) +X get(5) with an empty Int/Float/StringList was returning 0 +X https://github.com/processing/processing/pull/2343 +o fix for maxValue() and minValue() when all entries are bad +o on FloatDict it was NaN, check across the lists and other dict types +X nothing else to do here +X FloatDict and FloatList should always put NaN values at the end on sort +X same for the other list and dict classes +X (this is part of the point of having these easier versions) +o 'collector' class.. Dict that points to a list +o String as a key, int/float/string list as values +X seems too much like a better place for HashMap +X add print() method to other data types (not just IntList) + +pulls +X implement A and a (elliptical arcs) +X https://github.com/processing/processing/issues/169 +X http://code.google.com/p/processing/issues/detail?id=130 +X https://github.com/processing/processing/pull/2659 +X done with an approximation, if re-saving this will destroy data (docs) +X fix typo in StringList.insert() +X https://github.com/processing/processing/pull/2672 +X StingList.insert() error (should be an easy fix) +X https://github.com/processing/processing/issues/2548 + +earlier +X default font fixes (merged for 2.2.1 or earlier) +X https://github.com/processing/processing/issues/2331 +X https://github.com/processing/processing/pull/2338 +X image resize() takes oddly long time +X https://github.com/processing/processing/issues/5 +X the problem was confirmed to have fixed itself + + 0228 core (3.0a1) X add copy() method to PVector X modify PVector to include better methods for chaining operations diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 0cb8b3a66..79d4e95df 100755 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -10916,7 +10916,7 @@ public class PApplet extends Applet label.addMouseListener(new MouseAdapter() { @Override public void mousePressed(java.awt.event.MouseEvent e) { - System.exit(0); + applet.exit(); } }); frame.add(label); diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index c2bf327e9..bd463b52f 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -6440,19 +6440,22 @@ public class PGraphicsOpenGL extends PGraphics { protected void endOffscreenDraw() { + if (offscreenMultisample) { + multisampleFramebuffer.copyColor(offscreenFramebuffer); + } + + popFramebuffer(); + if (backgroundA == 1) { - // Set alpha channel to opaque in order to match behavior of JAVA2D: + // Set alpha channel to opaque in order to match behavior of JAVA2D, not + // on the multisampled FBO because it leads to wrong background color + // on some Macbooks with AMD graphics. pgl.colorMask(false, false, false, true); pgl.clearColor(0, 0, 0, backgroundA); pgl.clear(PGL.COLOR_BUFFER_BIT); pgl.colorMask(true, true, true, true); } - if (offscreenMultisample) { - multisampleFramebuffer.copyColor(offscreenFramebuffer); - } - - popFramebuffer(); texture.updateTexels(); // Mark all texels in screen texture as modified. getPrimaryPG().restoreGL(); diff --git a/core/todo.txt b/core/todo.txt index ee3902ee8..290d32746 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,49 +1,15 @@ -0229 core (3.0a2) -X PImage resize() causes images to not draw -X https://github.com/processing/processing/issues/2228 -X https://github.com/processing/processing/pull/2324 -X move to native OS X full screen (gets rid of native code) -X https://github.com/processing/processing/issues/2641 -X do bounds check on setVertex(PVector) -X https://github.com/processing/processing/issues/2556 -X using createGraphics() w/o begin/endDraw(), don't attempt drawing w/ image() -X https://github.com/processing/processing/issues/2208 - -data -X add copy() method to Table -X return null from getString() on NaN float and double values -X affects how saveTable() works (writes blank entries instead of NaN) -X get(5) with an empty Int/Float/StringList was returning 0 -X https://github.com/processing/processing/pull/2343 -o fix for maxValue() and minValue() when all entries are bad -o on FloatDict it was NaN, check across the lists and other dict types -X nothing else to do here -X FloatDict and FloatList should always put NaN values at the end on sort -X same for the other list and dict classes -X (this is part of the point of having these easier versions) -o 'collector' class.. Dict that points to a list -o String as a key, int/float/string list as values -X seems too much like a better place for HashMap -X add print() method to other data types (not just IntList) - -pulls -X implement A and a (elliptical arcs) -X https://github.com/processing/processing/issues/169 -X http://code.google.com/p/processing/issues/detail?id=130 -X https://github.com/processing/processing/pull/2659 -X done with an approximation, if re-saving this will destroy data (docs) -X fix typo in StringList.insert() -X https://github.com/processing/processing/pull/2672 -X StingList.insert() error (should be an easy fix) -X https://github.com/processing/processing/issues/2548 +0230 core (3.0a3) earlier -X default font fixes (merged for 2.2.1 or earlier) -X https://github.com/processing/processing/issues/2331 -X https://github.com/processing/processing/pull/2338 -X image resize() takes oddly long time -X https://github.com/processing/processing/issues/5 -X the problem was confirmed to have fixed itself +X PShape disableStyle() does not work with createShape() +X https://github.com/processing/processing/issues/1523 +X multisampled offscreen PGraphics don't clear the screen properly +X https://github.com/processing/processing/issues/2679 +X this was done midway through the 3.0a2 release process + +pull requests +X call applet.exit() instead of System.exit() from Present Mode's 'stop' +X https://github.com/processing/processing/pull/2680 applet/component diff --git a/done.txt b/done.txt index bffe7352c..ba69845aa 100644 --- a/done.txt +++ b/done.txt @@ -1,3 +1,92 @@ +0229 pde (3.0a2) +X fix "No such file or directory" error when exporting an application on OSX +X this also resulted in the application not being signed at all +X https://github.com/processing/processing/issues/2614 +X this is a fairly major issue... +X possible to open a sketch multiple times +X by double-clicking one of its files instead of the main pde file +X user opens non-main pde of already open sketch, it'll open again +X https://github.com/processing/processing/issues/2506 +X remove the prefs for 32/64-bit from Preferences +X also remove the extra OS X cruft inside Runner.java +X OS X export button not disabled on other platforms +X https://github.com/processing/processing/issues/2642 +o try new syntax package +X exclude 'fonts' folder from build (since it's going into the JRE) +X was storing our fonts in both ./lib/fonts and jre/lib/fonts +X now gets the jre folder and loads from there +X make ant fail when trying to delete JRE files that don't exist +X some aren't being removed properly +X fix the build scripts to include the examples +X https://github.com/processing/processing/issues/2652 +X all examples are out of "processing/java" and are now in "processing-docs/content/". The Book examples have been removed entirely from our repositories. +o "Platform is ${platform}" message during 'ant clean' +o on OS X, but not Windows (haven't checked Linux) +X this was in pdex/build.xml +X remove welcome message from the sound library +X URL opening problem fixed by use of getCanonicalPath() on Windows +X https://github.com/processing/processing/issues/2656 +X add a new pref for the 3.0 sketchbook location +X if Server constructor fails, throw an exception +X https://github.com/processing/processing/issues/2604 +o check on why 2x core.jar inside the Java folder +o maybe OS X Java can't look in subfolders? (just auto-adds things) +o https://github.com/processing/processing/issues/2344 +X one is used by the PDE, the other is used as a library +X get 'modified' indicator working on document windows again +X https://github.com/processing/processing/issues/2194 +X remove default menu bar hack when 7u60 arrives +X http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8022667 +X when renaming a tab, include the previous name to be edited +X changing the mode on an untitled, unmodified sketch removes untitled status + +gsoc +X clear status messages in the Contribution Manager +X https://github.com/processing/processing/pull/2667 +X https://github.com/processing/processing/issues/2599 +X may need a progress bar for "save as" +X or just the file copy function in general +X since it may take a long time (i.e. 1000s of screen grabs) +X http://code.google.com/p/processing/issues/detail?id=31 +X https://github.com/processing/processing/issues/70 +X https://github.com/processing/processing/pull/2370 +X NullPointerException in addBreakpointComments() when saving sketch +X https://github.com/processing/processing/issues/2675 +X run button seems to stay highlighted permanently +X https://github.com/processing/processing/issues/2676 +X new tab/rename dialog box +X https://github.com/processing/processing/issues/2431 +X fix issue where the browser wasn't opening the reference properly +X https://github.com/processing/processing/pull/2657 + +pulls +X insert tabs properly when prefs set for tabs mode +X https://github.com/processing/processing/pull/2607 +X improve look of Nimbus LAF +X https://github.com/processing/processing/pull/2671 + +earlier +X maxHeapSize typo in the build scripts +X https://github.com/processing/processing/issues/2603 +X remove minim +X add the new sound library to the build process +X for() loop with nothing inside parens crashes Auto Format +X https://github.com/processing/processing/issues/2141 +o double-clicking a .pde file doesn't open properly on OS X +o https://github.com/processing/processing/issues/2639 +X moving p5 examples to the web repo +X move examples into web repo +o OS X not opening a sketch at all on pde double-click? (though opening the app) +X Chinese text is overlapped in Processing 2.1 editor +X https://github.com/processing/processing/issues/2173 +o type cut off in dialog boxes on OS X retina machines +o https://github.com/processing/processing/issues/2116 +o add spaces to the end of the text? +X seems to have fixed itself in newer Java releases +X implement Windows menu in the PDE +X https://github.com/processing/processing/issues/584 + + 0228 pde (3.0a1) X increase heap size to 256m (-Xmx256) per Manindra request X use a ButtonGroup so that the current Mode cannot be de-selected diff --git a/pdex/.externalToolBuilders/Ant_Builder.launch b/pdex/.externalToolBuilders/Ant_Builder.launch index 2f93ff37a..9b95f0090 100644 --- a/pdex/.externalToolBuilders/Ant_Builder.launch +++ b/pdex/.externalToolBuilders/Ant_Builder.launch @@ -12,7 +12,7 @@ - + diff --git a/pdex/src/processing/mode/experimental/ASTGenerator.java b/pdex/src/processing/mode/experimental/ASTGenerator.java index 5918e8e4b..ea47a91d3 100644 --- a/pdex/src/processing/mode/experimental/ASTGenerator.java +++ b/pdex/src/processing/mode/experimental/ASTGenerator.java @@ -549,7 +549,7 @@ public class ASTGenerator { ASTNode astNode, boolean noCompare) { log("Resolve 3rdParty expr-- " + getNodeAsString(astNode) + " nearest node " + getNodeAsString(nearestNode)); - + if(astNode == null) return null; ClassMember scopeParent = null; SimpleType stp = null; if(astNode instanceof SimpleName){ @@ -1008,22 +1008,27 @@ public class ASTGenerator { ASTNode childExpr = getChildExpression(testnode); log("Parent expression : " + getParentExpression(testnode)); log("Child expression : " + childExpr); - - if (!noCompare) { - log("Original testnode " - + getNodeAsString(testnode)); - testnode = getParentExpression(testnode); - log("Corrected testnode " - + getNodeAsString(testnode)); + if (childExpr != null) { + if (!noCompare) { + log("Original testnode " + + getNodeAsString(testnode)); + testnode = getParentExpression(testnode); + log("Corrected testnode " + + getNodeAsString(testnode)); + } + ClassMember expr = resolveExpression3rdParty(nearestNode, testnode, + noCompare); + if (expr == null) { + log("Expr is null"); + } else { + log("Expr is " + expr.toString()); + candidates = getMembersForType(expr, childExpr.toString(), + noCompare, false); + } } - ClassMember expr = resolveExpression3rdParty(nearestNode, testnode, - noCompare); - if (expr == null) { - log("Expr is null"); - } else { - log("Expr is " + expr.toString()); - candidates = getMembersForType(expr, childExpr.toString(), - noCompare, false); + else + { + log("ChildExpr is null"); } } diff --git a/pdex/src/processing/mode/experimental/DebugEditor.java b/pdex/src/processing/mode/experimental/DebugEditor.java index c278b680c..861806ada 100755 --- a/pdex/src/processing/mode/experimental/DebugEditor.java +++ b/pdex/src/processing/mode/experimental/DebugEditor.java @@ -17,6 +17,7 @@ */ package processing.mode.experimental; import static processing.mode.experimental.ExperimentalMode.log; +import static processing.mode.experimental.ExperimentalMode.logE; import galsasson.mode.tweak.ColorControlBox; import galsasson.mode.tweak.Handle; import galsasson.mode.tweak.SketchParser; @@ -882,6 +883,13 @@ public class DebugEditor extends JavaEditor implements ActionListener { */ protected void addBreakpointComments(String tabFilename) { SketchCode tab = getTab(tabFilename); + if(tab == null) { + // this method gets called twice when saving sketch for the first time + // once with new name and another with old(causing NPE). Keep an eye out + // for potential issues. See #2675. TODO: + logE("Illegal tab name to addBreakpointComments() " + tabFilename); + return; + } List bps = dbg.getBreakpoints(tab.getFileName()); // load the source file @@ -907,7 +915,7 @@ public class DebugEditor extends JavaEditor implements ActionListener { public boolean handleSave(boolean immediately) { //System.out.println("handleSave " + immediately); - log("handleSave, viewing autosave? " + viewingAutosaveBackup); + //log("handleSave, viewing autosave? " + viewingAutosaveBackup); /* If user wants to save a backup, the backup sketch should get * copied to the main sketch directory, simply reload the main sketch. */ @@ -1901,6 +1909,11 @@ public class DebugEditor extends JavaEditor implements ActionListener { public void deactivateRun() { // toolbar.deactivate(TweakToolbar.RUN); + if(toolbar instanceof DebugToolbar){ + toolbar.deactivate(DebugToolbar.RUN); + } else { + super.deactivateRun(); + } } private boolean[] getModifiedTabs(ArrayList handles[]) diff --git a/pdex/src/processing/mode/experimental/ErrorCheckerService.java b/pdex/src/processing/mode/experimental/ErrorCheckerService.java index a68a2ebe8..2f63a752a 100644 --- a/pdex/src/processing/mode/experimental/ErrorCheckerService.java +++ b/pdex/src/processing/mode/experimental/ErrorCheckerService.java @@ -68,7 +68,7 @@ public class ErrorCheckerService implements Runnable{ /** * Error check happens every sleepTime milliseconds */ - public static final int sleepTime = 1000; + public static final int sleepTime = 4000; /** * The amazing eclipse ast parser @@ -728,7 +728,8 @@ public class ErrorCheckerService implements Runnable{ .getElement(javaLineNumber); if (lineElement == null) { log("calcPDEOffsetsForProbList(): Couldn't fetch javalinenum " - + javaLineNumber); + + javaLineNumber + "\nProblem: " + p); + p.setPDEOffsets(-1,-1); continue; } String javaLine = javaSource @@ -739,7 +740,8 @@ public class ErrorCheckerService implements Runnable{ .getDefaultRootElement().getElement(p.getLineNumber()); if (pdeLineElement == null) { log("calcPDEOffsetsForProbList(): Couldn't fetch pdelinenum " - + javaLineNumber); + + javaLineNumber + "\nProblem: " + p); + p.setPDEOffsets(-1,-1); continue; } String pdeLine = pdeTabs[p.getTabIndex()] @@ -1442,17 +1444,32 @@ public class ErrorCheckerService implements Runnable{ if (p == null) return; try { - astGenerator.highlightPDECode(p.getTabIndex(), - p.getLineNumber(), - p.getPDELineStartOffset(), - (p.getPDELineStopOffset() - - p.getPDELineStartOffset() + 1)); - editor.getTextArea().scrollTo(p.getLineNumber(), 0); + if(p.getPDELineStartOffset() == -1 || p.getPDELineStopOffset() == -1){ + // bad offsets, don't highlight, just scroll. + editor.toFront(); + editor.getSketch().setCurrentCode(p.getTabIndex()); + } + else { + astGenerator.highlightPDECode(p.getTabIndex(), + p.getLineNumber(), + p.getPDELineStartOffset(), + (p.getPDELineStopOffset() + - p.getPDELineStartOffset() + 1)); + } + + // scroll, but within boundaries + // It's also a bit silly that if parameters to scrollTo() are out of range, + // a BadLocation Exception is thrown internally and caught in JTextArea AND + // even the stack trace gets printed! W/o letting me catch it later! SMH + if (p.getLineNumber() < Base.countLines(editor.textArea().getDocument() + .getText(0, editor.textArea().getDocument().getLength())) + && p.getLineNumber() >= 0) { + editor.getTextArea().scrollTo(p.getLineNumber(), 0); + } editor.repaint(); } catch (Exception e) { - System.err.println(e - + " : Error while selecting text in scrollToErrorLine()"); - e.printStackTrace(); + logE(e + + " : Error while selecting text in scrollToErrorLine(), for problem: " + p); } // log("---"); } diff --git a/pdex/src/processing/mode/experimental/OffsetMatcher.java b/pdex/src/processing/mode/experimental/OffsetMatcher.java index 310e596d4..da62bb5a6 100644 --- a/pdex/src/processing/mode/experimental/OffsetMatcher.java +++ b/pdex/src/processing/mode/experimental/OffsetMatcher.java @@ -51,25 +51,32 @@ public class OffsetMatcher { } // log("PDE <-> Java"); - for (int i = 0; i < offsetMatch.size(); i++) { +// for (int i = 0; i < offsetMatch.size(); i++) { // log(offsetMatch.get(i).pdeOffset + " <-> " // + offsetMatch.get(i).javaOffset + -// ", " + word1.charAt(offsetMatch.get(i).pdeOffset) -// + " <-> " + word2.charAt(offsetMatch.get(i).javaOffset)); - } +// ", " + pdeCodeLine.charAt(offsetMatch.get(i).pdeOffset) +// + " <-> " + javaCodeLine.charAt(offsetMatch.get(i).javaOffset)); +// } // log("Length " + offsetMatch.size()); } public int getPdeOffForJavaOff(int start, int length) { - // log("PDE :" + pdeCodeLine + "\nJAVA:" + javaCodeLine); +// log("PDE :" + pdeCodeLine + "\nJAVA:" + javaCodeLine); +// log("getPdeOffForJavaOff() start:" + start + ", len " + length); if(!matchingNeeded) return start; - int ans = getPdeOffForJavaOff(start); //, end = getPdeOffForJavaOff(start + length - 1); -// log(start + " java start off, pde start off " -// + ans); -// log((start + length - 1) + " java end off, pde end off " -// + end); -// log("J: " + javaCodeLine.substring(start, start + length) + "\nP: " -// + pdeCodeLine.substring(ans, end + 1)); + int ans = getPdeOffForJavaOff(start); + int end = getPdeOffForJavaOff(start + length - 1); + if(ans == -1 || end == -1){ +// log("ans: " + ans + " end: " + end); + } + else { +// log(start + " java start off, pde start off " +// + ans); +// log((start + length - 1) + " java end off, pde end off " +// + end); +// log("J: " + javaCodeLine.substring(start, start + length) + "\nP: " +// + pdeCodeLine.substring(ans, end + 1)); + } return ans; } @@ -84,18 +91,25 @@ public class OffsetMatcher { } public int getPdeOffForJavaOff(int javaOff) { - if(!matchingNeeded) return javaOff; + if (!matchingNeeded) + return javaOff; for (int i = offsetMatch.size() - 1; i >= 0; i--) { if (offsetMatch.get(i).javaOffset < javaOff) { continue; } else if (offsetMatch.get(i).javaOffset == javaOff) { // int j = i; - while (offsetMatch.get(--i).javaOffset == javaOff) { + + // sometimes there are multiple repeated j offsets for a single pde offset + // so go to the last one, with bound check + while (i > 0 && offsetMatch.get(--i).javaOffset == javaOff) { // log("MP " + offsetMatch.get(i).javaOffset + " " // + offsetMatch.get(i).pdeOffset); } - int pdeOff = offsetMatch.get(++i).pdeOffset; - while (i > 0 && offsetMatch.get(--i).pdeOffset == pdeOff); + if (i + 1 < offsetMatch.size()) { // bounds check, see #2664 + int pdeOff = offsetMatch.get(++i).pdeOffset; + while (i > 0 && offsetMatch.get(--i).pdeOffset == pdeOff) { + } + } int j = i + 1; if (j > -1 && j < offsetMatch.size()) return offsetMatch.get(j).pdeOffset; @@ -112,12 +126,15 @@ public class OffsetMatcher { continue; } else if (offsetMatch.get(i).pdeOffset == pdeOff) { // int j = i; - while (offsetMatch.get(--i).pdeOffset == pdeOff) { + while (i > 0 && offsetMatch.get(--i).pdeOffset == pdeOff) { // log("MP " + offsetMatch.get(i).javaOffset + " " // + offsetMatch.get(i).pdeOffset); } - int javaOff = offsetMatch.get(++i).javaOffset; - while (i > 0 && offsetMatch.get(--i).javaOffset == javaOff); + if (i + 1 < offsetMatch.size()) { // bounds check, see #2664 + int javaOff = offsetMatch.get(++i).javaOffset; + while (i > 0 && offsetMatch.get(--i).javaOffset == javaOff) { + } + } int j = i + 1; if (j > -1 && j < offsetMatch.size()) return offsetMatch.get(j).javaOffset; @@ -242,12 +259,14 @@ public class OffsetMatcher { // a.getJavaOffForPdeOff(12, 3); // minDistance("static void main(){;", "public static void main(){;"); // minDistance("#bb00aa", "0xffbb00aa"); - a = new OffsetMatcher("void test(ArrayList boids){", - "public void test(ArrayList boids){"); - a.getJavaOffForPdeOff(20,4); +// a = new OffsetMatcher("void test(ArrayList boids){", +// "public void test(ArrayList boids){"); +// a.getJavaOffForPdeOff(20,4); + a = new OffsetMatcher("}", "\n"); + a.getPdeOffForJavaOff(0,1); log("--"); -// a = new OffsetMatcher("color abc = #qwerty;", "int abc = 0xffqwerty;"); -// a.getPdeOffForJavaOff(4, 3); + a = new OffsetMatcher("color abc = #qwerty;", "int abc = 0xffqwerty;"); + a.getPdeOffForJavaOff(4, 3); // a.getJavaOffForPdeOff(6, 3); // distance("c = #bb00aa;", "c = 0xffbb00aa;"); } diff --git a/todo.txt b/todo.txt index c7e49d2d7..bf095a65b 100644 --- a/todo.txt +++ b/todo.txt @@ -1,91 +1,17 @@ -0229 pde (3.0a2) -X new tab/rename dialog box -X https://github.com/processing/processing/issues/2431 -X fix issue where the browser wasn't opening the reference properly -X https://github.com/processing/processing/pull/2657 -X fix "No such file or directory" error when exporting an application on OSX -X this also resulted in the application not being signed at all -X https://github.com/processing/processing/issues/2614 -X this is a fairly major issue... -X possible to open a sketch multiple times -X by double-clicking one of its files instead of the main pde file -X user opens non-main pde of already open sketch, it'll open again -X https://github.com/processing/processing/issues/2506 -X remove the prefs for 32/64-bit from Preferences -X also remove the extra OS X cruft inside Runner.java -X OS X export button not disabled on other platforms -X https://github.com/processing/processing/issues/2642 -o try new syntax package -X exclude 'fonts' folder from build (since it's going into the JRE) -X was storing our fonts in both ./lib/fonts and jre/lib/fonts -X now gets the jre folder and loads from there -X make ant fail when trying to delete JRE files that don't exist -X some aren't being removed properly -X fix the build scripts to include the examples -X https://github.com/processing/processing/issues/2652 -X all examples are out of "processing/java" and are now in "processing-docs/content/". The Book examples have been removed entirely from our repositories. -o "Platform is ${platform}" message during 'ant clean' -o on OS X, but not Windows (haven't checked Linux) -X this was in pdex/build.xml -X remove welcome message from the sound library -X URL opening problem fixed by use of getCanonicalPath() on Windows -X https://github.com/processing/processing/issues/2656 -X add a new pref for the 3.0 sketchbook location -X if Server constructor fails, throw an exception -X https://github.com/processing/processing/issues/2604 -o check on why 2x core.jar inside the Java folder -o maybe OS X Java can't look in subfolders? (just auto-adds things) -o https://github.com/processing/processing/issues/2344 -X one is used by the PDE, the other is used as a library -X get 'modified' indicator working on document windows again -X https://github.com/processing/processing/issues/2194 -X remove default menu bar hack when 7u60 arrives -X http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8022667 -X when renaming a tab, include the previous name to be edited -X changing the mode on an untitled, unmodified sketch removes untitled status - -gsoc -X clear status messages in the Contribution Manager -X https://github.com/processing/processing/pull/2667 -X https://github.com/processing/processing/issues/2599 -X may need a progress bar for "save as" -X or just the file copy function in general -X since it may take a long time (i.e. 1000s of screen grabs) -X http://code.google.com/p/processing/issues/detail?id=31 -X https://github.com/processing/processing/issues/70 -X https://github.com/processing/processing/pull/2370 +0230 pde (3.0a3) pulls -X insert tabs properly when prefs set for tabs mode -X https://github.com/processing/processing/pull/2607 -X improve look of Nimbus LAF -X https://github.com/processing/processing/pull/2671 - -earlier -X maxHeapSize typo in the build scripts -X https://github.com/processing/processing/issues/2603 -X remove minim -X add the new sound library to the build process -X for() loop with nothing inside parens crashes Auto Format -X https://github.com/processing/processing/issues/2141 -o double-clicking a .pde file doesn't open properly on OS X -o https://github.com/processing/processing/issues/2639 -X moving p5 examples to the web repo -X move examples into web repo -o OS X not opening a sketch at all on pde double-click? (though opening the app) -X Chinese text is overlapped in Processing 2.1 editor -X https://github.com/processing/processing/issues/2173 -o type cut off in dialog boxes on OS X retina machines -o https://github.com/processing/processing/issues/2116 -o add spaces to the end of the text? -X seems to have fixed itself in newer Java releases -X implement Windows menu in the PDE -X https://github.com/processing/processing/issues/584 +X Add polling to detect file system changes +X https://github.com/processing/processing/issues/1939 +X https://github.com/processing/processing/pull/2628 +X huge i18n patch +X https://github.com/processing/processing/issues/632 +X https://github.com/processing/processing/pull/2084 +X http://code.google.com/p/processing/issues/detail?id=593 +_ need to make sure the .properties files are read properly as UTF-8 pending -_ huge i18n patch -_ https://github.com/processing/processing/pull/2084 _ look at the sound library https://github.com/wirsing/ProcessingSound _ sound is not yet supported on Windows _ glw? lwjgl? retina jogl? @@ -992,15 +918,6 @@ _ add proper copyright and license information for all included projects _ http://code.google.com/p/processing/issues/detail?id=185 _ list of license issues _ http://code.google.com/p/processing/issues/detail?id=575 -_ Internationalization -_ http://code.google.com/p/processing/issues/detail?id=593 -_ l10n, i18n of environment/core -_ http://docs.oracle.com/javase/tutorial/i18n/format/messageintro.html -_ http://docs.oracle.com/javase/tutorial/i18n/format/numberFormat.html -_ http://docs.oracle.com/javase/tutorial/i18n/format/choiceFormat.html -_ http://docs.oracle.com/javase/tutorial/i18n/format/messageFormat.html -_ http://docs.oracle.com/javase/7/docs/api/java/text/MessageFormat.html -_ http://docs.oracle.com/javase/tutorial/i18n/intro/checklist.html _ write up code guidelines for project _ make proper Eclipse style prefs to reinforce _ write up guidelines for modes