2003/10/31 09:50:08
[org.ibex.core.git] / src / org / xwt / builtin / splash.xwt
index 32ceb4c..6f44cca 100644 (file)
@@ -1,20 +1,20 @@
 <xwt>
 
-    <template thisbox="window" orient="vertical" width="394" height="276">
+    <template orient="vertical" width="394" height="276" color="white">
 
         KeyPressed += function(k) { if (k == "escape") thisbox = null; }
 
         var progress = function(n, d) {
-            xwt.println("loaded " + 100 * (n/d) + "%");
-            $innerbar.width = $bar.width * n / d;
+            $innerbar.width = $bar.width * n / d + 1;
+            $text.text = "downloaded " + (xwt.math.ceil(100 * n/d)) + "%";
         }
 
         xwt.thread = function() {
-            var img = xwt.org.xwt.builtin["splash.png"];
-            xwt.println("img is");
-            xwt.println(img);
-            fill = img;
-            xwt.yield();
+            $text.font = xwt.fonts.vera["Vera.ttf"];
+            $text.fontsize = 14;
+            $text.text = "downloading...";
+            fill = xwt.org.xwt.builtin["splash.png"];
+            xwt.window = thisbox;
             x = (xwt.screenWidth - width) / 2;
             y = (xwt.screenHeight - height) / 2;
             var origin = xwt.origin;
                 origin = "http://" + origin.substring(origin.indexOf('/') + 1);
             }
             xwt.println("origin is " + origin);
-            var new_rr = xwt.watchProgress(xwt.load(origin), progress);
+            var new_rr = xwt.unzip(xwt.watchProgress(xwt.load(origin), progress));
             var new_xwt = xwt.clone(new_rr);
+
+            xwt.thread = function() {
+for(var i=0; 100>i; i++) {
+progress(i, 100);
+xwt.yield();
+}
+                new_xwt.apply(xwt.box, new_xwt["main.xwt"]);
+                thisbox = null;
+            }
         }
 
-        <box packed="false" id="bar" x="20" y="236" width="354" height="19" align="left">
-            <box id="innerbar" fill="blue" width="0"/>
+        <box height="233" align="bottomleft" packed="false" x="20" y="0">
+            <box textcolor="white" id="text" shrink="true"/>
+        </box>
+        <box packed="false" id="bar" x="20" y="236" width="354" height="20" align="left">
+            <box id="innerbar" fill="blue" width="10"/>
         </box>
 
     </template>