colWidth[child.col] = max(colWidth[child.col], child.contentwidth / child.colspan);
for(int i=0; i<cols; i++) { contentwidth += colWidth[i]; colWidth[i] = 0; }
- contentwidth = bound(minwidth, max(font.textwidth(text), contentwidth), maxwidth);
+ contentwidth = bound(minwidth, max(font == null ? 0 : font.textwidth(text), contentwidth), maxwidth);
//#end
}
boolean poschange = (this.x != x || this.y != y) && getTrap("PosChange") != null;
this.width = width; this.height = height; this.x = x; this.y = y;
dirty();
+ /*
try { if (sizechange) putAndTriggerJSTraps("SizeChange", T); Surface.abort = true; }
catch (Exception e) { Log.log(this, e); }
try { if (poschange) putAndTriggerJSTraps("PosChange", T); Surface.abort = true; }
catch (Exception e) { Log.log(this, e); }
- /*
}
*/
if (numchildren > 0) resize_children();
public static class Ref extends Res {
Res parent;
Object key;
+ public String toString() { return parent.toString() + "/" + key; }
Ref(Res parent, Object key) { this.parent = parent; this.key = key; }
public String getCacheKey() throws NotCacheableException { return parent.getCacheKey() + "/" + key; }
public Res addExtension(String extension) {
}
public Surface(Box root) {
-
this.root = root;
Surface old = fromBox(root);
if (old != null) old.dispose(false);
private JSFunction parseScript(boolean isstatic) {
JSFunction thisscript = null;
try {
- thisscript = JS.parse(t.fileName + (isstatic ? "._" : ""), t.content_start, new StringReader(t.content.toString()));
+ String contentString = t.content.toString();
+ if (contentString.trim().length() > 0)
+ thisscript = JS.parse(t.fileName + (isstatic ? "._" : ""), t.content_start, new StringReader(contentString));
} catch (IOException ioe) {
if (Log.on) Log.log(this, " ERROR: " + ioe.getMessage());
thisscript = null;
case "date": return new JSDate();
case "origin": return Main.origin;
case "box": return new BoxTree();
+ case "log": return new Sub("log");
case "ui": return new Sub("ui");
case "ui.key": return new Sub("ui.key");
case "ui.key.alt": return Surface.alt ? Boolean.TRUE : Boolean.FALSE;
case "fs.home": return System.getProperty("user.home");
case "fs.temp": return System.getProperty("java.io.tempdir");
case "ui.mouse": return new Sub("ui.mouse");
+ case "res": return new Sub("res");
case "ui.mouse.button":
if (Surface.button1 && !Surface.button2 && !Surface.button3) return new Integer(1);
else if (!Surface.button1 && Surface.button2 && !Surface.button3) return new Integer(2);
case "res.uncab": return new Res.Cab((Res)a);
case "res.cache": try { return new Res.CachedRes((Res)a, "resources", true); }
catch (Res.NotCacheableException e) { throw new JS.Exn("this resource cannot be cached"); }
- case "res.fromURL": return Res.fromString((String)a);
+ case "res.url": return Res.fromString((String)a);
case "thread.sleep": sleep(JS.toInt(a)); return null;
case "log.println": Log.logJS(this, a== null ? "**null**" : a.toString()); return null;
case "log.dump": Log.recursiveLog("","",a); return null;
}
xwt.thread = function() {
+xwt.log.println("1");
// $text.font = xwt.fonts.vera["Vera.ttf"];
- $text.font = xwt.cache(xwt.uncab(xwt.load("http://master.dist.xwt.org/msfonts/arial32.exe"))["Arial.TTF"]);
+ var cab = xwt.res.uncab(xwt.res.url("http://master.dist.xwt.org/msfonts/arial32.exe"));
+// $text.font = xwt.res.cache(cab["Arial.TTF"]);
+xwt.log.println("2");
+ $text.font = cab["Arial.TTF"];
+xwt.log.println("3");
$text.fontsize = 18;
+xwt.log.println("4");
$text.text = "downloading...";
+xwt.log.println("5");
fill = xwt.org.xwt.builtin["splash.png"];
- xwt.window = thisbox;
- x = (xwt.screenWidth - width) / 2;
- y = (xwt.screenHeight - height) / 2;
+xwt.log.println("6");
+ xwt.ui.window = thisbox;
+xwt.log.println("7");
+ thisbox.width = 100;
+ thisbox.height = 100;
+xwt.log.println("8");
+ x = (xwt.screen.width - width) / 2;
+ y = (xwt.screen.height - height) / 2;
var origin = xwt.origin;
if (origin.substring(0, 21) == "http://launch.xwt.org") {
origin = origin.substring(22);
origin = "http://" + origin.substring(origin.indexOf('/') + 1);
}
- xwt.println("origin is " + origin);
- var new_rr = xwt.unzip(xwt.watchProgress(xwt.load(origin), progress));
+ xwt.log.println("origin is " + origin);
+ var new_rr = xwt.res.unzip(xwt.watchProgress(xwt.load(origin), progress));
var new_xwt = xwt.clone(new_rr);
xwt.thread = function() {
-xwt.sleep(1000); // let the fonts get pulled in
+xwt.thread.sleep(1000); // let the fonts get pulled in
for(var i=0; 100>i; i++) {
progress(i, 100);
-xwt.yield();
+xwt.thread.yield();
}
new_xwt.apply(xwt.box, new_xwt["main.xwt"]);
thisbox = null;