//#define CHECKSET_SHORT(prop) short nu = (short)JSU.toInt(value); if (nu == prop) break; prop = nu;
//#define CHECKSET_INT(prop) int nu = JSU.toInt(value); if (nu == prop) break; prop = nu;
- //#define CHECKSET_FLAG(flag) boolean nu = JSU.toBoolean(value); if (nu == test(flag)) break; if (nu) set(flag); else clear(flag);
+ //#define CHECKSET_FLAG(flag) boolean nu=JSU.toBoolean(value);if(nu == test(flag)) break; if (nu) set(flag); else clear(flag);
//#define CHECKSET_BOOLEAN.N(prop) boolean nu = JSU.toBoolean(value); if (nu == prop) break; prop = nu;
- //#define CHECKSET_STRING(prop) if ((value==null&&prop==null)||(value!=null&&JSU.toString(value).equals(prop))) break; prop=JSU.toString(value);
+ //#define CHECKSET_STRING(prop) if((value==null&&prop==null)||(value!=null&&JSU.toString(value).equals(prop)))break;prop=JSU.toString(value);
// FIXME memory leak
static Basket.Map boxToCursor = new Basket.Hash(500, 3);
// Flags //////////////////////////////////////////////////////////////////////
- static final int MOUSEINSIDE = 0x00000001;
- static final int VISIBLE = 0x00000002;
- static final int PACKED = 0x00000004;
- public static final int HSHRINK = 0x00000008;
- public static final int VSHRINK = 0x00000010;
- static final int BLACK = 0x00000020; // for red-black code
+ static final int MOUSEINSIDE = 0x00000001;
+ static final int VISIBLE = 0x00000002;
+ static final int PACKED = 0x00000004;
+ public static final int HSHRINK = 0x00000008;
+ public 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 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 RECONSTRAIN = 0x00000200;
- static final int REPLACE = 0x00000400;
+ static final int ISROOT = 0x00000080;
+ static final int REPACK = 0x00000100;
+ static final int RECONSTRAIN = 0x00000200;
+ static final int REPLACE = 0x00000400;
- static final int CURSOR = 0x00010000; // if true, this box has a cursor in the cursor hash; FEATURE: GC issues?
- static final int CLIP = 0x00020000;
- static final int STOP_UPWARD_PROPAGATION = 0x00040000;
- static final int MOVED = 0x00080000;
+ static final int CURSOR = 0x00010000; // if true, this box has cursor in the cursor hash; FEATURE: GC issues?
+ static final int CLIP = 0x00020000;
+ static final int STOP_UPWARD_PROPAGATION = 0x00040000;
+ static final int MOVED = 0x00080000;
// Instance Data //////////////////////////////////////////////////////////////////////
private short col = 0;
public int x = 0;
public int y = 0;
- public int ax = 0; // FEATURE: roll these into x/y; requires lots of changes
- public int ay = 0; // FEATURE: roll these into x/y; requires lots of changes; perhaps y()?
public int width = 0;
public int height = 0;
public int contentwidth = 0; // == max(minwidth, textwidth, sum(child.contentwidth))
if (!child.test(REPLACE)) continue;
int child_width, child_height, child_x, child_y;
if (!child.test(PACKED)) {
- 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 = child.test(HSHRINK) ? child.contentwidth : min(child.maxwidth, width);
+ child_height = child.test(VSHRINK) ? child.contentheight : min(child.maxheight, height);
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 + gap_x / 2;
- child_y = child.ay + gap_y / 2;
+ child_x = gap_x / 2;
+ child_y = gap_y / 2;
} else {
int diff;
//#repeat col/row colspan/rowspan contentwidth/contentheight width/height colMaxWidth/rowMaxHeight \
case "hshrink": return JSU.B(test(HSHRINK));
case "vshrink": return JSU.B(test(VSHRINK));
case "aspect": return JSU.N(aspect);
- case "x": return (parent == null || !test(VISIBLE)) ? JSU.N(0) : test(PACKED) ? JSU.N(x) : JSU.N(ax);
- case "y": return (parent == null || !test(VISIBLE)) ? JSU.N(0) : test(PACKED) ? JSU.N(y) : JSU.N(ay);
+ case "x": return JSU.N(x);
+ case "y": return JSU.N(y);
case "cols": return test(FIXED) == COLS ? JSU.N(cols) : JSU.N(0);
case "rows": return test(FIXED) == ROWS ? JSU.N(rows) : JSU.N(0);
case "colspan": return JSU.N(colspan);
font = value == null ? null : Font.getFont((Fountain)value, font == null ? 10 : font.pointsize);
RECONSTRAIN();
dirty();
- case "x": if (parent==null && Surface.fromBox(this)!=null) {
- CHECKSET_INT(x);
- } else {
- if (test(PACKED) && parent != null) return;
- CHECKSET_INT(ax);
- REPLACE();
- }
- case "y": if (parent==null && Surface.fromBox(this)!=null) {
- CHECKSET_INT(y);
- } else {
- if (test(PACKED) && parent != null) return;
- CHECKSET_INT(ay);
- REPLACE();
- }
+ case "x": if (parent==null && Surface.fromBox(this)!=null) { CHECKSET_INT(x); }
+ case "y": if (parent==null && Surface.fromBox(this)!=null) { CHECKSET_INT(y); }
case "titlebar": if (getSurface()!=null) getSurface().setTitleBarText(JSU.toString(value)); super.put(name,value);
// FIXME: icon