X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2FIbex.java;h=d97a9d5180ebffd86867f90e8e554d4cc7ba620b;hb=707b1064f56e88db0cf555a99cb4aa224484f51a;hp=0aea062bec30a8556a4d60210d4b98baa6bc1b7d;hpb=c28ed126fbc51fb5794bb367f51a8755dc20140e;p=org.ibex.core.git diff --git a/src/org/ibex/Ibex.java b/src/org/ibex/Ibex.java index 0aea062..d97a9d5 100644 --- a/src/org/ibex/Ibex.java +++ b/src/org/ibex/Ibex.java @@ -201,15 +201,7 @@ public final class Ibex extends JS.Cloneable { case 3: //#switch(name) case "ui.font.height": return N(Font.getFont((Stream)a, JS.toInt(b)).textheight((String)c)); - case "ui.font.wait": - try { - JS.UnpauseCallback callback = JS.pause(); - Font font = Font.getFont((Stream)a, JS.toInt(b)); - if (font.rasterizeGlyphs((String)c, null, 0,0,0,0,0,0,0, callback) != -1) Scheduler.add(callback); - } catch (JS.NotPauseableException npe) { - JS.error("can't wait for a font in a foreground thread"); - } - return null; + case "ui.font.wait": throw new Error("FIXME: ibex.ui.font.wait not implemented"); case "ui.font.width": return N(Font.getFont((Stream)a, JS.toInt(b)).textwidth((String)c)); //#end break; @@ -329,10 +321,15 @@ public final class Ibex extends JS.Cloneable { private Template t = null; public Object parentkey = null; public Blessing parent = null; + private Hash cache = new Hash(); public Blessing(JS.Cloneable clonee, Ibex ibex, Blessing parent, Object parentkey) { super(clonee); this.ibex = ibex; this.parentkey = parentkey; this.parent = parent; } public Object get(Object key) throws JSExn { - return key.equals("") ? ((Object)getStatic()) : (new Blessing((JS.Cloneable)clonee.get(key), ibex, this, key)); + if (key.equals("")) return ((Object)getStatic()); + if (cache.get(key) != null) return cache.get(key); + Object ret = new Blessing((JS.Cloneable)clonee.get(key), ibex, this, key); + cache.put(key, ret); + return ret; } public static Blessing getBlessing(Object o) { if (!(o instanceof JS)) return null; @@ -356,10 +353,7 @@ public final class Ibex extends JS.Cloneable { } public JSScope getStatic() { try { - // FIXME background? - System.out.println("parentkey.t == " + parentkey + ".t"); - if (t == null) - t = Template.buildTemplate(parentkey + ".t", parent.get(parentkey + ".t"), ibex); + if (t == null) t = Template.buildTemplate(parentkey + ".t", parent.get(parentkey + ".t"), ibex); return t.staticScope; } catch (Exception e) { Log.error(this, e);