X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2FBox.java;h=2ada11fffc1d619f9040748ceba98d1f300e1712;hp=9489a8b3f29d6907b1287d48be04c426e900340a;hb=ae0cd6164facf843cc136f52e3f78e3843191d61;hpb=a113d1f48d1c3db8aa08c550a925360d1d664b47 diff --git a/src/org/ibex/Box.java b/src/org/ibex/Box.java index 9489a8b..2ada11f 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 } @@ -287,57 +294,56 @@ public final class Box extends JSScope implements Scheduler.Task { } private static float[] coeff = null; + private static LinearProgramming.Simplex lp_h = new LinearProgramming.Simplex(50, 50, 300); + private static LinearProgramming.Simplex lp_v = new LinearProgramming.Simplex(50, 50, 300); + void place_children() { 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 lp_h/lp_v do { + int nc = numkids * 2 + cols * 3 + 1 + 2; + if (coeff == null || nc+1>coeff.length) coeff = new float[nc+1]; + lp_h.init(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