X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2FBox.java;h=f8b4bf5639a06904e19cf2b9b8c0dc474f30d45c;hb=9c46568249885085b710f76f00a56a12f5ee61c9;hp=0e5d2a7b45b54e698a10ee147e6cb4deab3e00e6;hpb=39f90dcf231fe24e5e6c03b3368a33a648b148fa;p=org.ibex.core.git diff --git a/src/org/ibex/Box.java b/src/org/ibex/Box.java index 0e5d2a7..f8b4bf5 100644 --- a/src/org/ibex/Box.java +++ b/src/org/ibex/Box.java @@ -178,8 +178,9 @@ public final class Box extends JSScope implements Scheduler.Task { if (texture != null) { if (texture.isLoaded) { minwidth = min(texture.width, maxwidth); minheight = min(texture.height, maxheight); } else { JS res = texture.stream; texture = null; throw new JSExn("image not found: "+res); } + } else { + Log.warn(Box.class, "perform() called with null texture"); } - MARK_REPACK; MARK_REFLOW; MARK_RESIZE; @@ -378,10 +379,9 @@ public final class Box extends JSScope implements Scheduler.Task { int globaly = parenty + (parent == null ? 0 : y); // intersect the x,y,w,h rendering window with ourselves; quit if it's empty - if (test(CLIP)) { - cx1 = max(cx1, parent == null ? 0 : globalx); - cy1 = max(cy1, parent == null ? 0 : globaly); + cx1 = max(cx1, globalx); + cy1 = max(cy1, globaly); cx2 = min(cx2, globalx + width); cy2 = min(cy2, globaly + height); if (cx2 <= cx1 || cy2 <= cy1) return; @@ -557,15 +557,35 @@ public final class Box extends JSScope implements Scheduler.Task { case "Minimized": if (parent == null && getSurface() != null) getSurface().minimized = toBoolean(value); // FEATURE case "Maximized": if (parent == null && getSurface() != null) getSurface().maximized = toBoolean(value); // FEATURE case "Close": if (parent == null && getSurface() != null) getSurface().dispose(true); - case "redirect": if (redirect == this) redirect = (Box)value; else Log.info(this, "redirect can only be set once"); + case "redirect": + for(Box cur = (Box)value; cur != null; cur = cur.parent) + if (cur == redirect) { + redirect = (Box)value; + return; + } + JS.error("redirect can only be set to a descendant of its current value"); case "font": if(!(value instanceof Stream)) throw new JSExn("You can only put streams to the font property"); font = value == null ? null : Font.getFont((Stream)value, font == null ? 10 : font.pointsize); 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(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 "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); @@ -677,6 +697,7 @@ public final class Box extends JSScope implements Scheduler.Task { fillcolor = newfillcolor; } else if(value instanceof JS) { texture = Picture.load((JS)value, this); + if (texture != null) perform(); } else { throw new JSExn("fill must be null, a String, or a stream, not a " + value.getClass()); }