diff --git a/Contents/core/.classpath b/Contents/core/.classpath index 8c49e3f..36f2684 100644 --- a/Contents/core/.classpath +++ b/Contents/core/.classpath @@ -32,7 +32,6 @@ - diff --git a/Contents/core/java/field/bytecode/protect/ModificationCache.java b/Contents/core/java/field/bytecode/protect/ModificationCache.java index 15d4b8f..483ea9e 100644 --- a/Contents/core/java/field/bytecode/protect/ModificationCache.java +++ b/Contents/core/java/field/bytecode/protect/ModificationCache.java @@ -36,21 +36,17 @@ public boolean is(String name, boolean def, long at) { Modification m = known.get(name); if (m == null) { - //;//System.out.println(" cache miss :"+name+" "+at); return def; } if (m.at < at) { - //;//System.out.println(" cache stale :"+name+" "+at+" > "+m.at); known.remove(name); return def; } - //;//System.out.println(" cache hit :"+name+" "+m.instrumented); return m.instrumented; } public void state(String name, boolean is, long at) { - //;//System.out.println(" marking <"+name+"> as <"+is+"> @ "+at); known.put(name, new Modification(is, at)); } diff --git a/Contents/core/java/field/core/StandardFluidSheet.java b/Contents/core/java/field/core/StandardFluidSheet.java index cd37948..37ddf06 100755 --- a/Contents/core/java/field/core/StandardFluidSheet.java +++ b/Contents/core/java/field/core/StandardFluidSheet.java @@ -81,6 +81,8 @@ import field.core.plugins.python.PythonPluginEditor; import field.core.plugins.selection.ToolBarFolder; import field.core.plugins.snip.SnippetsPlugin; +import field.core.ui.FieldMenus2; +import field.core.ui.FieldMenus2.Sheet; import field.core.ui.MarkingMenuBuilder; import field.core.ui.NewTemplates; import field.core.ui.PopupTextBox; @@ -639,10 +641,10 @@ public VisitCode beginExecution(final iVisualElement source) { if (inprogress.get().contains(source)) return VisitCode.stop; - - System.out.println(" inprogress <"+inprogress.get()+">"); + + System.out.println(" inprogress <" + inprogress.get() + ">"); inprogress.get().add(source); - + try { // should be @@ -708,6 +710,7 @@ public void close() { for (iPlugin p : plugins) p.close(); + Launcher.getLauncher().registerUpdateable(this); Launcher.getLauncher().deregisterUpdateable(window); window.getFrame().setVisible(false); window.getFrame().dispose(); @@ -1262,7 +1265,10 @@ static public boolean canPaste() { } public VisitCode menuItemsFor(iVisualElement source, Map items) { - + + if (Platform.isLinux()) + insertFileMenuItems(rootSheetElement, group, items); + insertCopyPasteMenuItems(rootSheetElement, group, items); final HashSet o = selectionOrOver(); @@ -1319,43 +1325,34 @@ public iAcceptor set(String to2) { }); } - // items.put(" \u1d40 Create from template ///T///", - // new iUpdateable() { - // public void update() { - // createFromTemplate(); - // } - // }); + return VisitCode.cont; + } - // // TODO swt - temp menu code here to create something - // items.put(" \u21e3 create new visual element here ///N///", - // new iUpdateable() { - // - // public void update() { - // - // iVisualElement ee = rootSheetElement; - // - // GLComponentWindow frame = iVisualElement.enclosingFrame - // .get(rootSheetElement); - // - // Rect bounds = new Rect(30, 30, 50, 50); - // if (frame != null) { - // bounds.x = frame.getCurrentMousePosition().x; - // bounds.y = frame.getCurrentMousePosition().y; - // } - // - // Triple - // created = - // VisualElement - // .createWithName(bounds, ee, - // VisualElement.class, - // DraggableComponent.class, - // DefaultOverride.class,"untitled"); - // - // } - // - // }); + public void insertFileMenuItems(final iVisualElement rootSheetElement, MainSelectionGroup group, Map items) { + items.put("File", null); + items.put("\tNew File...", new iUpdateable() { - return VisitCode.cont; + @Override + public void update() { + Sheet s = FieldMenus2.fieldMenus.sheetForSheet(StandardFluidSheet.this); + FieldMenus2.fieldMenus.doNewFile(); + } + }); + items.put("\tSave", new iUpdateable() { + + @Override + public void update() { + saveNow(); + } + }); + items.put("\tSave As...", new iUpdateable() { + + @Override + public void update() { + Sheet s = FieldMenus2.fieldMenus.sheetForSheet(StandardFluidSheet.this); + FieldMenus2.fieldMenus.doSaveAs(s, window.getFrame()); + } + }); } static public void insertCopyPasteMenuItems(final iVisualElement rootSheetElement, MainSelectionGroup group, Map items) { @@ -1368,7 +1365,6 @@ static public void insertCopyPasteMenuItems(final iVisualElement rootSheetElemen items.put(" \u2397 Copy elements ///meta C///", new iUpdateable() { public void update() { - ;// System.out.println(" copying file reference to clipboard "); File tmp = new PackageTools().newTempFileWithSelected(rootSheetElement, "copied"); new PackageTools().copyFileReferenceToClipboard(tmp.getAbsolutePath()); OverlayAnimationManager.notifyTextOnWindow(iVisualElement.enclosingFrame.get(rootSheetElement), "Copied to clipboard", null, 1, new Vector4(1, 1, 1, 0.15f)); diff --git a/Contents/core/java/field/core/plugins/history/ElementFileSystemTreePlugin.java b/Contents/core/java/field/core/plugins/history/ElementFileSystemTreePlugin.java index 9a7b0dc..080f258 100644 --- a/Contents/core/java/field/core/plugins/history/ElementFileSystemTreePlugin.java +++ b/Contents/core/java/field/core/plugins/history/ElementFileSystemTreePlugin.java @@ -1,36 +1,40 @@ package field.core.plugins.history; +import java.util.Map; + import field.bytecode.protect.Woven; import field.bytecode.protect.annotations.NextUpdate; import field.core.dispatch.iVisualElement; import field.core.dispatch.iVisualElement.VisualElementProperty; +import field.core.dispatch.iVisualElementOverrides.DefaultOverride; import field.core.plugins.BaseSimplePlugin; import field.core.plugins.help.ContextualHelp; import field.core.plugins.help.HelpBrowser; import field.core.plugins.history.ElementFileSystemTree.SheetDropSupport; +import field.launch.iUpdateable; +import field.math.graph.GraphNodeSearching.VisitCode; @Woven -public class ElementFileSystemTreePlugin extends BaseSimplePlugin{ +public class ElementFileSystemTreePlugin extends BaseSimplePlugin { - static public final VisualElementProperty fileSystemTree= new VisualElementProperty("fileSystemTree"); + static public final VisualElementProperty fileSystemTree = new VisualElementProperty("fileSystemTree"); private ElementFileSystemTree efst; - @Override protected String getPluginNameImpl() { return "efs"; } - + @Override public void registeredWith(iVisualElement root) { super.registeredWith(root); - + efst = new ElementFileSystemTree(); new SheetDropSupport(iVisualElement.enclosingFrame.get(root).getCanvas(), root); - + fileSystemTree.set(root, root, this); - + installHelpBrowser(root); } diff --git a/Contents/core/java/field/core/ui/FieldMenus2.java b/Contents/core/java/field/core/ui/FieldMenus2.java index cef19ba..658c174 100644 --- a/Contents/core/java/field/core/ui/FieldMenus2.java +++ b/Contents/core/java/field/core/ui/FieldMenus2.java @@ -49,7 +49,7 @@ public FieldMenus2() { Logging.registerCycleUpdateable(); hiddenWindow = new Shell(Launcher.display); - if (Platform.getOS() == OS.mac && false) { + if (Platform.getOS() == OS.mac && false) { CocoaUIEnhancer enhancer = new CocoaUIEnhancer("Field"); enhancer.hookApplicationMenu(Launcher.display, new iUpdateable() { @@ -66,7 +66,7 @@ public void update() { @Override public void update() { - ;//System.out.println(" preferences "); + ;// System.out.println(" preferences "); } }); } @@ -100,12 +100,11 @@ public void handleEvent(Event arg0) { @Override public void widgetSelected(SelectionEvent arg0) { - Platform.willBe17 = !Platform.willBe17; - mi.setText("Use OpenJDK 1.7 (restart required)"); - mi.setSelection(Platform.willBe17); + Platform.willBe17 = !Platform.willBe17; + mi.setText("Use OpenJDK 1.7 (restart required)"); + mi.setSelection(Platform.willBe17); - - new ExecuteCommand(".", new String[] { "/usr/bin/defaults", "write", "com.openendedgroup.Field", "use16", Platform.willBe17 ? "NO" : "YES"}, true); + new ExecuteCommand(".", new String[] { "/usr/bin/defaults", "write", "com.openendedgroup.Field", "use16", Platform.willBe17 ? "NO" : "YES" }, true); } @@ -146,7 +145,7 @@ public void widgetDefaultSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { - ;//System.out.println(" OPEN "); + ;// System.out.println(" OPEN "); doOpenFile(hiddenWindow); } @@ -178,7 +177,6 @@ public PhantomFluidSheet open(String filename) { @Override public void widgetDisposed(DisposeEvent e) { if (!Launcher.shuttingDown) { - ;//System.out.println(" gone "); doClose(s); } } @@ -193,11 +191,9 @@ public void widgetDisposed(DisposeEvent e) { private void makeMenuForSheet(final Sheet s) { - ;//System.out.println(" setting menu bar"); + if (Platform.isLinux()) + return; - if (Platform.isLinux()) return; - - Menu bar = s.setup.getMenuBar(); if (bar == null) { bar = new Menu(s.setup, SWT.BAR); @@ -231,7 +227,7 @@ public void widgetDefaultSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { - ;//System.out.println(" OPEN "); + ;// System.out.println(" OPEN "); doOpenFile(s.setup); } @@ -338,7 +334,7 @@ public void openAnyFile(String path, Shell parent) { } - protected void doSaveAs(Sheet s, Shell setup) { + public void doSaveAs(Sheet s, Shell setup) { FileDialog d = new FileDialog(setup, SWT.SAVE | SWT.SHEET); d.setOverwrite(true); d.setFilterPath(WorkspaceDirectory.dir[0]); @@ -346,7 +342,7 @@ protected void doSaveAs(Sheet s, Shell setup) { String fn = d.open(); - ;//System.out.println(" -- fn : " + fn); + ;// System.out.println(" -- fn : " + fn); if (fn != null) { @@ -375,15 +371,17 @@ protected void doSaveAs(Sheet s, Shell setup) { } } else { - ;//System.out.println(" no mkdir "); + ;// System.out.println(" no mkdir "); } } else { - ;//System.out.println(" no prefix <" + fn + "> <" + getCanonicalVersioningDir() + ">"); + ;// System.out.println(" no prefix <" + fn + + // "> <" + getCanonicalVersioningDir() + + // ">"); } } } - protected void doNewFile() { + public void doNewFile() { FileDialog d = new FileDialog(hiddenWindow, SWT.SAVE); d.setOverwrite(false); diff --git a/Contents/core/java/field/core/ui/GraphNodeToTreeFancy.java b/Contents/core/java/field/core/ui/GraphNodeToTreeFancy.java index 1d712e2..97388d8 100644 --- a/Contents/core/java/field/core/ui/GraphNodeToTreeFancy.java +++ b/Contents/core/java/field/core/ui/GraphNodeToTreeFancy.java @@ -27,7 +27,7 @@ public class GraphNodeToTreeFancy { public static int baseFontHeight(Control install) { if (Platform.isMac()) - return install.getFont().getFontData()[0].getHeight()-1; + return install.getFont().getFontData()[0].getHeight() - 1; else return 8; } @@ -54,7 +54,7 @@ private void populate(iMutable m, Widget i) { List c = m.getChildren(); for (iMutable cc : c) { - populate(cc, item); + populate(cc, item); } } @@ -77,7 +77,7 @@ static public class Pretty { public Pretty(Tree install, final int fixedWidth) { String name = install.getFont().getFontData()[0].getName(); - name = "Gill Sans"; + name = Constants.defaultFont; smallerFont = new Font(Launcher.display, name, (int) (baseFontHeight(install) * 0.66f), SWT.NORMAL); boldFont = new Font(Launcher.display, name, baseFontHeight(install), SWT.BOLD); @@ -94,8 +94,7 @@ public void handleEvent(Event event) { Point dim = measure(textToDraw, event.gc); event.width = Math.max(fixedWidth, dim.x + indent); event.height = dim.y + vertSpace * 2; - - + } }); install.addListener(SWT.PaintItem, new Listener() { diff --git a/Contents/core/java/field/core/ui/SmallMenu.java b/Contents/core/java/field/core/ui/SmallMenu.java index 552c4fa..baed494 100755 --- a/Contents/core/java/field/core/ui/SmallMenu.java +++ b/Contents/core/java/field/core/ui/SmallMenu.java @@ -181,7 +181,8 @@ public void widgetSelected(SelectionEvent e) { menu.deselectAll(); e.doit = false; - ;//System.out.println(" SELECTION :" + e); + ;// System.out.println(" SELECTION :" + + // e); if (hu != null) { hu.update(menu.getSelectionIndex()); @@ -275,7 +276,8 @@ public void handleEvent(Event event) { TableItem m = (TableItem) (ss == null || ss.length == 0 ? null : ss[0]); shell.setVisible(false); Object d = m == null ? null : m.getData(); - // ;//System.out.println(" d = <" + + // ;//System.out.println(" d = <" + // + // d + ">"); done(); if (d instanceof iUpdateable) { @@ -396,7 +398,6 @@ public void handleEvent(Event event) { } }); - // Listener focusOutListener = new Listener() { // public void handleEvent(Event event) { // /* @@ -427,8 +428,7 @@ public void handleEvent(Event event) { } openNext(s); - - + System.out.println(" ---------- OPEN ----------"); new Exception().printStackTrace(); @@ -462,7 +462,7 @@ protected void openNext(Point s) { // ;//System.out.println(" forced ? <" + forced + ">"); down = System.currentTimeMillis(); - + Listener f = new Listener() { @Override @@ -480,12 +480,16 @@ public void handleEvent(Event event) { Launcher.display.removeFilter(SWT.MouseMove, this); Launcher.display.removeFilter(SWT.MouseUp, this); - ;//System.out.println(" menu is at <" + (System.currentTimeMillis() - down) + "> ms <"+menu.getSelectionCount()+">"); + ;// System.out.println(" menu is at <" + // + + // (System.currentTimeMillis() + // - down) + + // "> ms <"+menu.getSelectionCount()+">"); + + if ((down > 0 && System.currentTimeMillis() - down > 1000) || menu.getSelectionCount() > 0) { - if ((down >0 && System.currentTimeMillis() - down > 1000) || menu.getSelectionCount() > 0) { + ;// System.out.println(" selection is :"+Arrays.asList(menu.getSelection())); - ;//System.out.println(" selection is :"+Arrays.asList(menu.getSelection())); - if (event.widget != menu) { // ;//System.out.println(" event not going to widget, would redispatch the up event"); @@ -509,7 +513,9 @@ public void handleEvent(Event event) { // ;//System.out.println(" event not going to widget, would redispatch"); Listener[] movers = menu.getListeners(SWT.MouseMove); - ;//System.out.println(" movers :" + Arrays.asList(movers)); + ;// System.out.println(" movers :" + // + + // Arrays.asList(movers)); Point c = Launcher.display.map((Control) event.widget, menu, new Point(event.x, event.y)); int ox = event.x; @@ -563,374 +569,6 @@ public BetterPopup setHoverUpdate(iHoverUpdate hoverUpdate) { } } - // public final class BetterPopup extends JPopupMenu { - // private final iKeystrokeUpdate update; - // - // private final BetterPopup parent; - // - // private final KeyboardNavigationOfMenu key; - // - // protected boolean hasInteracted; - // - // JPopupMenu ongoingSubmenu = null; - // - // boolean ignoreSetVisible = false; - // - // private JButton actions; - // - // private Window previousWindow; - // - // private Component previousOwner; - // - // public BetterPopup(iKeystrokeUpdate update, BetterPopup parent) { - // setLightWeightPopupEnabled(false); - // this.update = update; - // this.parent = parent; - // - // this.setFocusable(true); - // setFocusTraversalKeysEnabled(true); - // - // key = new KeyboardNavigationOfMenu(this); - // enableEvents(AWTEvent.KEY_EVENT_MASK | - // AWTEvent.MOUSE_MOTION_EVENT_MASK | - // AWTEvent.MOUSE_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK); - // - // getInputMap().clear(); - // - // } - // - // public void addActions() { - // // this.add(getActions()); - // } - // - // public KeyboardNavigationOfMenu getKey() { - // return key; - // } - // - // boolean firstPaint = true; - // - // @Override - // public void paint(Graphics g) { - // - // super.paint(g); - // - // // paintComponents(g); - // - // new MiscNative().enableScreenUpdates(); - // if (firstPaint) { - // attachKeyboard(); - // firstPaint = false; - // } - // } - // - // private void attachKeyboard() { - // getPopupWindow().addKeyListener(new KeyListener() { - // - // public void keyTyped(KeyEvent e) { - // processKeyEvent(e, null, null); - // } - // - // public void keyReleased(KeyEvent e) { - // } - // - // public void keyPressed(KeyEvent e) { - // processKeyEvent(e, null, null); - // } - // }); - // } - // - // boolean isKeyboardShy = false; - // - // public void setKeyboardShy(boolean isKeyboardShy) { - // if (isKeyboardShy) { - // this.setFocusable(false); - // setFocusTraversalKeysEnabled(false); - // } - // } - // - // @Override - // public void processMouseEvent(MouseEvent event, MenuElement[] path, - // MenuSelectionManager manager) { - // super.processMouseEvent(event, path, manager); - // ;//System.out.println(" special mouse event process <" + event + ">"); - // } - // - // @Override - // public void processKeyEvent(KeyEvent arg0, MenuElement[] arg1, - // MenuSelectionManager arg2) { - // - // ;//System.out.println(" process key event <" + arg0 + "> (handled)"); - // - // if (arg0.getKeyCode() == KeyEvent.VK_DOWN && arg0.getID() == - // KeyEvent.KEY_PRESSED) { - // key.down(); - // } else if (arg0.getKeyCode() == KeyEvent.VK_UP && arg0.getID() == - // KeyEvent.KEY_PRESSED) { - // key.up(); - // } else if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE && arg0.getID() == - // KeyEvent.KEY_PRESSED) { - // key.escape(); - // forceFocus(); - // } else if (arg0.isActionKey()) {// super.processKeyEvent(arg0, - // // arg1, arg2); - // } else { - // if (arg0.getID() == KeyEvent.KEY_TYPED) { - // if (arg0.getKeyChar() == '\n') { - // key.enter(); - // - // ;//System.out.println(" attempting to force focus <" + previousWindow + - // " / " + previousOwner + ">"); - // // previousWindow.requestFocus(); - // forceFocus(); - // - // } else if (update != null) - // update.update(arg0); - // } else if (arg0.getKeyChar() == '\b' && update != null) - // update.update(arg0); - // else if (arg0.getID() == KeyEvent.KEY_PRESSED && update != null && - // arg0.getKeyChar() != '\n' && arg0.getKeyChar() != '\b') { - // update.update(arg0); - // } else if (isKeyboardShy && arg0.getID() == KeyEvent.KEY_RELEASED) { - // // key.enter(); - // // setVisible(false); - // // return; - // } - // // super.processKeyEvent(arg0, arg1, arg2); - // } - // } - // - // private void forceFocus() { - // ;//System.out.println(" forcing focus to <" + previousOwner + ">"); - // - // if (!previousWindow.isVisible()) { - // ;//System.out.println(" window is not valid "); - // return; - // } - // if (!previousOwner.isValid()) { - // ;//System.out.println(" owner is not valid "); - // return; - // } - // previousWindow.requestFocus(); - // previousOwner.requestFocus(); - // Launcher.getLauncher().registerUpdateable(new iUpdateable() { - // int n = 0; - // - // @Override - // public void update() { - // previousWindow.requestFocus(); - // previousOwner.requestFocus(); - // if (n++ > 3) - // Launcher.getLauncher().deregisterUpdateable(this); - // } - // }); - // } - // - // @Override - // public void setVisible(boolean b) { - // if (b && !isVisible()) { - // previousWindow = - // FocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); - // previousOwner = - // FocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); - // } - // // ;//System.out.println(" set - // // visible on popup <" + b + - // // ">"); - // // new - // // Exception().printStackTrace(); - // - // // if (!b) { - // // if (parent != null) { - // // parent.ignoreSetVisible = - // // false; - // // getPopupWindow().setAlwaysOnTop(false); - // // } - // // } - // // if (ignoreSetVisible && !b) { - // // getPopupWindow().setAlwaysOnTop(false); - // // - // // ignoreSetVisible = false; - // // } else { - // - // super.setVisible(b); - // - // if (b && Platform.getOS() == Platform.OS.mac) { - // - // getPopupWindow().setAlwaysOnTop(true); - // - // ;//System.out.println(" attaching event handlers to small menu"); - // - // JWindow window = getPopupWindow(); - // if (window != null) { - // window.addWindowFocusListener(new WindowFocusListener() { - // - // public void windowGainedFocus(WindowEvent e) { - // ;//System.out.println(" gained focus"); - // } - // - // public void windowLostFocus(WindowEvent e) { - // ;//System.out.println(" lost focus, faking escape"); - // key.escape(); - // } - // }); - // - // window.addWindowStateListener(new WindowStateListener() { - // - // public void windowStateChanged(WindowEvent e) { - // ;//System.out.println(" state changed <" + e + ">"); - // } - // }); - // - // window.addWindowListener(new WindowAdapter() { - // - // @Override - // public void windowActivated(WindowEvent e) { - // ;//System.out.println(" window activated"); - // } - // - // @Override - // public void windowDeactivated(WindowEvent e) { - // ;//System.out.println(" window deactivated"); - // } - // }); - // - // window.addMouseListener(new MouseListener() { - // - // public void mouseReleased(MouseEvent e) { - // ;//System.out.println(" window event for parent of popup <" + e + ">"); - // } - // - // public void mousePressed(MouseEvent e) { - // ;//System.out.println(" window event for parent of popup <" + e + ">"); - // } - // - // public void mouseExited(MouseEvent e) { - // ;//System.out.println(" window event for parent of popup <" + e + ">"); - // } - // - // public void mouseEntered(MouseEvent e) { - // ;//System.out.println(" window event for parent of popup <" + e + ">"); - // } - // - // public void mouseClicked(MouseEvent e) { - // ;//System.out.println(" window event for parent of popup <" + e + ">"); - // } - // }); - // - // // window.requestFocus(); - // } - // } - // - // // actions menu not working for - // // now - // - // // if (b) - // // { - // // getPopupWindow().getLayeredPane().setLayer(getActionMenu(), - // // 1000); - // // getPopupWindow().getLayeredPane().add(getActions()); - // // getActions().setBounds(this.getWidth() - // // - 30, 5, 30, 30); - // // } - // // } - // - // } - // - // @Override - // protected void processFocusEvent(FocusEvent evt) { - // super.processFocusEvent(evt); - // - // ;//System.out.println(" focus event on popup <" + evt + ">"); - // - // if (evt.getID() == FocusEvent.FOCUS_LOST) { - // setVisible(false); - // // requestFocus(); - // } - // - // } - // - // @Override - // protected void processKeyEvent(KeyEvent arg0) { - // ;//System.out.println(" process key event on small menu (unhandled) "); - // super.processKeyEvent(arg0); - // } - // - // public JWindow getPopupWindow() { - // try { - // Popup p = (Popup) - // ReflectionTools.getFirstFIeldCalled(JPopupMenu.class, - // "popup").get(this); - // ;//System.out.println(" popup window is <" + p + ">"); - // JWindow window = (JWindow) - // ReflectionTools.getFirstFIeldCalled(p.getClass(), - // "component").get(p); - // - // ;//System.out.println(" popup window is <" + p + "> / <" + window + - // ">"); - // - // return window; - // } catch (IllegalArgumentException e) { - // e.printStackTrace(); - // } catch (IllegalAccessException e) { - // e.printStackTrace(); - // } - // return null; - // } - // - // private JButton getActions() { - // if (actions == null) { - // actions = new JButton(); - // actions.setPreferredSize(new Dimension(24, 24)); - // actions.setMaximumSize(new Dimension(24, 24)); - // actions.setMinimumSize(new Dimension(24, 24)); - // // actions.setPressedIcon(new - // // - // ImageIcon(getClass().getResource("/content/icons/Action_Pressed.jpg"))); - // // actions.setIcon(new - // // ImageIcon(getClass().getResource("/content/icons/action.tiff"))); - // // actions.setIcon(BetterComboBox.getDiscloseIcon()); - // actions.setIcon(new ImageIcon("content/icons/Gear.png")); - // actions.setIconTextGap(0); - // actions.putClientProperty("Quaqua.Button.style", "square"); - // actions.addActionListener(new ActionListener() { - // public void actionPerformed(ActionEvent e) { - // JPopupMenu menu = getActionMenu(); - // ;//System.out.println(" opening action menu"); - // menu.show(actions, 20, 10); - // } - // - // }); - // - // actions.setOpaque(false); - // - // } - // return actions; - // } - // - // private JPopupMenu getActionMenu() { - // LinkedHashMap someItems = new - // LinkedHashMap(); - // someItems.put("here", new iUpdateable() { - // - // public void update() { - // } - // }); - // someItems.put("there", new iUpdateable() { - // - // public void update() { - // } - // }); - // someItems.put("everywhere", new iUpdateable() { - // - // public void update() { - // } - // }); - // JPopupMenu p = new SmallMenu().createMenu(someItems); - // return p; - // } - // } - public interface iKeystrokeUpdate { // returns should close public boolean update(Event ke); @@ -1020,7 +658,7 @@ public BetterPopup createMenu(LinkedHashMap items, Decorati name = " " + lead + "\t" + name.substring(in).trim(); break; } else if (!Character.isWhitespace(name.charAt(in)) && lead != 0) { - name = " " + name.trim(); + name = "\t" + name.trim(); break; } } @@ -1071,36 +709,6 @@ public void handleEvent(Event event) { return menu; } - // public boolean runKeyboardShortcut(LinkedHashMap - // into, - // KeyEvent event) { - // - // Set> es = into.entrySet(); - // for (Entry e : es) { - // String name = e.getKey(); - // - // String accelerator = null; - // Pattern accPattern = Pattern.compile("///(.*)///"); - // Matcher m = accPattern.matcher(name); - // if (m.find()) { - // accelerator = m.group(1); - // name = m.replaceAll(""); - // } - // if (accelerator != null) { - // KeyStroke stroke = KeyStroke.getKeyStroke(accelerator); - // int code = stroke.getKeyCode(); - // int mod = stroke.getModifiers(); - // - // if (event.getKeyCode() == code - // && (event.getModifiers() & 255) == (mod & 255)) { - // e.getValue().update(); - // return true; - // } - // } - // } - // - // return false; - static public class Pretty { Pattern SMALLER_PATTERN = Pattern.compile("()(.*?)()"); @@ -1181,7 +789,7 @@ public void handleEvent(Event event) { event.gc.setForeground(Launcher.display.getSystemColor(SWT.COLOR_BLACK)); - draw(textToDraw, event.gc, event.x + indent, event.y + 2 + vertSpace, null); + draw(""+textToDraw+"", event.gc, event.x + indent, event.y + 2 + vertSpace, null); } } else { draw(textToDraw, event.gc, event.x + indent, event.y + 2 + vertSpace); @@ -1426,9 +1034,6 @@ public int compare(Area o1, Area o2) { gc.drawText(a.text, cx + x, y + dasc - asc, true); - // ;//System.out.println(" text <" + a.text - // + ">"); - cx += gc.textExtent(a.text).x; areaIndex++; @@ -1444,10 +1049,6 @@ public int compare(Area o1, Area o2) { gc.drawText(ttd, cx + x, y, true); } - // ;//System.out.println(" normal text <" + - // textToDraw.substring(start, end) + - // ">"); - cx += gc.textExtent(ttd).x; index = end; @@ -1457,6 +1058,4 @@ public int compare(Area o1, Area o2) { } } - // } - } diff --git a/Contents/extras/processing/src/field/extras/plugins/processing/ProcessingLoader.java b/Contents/extras/processing/src/field/extras/plugins/processing/ProcessingLoader.java index 475caa9..8eb50f6 100755 --- a/Contents/extras/processing/src/field/extras/plugins/processing/ProcessingLoader.java +++ b/Contents/extras/processing/src/field/extras/plugins/processing/ProcessingLoader.java @@ -231,7 +231,7 @@ protected void run() { @Override public void draw() { - System.out.println(" draw_impl for <"+System.identityHashCode(this)+"> <"+drawQueue.getNumTasks()+">"); + System.out.println(" draw_impl for <" + System.identityHashCode(this) + "> <" + drawQueue.getNumTasks() + ">"); theApplet = this; if (Platform.isMac()) @@ -244,7 +244,6 @@ public void draw() { private void draw_impl() { - frameNumber++; if (g != null && g.getClass().getName().toLowerCase().contains("opengl") && ProcessingLoader.this.frame != null && frameNumber == 4) { if (ProcessingLoader.this.frame.isResizable()) @@ -254,33 +253,28 @@ private void draw_impl() { int d1 = 0; try { - // if (g instanceof PGraphics) - // d1 = (Integer) - // ReflectionTools.illegalGetObject( - // ((PGraphics) g), "matrixStackDepth"); - } catch (Throwable t) { } try { PythonInterface.getPythonInterface().setVariable("p", applet); try { - if (drawQueue.getNumTasks() > 0) + System.out.println(" num tasks <" + drawQueue.getNumTasks() + "> in <" + System.identityHashCode(drawQueue) + ">"); - try { - inside = true; + try { + inside = true; - pmouseX = dmouseX; - pmouseY = dmouseY; - drawQueue.update(); - dmouseX = mouseX; - dmouseY = mouseY; + pmouseX = dmouseX; + pmouseY = dmouseY; + drawQueue.update(); + dmouseX = mouseX; + dmouseY = mouseY; - } catch (Exception e) { - e.printStackTrace(); - } finally { - inside = false; - } + } catch (Exception e) { + e.printStackTrace(); + } finally { + inside = false; + } if (t == null) t = TemporalSliderOverrides.currentTimeSystem.get(ProcessingLoader.this.root); runner.update(t == null ? 0 : (float) t.evaluate()); @@ -289,7 +283,6 @@ private void draw_impl() { } } finally { - } } @@ -577,7 +570,7 @@ public void deferSetVisible(boolean b) { @Override public void run() { frame.setVisible(true); -// frame.pack(); + // frame.pack(); applet.setLocation(0, 22); } }); @@ -694,7 +687,7 @@ public Object executeReturningValue(final String string) { return lf; } - + @Override public boolean globalCompletionHook(String leftText, boolean publicOnly, ArrayList comp) { return false; @@ -707,6 +700,7 @@ public iExecutesPromise getExecutesPromise(final iExecutesPromise delegateTo) { } public iRegistersUpdateable getQueueFor(Method m) { + return drawQueue; } @@ -808,6 +802,9 @@ protected void addActive(iFloatProvider timeProvider, final Promise p, iExecutes @InQueue protected void executeFragment(String fragment, EditorExecutionInterface delegateTo) { + + System.out.println(" -- exec fragment in queue :" + this.getQueueFor(null) + " " + System.identityHashCode(this.getQueueFor(null))); + PythonInterface.getPythonInterface().setVariable("p", applet); if (delegateTo == null) { PythonInterface.getPythonInterface().execString(fragment); diff --git a/Contents/extras/processing/src/field/extras/plugins/processing/ProcessingPlugin.java b/Contents/extras/processing/src/field/extras/plugins/processing/ProcessingPlugin.java index d4ecaff..be32b01 100755 --- a/Contents/extras/processing/src/field/extras/plugins/processing/ProcessingPlugin.java +++ b/Contents/extras/processing/src/field/extras/plugins/processing/ProcessingPlugin.java @@ -125,7 +125,7 @@ public void close() { // VM crash if this is uncommented in. // alreadyLoaded = false; - ;//;//System.out.println(" ----------- processing is closing ---------"); + ;// ;//System.out.println(" ----------- processing is closing ---------"); } @@ -157,19 +157,10 @@ public boolean needsProcessing(iVisualElement source) { static boolean warnOnce = true; public boolean ontop = false; - + @Override public void registeredWith(final iVisualElement root) { if (alreadyLoaded) { - // stillborn = true; - // - // if (warnOnce) - // JOptionPane.showMessageDialog(null, - // "Currently the Processing Plugin only works with one sheet at a time \u2014 this second sheet will not be able to access your applet (although it can do everything else).\nTo start up with the sheet that you are opening, close all other sheets and select 'Automatically open at launch' from the file menu or set a file from the command line explicitly."); - // - // warnOnce = false; - // - // return; } else { } @@ -189,30 +180,27 @@ public void registeredWith(final iVisualElement root) { System.err.println("warning: cannot find processing application at <" + rootProcessingPath + ">"); error = true; } else { - if (Platform.isMac()) - { - try { - Trampoline2.trampoline.addJar(new File(rootProcessingPath+"/Contents/Resources/Java/core.jar").getAbsolutePath()); - Trampoline2.trampoline.addJar(new File(rootProcessingPath+"/Contents/Resources/Java/core/library/core.jar").getAbsolutePath()); - Trampoline2.trampoline.addWildcardPath(new File(rootProcessingPath+"/Contents/Resources/Java/modes/java/libraries/opengl/library/").getAbsolutePath()); - Trampoline2.trampoline.addWildcardPath(new File(rootProcessingPath+"/Contents/Resources/Java/core/library/").getAbsolutePath()); - Trampoline2.trampoline.addWildcardPath(new File(rootProcessingPath+"/Contents/Resources/Java/modes/java/libraries/").getAbsolutePath()); - } catch (MalformedURLException e1) { - e1.printStackTrace(); - } + if (Platform.isMac()) { + try { + Trampoline2.trampoline.addJar(new File(rootProcessingPath + "/Contents/Resources/Java/core.jar").getAbsolutePath()); + Trampoline2.trampoline.addJar(new File(rootProcessingPath + "/Contents/Resources/Java/core/library/core.jar").getAbsolutePath()); + Trampoline2.trampoline.addWildcardPath(new File(rootProcessingPath + "/Contents/Resources/Java/modes/java/libraries/opengl/library/").getAbsolutePath()); + Trampoline2.trampoline.addWildcardPath(new File(rootProcessingPath + "/Contents/Resources/Java/core/library/").getAbsolutePath()); + Trampoline2.trampoline.addWildcardPath(new File(rootProcessingPath + "/Contents/Resources/Java/modes/java/libraries/").getAbsolutePath()); + } catch (MalformedURLException e1) { + e1.printStackTrace(); } - else - { - Trampoline2.trampoline.addJar(new File(rootProcessingPath+"/core/library/core.jar").getAbsolutePath()); - try { -// Trampoline2.trampoline.addWildcardPath(new File(rootProcessingPath+"/modes/java/libraries/opengl/library/").getAbsolutePath()); - Trampoline2.trampoline.addWildcardPath(new File(rootProcessingPath+"/modes/java/libraries/").getAbsolutePath()); - } catch (MalformedURLException e1) { - e1.printStackTrace(); - } - + } else { + Trampoline2.trampoline.addJar(new File(rootProcessingPath + "/core/library/core.jar").getAbsolutePath()); + try { + // Trampoline2.trampoline.addWildcardPath(new + // File(rootProcessingPath+"/modes/java/libraries/opengl/library/").getAbsolutePath()); + Trampoline2.trampoline.addWildcardPath(new File(rootProcessingPath + "/modes/java/libraries/").getAbsolutePath()); + } catch (MalformedURLException e1) { + e1.printStackTrace(); } + } error = true; @@ -245,13 +233,13 @@ public void registeredWith(final iVisualElement root) { if (!error) { - ;//;//System.out.println(" -- about to throw an exception -- "); + ;// ;//System.out.println(" -- about to throw an exception -- "); try { shim.init(); } catch (RuntimeException e) { } shim.update(); - ;//;//System.out.println(" -- finished --"); + ;// ;//System.out.println(" -- finished --"); } @@ -275,7 +263,8 @@ public void registeredWith(final iVisualElement root) { folder.add("icons/p_16x16.png", status); - ;//;//System.out.println(" status is :" + nothing + " " + error); + ;// ;//System.out.println(" status is :" + nothing + " " + // + error); status.setBackground(ToolBarFolder.firstLineBackground); GridLayout gl = new GridLayout(1, true); @@ -297,7 +286,8 @@ public void registeredWith(final iVisualElement root) { folder.add("icons/p_16x16.png", status); - ;//;//System.out.println(" status is :" + nothing + " " + error); + ;// ;//System.out.println(" status is :" + nothing + " " + // + error); status.setBackground(ToolBarFolder.firstLineBackground); GridLayout gl = new GridLayout(1, true); @@ -413,21 +403,20 @@ public void setValue(Boolean s) { } }); - c.setUnits("(restart required)"); BooleanControl o = inspect.new BooleanControl(new iIO("On top ?") { - + @Override public Boolean getValue() { return ontop; } - + @Override public Status getStatus() { return Status.valid; } - + @Override public void setValue(Boolean s) { ontop = s; @@ -474,7 +463,8 @@ public void update() { private void addLibraryPathRecursively(File file) { - ;//;//System.out.println(" adding extensions directory <" + file + ">"); + ;// ;//System.out.println(" adding extensions directory <" + + // file + ">"); // Trampoline2.trampoline.addExtensionsDirectory(file); @@ -497,13 +487,15 @@ private void addLibraryPathRecursively(File file) { // else if // (f.getCanonicalPath().endsWith(".jar")) // { - // ;//;//System.out.println(" adding package + // ;//;//System.out.println(" adding + // package // <" + f + // ">"); // PyJavaPackage p = // PySystemState.add_package(f.getCanonicalPath()); // p.fillDir(); - // ;//;//System.out.println(" filled <" + + // ;//;//System.out.println(" filled <" + // + // p.__dir__() // + ">"); // } @@ -532,7 +524,8 @@ public boolean accept(File arg0) { if (d != null && d.length > 0) { for (File f : d) { - ;//;//System.out.println(" looking at <" + f + ">"); + ;// ;//System.out.println(" looking at <" + // + f + ">"); if (f.isDirectory() && field.core.Platform.isMac()) { if (f.getName().toLowerCase().startsWith("processing") && f.getName().toLowerCase().endsWith(".app")) diff --git a/Contents/extras/wrap/src/field/extras/wrapintransform/WrapInTransformPlugin.java b/Contents/extras/wrap/src/field/extras/wrapintransform/WrapInTransformPlugin.java index 93fbde0..ff06dd7 100644 --- a/Contents/extras/wrap/src/field/extras/wrapintransform/WrapInTransformPlugin.java +++ b/Contents/extras/wrap/src/field/extras/wrapintransform/WrapInTransformPlugin.java @@ -190,6 +190,9 @@ public Object executeReturningValue(String fragment) { @Override public boolean globalCompletionHook(String leftText, boolean publicOnly, ArrayList comp) { + + + return false; }