static {
specialBoxProperties.put("fill", new ColorBoxProperty() {
+ public void put(Box b, Object value) {
+ if (value != null && value instanceof Res) {
+ b.image = Picture.fromRes((Res)value);
+ b.minwidth = b.image.getWidth();
+ b.minheight = b.image.getHeight();
+ b.dirty();
+ } else {
+ super.put(b, value);
+ }
+ }
public int getColor(Box b) { return b.fillcolor; }
public void putColor(Box b, int argb) { b.fillcolor = argb; }
});
return new Integer(b.x);
}
public void put(Box b, Object value) {
- if (!((b.flags & NOTPACKED_FLAG) != 0)) return;
+ if (!((b.flags & NOTPACKED_FLAG) != 0) && (b.parent != null || b.surface == null)) return;
int x = stoi(value);
if (x == b.x) return;
b.dirty();
Platform.forceLoad();
if (Log.on) for(int i=0; i<args.length; i++) Log.log(Main.class, "argument " + i + ": " + args[i]);
- builtin = new Res.Zip(new Res.IS(Platform.getBuiltinInputStream()));
+ Res zip = new Res() { public InputStream getInputStream(String path) { return Platform.getBuiltinInputStream(); } };
+ builtin = new Res.Zip(zip);
String initialTemplateName = args.length > startargs + 1 ? args[startargs + 1] : "main";
initialTemplateName = initialTemplateName.replace('/', '.');
origin = args[startargs];
+ final Res rr;
+ final String initialTemplate;
+
if (origin.startsWith("http://") || origin.startsWith("https://")) {
originHost = origin.substring(origin.indexOf('/') + 2);
originHost = originHost.substring(0, originHost.indexOf('/') == -1 ? originHost.length() : originHost.indexOf('/'));
if (originHost.indexOf('@') != -1) originHost = originHost.substring(originHost.indexOf('@') + 1);
originAddr = InetAddress.getByName(originHost);
+ rr = builtin;
+ initialTemplate = "org/xwt/builtin/splash.xwt";
} else {
// HACK because MSIE turns \'s into /'s in file URLs... argh!!
if (Platform.platform.getClass().getName().endsWith("Win32")) origin = origin.replace('/', '\\');
if (!new File(origin).isDirectory()) origin += "!";
origin = "file:" + origin;
+ rr = Res.stringToRes(origin, true);
+ initialTemplate = initialTemplateName;
}
- // FIXME put the splash screen back in
if (Log.on) Log.log(Main.class, "loading xwar");
-
- final Res rr = Res.stringToRes(origin, true);
final XWT xwt = new XWT(rr);
- final String initialTemplateName_ = initialTemplateName;
new Thread(new Runnable() {
public void run() {
- Template.getTemplate(((Res)rr.get(initialTemplateName_)).addExtension(".xwt")).apply(new Box(), null, xwt);
Message.Q.startQ();
+ ThreadMessage.newthread(new JS.Callable() {
+ public Object call(JS.Array args) {
+ Template.getTemplate(((Res)rr.get(initialTemplate))).apply(new Box(), null, xwt);
+ return null;
+ }
+ });
}
}).start();