summaryrefslogtreecommitdiffstats
path: root/khtml/rendering/table_layout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'khtml/rendering/table_layout.cpp')
-rw-r--r--khtml/rendering/table_layout.cpp282
1 files changed, 141 insertions, 141 deletions
diff --git a/khtml/rendering/table_layout.cpp b/khtml/rendering/table_layout.cpp
index 7b5215d02..a9c40a272 100644
--- a/khtml/rendering/table_layout.cpp
+++ b/khtml/rendering/table_layout.cpp
@@ -32,19 +32,19 @@ using namespace khtml;
/*
The text below is from the CSS 2.1 specs.
- Fixed table layout
+ Fixed table tqlayout
------------------
- With this (fast) algorithm, the horizontal layout of the table does
+ With this (fast) algorithm, the horizontal tqlayout of the table does
not depend on the contents of the cells; it only depends on the
table's width, the width of the columns, and borders or cell
spacing.
The table's width may be specified explicitly with the 'width'
property. A value of 'auto' (for both 'display: table' and 'display:
- inline-table') means use the automatic table layout algorithm.
+ inline-table') means use the automatic table tqlayout algorithm.
- In the fixed table layout algorithm, the width of each column is
+ In the fixed table tqlayout algorithm, the width of each column is
determined as follows:
1. A column element with a value other than 'auto' for the 'width'
@@ -73,7 +73,7 @@ using namespace khtml;
_____________________________________________________
This is not quite true when comparing to IE. IE always honors
- table-layout:fixed and treats a variable table width as 100%. Makes
+ table-tqlayout:fixed and treats a variable table width as 100%. Makes
a lot of sense, and is implemented here the same way.
*/
@@ -223,7 +223,7 @@ int FixedTableLayout::calcWidthArray()
void FixedTableLayout::calcMinMaxWidth()
{
// we might want to wait until we have all of the first row before
- // layouting for the first time.
+ // tqlayouting for the first time.
// only need to calculate the minimum width as the sum of the
// cols/cells with a fixed width.
@@ -258,13 +258,13 @@ void FixedTableLayout::calcMinMaxWidth()
#endif
}
-void FixedTableLayout::layout()
+void FixedTableLayout::tqlayout()
{
int tableWidth = table->width() - table->bordersPaddingAndSpacing();
int available = tableWidth;
int nEffCols = table->numEffCols();
#ifdef DEBUG_LAYOUT
- qDebug("FixedTableLayout::layout: tableWidth=%d, numEffCols=%d", tableWidth, nEffCols);
+ qDebug("FixedTableLayout::tqlayout: tableWidth=%d, numEffCols=%d", tableWidth, nEffCols);
#endif
@@ -293,7 +293,7 @@ void FixedTableLayout::layout()
base = available;
#ifdef DEBUG_LAYOUT
- qDebug("FixedTableLayout::layout: assigning percent width, base=%d, totalPercent=%d", base, totalPercent);
+ qDebug("FixedTableLayout::tqlayout: assigning percent width, base=%d, totalPercent=%d", base, totalPercent);
#endif
for ( int i = 0; available > 0 && i < nEffCols; i++ ) {
if ( width[i].isPercent() ) {
@@ -369,13 +369,13 @@ AutoTableLayout::~AutoTableLayout()
{
}
-/* recalculates the full structure needed to do layouting and minmax calculations.
+/* recalculates the full structure needed to do tqlayouting and minmax calculations.
This is usually calculated on the fly, but needs to be done fully when table cells change
dynamically
*/
void AutoTableLayout::recalcColumn( int effCol )
{
- Layout &l = layoutStruct[effCol];
+ Layout &l = tqlayoutStruct[effCol];
RenderObject *child = table->firstChild();
// first we iterate over all rows.
@@ -478,8 +478,8 @@ void AutoTableLayout::fullRecalc()
effWidthDirty = true;
int nEffCols = table->numEffCols();
- layoutStruct.resize( nEffCols );
- layoutStruct.fill( Layout() );
+ tqlayoutStruct.resize( nEffCols );
+ tqlayoutStruct.fill( Layout() );
spanCells.fill( 0 );
RenderObject *child = table->firstChild();
@@ -504,9 +504,9 @@ void AutoTableLayout::fullRecalc()
#endif
if ( !w.isVariable() && span == 1 && cEffCol < nEffCols ) {
if ( table->spanOfEffCol( cEffCol ) == 1 ) {
- layoutStruct[cEffCol].width = w;
- if (w.isFixed() && layoutStruct[cEffCol].maxWidth < w.value())
- layoutStruct[cEffCol].maxWidth = w.value();
+ tqlayoutStruct[cEffCol].width = w;
+ if (w.isFixed() && tqlayoutStruct[cEffCol].maxWidth < w.value())
+ tqlayoutStruct[cEffCol].maxWidth = w.value();
}
}
cCol += span;
@@ -577,16 +577,16 @@ void AutoTableLayout::calcMinMaxWidth()
int maxNonPercent = 0;
int remainingPercent = 100;
- for ( unsigned int i = 0; i < layoutStruct.size(); i++ ) {
- minWidth += layoutStruct[i].effMinWidth;
- maxWidth += layoutStruct[i].effMaxWidth;
- if ( layoutStruct[i].effWidth.isPercent() ) {
- int percent = kMin(layoutStruct[i].effWidth.value(), remainingPercent);
- int pw = ( layoutStruct[i].effMaxWidth * 100) / kMax(percent, 1);
+ for ( unsigned int i = 0; i < tqlayoutStruct.size(); i++ ) {
+ minWidth += tqlayoutStruct[i].effMinWidth;
+ maxWidth += tqlayoutStruct[i].effMaxWidth;
+ if ( tqlayoutStruct[i].effWidth.isPercent() ) {
+ int percent = kMin(tqlayoutStruct[i].effWidth.value(), remainingPercent);
+ int pw = ( tqlayoutStruct[i].effMaxWidth * 100) / kMax(percent, 1);
remainingPercent -= percent;
maxPercent = kMax( pw, maxPercent );
} else {
- maxNonPercent += layoutStruct[i].effMaxWidth;
+ maxNonPercent += tqlayoutStruct[i].effMaxWidth;
}
}
@@ -624,15 +624,15 @@ int AutoTableLayout::calcEffectiveWidth()
{
int tMaxWidth = 0;
- unsigned int nEffCols = layoutStruct.size();
+ unsigned int nEffCols = tqlayoutStruct.size();
int hspacing = table->borderHSpacing();
#ifdef DEBUG_LAYOUT
qDebug("AutoTableLayout::calcEffectiveWidth for %d cols", nEffCols );
#endif
for ( unsigned int i = 0; i < nEffCols; i++ ) {
- layoutStruct[i].effWidth = layoutStruct[i].width;
- layoutStruct[i].effMinWidth = layoutStruct[i].minWidth;
- layoutStruct[i].effMaxWidth = layoutStruct[i].maxWidth;
+ tqlayoutStruct[i].effWidth = tqlayoutStruct[i].width;
+ tqlayoutStruct[i].effMinWidth = tqlayoutStruct[i].minWidth;
+ tqlayoutStruct[i].effMaxWidth = tqlayoutStruct[i].maxWidth;
}
for ( unsigned int i = 0; i < spanCells.size(); i++ ) {
@@ -660,14 +660,14 @@ int AutoTableLayout::calcEffectiveWidth()
int cSpan = span;
#endif
while ( lastCol < nEffCols && span > 0 ) {
- switch( layoutStruct[lastCol].width.type() ) {
+ switch( tqlayoutStruct[lastCol].width.type() ) {
case Percent:
- totalPercent += layoutStruct[lastCol].width.value();
+ totalPercent += tqlayoutStruct[lastCol].width.value();
allColsAreFixed = false;
break;
case Fixed:
- if (layoutStruct[lastCol].width.value() > 0) {
- fixedWidth += layoutStruct[lastCol].width.value();
+ if (tqlayoutStruct[lastCol].width.value() > 0) {
+ fixedWidth += tqlayoutStruct[lastCol].width.value();
allColsArePercent = false;
// IE resets effWidth to Variable here, but this breaks the konqueror about page and seems to be some bad
// legacy behavior anyway. mozilla doesn't do this so I decided we don't either.
@@ -685,17 +685,17 @@ int AutoTableLayout::calcEffectiveWidth()
// <tr><td>1</td><td colspan=2>2-3</tr>
// <tr><td>1</td><td colspan=2 width=100%>2-3</td></tr>
// </table>
- if (!layoutStruct[lastCol].effWidth.isPercent()) {
- layoutStruct[lastCol].effWidth = Length();
+ if (!tqlayoutStruct[lastCol].effWidth.isPercent()) {
+ tqlayoutStruct[lastCol].effWidth = Length();
allColsArePercent = false;
}
else
- totalPercent += layoutStruct[lastCol].effWidth.value();
+ totalPercent += tqlayoutStruct[lastCol].effWidth.value();
allColsAreFixed = false;
}
span -= table->spanOfEffCol( lastCol );
- minWidth += layoutStruct[lastCol].effMinWidth;
- maxWidth += layoutStruct[lastCol].effMaxWidth;
+ minWidth += tqlayoutStruct[lastCol].effMinWidth;
+ maxWidth += tqlayoutStruct[lastCol].effMaxWidth;
lastCol++;
cMinWidth -= hspacing;
cMaxWidth -= hspacing;
@@ -720,22 +720,22 @@ int AutoTableLayout::calcEffectiveWidth()
int percentMissing = w.value() - totalPercent;
int totalWidth = 0;
for ( unsigned int pos = col; pos < lastCol; pos++ ) {
- if ( !(layoutStruct[pos].width.isPercent() ) )
- totalWidth += layoutStruct[pos].effMaxWidth;
+ if ( !(tqlayoutStruct[pos].width.isPercent() ) )
+ totalWidth += tqlayoutStruct[pos].effMaxWidth;
}
for ( unsigned int pos = col; pos < lastCol && totalWidth > 0; pos++ ) {
- if ( !(layoutStruct[pos].width.isPercent() ) ) {
- int percent = percentMissing * layoutStruct[pos].effMaxWidth / totalWidth;
+ if ( !(tqlayoutStruct[pos].width.isPercent() ) ) {
+ int percent = percentMissing * tqlayoutStruct[pos].effMaxWidth / totalWidth;
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: setting percent value %d effMaxWidth=%d totalWidth=%d", pos, percent, layoutStruct[pos].effMaxWidth, totalWidth );
+ qDebug(" col %d: setting percent value %d effMaxWidth=%d totalWidth=%d", pos, percent, tqlayoutStruct[pos].effMaxWidth, totalWidth );
#endif
- totalWidth -= layoutStruct[pos].effMaxWidth;
+ totalWidth -= tqlayoutStruct[pos].effMaxWidth;
percentMissing -= percent;
if ( percent > 0 )
- layoutStruct[pos].effWidth = Length( percent, Percent );
+ tqlayoutStruct[pos].effWidth = Length( percent, Percent );
else
- layoutStruct[pos].effWidth = Length();
+ tqlayoutStruct[pos].effWidth = Length();
}
}
@@ -749,13 +749,13 @@ int AutoTableLayout::calcEffectiveWidth()
qDebug("extending minWidth of cols %d-%d to %dpx currentMin=%d accroding to fixed sum %d", col, lastCol-1, cMinWidth, minWidth, fixedWidth );
#endif
for ( unsigned int pos = col; fixedWidth > 0 && pos < lastCol; pos++ ) {
- int w = kMax( int( layoutStruct[pos].effMinWidth ), cMinWidth * layoutStruct[pos].width.value() / fixedWidth );
+ int w = kMax( int( tqlayoutStruct[pos].effMinWidth ), cMinWidth * tqlayoutStruct[pos].width.value() / fixedWidth );
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, layoutStruct[pos].effMinWidth, layoutStruct[pos].effMinWidth, w );
+ qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, tqlayoutStruct[pos].effMinWidth, tqlayoutStruct[pos].effMinWidth, w );
#endif
- fixedWidth -= layoutStruct[pos].width.value();
+ fixedWidth -= tqlayoutStruct[pos].width.value();
cMinWidth -= w;
- layoutStruct[pos].effMinWidth = w;
+ tqlayoutStruct[pos].effMinWidth = w;
}
} else if ( allColsArePercent ) {
@@ -764,17 +764,17 @@ int AutoTableLayout::calcEffectiveWidth()
int cminw = cMinWidth;
for ( unsigned int pos = col; maxw > 0 && pos < lastCol; pos++ ) {
- if ( layoutStruct[pos].effWidth.isPercent() && layoutStruct[pos].effWidth.value()>0 && fixedWidth <= cMinWidth) {
- int w = layoutStruct[pos].effMinWidth;
- w = kMax( w, cminw*layoutStruct[pos].effWidth.value()/totalPercent );
- w = kMin(layoutStruct[pos].effMinWidth+(cMinWidth-minw), w);
+ if ( tqlayoutStruct[pos].effWidth.isPercent() && tqlayoutStruct[pos].effWidth.value()>0 && fixedWidth <= cMinWidth) {
+ int w = tqlayoutStruct[pos].effMinWidth;
+ w = kMax( w, cminw*tqlayoutStruct[pos].effWidth.value()/totalPercent );
+ w = kMin(tqlayoutStruct[pos].effMinWidth+(cMinWidth-minw), w);
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, layoutStruct[pos].effMinWidth, layoutStruct[pos].effMinWidth, w );
+ qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, tqlayoutStruct[pos].effMinWidth, tqlayoutStruct[pos].effMinWidth, w );
#endif
- maxw -= layoutStruct[pos].effMaxWidth;
- minw -= layoutStruct[pos].effMinWidth;
+ maxw -= tqlayoutStruct[pos].effMaxWidth;
+ minw -= tqlayoutStruct[pos].effMinWidth;
cMinWidth -= w;
- layoutStruct[pos].effMinWidth = w;
+ tqlayoutStruct[pos].effMinWidth = w;
}
}
} else {
@@ -786,31 +786,31 @@ int AutoTableLayout::calcEffectiveWidth()
// Give min to variable first, to fixed second, and to others third.
for ( unsigned int pos = col; maxw > 0 && pos < lastCol; pos++ ) {
- if ( layoutStruct[pos].width.isFixed() && haveVariable && fixedWidth <= cMinWidth ) {
- int w = kMax( int( layoutStruct[pos].effMinWidth ), layoutStruct[pos].width.value() );
- fixedWidth -= layoutStruct[pos].width.value();
- minw -= layoutStruct[pos].effMinWidth;
+ if ( tqlayoutStruct[pos].width.isFixed() && haveVariable && fixedWidth <= cMinWidth ) {
+ int w = kMax( int( tqlayoutStruct[pos].effMinWidth ), tqlayoutStruct[pos].width.value() );
+ fixedWidth -= tqlayoutStruct[pos].width.value();
+ minw -= tqlayoutStruct[pos].effMinWidth;
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, layoutStruct[pos].effMinWidth, layoutStruct[pos].effMinWidth, w );
+ qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, tqlayoutStruct[pos].effMinWidth, tqlayoutStruct[pos].effMinWidth, w );
#endif
- maxw -= layoutStruct[pos].effMaxWidth;
+ maxw -= tqlayoutStruct[pos].effMaxWidth;
cMinWidth -= w;
- layoutStruct[pos].effMinWidth = w;
+ tqlayoutStruct[pos].effMinWidth = w;
}
}
for ( unsigned int pos = col; maxw > 0 && pos < lastCol && minw < cMinWidth; pos++ ) {
- if ( !(layoutStruct[pos].width.isFixed() && haveVariable && fixedWidth <= cMinWidth) ) {
- int w = kMax( int( layoutStruct[pos].effMinWidth ), cMinWidth * layoutStruct[pos].effMaxWidth / maxw );
- w = kMin(layoutStruct[pos].effMinWidth+(cMinWidth-minw), w);
+ if ( !(tqlayoutStruct[pos].width.isFixed() && haveVariable && fixedWidth <= cMinWidth) ) {
+ int w = kMax( int( tqlayoutStruct[pos].effMinWidth ), cMinWidth * tqlayoutStruct[pos].effMaxWidth / maxw );
+ w = kMin(tqlayoutStruct[pos].effMinWidth+(cMinWidth-minw), w);
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, layoutStruct[pos].effMinWidth, layoutStruct[pos].effMinWidth, w );
+ qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, tqlayoutStruct[pos].effMinWidth, tqlayoutStruct[pos].effMinWidth, w );
#endif
- maxw -= layoutStruct[pos].effMaxWidth;
- minw -= layoutStruct[pos].effMinWidth;
+ maxw -= tqlayoutStruct[pos].effMaxWidth;
+ minw -= tqlayoutStruct[pos].effMinWidth;
cMinWidth -= w;
- layoutStruct[pos].effMinWidth = w;
+ tqlayoutStruct[pos].effMinWidth = w;
}
}
}
@@ -821,18 +821,18 @@ int AutoTableLayout::calcEffectiveWidth()
qDebug("extending maxWidth of cols %d-%d to %dpx", col, lastCol-1, cMaxWidth );
#endif
for ( unsigned int pos = col; maxWidth > 0 && pos < lastCol; pos++ ) {
- int w = kMax( int( layoutStruct[pos].effMaxWidth ), cMaxWidth * layoutStruct[pos].effMaxWidth / maxWidth );
+ int w = kMax( int( tqlayoutStruct[pos].effMaxWidth ), cMaxWidth * tqlayoutStruct[pos].effMaxWidth / maxWidth );
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: max=%d, effMax=%d, new=%d", pos, layoutStruct[pos].effMaxWidth, layoutStruct[pos].effMaxWidth, w );
+ qDebug(" col %d: max=%d, effMax=%d, new=%d", pos, tqlayoutStruct[pos].effMaxWidth, tqlayoutStruct[pos].effMaxWidth, w );
#endif
- maxWidth -= layoutStruct[pos].effMaxWidth;
+ maxWidth -= tqlayoutStruct[pos].effMaxWidth;
cMaxWidth -= w;
- layoutStruct[pos].effMaxWidth = w;
+ tqlayoutStruct[pos].effMaxWidth = w;
}
}
} else {
for ( unsigned int pos = col; pos < lastCol; pos++ )
- layoutStruct[pos].maxWidth = kMax(layoutStruct[pos].maxWidth, int(layoutStruct[pos].minWidth) );
+ tqlayoutStruct[pos].maxWidth = kMax(tqlayoutStruct[pos].maxWidth, int(tqlayoutStruct[pos].minWidth) );
}
}
effWidthDirty = false;
@@ -868,20 +868,20 @@ void AutoTableLayout::insertSpanCell( RenderTableCell *cell )
}
-void AutoTableLayout::layout()
+void AutoTableLayout::tqlayout()
{
- // table layout based on the values collected in the layout structure.
+ // table tqlayout based on the values collected in the tqlayout structure.
int tableWidth = table->width() - table->bordersPaddingAndSpacing();
int available = tableWidth;
int nEffCols = table->numEffCols();
- if ( nEffCols != (int)layoutStruct.size() ) {
- qWarning("WARNING: nEffCols is not equal to layoutstruct!" );
+ if ( nEffCols != (int)tqlayoutStruct.size() ) {
+ qWarning("WARNING: nEffCols is not equal to tqlayoutstruct!" );
fullRecalc();
nEffCols = table->numEffCols();
}
#ifdef DEBUG_LAYOUT
- qDebug("AutoTableLayout::layout()");
+ qDebug("AutoTableLayout::tqlayout()");
#endif
if ( effWidthDirty )
@@ -891,11 +891,11 @@ void AutoTableLayout::layout()
qDebug(" tableWidth=%d, nEffCols=%d", tableWidth, nEffCols );
for ( int i = 0; i < nEffCols; i++ ) {
qDebug(" effcol %d is of type %d value %d, minWidth=%d, maxWidth=%d",
- i, layoutStruct[i].width.type(), layoutStruct[i].width.value(),
- layoutStruct[i].minWidth, layoutStruct[i].maxWidth );
+ i, tqlayoutStruct[i].width.type(), tqlayoutStruct[i].width.value(),
+ tqlayoutStruct[i].minWidth, tqlayoutStruct[i].maxWidth );
qDebug(" effective: type %d value %d, minWidth=%d, maxWidth=%d",
- layoutStruct[i].effWidth.type(), layoutStruct[i].effWidth.value(),
- layoutStruct[i].effMinWidth, layoutStruct[i].effMaxWidth );
+ tqlayoutStruct[i].effWidth.type(), tqlayoutStruct[i].effWidth.value(),
+ tqlayoutStruct[i].effMinWidth, tqlayoutStruct[i].effMaxWidth );
}
#endif
@@ -911,10 +911,10 @@ void AutoTableLayout::layout()
// fill up every cell with it's minWidth
for ( int i = 0; i < nEffCols; i++ ) {
- int w = layoutStruct[i].effMinWidth;
- layoutStruct[i].calcWidth = w;
+ int w = tqlayoutStruct[i].effMinWidth;
+ tqlayoutStruct[i].calcWidth = w;
available -= w;
- Length& width = layoutStruct[i].effWidth;
+ Length& width = tqlayoutStruct[i].effWidth;
switch( width.type()) {
case Percent:
havePercent = true;
@@ -926,13 +926,13 @@ void AutoTableLayout::layout()
break;
case Fixed:
numFixed++;
- totalFixed += layoutStruct[i].effMaxWidth;
+ totalFixed += tqlayoutStruct[i].effMaxWidth;
// fall through
break;
case Variable:
case Static:
numVariable++;
- totalVariable += layoutStruct[i].effMaxWidth;
+ totalVariable += tqlayoutStruct[i].effMaxWidth;
allocVariable += w;
}
}
@@ -940,25 +940,25 @@ void AutoTableLayout::layout()
// allocate width to percent cols
if ( available > 0 && havePercent ) {
for ( int i = 0; i < nEffCols; i++ ) {
- const Length &width = layoutStruct[i].effWidth;
+ const Length &width = tqlayoutStruct[i].effWidth;
if ( width.isPercent() ) {
- int w = kMax ( int( layoutStruct[i].effMinWidth ), width.minWidth( tableWidth ) );
- available += layoutStruct[i].calcWidth - w;
- layoutStruct[i].calcWidth = w;
+ int w = kMax ( int( tqlayoutStruct[i].effMinWidth ), width.minWidth( tableWidth ) );
+ available += tqlayoutStruct[i].calcWidth - w;
+ tqlayoutStruct[i].calcWidth = w;
}
}
if ( totalPercent > 100 ) {
// remove overallocated space from the last columns
int excess = tableWidth*(totalPercent-100)/100;
for ( int i = nEffCols-1; i >= 0; i-- ) {
- if ( layoutStruct[i].effWidth.isPercent() ) {
- int w = layoutStruct[i].calcWidth;
+ if ( tqlayoutStruct[i].effWidth.isPercent() ) {
+ int w = tqlayoutStruct[i].calcWidth;
int reduction = kMin( w, excess );
// the lines below might look inconsistent, but that's the way it's handled in mozilla
excess -= reduction;
- int newWidth = kMax( int (layoutStruct[i].effMinWidth), w - reduction );
+ int newWidth = kMax( int (tqlayoutStruct[i].effMinWidth), w - reduction );
available += w - newWidth;
- layoutStruct[i].calcWidth = newWidth;
+ tqlayoutStruct[i].calcWidth = newWidth;
//qDebug("col %d: reducing to %d px (reduction=%d)", i, newWidth, reduction );
}
}
@@ -971,10 +971,10 @@ void AutoTableLayout::layout()
// then allocate width to fixed cols
if ( available > 0 ) {
for ( int i = 0; i < nEffCols; ++i ) {
- const Length &width = layoutStruct[i].effWidth;
- if ( width.isFixed() && width.value() > layoutStruct[i].calcWidth ) {
- available += layoutStruct[i].calcWidth - width.value();
- layoutStruct[i].calcWidth = width.value();
+ const Length &width = tqlayoutStruct[i].effWidth;
+ if ( width.isFixed() && width.value() > tqlayoutStruct[i].calcWidth ) {
+ available += tqlayoutStruct[i].calcWidth - width.value();
+ tqlayoutStruct[i].calcWidth = width.value();
}
}
}
@@ -985,12 +985,12 @@ void AutoTableLayout::layout()
// now satisfy relative
if ( available > 0 ) {
for ( int i = 0; i < nEffCols; i++ ) {
- const Length &width = layoutStruct[i].effWidth;
+ const Length &width = tqlayoutStruct[i].effWidth;
if ( width.isRelative() && width.value() ) {
// width=0* gets effMinWidth.
int w = width.value()*tableWidth/totalRelative;
- available += layoutStruct[i].calcWidth - w;
- layoutStruct[i].calcWidth = w;
+ available += tqlayoutStruct[i].calcWidth - w;
+ tqlayoutStruct[i].calcWidth = w;
}
}
}
@@ -1000,13 +1000,13 @@ void AutoTableLayout::layout()
available += allocVariable; // this gets redistributed
//qDebug("redistributing %dpx to %d variable columns. totalVariable=%d", available, numVariable, totalVariable );
for ( int i = 0; i < nEffCols; i++ ) {
- const Length &width = layoutStruct[i].effWidth;
+ const Length &width = tqlayoutStruct[i].effWidth;
if ( width.isVariable() && totalVariable != 0 ) {
- int w = kMax( int ( layoutStruct[i].calcWidth ),
- available * layoutStruct[i].effMaxWidth / totalVariable );
+ int w = kMax( int ( tqlayoutStruct[i].calcWidth ),
+ available * tqlayoutStruct[i].effMaxWidth / totalVariable );
available -= w;
- totalVariable -= layoutStruct[i].effMaxWidth;
- layoutStruct[i].calcWidth = w;
+ totalVariable -= tqlayoutStruct[i].effMaxWidth;
+ tqlayoutStruct[i].calcWidth = w;
}
}
}
@@ -1018,12 +1018,12 @@ void AutoTableLayout::layout()
if ( available > 0 && numFixed) {
// still have some width to spread, distribute to fixed columns
for ( int i = 0; i < nEffCols; i++ ) {
- const Length &width = layoutStruct[i].effWidth;
+ const Length &width = tqlayoutStruct[i].effWidth;
if ( width.isFixed() ) {
- int w = available * layoutStruct[i].effMaxWidth / totalFixed;
+ int w = available * tqlayoutStruct[i].effMaxWidth / totalFixed;
available -= w;
- totalFixed -= layoutStruct[i].effMaxWidth;
- layoutStruct[i].calcWidth += w;
+ totalFixed -= tqlayoutStruct[i].effMaxWidth;
+ tqlayoutStruct[i].calcWidth += w;
}
}
}
@@ -1036,12 +1036,12 @@ void AutoTableLayout::layout()
if ( available > 0 && hasPercent && totalPercent < 100) {
// still have some width to spread, distribute weighted to percent columns
for ( int i = 0; i < nEffCols; i++ ) {
- const Length &width = layoutStruct[i].effWidth;
+ const Length &width = tqlayoutStruct[i].effWidth;
if ( width.isPercent() ) {
int w = available * width.value() / totalPercent;
available -= w;
totalPercent -= width.value();
- layoutStruct[i].calcWidth += w;
+ tqlayoutStruct[i].calcWidth += w;
if (!available || !totalPercent) break;
}
}
@@ -1060,7 +1060,7 @@ void AutoTableLayout::layout()
int w = available / total;
available -= w;
total--;
- layoutStruct[i].calcWidth += w;
+ tqlayoutStruct[i].calcWidth += w;
}
}
@@ -1079,17 +1079,17 @@ void AutoTableLayout::layout()
if (available < 0) {
int mw = 0;
for ( int i = nEffCols-1; i >= 0; i-- ) {
- Length &width = layoutStruct[i].effWidth;
+ Length &width = tqlayoutStruct[i].effWidth;
if (width.isVariable())
- mw += layoutStruct[i].calcWidth - layoutStruct[i].effMinWidth;
+ mw += tqlayoutStruct[i].calcWidth - tqlayoutStruct[i].effMinWidth;
}
for ( int i = nEffCols-1; i >= 0 && mw > 0; i-- ) {
- Length &width = layoutStruct[i].effWidth;
+ Length &width = tqlayoutStruct[i].effWidth;
if (width.isVariable()) {
- int minMaxDiff = layoutStruct[i].calcWidth-layoutStruct[i].effMinWidth;
+ int minMaxDiff = tqlayoutStruct[i].calcWidth-tqlayoutStruct[i].effMinWidth;
int reduce = available * minMaxDiff / mw;
- layoutStruct[i].calcWidth += reduce;
+ tqlayoutStruct[i].calcWidth += reduce;
available -= reduce;
mw -= minMaxDiff;
if ( available >= 0 )
@@ -1101,17 +1101,17 @@ void AutoTableLayout::layout()
if (available < 0) {
int mw = 0;
for ( int i = nEffCols-1; i >= 0; i-- ) {
- Length &width = layoutStruct[i].effWidth;
+ Length &width = tqlayoutStruct[i].effWidth;
if (width.isRelative())
- mw += layoutStruct[i].calcWidth - layoutStruct[i].effMinWidth;
+ mw += tqlayoutStruct[i].calcWidth - tqlayoutStruct[i].effMinWidth;
}
for ( int i = nEffCols-1; i >= 0 && mw > 0; i-- ) {
- Length &width = layoutStruct[i].effWidth;
+ Length &width = tqlayoutStruct[i].effWidth;
if (width.isRelative()) {
- int minMaxDiff = layoutStruct[i].calcWidth-layoutStruct[i].effMinWidth;
+ int minMaxDiff = tqlayoutStruct[i].calcWidth-tqlayoutStruct[i].effMinWidth;
int reduce = available * minMaxDiff / mw;
- layoutStruct[i].calcWidth += reduce;
+ tqlayoutStruct[i].calcWidth += reduce;
available -= reduce;
mw -= minMaxDiff;
if ( available >= 0 )
@@ -1123,17 +1123,17 @@ void AutoTableLayout::layout()
if (available < 0) {
int mw = 0;
for ( int i = nEffCols-1; i >= 0; i-- ) {
- Length &width = layoutStruct[i].effWidth;
+ Length &width = tqlayoutStruct[i].effWidth;
if (width.isFixed())
- mw += layoutStruct[i].calcWidth - layoutStruct[i].effMinWidth;
+ mw += tqlayoutStruct[i].calcWidth - tqlayoutStruct[i].effMinWidth;
}
for ( int i = nEffCols-1; i >= 0 && mw > 0; i-- ) {
- Length &width = layoutStruct[i].effWidth;
+ Length &width = tqlayoutStruct[i].effWidth;
if (width.isFixed()) {
- int minMaxDiff = layoutStruct[i].calcWidth-layoutStruct[i].effMinWidth;
+ int minMaxDiff = tqlayoutStruct[i].calcWidth-tqlayoutStruct[i].effMinWidth;
int reduce = available * minMaxDiff / mw;
- layoutStruct[i].calcWidth += reduce;
+ tqlayoutStruct[i].calcWidth += reduce;
available -= reduce;
mw -= minMaxDiff;
if ( available >= 0 )
@@ -1145,17 +1145,17 @@ void AutoTableLayout::layout()
if (available < 0) {
int mw = 0;
for ( int i = nEffCols-1; i >= 0; i-- ) {
- Length &width = layoutStruct[i].effWidth;
+ Length &width = tqlayoutStruct[i].effWidth;
if (width.isPercent())
- mw += layoutStruct[i].calcWidth - layoutStruct[i].effMinWidth;
+ mw += tqlayoutStruct[i].calcWidth - tqlayoutStruct[i].effMinWidth;
}
for ( int i = nEffCols-1; i >= 0 && mw > 0; i-- ) {
- Length &width = layoutStruct[i].effWidth;
+ Length &width = tqlayoutStruct[i].effWidth;
if (width.isPercent()) {
- int minMaxDiff = layoutStruct[i].calcWidth-layoutStruct[i].effMinWidth;
+ int minMaxDiff = tqlayoutStruct[i].calcWidth-tqlayoutStruct[i].effMinWidth;
int reduce = available * minMaxDiff / mw;
- layoutStruct[i].calcWidth += reduce;
+ tqlayoutStruct[i].calcWidth += reduce;
available -= reduce;
mw -= minMaxDiff;
if ( available >= 0 )
@@ -1170,10 +1170,10 @@ void AutoTableLayout::layout()
int pos = 0;
for ( int i = 0; i < nEffCols; i++ ) {
#ifdef DEBUG_LAYOUT
- qDebug("col %d: %d (width %d)", i, pos, layoutStruct[i].calcWidth );
+ qDebug("col %d: %d (width %d)", i, pos, tqlayoutStruct[i].calcWidth );
#endif
table->columnPos[i] = pos;
- pos += layoutStruct[i].calcWidth + table->borderHSpacing();
+ pos += tqlayoutStruct[i].calcWidth + table->borderHSpacing();
}
table->columnPos[table->columnPos.size()-1] = pos;
@@ -1183,9 +1183,9 @@ void AutoTableLayout::layout()
void AutoTableLayout::calcPercentages() const
{
total_percent = 0;
- for ( unsigned int i = 0; i < layoutStruct.size(); i++ ) {
- if ( layoutStruct[i].width.isPercent() )
- total_percent += layoutStruct[i].width.value();
+ for ( unsigned int i = 0; i < tqlayoutStruct.size(); i++ ) {
+ if ( tqlayoutStruct[i].width.isPercent() )
+ total_percent += tqlayoutStruct[i].width.value();
}
percentagesDirty = false;
}