2003/11/17 06:19:20
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:41:41 +0000 (07:41 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:41:41 +0000 (07:41 +0000)
darcs-hash:20040130074141-2ba56-8c89302f2cdfee911c51a8b33ef3bb858d1e251e.gz

Makefile
src/org/xwt/Box.java
src/org/xwt/BoxTree.java
src/org/xwt/XWT.java
src/org/xwt/builtin/splash.xwt

index 4ee19ec..bb82c5f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -154,7 +154,8 @@ builtin_src := $(shell find src/org/xwt/builtin -name '*.*' \! -name '*.xcf')
 build/res/fonts/vera: .download_vera-1.10
        mkdir -p build/res/fonts/vera
        cd build/res/fonts/vera; ln -s ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/Vera.ttf
-       cd build/res/fonts/vera; ln -s ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/VeraBd.ttf
+       cd build/res/fonts/vera; ln -s ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/VeraMono.ttf
+       cd build/res/fonts/vera; ln -s ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/VeraSe.ttf
 build/res/builtin.jar: $(builtin_src:src/%=build/res/%) build/res/freetype.mips build/res/libmspack.mips build/res/fonts/vera
        @echo -e "\n\033[1mzipping            res/* -> .jar: builtin.jar\033[0m"
        cd build/res; $(jar) cf builtin.jar $(^:build/res/%=%)
@@ -208,11 +209,10 @@ build/res/freetype.mips: build/mips/org/xwt/translators/Freetype.c.o build/mips/
                -Lupstream/freetype-2.1.4/src/objs \
                -o $@ \
                $^ \
-               -lfreetype \
-#              -Wl,-s \
+               -lfreetype
 
 .install_libmspack-20030726:; make .install_libmspack-20030726_mips-unknown-elf target=mips-unknown-elf
-build/mips/org/xwt/translators/MSPack.c.o: .install_libmspack-20030726 
+build/mips/org/xwt/translators/MSPack.c.o: .install_libmspack-20030726
 build/res/libmspack.mips: build/mips/org/xwt/translators/MSPack.c.o build/mips/org/xwt/mips/crt0.c.o build/mips/org/xwt/mips/syscalls.c.o
        @echo -e "\n\033[1mlinking               .o -> .mips:  $@\033[0m"
        mkdir -p build/mips build/res
@@ -226,10 +226,7 @@ build/res/libmspack.mips: build/mips/org/xwt/translators/MSPack.c.o build/mips/o
                -Lupstream/libmspack-20030726/build-mips-unknown-elf \
                -o $@ \
                $^ \
-               -lmspack \
-#              -Wl,-s \
-
-
+               -lmspack
 
 
 ##############################################################################
index 8e51542..0d23a6f 100644 (file)
@@ -208,14 +208,15 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable {
         if (test(FIXED) == COLS) {
             short r = 0;
             for(Box child = firstPackedChild(); child != null; r++) {
-                for(short col=0, numclear=0; child != null && col < cols;) {
-                    if (numRowsInCol[col] > r) continue;
-                    if (col != 0 && col + min(cols, child.colspan) > cols) break;
+                for(short c=0, numclear=0; child != null && c < cols; c++) {
+                    if (numRowsInCol[c] > r) continue;
+                    if (c != 0 && c + min(cols, child.colspan) - numclear > cols) break;
                     if (++numclear < min(cols, child.colspan)) continue;
-                    for(int i=col - numclear + 1; i <= col; i++) numRowsInCol[i] += child.rowspan;
-                    child.col = col; child.row = r;
+                    for(int i=c - numclear + 1; i <= c; i++) numRowsInCol[i] += child.rowspan;
+                    child.col = (short)(c - numclear + 1); child.row = r;
                     rows = (short)max(rows, child.row + child.rowspan);
                     child = child.nextPackedSibling();
+                    numclear = 0;
                 }
             }
             for(int i=0; i<cols; i++) numRowsInCol[i] = 0;
@@ -228,7 +229,6 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable {
         for(Box child = firstPackedChild(); child != null; child = child.nextPackedSibling())
             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 == null || text == null ? 0 : font.textwidth(text), contentwidth), maxwidth);
         //#end               
     }
@@ -293,7 +293,7 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable {
                 //        colWidth/rowHeight child_width/child_height ALIGN_RIGHT/ALIGN_BOTTOM ALIGN_LEFT/ALIGN_TOP
                 unbounded = 0;
                 for(int i = child.col; i < child.col + child.colspan; i++) unbounded += colWidth[i];
-                child_width = bound(child.contentwidth, unbounded, child.test(HSHRINK) ? child.contentwidth : child.maxwidth);
+                child_width = min(unbounded, child.test(HSHRINK) ? child.contentwidth : child.maxwidth);
                 child_x = test(ALIGN_RIGHT) ? x_slack : test(ALIGN_LEFT) ? 0 : x_slack / 2;
                 for(int i=0; i < child.col; i++) child_x += colWidth[i];
                 if (child_width > unbounded) child_x -= (child_width - unbounded) / 2;
index 7d2d3d5..86f1566 100644 (file)
@@ -346,7 +346,7 @@ public final class BoxTree extends Box {
     /** Returns our index in our parent */
     public int getIndexInParent() {
         // FIXME: store numleft and numright in the tree
-        if (peerTree_parent == null) return left == null ? 0 : left.numPeerChildren();
+        if (peerTree_parent == null) return left == null ? 0 : left.numPeerChildren() + 1;
         else if (peerTree_parent.left == this) return peerTree_parent.getIndexInParent() - 1;
         else if (peerTree_parent.right == this) return peerTree_parent.getIndexInParent() + 1;
         else throw new Error("we're not a child of our parent!");
index 51e37f3..45144cd 100644 (file)
@@ -41,6 +41,10 @@ public final class XWT extends JSCallable {
         case "log": return new Sub("log");
         case "ui": return new Sub("ui");
         case "thread": return new Sub("thread");
+        case "font": return new Sub("font");
+        case "font.sansserif": return Main.builtin.get("fonts/vera/Vera.ttf");
+        case "font.monospace": return Main.builtin.get("fonts/vera/VeraMono.ttf");
+        case "font.serif": return Main.builtin.get("fonts/vera/VeraSe.ttf");
         case "ui.key": return new Sub("ui.key");
         case "ui.key.alt": return Surface.alt ? Boolean.TRUE : Boolean.FALSE;
         case "ui.key.control": return Surface.control ? Boolean.TRUE : Boolean.FALSE;
index bef5995..c4f3d8b 100644 (file)
@@ -4,19 +4,33 @@
 
         KeyPressed += function(k) { if (k == "escape") thisbox = null; }
 
-        var progress = function(n, d) {
-var t = "downloaded " + xwt.math.ceil(100 * n/d) + "%";
-xwt.log.println("downloaded " + t);
-            $innerbar.width = $bar.width * n / d + 1;
+        var settext = function(t) {
             $text.text = t;
+            $text1.text = t;
+            $text2.text = t;
+            $text3.text = t;
+            $text4.text = t;
         }
 
+        var progress = function(n, d) {
+            var t = "downloaded " + xwt.math.ceil(100 * n/d) + "%";
+            xwt.log.println("downloaded " + t);
+            $innerbar.width = $bar.width * n / d + 1;
+            settext(t);
+       } 
+
         xwt.thread = function() {
-//            $text.font = xwt.fonts.vera["Vera.ttf"];
-//            $text.font = xwt.res.cache(cab["Arial.TTF"]);
-            $text.font = xwt.res.uncab(xwt.res.url("http://master.dist.xwt.org/msfonts/arial32.exe"))["Arial.TTF"];
-            $text.fontsize = 18;
-          $text.text = "downloading...";
+            $text.font = xwt.font.sansserif;
+            $text.fontsize = 14;
+            $text1.font = xwt.font.sansserif;
+            $text1.fontsize = 14;
+            $text2.font = xwt.font.sansserif;
+            $text2.fontsize = 14;
+            $text3.font = xwt.font.sansserif;
+            $text3.fontsize = 14;
+            $text4.font = xwt.font.sansserif;
+            $text4.fontsize = 14;
+            settext("downloading...");
             fill = xwt.org.xwt.builtin["splash.png"];
             xwt.ui.window = thisbox;
             thisbox.width=394;
@@ -44,7 +58,17 @@ xwt.log.println("leaving");
         }
 
         <box height="236" align="bottomleft" packed="false" x="20" y="0">
-            <box textcolor="white" id="text" shrink="true"/>
+            <box vshrink="true">
+                <box packed="false" textcolor="black" x="2" y="2" id="text1"/>
+                <box packed="false" textcolor="black" x="0" y="2" id="text2"/>
+                <box packed="false" textcolor="black" x="2" y="0" id="text3"/>
+                <box packed="false" textcolor="black" x="0" y="0" id="text4"/>
+                <box cols="2">
+                    <box height="1" colspan="2"/>
+                    <box width="1"/>
+                    <box textcolor="white" id="text"/>
+                </box>
+            </box>
         </box>
         <box packed="false" id="bar" x="20" y="236" width="354" height="20" align="left">
             <box id="innerbar" fill="blue" width="10" height="20"/>