-public final class Box extends JS.Scope {
-
-
- // Static Data //////////////////////////////////////////////////////////////
-
- /** a pool of one-element Object[]'s */
- private static Queue singleObjects = new Queue(100);
-
- /** caches images, keyed on resource name or url */
- public static Hash pictureCache = new Hash();
-
- /** cache of border objects */
- static Hash bordercache = new Hash();
-
- /** stores image names, keyed on image object */
- static Hash imageToNameMap = new Hash();
-
- /** the empty object, used for get-traps */
- private static JS.Array emptyobj = new JS.Array();
-
-
- // Instance Data: Templates ////////////////////////////////////////////////////////
-
- /** the unresolved name of the first template applied to this node [ignoring preapply's], or null if this template was specified anonymously */
- String templatename = null;
-
- /** the importlist which was used to resolve <tt>templatename</tt>, or null if this template was specified anonymously */
- String[] importlist = Template.defaultImportList;
-
- /** the template instance that resulted from resolving <tt>templatename</tt> using <tt>importlist</tt>, or the anonymous template applied */
- Template template = null;
-
-
- // Instance Data: Geometry ////////////////////////////////////////////////////////
-
- /** The number of elements in the geom array */
- public static final int NUMINTS = 10;
-
- /** The maximum <i>defined</i> width and height of this box */
- public static final int dmax = 0;
- private int _dmax_0 = 0;
- private int _dmax_1 = 0;
- public final int dmax(int axis) { return axis == 0 ? _dmax_0 : _dmax_1; }
-
- /** The minimum <i>defined</i> width and height of this box */
- public static final int dmin = 1;
- private int _dmin_0 = 0;
- private int _dmin_1 = 0;
- public final int dmin(int axis) { return axis == 0 ? _dmin_0 : _dmin_1; }
-
- /** The minimum <i>calculated</i> width and height of this box -- unlike dmin, this takes childrens' sizes into account */
- public static final int cmin = 2;
- private int _cmin_0 = 0;
- private int _cmin_1 = 0;
- public final int cmin(int axis) { return axis == 0 ? _cmin_0 : _cmin_1; }
-
- /** The position of this box, relitave to the parent */
- public static final int abs = 3;
- private int _abs_0 = 0;
- private int _abs_1 = 0;
- public final int abs(int axis) { return axis == 0 ? _abs_0 : _abs_1; }
-
- /** The absolute position of this box (ie relitave to the root); set by the parent */
- public static final int pos = 4;
- private int _pos_0 = 0;
- private int _pos_1 = 0;
- public final int pos(int axis) { return axis == 0 ? _pos_0 : _pos_1; }
-
- /** The actual size of this box; set by the parent. */
- public static final int size = 5;
- int _size_0 = 0;
- int _size_1 = 0;
- public final int size(int axis) { return axis == 0 ? _size_0 : _size_1; }
-
- /** The old actual absolute position of this box (ie relitave to the root) */
- public static final int oldpos = 6;
- private int _oldpos_0 = 0;
- private int _oldpos_1 = 0;
- public final int oldpos(int axis) { return axis == 0 ? _oldpos_0 : _oldpos_1; }
-
- /** The old actual size of this box */
- public static final int oldsize = 7;
- private int _oldsize_0 = 0;
- private int _oldsize_1 = 0;
- public final int oldsize(int axis) { return axis == 0 ? _oldsize_0 : _oldsize_1; }
-
- /** The padding along each edge for this box */
- public static final int pad = 8;
- private int _pad_0 = 0;
- private int _pad_1 = 0;
- public final int pad(int axis) { return axis == 0 ? _pad_0 : _pad_1; }
-
- /** The dimensions of the text in this box */
- public static final int textdim = 9;
- private int _textdim_0 = 0;
- private int _textdim_1 = 0;
- public final int textdim(int axis) { return axis == 0 ? _textdim_0 : _textdim_1; }
-
-
- // Instance Data /////////////////////////////////////////////////////////////////
-
- /** This box's mouseinside property, as defined in the reference */
- boolean mouseinside = false;
-
- /** If redirect is enabled, this holds the Box redirected to */
+public final class Box extends JSScope {
+
+ // Macros //////////////////////////////////////////////////////////////////////
+
+ //#define LENGTH int
+ //#define MARK_REPACK for(Box b2 = this; b2 != null && !b2.test(REPACK); b2 = b2.parent) b2.set(REPACK);
+ //#define MARK_REPACK_b for(Box b2 = b; b2 != null && !b2.test(REPACK); b2 = b2.parent) b2.set(REPACK);
+ //#define MARK_REPACK_parent for(Box b2 = parent; b2 != null && !b2.test(REPACK); b2 = b2.parent) b2.set(REPACK);
+ //#define MARK_REFLOW for(Box b2 = this; b2 != null && !b2.test(REFLOW); b2 = b2.parent) b2.set(REFLOW);
+ //#define MARK_REFLOW_b for(Box b2 = b; b2 != null && !b2.test(REFLOW); b2 = b2.parent) b2.set(REFLOW);
+ //#define MARK_RESIZE for(Box b2 = this; b2 != null && !b2.test(RESIZE); b2 = b2.parent) b2.set(RESIZE);
+ //#define MARK_RESIZE_b for(Box b2 = b; b2 != null && !b2.test(RESIZE); b2 = b2.parent) b2.set(RESIZE);
+ //#define CHECKSET_SHORT(prop) short nu = (short)toInt(value); if (nu == prop) break; prop = nu;
+ //#define CHECKSET_INT(prop) int nu = toInt(value); if (nu == prop) break; prop = nu;
+ //#define CHECKSET_FLAG(flag) boolean nu = toBoolean(value); if (nu == test(flag)) break; if (nu) set(flag); else clear(flag);
+ //#define CHECKSET_BOOLEAN(prop) boolean nu = toBoolean(value); if (nu == prop) break; prop = nu;
+ //#define CHECKSET_STRING(prop) if ((value==null&&prop==null)||(value!=null&&value.equals(prop))) break; prop=(String)value;
+
+ protected Box() { super(null); }
+
+ static Hash boxToCursor = new Hash(500, 3);
+ public static final int MAX_LENGTH = Integer.MAX_VALUE;
+
+ // Flags //////////////////////////////////////////////////////////////////////
+
+ static final int MOUSEINSIDE = 0x00000001;
+ static final int VISIBLE = 0x00000002;
+ static final int PACKED = 0x00000004;
+ static final int HSHRINK = 0x00000008;
+ static final int VSHRINK = 0x00000010;
+ static final int BLACK = 0x00000020; // for red-black code
+
+ static final int FIXED = 0x00000040;
+ static final boolean ROWS = true;
+ static final boolean COLS = false;
+
+ static final int ISROOT = 0x00000080;
+ static final int REPACK = 0x00000100;
+ static final int REFLOW = 0x00000200;
+ static final int RESIZE = 0x00000400;
+ static final int RECONSTRAIN = 0x00000800;
+ static final int ALIGN_TOP = 0x00001000;
+ static final int ALIGN_BOTTOM = 0x00002000;
+ static final int ALIGN_LEFT = 0x00004000;
+ static final int ALIGN_RIGHT = 0x00008000;
+ static final int ALIGNS = 0x0000f000;
+ static final int CURSOR = 0x00010000; // if true, this box has a cursor in the cursor hash; FEATURE: GC issues?
+ static final int NOCLIP = 0x00020000;
+
+
+ // Instance Data //////////////////////////////////////////////////////////////////////
+
+ Box parent = null;