fixed bug 440, reintroduced splash screen
authoradam <adam@megacz.com>
Sun, 15 Feb 2004 04:24:35 +0000 (04:24 +0000)
committeradam <adam@megacz.com>
Sun, 15 Feb 2004 04:24:35 +0000 (04:24 +0000)
darcs-hash:20040215042435-5007d-d5c03c0067d1413515de66e8c539b8c4783e5db5.gz

Makefile.upstream
src/org/ibex/Box.java
src/org/ibex/Template.java

index c531107..50f471d 100644 (file)
@@ -68,8 +68,9 @@ configure_gcc-3.3                       += --with-as=$(shell pwd)/upstream/insta
 ifneq ($(platform),Darwin)
 configure_gcc-3.3                       += --with-gnu-ld --with-gnu-as
 endif
-configure_gcc-3.3                       += --disable-java-awt --disable-interpreter --enable-static --enable-libgcj
+configure_gcc-3.3                       += --disable-java-awt --disable-interpreter --enable-libgcj
 configure_gcc-3.3                       += --disable-shared --enable-static
+configure_binutils-2.13.2.1             += --disable-shared --enable-static
 configure_gcc-3.3_powerpc-apple-darwin  += --enable-threads=posix --disable-hash-synchronization --disable-multilib
 configure_gcc-3.3_i686-pc-mingw32       += --enable-threads=win32 --enable-hash-synchronization
 configure_gcc-3.3_i686-pc-linux-gnu     += --enable-threads=posix --enable-hash-synchronization
