2003/10/20 01:41:21
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:39:50 +0000 (07:39 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:39:50 +0000 (07:39 +0000)
darcs-hash:20040130073950-2ba56-7fb314a016392a3ef42fd700fed3a53a719caea7.gz

Makefile
src/org/xwt/Box.java.pp
src/org/xwt/Main.java

index 7d356f5..61588b4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -314,3 +314,9 @@ dist-private:
 
        echo
        echo "*** DONE ******************************************"
+
+
+# this is for Adam; don't mess with it
+test: JVM; /System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Commands/java -jar build/JVM/xwt.jar http://www.xwt.org/demo.xwar
+
+
index 32127af..9699421 100644 (file)
@@ -931,6 +931,16 @@ public final class Box extends JS.Scope {
 
         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; }
                 });
@@ -1156,7 +1166,7 @@ public final class Box extends JS.Scope {
                         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();
index 902cb92..8967902 100644 (file)
@@ -60,35 +60,44 @@ public class Main {
         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();