Skip to content

Commit

Permalink
Processing fixeds, potentially adressing #8 ?
Browse files Browse the repository at this point in the history
  • Loading branch information
marc committed Sep 24, 2012
1 parent ebf0c83 commit c80e0b1
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 563 deletions.
1 change: 0 additions & 1 deletion Contents/core/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="swt-grouplayout.jar" sourcepath="swt-grouplayout.zip"/>
<classpathentry kind="lib" path="swt.jar" sourcepath="/Users/marc/Downloads/swt-3.8M5-cocoa-macosx-x86_64/src.zip"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
76 changes: 36 additions & 40 deletions Contents/core/java/field/core/StandardFluidSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -1262,7 +1265,10 @@ static public boolean canPaste() {
}

public VisitCode menuItemsFor(iVisualElement source, Map<String, iUpdateable> items) {


if (Platform.isLinux())
insertFileMenuItems(rootSheetElement, group, items);

insertCopyPasteMenuItems(rootSheetElement, group, items);

final HashSet<iVisualElement> o = selectionOrOver();
Expand Down Expand Up @@ -1319,43 +1325,34 @@ public iAcceptor<String> set(String to2) {
});
}

// items.put(" \u1d40 Create from <b>template</b> ///T///",
// new iUpdateable() {
// public void update() {
// createFromTemplate();
// }
// });
return VisitCode.cont;
}

// // TODO swt - temp menu code here to create something
// items.put(" \u21e3 create <b>new</b> 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<VisualElement, DraggableComponent, DefaultOverride>
// created =
// VisualElement
// .createWithName(bounds, ee,
// VisualElement.class,
// DraggableComponent.class,
// DefaultOverride.class,"untitled");
//
// }
//
// });
public void insertFileMenuItems(final iVisualElement rootSheetElement, MainSelectionGroup group, Map<String, iUpdateable> items) {
items.put("File", null);
items.put("\t<b>New File...</b>", new iUpdateable() {

return VisitCode.cont;
@Override
public void update() {
Sheet s = FieldMenus2.fieldMenus.sheetForSheet(StandardFluidSheet.this);
FieldMenus2.fieldMenus.doNewFile();
}
});
items.put("\t<b>Save</b>", new iUpdateable() {

@Override
public void update() {
saveNow();
}
});
items.put("\t<b>Save As...</b>", 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<String, iUpdateable> items) {
Expand All @@ -1368,7 +1365,6 @@ static public void insertCopyPasteMenuItems(final iVisualElement rootSheetElemen
items.put(" \u2397 <b>Copy</b> 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));
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ElementFileSystemTreePlugin> fileSystemTree= new VisualElementProperty<ElementFileSystemTreePlugin>("fileSystemTree");
static public final VisualElementProperty<ElementFileSystemTreePlugin> fileSystemTree = new VisualElementProperty<ElementFileSystemTreePlugin>("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);
}

Expand Down
36 changes: 17 additions & 19 deletions Contents/core/java/field/core/ui/FieldMenus2.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand All @@ -66,7 +66,7 @@ public void update() {

@Override
public void update() {
;//System.out.println(" preferences ");
;// System.out.println(" preferences ");
}
});
}
Expand Down Expand Up @@ -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);

}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -178,7 +177,6 @@ public PhantomFluidSheet open(String filename) {
@Override
public void widgetDisposed(DisposeEvent e) {
if (!Launcher.shuttingDown) {
;//System.out.println(" gone ");
doClose(s);
}
}
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -338,15 +334,15 @@ 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]);
d.setFilterExtensions(new String[] { ".field" });

String fn = d.open();

;//System.out.println(" -- fn : " + fn);
;// System.out.println(" -- fn : " + fn);

if (fn != null) {

Expand Down Expand Up @@ -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);
Expand Down
9 changes: 4 additions & 5 deletions Contents/core/java/field/core/ui/GraphNodeToTreeFancy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -54,7 +54,7 @@ private void populate(iMutable m, Widget i) {

List<iMutable> c = m.getChildren();
for (iMutable cc : c) {
populate(cc, item);
populate(cc, item);
}

}
Expand All @@ -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);
Expand All @@ -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() {
Expand Down
Loading

0 comments on commit c80e0b1

Please sign in to comment.