index 90fd499..4e8d778 100644 (file)
@@ -152,6 +152,8 @@ public final class Box extends JSScope implements Scheduler.Task {
     private short col = 0;
     public LENGTH x = 0;
     public LENGTH y = 0;
+    public LENGTH ax = 0;   // FEATURE: roll these into x/y; requires lots of changes
+    public LENGTH ay = 0;   // FEATURE: roll these into x/y; requires lots of changes; perhaps y()?
     public LENGTH width = 0;
     public LENGTH height = 0;
     private LENGTH contentwidth = 0;      // == max(minwidth, textwidth, sum(child.contentwidth))
@@ -320,12 +322,14 @@ public final class Box extends JSScope implements Scheduler.Task {
             if (!child.test(VISIBLE)) continue;
             int child_width, child_height, child_x, child_y;
             if (!child.test(PACKED)) {
-                child_x = child.x;
-                child_y = child.y;
-                child_width = child.test(HSHRINK) ? child.contentwidth : min(child.maxwidth, width - child_x);
-                child_height = child.test(VSHRINK) ? child.contentheight : min(child.maxheight, height - child_y);
+                child_width = child.test(HSHRINK) ? child.contentwidth : min(child.maxwidth, width - Math.abs(child.ax));
+                child_height = child.test(VSHRINK) ? child.contentheight : min(child.maxheight, height - Math.abs(child.ay));
                 child_width = max(child.minwidth, child_width);
                 child_height = max(child.minheight, child_height);
+                int gap_x = width - child_width;
+                int gap_y = height - child_height;
+                child_x = child.ax + (child.test(ALIGN_RIGHT) ? gap_x : !child.test(ALIGN_LEFT) ? gap_x / 2 : 0);
+                child_y = child.ay + (child.test(ALIGN_BOTTOM) ? gap_y : !child.test(ALIGN_TOP) ? gap_y / 2 : 0);
             } else {
                 int unbounded;
                 //#repeat col/row colspan/rowspan contentwidth/contentheight width/height colMaxWidth/rowMaxHeight \
@@ -379,10 +383,15 @@ public final class Box extends JSScope implements Scheduler.Task {
             for(int x = globalx; x < cx2; x += texture.width)
                 for(int y = globaly; y < cy2; y += texture.height)
                     buf.drawPicture(texture, x, y, cx1, cy1, cx2, cy2);
-
-        if (text != null && !text.equals("") && font != null)
-            if (font.rasterizeGlyphs(text, buf, strokecolor, globalx, globaly, cx1, cy1, cx2, cy2, null) == -1)
-                font.rasterizeGlyphs(text, buf, strokecolor, globalx, globaly, cx1, cy1, cx2, cy2, this);
+        if (text != null && !text.equals("") && font != null) {
+            int gap_x = width - font.textwidth(text);
+            int gap_y = height - font.textheight(text);
+            int text_x = globalx + (test(ALIGN_RIGHT) ? gap_x : !test(ALIGN_LEFT) ? gap_x/2 : 0);
+            int text_y = globaly + (test(ALIGN_BOTTOM) ? gap_y : !test(ALIGN_TOP) ? gap_y/2 : 0);
+            if (font.rasterizeGlyphs(text, buf, strokecolor, text_x, text_y, cx1, cy1, cx2, cy2, null) == -1)
+                font.rasterizeGlyphs(text, buf, strokecolor, text_x, text_y, cx1, cy1, cx2, cy2, this);
+        }
 
         for(Box b = getChild(0); b != null; b = b.nextSibling())
             b.render(globalx, globaly, cx1, cy1, cx2, cy2, buf, null);
@@ -543,8 +552,8 @@ public final class Box extends JSScope implements Scheduler.Task {
             MARK_RESIZE;
             dirty();
         case "fontsize": font = Font.getFont(font == null ? null : font.stream, toInt(value)); MARK_RESIZE; dirty();
-        case "x": if (parent==null && Surface.fromBox(this)!=null) { CHECKSET_INT(x); } else { if (test(PACKED) && parent != null) return; dirty(); CHECKSET_INT(x); dirty(); MARK_RESIZE; dirty(); }
-        case "y": if (parent==null && Surface.fromBox(this)!=null) { CHECKSET_INT(y); } else { if (test(PACKED) && parent != null) return; dirty(); CHECKSET_INT(y); dirty(); MARK_RESIZE; dirty(); }
+        case "x": if (parent==null && Surface.fromBox(this)!=null) { CHECKSET_INT(x); } else { if (test(PACKED) && parent != null) return; dirty(); CHECKSET_INT(ax); dirty(); MARK_RESIZE; dirty(); }
+        case "y": if (parent==null && Surface.fromBox(this)!=null) { CHECKSET_INT(y); } else { if (test(PACKED) && parent != null) return; dirty(); CHECKSET_INT(ay); dirty(); MARK_RESIZE; dirty(); }
         case "titlebar":
             if (getSurface() != null && value != null) getSurface().setTitleBarText(JS.toString(value));
             super.put(name,value);
index 154de72..c7a9acb 100644 (file)
@@ -81,6 +81,7 @@ public class Template {
 
         PerInstantiationScope pis = new PerInstantiationScope(b, ibex, parentPis, staticScope);
         for(int i=0; i<urikeys.length; i++) {
+            if (urikeys[i] == null) continue;
             pis.declare(urikeys[i]);
             pis.put(urikeys[i], ibex.resolveString(urivals[i], true));
         }
@@ -182,11 +183,14 @@ public class Template {
                     if (c.getAttrLen() != 0)
                         throw new XML.Exn("root element must not have attributes", XML.Exn.SCHEMA, getLine(), getCol());
                     if (c.getUri("ui") == null || "".equals(c.getUri("ui"))) c.addUri("ui", "ibex://ui");
+                    if (c.getUri("meta") == null || "".equals(c.getUri("meta"))) c.addUri("meta", "ibex://meta");
                     if (c.getUri("") == null || "".equals(c.getUri(""))) c.addUri("", initial_uri);
                     state = STATE_IN_ROOT_NODE;
                     return;
                 case STATE_IN_ROOT_NODE:
-                    if ("ibex://meta".equals(c.getUri())) { state = STATE_IN_META_NODE; meta = 0; return; }
+                    if ("ibex://meta".equals(c.getUri())) {
+                        state = STATE_IN_META_NODE; meta = 0; return;
+                    }
                     state = STATE_IN_TEMPLATE_NODE;
                     t = (t == null) ? new Template(ibex) : new Template(t, getLine());
                     break;
@@ -207,14 +211,15 @@ public class Template {
             }
                 
             Hash urimap = c.getUriMap();
-            t.urikeys = new String[urimap.size() - (urimap.get("ui") == null ? 0 : 1)];
-            t.urivals = new String[urimap.size() - (urimap.get("ui") == null ? 0 : 1)];
+            t.urikeys = new String[urimap.size()];
+            t.urivals = new String[urimap.size()];
             Enumeration uriEnumeration = urimap.keys();
             int ii = 0;
             while(uriEnumeration.hasMoreElements()) {
                 String key = (String)uriEnumeration.nextElement();
-                if (key.equals("ui")) continue;
                 String val = (String)urimap.get(key);
+                if (val.equals("ibex://ui")) continue;
+                if (val.equals("ibex://meta")) continue;
                 t.urikeys[ii] = key;
                 if (val.length() > 0 && val.charAt(0) == '.') val = val.substring(1);
                 t.urivals[ii] = val;