From 4052bf6501ced1a941a66108e87262da033f33af Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 4 Apr 2004 05:31:42 +0000 Subject: [PATCH] constraint solver now treats children appropriately darcs-hash:20040404053142-5007d-46a24a44b78e621ed515f28f04c21b2588bf33ac.gz --- src/org/ibex/Box.java | 71 ++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/src/org/ibex/Box.java b/src/org/ibex/Box.java index 28a3229..8c0d3ef 100644 --- a/src/org/ibex/Box.java +++ b/src/org/ibex/Box.java @@ -240,14 +240,21 @@ public final class Box extends JSScope implements Scheduler.Task { for(int i=0; i i)) + rowcontentwidth += child.contentwidth; + contentwidth = max(contentwidth, rowcontentwidth); + } contentwidth = bound(minwidth, max(font == null || text == null ? 0 : font.textwidth(text), contentwidth), maxwidth); //#end } @@ -288,49 +295,49 @@ public final class Box extends JSScope implements Scheduler.Task { private static float[] coeff = null; void place_children() { + LinearProgramming.Problem lpr_h; + LinearProgramming.Problem lpr_v; int numkids = 0; for(Box c = firstPackedChild(); c != null; c = c.nextPackedSibling()) numkids++; - int nc = numkids * 2 + cols * 3 + 1 + 2; - if (coeff == null || nc+1>coeff.length) coeff = new float[nc+1]; - LinearProgramming.Simplex lp_h = new LinearProgramming.Simplex(); - LinearProgramming.Problem lpr_h = new LinearProgramming.Problem(nc, nc); - LinearProgramming.Simplex lp_v = new LinearProgramming.Simplex(); - LinearProgramming.Problem lpr_v = new LinearProgramming.Problem(nc, nc); - - //#repeat col/row colspan/rowspan contentwidth/contentheight width/height colMaxWidth/rowMaxHeight colWidth/rowHeight \ - // HSHRINK/VSHRINK maxwidth/maxheight cols/rows minwidth/minheight colWidth/rowHeight x_slack/y_slack lp_h/lp_v lpr_h/lpr_v + //#repeat col/row colspan/rowspan contentwidth/contentheight width/height \ + // maxwidth/maxheight cols/rows minwidth/minheight lp_h/lp_v lpr_h/lpr_v do { + int nc = numkids * 2 + cols * 3 + 1 + 2; + if (coeff == null || nc+1>coeff.length) coeff = new float[nc+1]; + LinearProgramming.Simplex lp_h = new LinearProgramming.Simplex(); + lpr_h = new LinearProgramming.Problem(nc, nc); + // objective function - coeff[cols*2+numkids] = coeff[cols*2+numkids+1] = (float)-10000.0; // attempt to make sum of columns equal to parent width - for(int i=cols*2; i=child.col && i=child.col && i=child.col && i