+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include "layout.hxx"
+#include <simgear/math/SGMath.hxx>
+
// This file contains the actual layout engine. It has no dependence
// on outside libraries; see layout-props.cxx for the glue code.
{
*w = *h = 0; // Ask for nothing by default
+ if (!getBool("enabled", true) || isType("nasal"))
+ return;
+
int legw = stringLength(getStr("legend"));
int labw = stringLength(getStr("label"));
*w = *h = 17*UNIT;
if(getBool("vertical")) *w = 4*UNIT;
else *h = 4*UNIT;
- } else if (isType("list") || isType("airport-list") || isType("dial")) {
+ } else if (isType("list") || isType("airport-list")
+ || isType("property-list") || isType("dial") || isType("waypointlist")) {
*w = *h = 12*UNIT;
} else if (isType("hrule")) {
*h = 1;
// Set up geometry such that the widget lives "inside" the specified
void LayoutWidget::layout(int x, int y, int w, int h)
{
+ if (!getBool("enabled", true) || isType("nasal"))
+ return;
+
setNum("__bx", x);
setNum("__by", y);
setNum("__bw", w);
// the x/y/w/h box we have calculated.
if (isType("text")) {
// puText labels are layed out to the right of the box, so
- // zero the width.
+ // zero the width. Also subtract PUSTR_RGAP from the x
+ // coordinate to compensate for the added gap between the
+ // label and its empty puObject.
+ x -= 5;
w = 0;
} else if (isType("input") || isType("combo") || isType("select")) {
// Fix the height to a constant
if (eq(layout, "hbox" )) doHVBox(true, false);
else if(eq(layout, "vbox" )) doHVBox(true, true);
else if(eq(layout, "table")) doTable(true);
- } else if(isType("hrule"))
- doHVBox(true, false);
- else if(isType("vrule"))
- doHVBox(true, true);
+ }
}
// Convention: the "A" cooridinate refers to the major axis of the
int nEq = 0, eqA = 0, eqB = 0, eqTotalA = 0;
for(i=0; i<nc; i++) {
LayoutWidget child = getChild(i);
+ if (!child.getBool("enabled", true))
+ continue;
+
int a, b;
child.calcPrefSize(vertical ? &b : &a, vertical ? &a : &b);
if(doLayout) prefA[i] = a;
// from top to bottom instead of along the cartesian Y axis.
int idx = vertical ? (nc-i-1) : i;
LayoutWidget child = getChild(idx);
+ if (!child.getBool("enabled", true))
+ continue;
+
if(child.getBool("equal")) {
int pad = child.padding();
prefA[idx] = eqA + 2*pad;
int total = 0;
for(j=0; j<cell->rspan; j++)
total += rowSizes[cell->row + j];
- int extra = total - cell->h;
+ int extra = cell->h - total;
if(extra > 0) {
for(j=0; j<cell->rspan; j++) {
int chunk = extra / (cell->rspan - j);
int total = 0;
for(j=0; j<cell->cspan; j++)
total += colSizes[cell->col + j];
- int extra = total - cell->w;
+ int extra = cell->w - total;
if(extra > 0) {
for(j=0; j<cell->cspan; j++) {
int chunk = extra / (cell->cspan - j);