summaryrefslogtreecommitdiffstats
path: root/khtml/rendering/table_layout.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-07 03:45:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-07 03:45:53 +0000
commit10308be19ef7fa44699562cc75946e7ea1fdf6b9 (patch)
tree4bc444c00a79e88105f2cfce5b6209994c413ca0 /khtml/rendering/table_layout.cpp
parent307136d8eef0ba133b78ceee8e901138d4c996a1 (diff)
downloadtdelibs-10308be19ef7fa44699562cc75946e7ea1fdf6b9.tar.gz
tdelibs-10308be19ef7fa44699562cc75946e7ea1fdf6b9.zip
Revert automated changes
Sorry guys, they are just not ready for prime time Work will continue as always git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1212479 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
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 a9c40a272..7b5215d02 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 tqlayout
+ Fixed table layout
------------------
- With this (fast) algorithm, the horizontal tqlayout of the table does
+ With this (fast) algorithm, the horizontal layout 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 tqlayout algorithm.
+ inline-table') means use the automatic table layout algorithm.
- In the fixed table tqlayout algorithm, the width of each column is
+ In the fixed table layout 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-tqlayout:fixed and treats a variable table width as 100%. Makes
+ table-layout: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
- // tqlayouting for the first time.
+ // layouting 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::tqlayout()
+void FixedTableLayout::layout()
{
int tableWidth = table->width() - table->bordersPaddingAndSpacing();
int available = tableWidth;
int nEffCols = table->numEffCols();
#ifdef DEBUG_LAYOUT
- qDebug("FixedTableLayout::tqlayout: tableWidth=%d, numEffCols=%d", tableWidth, nEffCols);
+ qDebug("FixedTableLayout::layout: tableWidth=%d, numEffCols=%d", tableWidth, nEffCols);
#endif
@@ -293,7 +293,7 @@ void FixedTableLayout::tqlayout()
base = available;
#ifdef DEBUG_LAYOUT
- qDebug("FixedTableLayout::tqlayout: assigning percent width, base=%d, totalPercent=%d", base, totalPercent);
+ qDebug("FixedTableLayout::layout: 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 tqlayouting and minmax calculations.
+/* recalculates the full structure needed to do layouting 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 = tqlayoutStruct[effCol];
+ Layout &l = layoutStruct[effCol];
RenderObject *child = table->firstChild();
// first we iterate over all rows.
@@ -478,8 +478,8 @@ void AutoTableLayout::fullRecalc()
effWidthDirty = true;
int nEffCols = table->numEffCols();
- tqlayoutStruct.resize( nEffCols );
- tqlayoutStruct.fill( Layout() );
+ layoutStruct.resize( nEffCols );
+ layoutStruct.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 ) {
- tqlayoutStruct[cEffCol].width = w;
- if (w.isFixed() && tqlayoutStruct[cEffCol].maxWidth < w.value())
- tqlayoutStruct[cEffCol].maxWidth = w.value();
+ layoutStruct[cEffCol].width = w;
+ if (w.isFixed() && layoutStruct[cEffCol].maxWidth < w.value())
+ layoutStruct[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 < 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);
+ 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);
remainingPercent -= percent;
maxPercent = kMax( pw, maxPercent );
} else {
- maxNonPercent += tqlayoutStruct[i].effMaxWidth;
+ maxNonPercent += layoutStruct[i].effMaxWidth;
}
}
@@ -624,15 +624,15 @@ int AutoTableLayout::calcEffectiveWidth()
{
int tMaxWidth = 0;
- unsigned int nEffCols = tqlayoutStruct.size();
+ unsigned int nEffCols = layoutStruct.size();
int hspacing = table->borderHSpacing();
#ifdef DEBUG_LAYOUT
qDebug("AutoTableLayout::calcEffectiveWidth for %d cols", nEffCols );
#endif
for ( unsigned int i = 0; i < nEffCols; i++ ) {
- tqlayoutStruct[i].effWidth = tqlayoutStruct[i].width;
- tqlayoutStruct[i].effMinWidth = tqlayoutStruct[i].minWidth;
- tqlayoutStruct[i].effMaxWidth = tqlayoutStruct[i].maxWidth;
+ layoutStruct[i].effWidth = layoutStruct[i].width;
+ layoutStruct[i].effMinWidth = layoutStruct[i].minWidth;
+ layoutStruct[i].effMaxWidth = layoutStruct[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( tqlayoutStruct[lastCol].width.type() ) {
+ switch( layoutStruct[lastCol].width.type() ) {
case Percent:
- totalPercent += tqlayoutStruct[lastCol].width.value();
+ totalPercent += layoutStruct[lastCol].width.value();
allColsAreFixed = false;
break;
case Fixed:
- if (tqlayoutStruct[lastCol].width.value() > 0) {
- fixedWidth += tqlayoutStruct[lastCol].width.value();
+ if (layoutStruct[lastCol].width.value() > 0) {
+ fixedWidth += layoutStruct[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 (!tqlayoutStruct[lastCol].effWidth.isPercent()) {
- tqlayoutStruct[lastCol].effWidth = Length();
+ if (!layoutStruct[lastCol].effWidth.isPercent()) {
+ layoutStruct[lastCol].effWidth = Length();
allColsArePercent = false;
}
else
- totalPercent += tqlayoutStruct[lastCol].effWidth.value();
+ totalPercent += layoutStruct[lastCol].effWidth.value();
allColsAreFixed = false;
}
span -= table->spanOfEffCol( lastCol );
- minWidth += tqlayoutStruct[lastCol].effMinWidth;
- maxWidth += tqlayoutStruct[lastCol].effMaxWidth;
+ minWidth += layoutStruct[lastCol].effMinWidth;
+ maxWidth += layoutStruct[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 ( !(tqlayoutStruct[pos].width.isPercent() ) )
- totalWidth += tqlayoutStruct[pos].effMaxWidth;
+ if ( !(layoutStruct[pos].width.isPercent() ) )
+ totalWidth += layoutStruct[pos].effMaxWidth;
}
for ( unsigned int pos = col; pos < lastCol && totalWidth > 0; pos++ ) {
- if ( !(tqlayoutStruct[pos].width.isPercent() ) ) {
- int percent = percentMissing * tqlayoutStruct[pos].effMaxWidth / totalWidth;
+ if ( !(layoutStruct[pos].width.isPercent() ) ) {
+ int percent = percentMissing * layoutStruct[pos].effMaxWidth / totalWidth;
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: setting percent value %d effMaxWidth=%d totalWidth=%d", pos, percent, tqlayoutStruct[pos].effMaxWidth, totalWidth );
+ qDebug(" col %d: setting percent value %d effMaxWidth=%d totalWidth=%d", pos, percent, layoutStruct[pos].effMaxWidth, totalWidth );
#endif
- totalWidth -= tqlayoutStruct[pos].effMaxWidth;
+ totalWidth -= layoutStruct[pos].effMaxWidth;
percentMissing -= percent;
if ( percent > 0 )
- tqlayoutStruct[pos].effWidth = Length( percent, Percent );
+ layoutStruct[pos].effWidth = Length( percent, Percent );
else
- tqlayoutStruct[pos].effWidth = Length();
+ layoutStruct[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( tqlayoutStruct[pos].effMinWidth ), cMinWidth * tqlayoutStruct[pos].width.value() / fixedWidth );
+ int w = kMax( int( layoutStruct[pos].effMinWidth ), cMinWidth * layoutStruct[pos].width.value() / fixedWidth );
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, tqlayoutStruct[pos].effMinWidth, tqlayoutStruct[pos].effMinWidth, w );
+ qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, layoutStruct[pos].effMinWidth, layoutStruct[pos].effMinWidth, w );
#endif
- fixedWidth -= tqlayoutStruct[pos].width.value();
+ fixedWidth -= layoutStruct[pos].width.value();
cMinWidth -= w;
- tqlayoutStruct[pos].effMinWidth = w;
+ layoutStruct[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 ( 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);
+ 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);
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, tqlayoutStruct[pos].effMinWidth, tqlayoutStruct[pos].effMinWidth, w );
+ qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, layoutStruct[pos].effMinWidth, layoutStruct[pos].effMinWidth, w );
#endif
- maxw -= tqlayoutStruct[pos].effMaxWidth;
- minw -= tqlayoutStruct[pos].effMinWidth;
+ maxw -= layoutStruct[pos].effMaxWidth;
+ minw -= layoutStruct[pos].effMinWidth;
cMinWidth -= w;
- tqlayoutStruct[pos].effMinWidth = w;
+ layoutStruct[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 ( 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;
+ 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;
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, tqlayoutStruct[pos].effMinWidth, tqlayoutStruct[pos].effMinWidth, w );
+ qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, layoutStruct[pos].effMinWidth, layoutStruct[pos].effMinWidth, w );
#endif
- maxw -= tqlayoutStruct[pos].effMaxWidth;
+ maxw -= layoutStruct[pos].effMaxWidth;
cMinWidth -= w;
- tqlayoutStruct[pos].effMinWidth = w;
+ layoutStruct[pos].effMinWidth = w;
}
}
for ( unsigned int pos = col; maxw > 0 && pos < lastCol && minw < cMinWidth; pos++ ) {
- 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);
+ 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);
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, tqlayoutStruct[pos].effMinWidth, tqlayoutStruct[pos].effMinWidth, w );
+ qDebug(" col %d: min=%d, effMin=%d, new=%d", pos, layoutStruct[pos].effMinWidth, layoutStruct[pos].effMinWidth, w );
#endif
- maxw -= tqlayoutStruct[pos].effMaxWidth;
- minw -= tqlayoutStruct[pos].effMinWidth;
+ maxw -= layoutStruct[pos].effMaxWidth;
+ minw -= layoutStruct[pos].effMinWidth;
cMinWidth -= w;
- tqlayoutStruct[pos].effMinWidth = w;
+ layoutStruct[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( tqlayoutStruct[pos].effMaxWidth ), cMaxWidth * tqlayoutStruct[pos].effMaxWidth / maxWidth );
+ int w = kMax( int( layoutStruct[pos].effMaxWidth ), cMaxWidth * layoutStruct[pos].effMaxWidth / maxWidth );
#ifdef DEBUG_LAYOUT
- qDebug(" col %d: max=%d, effMax=%d, new=%d", pos, tqlayoutStruct[pos].effMaxWidth, tqlayoutStruct[pos].effMaxWidth, w );
+ qDebug(" col %d: max=%d, effMax=%d, new=%d", pos, layoutStruct[pos].effMaxWidth, layoutStruct[pos].effMaxWidth, w );
#endif
- maxWidth -= tqlayoutStruct[pos].effMaxWidth;
+ maxWidth -= layoutStruct[pos].effMaxWidth;
cMaxWidth -= w;
- tqlayoutStruct[pos].effMaxWidth = w;
+ layoutStruct[pos].effMaxWidth = w;
}
}
} else {
for ( unsigned int pos = col; pos < lastCol; pos++ )
- tqlayoutStruct[pos].maxWidth = kMax(tqlayoutStruct[pos].maxWidth, int(tqlayoutStruct[pos].minWidth) );
+ layoutStruct[pos].maxWidth = kMax(layoutStruct[pos].maxWidth, int(layoutStruct[pos].minWidth) );
}
}
effWidthDirty = false;
@@ -868,20 +868,20 @@ void AutoTableLayout::insertSpanCell( RenderTableCell *cell )
}
-void AutoTableLayout::tqlayout()
+void AutoTableLayout::layout()
{
- // table tqlayout based on the values collected in the tqlayout structure.
+ // table layout based on the values collected in the layout structure.
int tableWidth = table->width() - table->bordersPaddingAndSpacing();
int available = tableWidth;
int nEffCols = table->numEffCols();
- if ( nEffCols != (int)tqlayoutStruct.size() ) {
- qWarning("WARNING: nEffCols is not equal to tqlayoutstruct!" );
+ if ( nEffCols != (int)layoutStruct.size() ) {
+ qWarning("WARNING: nEffCols is not equal to layoutstruct!" );
fullRecalc();
nEffCols = table->numEffCols();
}
#ifdef DEBUG_LAYOUT
- qDebug("AutoTableLayout::tqlayout()");
+ qDebug("AutoTableLayout::layout()");
#endif
if ( effWidthDirty )
@@ -891,11 +891,11 @@ void AutoTableLayout::tqlayout()
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, tqlayoutStruct[i].width.type(), tqlayoutStruct[i].width.value(),
- tqlayoutStruct[i].minWidth, tqlayoutStruct[i].maxWidth );
+ i, layoutStruct[i].width.type(), layoutStruct[i].width.value(),
+ layoutStruct[i].minWidth, layoutStruct[i].maxWidth );
qDebug(" effective: type %d value %d, minWidth=%d, maxWidth=%d",
- tqlayoutStruct[i].effWidth.type(), tqlayoutStruct[i].effWidth.value(),
- tqlayoutStruct[i].effMinWidth, tqlayoutStruct[i].effMaxWidth );
+ layoutStruct[i].effWidth.type(), layoutStruct[i].effWidth.value(),
+ layoutStruct[i].effMinWidth, layoutStruct[i].effMaxWidth );
}
#endif
@@ -911,10 +911,10 @@ void AutoTableLayout::tqlayout()
// fill up every cell with it's minWidth
for ( int i = 0; i < nEffCols; i++ ) {
- int w = tqlayoutStruct[i].effMinWidth;
- tqlayoutStruct[i].calcWidth = w;
+ int w = layoutStruct[i].effMinWidth;
+ layoutStruct[i].calcWidth = w;
available -= w;
- Length& width = tqlayoutStruct[i].effWidth;
+ Length& width = layoutStruct[i].effWidth;
switch( width.type()) {
case Percent:
havePercent = true;
@@ -926,13 +926,13 @@ void AutoTableLayout::tqlayout()
break;
case Fixed:
numFixed++;
- totalFixed += tqlayoutStruct[i].effMaxWidth;
+ totalFixed += layoutStruct[i].effMaxWidth;
// fall through
break;
case Variable:
case Static:
numVariable++;
- totalVariable += tqlayoutStruct[i].effMaxWidth;
+ totalVariable += layoutStruct[i].effMaxWidth;
allocVariable += w;
}
}
@@ -940,25 +940,25 @@ void AutoTableLayout::tqlayout()
// allocate width to percent cols
if ( available > 0 && havePercent ) {
for ( int i = 0; i < nEffCols; i++ ) {
- const Length &width = tqlayoutStruct[i].effWidth;
+ const Length &width = layoutStruct[i].effWidth;
if ( width.isPercent() ) {
- int w = kMax ( int( tqlayoutStruct[i].effMinWidth ), width.minWidth( tableWidth ) );
- available += tqlayoutStruct[i].calcWidth - w;
- tqlayoutStruct[i].calcWidth = w;
+ int w = kMax ( int( layoutStruct[i].effMinWidth ), width.minWidth( tableWidth ) );
+ available += layoutStruct[i].calcWidth - w;
+ layoutStruct[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 ( tqlayoutStruct[i].effWidth.isPercent() ) {
- int w = tqlayoutStruct[i].calcWidth;
+ if ( layoutStruct[i].effWidth.isPercent() ) {
+ int w = layoutStruct[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 (tqlayoutStruct[i].effMinWidth), w - reduction );
+ int newWidth = kMax( int (layoutStruct[i].effMinWidth), w - reduction );
available += w - newWidth;
- tqlayoutStruct[i].calcWidth = newWidth;
+ layoutStruct[i].calcWidth = newWidth;
//qDebug("col %d: reducing to %d px (reduction=%d)", i, newWidth, reduction );
}
}
@@ -971,10 +971,10 @@ void AutoTableLayout::tqlayout()
// then allocate width to fixed cols
if ( available > 0 ) {
for ( int i = 0; i < nEffCols; ++i ) {
- 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();
+ 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();
}
}
}
@@ -985,12 +985,12 @@ void AutoTableLayout::tqlayout()
// now satisfy relative
if ( available > 0 ) {
for ( int i = 0; i < nEffCols; i++ ) {
- const Length &width = tqlayoutStruct[i].effWidth;
+ const Length &width = layoutStruct[i].effWidth;
if ( width.isRelative() && width.value() ) {
// width=0* gets effMinWidth.
int w = width.value()*tableWidth/totalRelative;
- available += tqlayoutStruct[i].calcWidth - w;
- tqlayoutStruct[i].calcWidth = w;
+ available += layoutStruct[i].calcWidth - w;
+ layoutStruct[i].calcWidth = w;
}
}
}
@@ -1000,13 +1000,13 @@ void AutoTableLayout::tqlayout()
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 = tqlayoutStruct[i].effWidth;
+ const Length &width = layoutStruct[i].effWidth;
if ( width.isVariable() && totalVariable != 0 ) {
- int w = kMax( int ( tqlayoutStruct[i].calcWidth ),
- available * tqlayoutStruct[i].effMaxWidth / totalVariable );
+ int w = kMax( int ( layoutStruct[i].calcWidth ),
+ available * layoutStruct[i].effMaxWidth / totalVariable );
available -= w;
- totalVariable -= tqlayoutStruct[i].effMaxWidth;
- tqlayoutStruct[i].calcWidth = w;
+ totalVariable -= layoutStruct[i].effMaxWidth;
+ layoutStruct[i].calcWidth = w;
}
}
}
@@ -1018,12 +1018,12 @@ void AutoTableLayout::tqlayout()
if ( available > 0 && numFixed) {
// still have some width to spread, distribute to fixed columns
for ( int i = 0; i < nEffCols; i++ ) {
- const Length &width = tqlayoutStruct[i].effWidth;
+ const Length &width = layoutStruct[i].effWidth;
if ( width.isFixed() ) {
- int w = available * tqlayoutStruct[i].effMaxWidth / totalFixed;
+ int w = available * layoutStruct[i].effMaxWidth / totalFixed;
available -= w;
- totalFixed -= tqlayoutStruct[i].effMaxWidth;
- tqlayoutStruct[i].calcWidth += w;
+ totalFixed -= layoutStruct[i].effMaxWidth;
+ layoutStruct[i].calcWidth += w;
}
}
}
@@ -1036,12 +1036,12 @@ void AutoTableLayout::tqlayout()
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 = tqlayoutStruct[i].effWidth;
+ const Length &width = layoutStruct[i].effWidth;
if ( width.isPercent() ) {
int w = available * width.value() / totalPercent;
available -= w;
totalPercent -= width.value();
- tqlayoutStruct[i].calcWidth += w;
+ layoutStruct[i].calcWidth += w;
if (!available || !totalPercent) break;
}
}
@@ -1060,7 +1060,7 @@ void AutoTableLayout::tqlayout()
int w = available / total;
available -= w;
total--;
- tqlayoutStruct[i].calcWidth += w;
+ layoutStruct[i].calcWidth += w;
}
}
@@ -1079,17 +1079,17 @@ void AutoTableLayout::tqlayout()
if (available < 0) {
int mw = 0;
for ( int i = nEffCols-1; i >= 0; i-- ) {
- Length &width = tqlayoutStruct[i].effWidth;
+ Length &width = layoutStruct[i].effWidth;
if (width.isVariable())
- mw += tqlayoutStruct[i].calcWidth - tqlayoutStruct[i].effMinWidth;
+ mw += layoutStruct[i].calcWidth - layoutStruct[i].effMinWidth;
}
for ( int i = nEffCols-1; i >= 0 && mw > 0; i-- ) {
- Length &width = tqlayoutStruct[i].effWidth;
+ Length &width = layoutStruct[i].effWidth;
if (width.isVariable()) {
- int minMaxDiff = tqlayoutStruct[i].calcWidth-tqlayoutStruct[i].effMinWidth;
+ int minMaxDiff = layoutStruct[i].calcWidth-layoutStruct[i].effMinWidth;
int reduce = available * minMaxDiff / mw;
- tqlayoutStruct[i].calcWidth += reduce;
+ layoutStruct[i].calcWidth += reduce;
available -= reduce;
mw -= minMaxDiff;
if ( available >= 0 )
@@ -1101,17 +1101,17 @@ void AutoTableLayout::tqlayout()
if (available < 0) {
int mw = 0;
for ( int i = nEffCols-1; i >= 0; i-- ) {
- Length &width = tqlayoutStruct[i].effWidth;
+ Length &width = layoutStruct[i].effWidth;
if (width.isRelative())
- mw += tqlayoutStruct[i].calcWidth - tqlayoutStruct[i].effMinWidth;
+ mw += layoutStruct[i].calcWidth - layoutStruct[i].effMinWidth;
}
for ( int i = nEffCols-1; i >= 0 && mw > 0; i-- ) {
- Length &width = tqlayoutStruct[i].effWidth;
+ Length &width = layoutStruct[i].effWidth;
if (width.isRelative()) {
- int minMaxDiff = tqlayoutStruct[i].calcWidth-tqlayoutStruct[i].effMinWidth;
+ int minMaxDiff = layoutStruct[i].calcWidth-layoutStruct[i].effMinWidth;
int reduce = available * minMaxDiff / mw;
- tqlayoutStruct[i].calcWidth += reduce;
+ layoutStruct[i].calcWidth += reduce;
available -= reduce;
mw -= minMaxDiff;
if ( available >= 0 )
@@ -1123,17 +1123,17 @@ void AutoTableLayout::tqlayout()
if (available < 0) {
int mw = 0;
for ( int i = nEffCols-1; i >= 0; i-- ) {
- Length &width = tqlayoutStruct[i].effWidth;
+ Length &width = layoutStruct[i].effWidth;
if (width.isFixed())
- mw += tqlayoutStruct[i].calcWidth - tqlayoutStruct[i].effMinWidth;
+ mw += layoutStruct[i].calcWidth - layoutStruct[i].effMinWidth;
}
for ( int i = nEffCols-1; i >= 0 && mw > 0; i-- ) {
- Length &width = tqlayoutStruct[i].effWidth;
+ Length &width = layoutStruct[i].effWidth;
if (width.isFixed()) {
- int minMaxDiff = tqlayoutStruct[i].calcWidth-tqlayoutStruct[i].effMinWidth;
+ int minMaxDiff = layoutStruct[i].calcWidth-layoutStruct[i].effMinWidth;
int reduce = available * minMaxDiff / mw;
- tqlayoutStruct[i].calcWidth += reduce;
+ layoutStruct[i].calcWidth += reduce;
available -= reduce;
mw -= minMaxDiff;
if ( available >= 0 )
@@ -1145,17 +1145,17 @@ void AutoTableLayout::tqlayout()
if (available < 0) {
int mw = 0;
for ( int i = nEffCols-1; i >= 0; i-- ) {
- Length &width = tqlayoutStruct[i].effWidth;
+ Length &width = layoutStruct[i].effWidth;
if (width.isPercent())
- mw += tqlayoutStruct[i].calcWidth - tqlayoutStruct[i].effMinWidth;
+ mw += layoutStruct[i].calcWidth - layoutStruct[i].effMinWidth;
}
for ( int i = nEffCols-1; i >= 0 && mw > 0; i-- ) {
- Length &width = tqlayoutStruct[i].effWidth;
+ Length &width = layoutStruct[i].effWidth;
if (width.isPercent()) {
- int minMaxDiff = tqlayoutStruct[i].calcWidth-tqlayoutStruct[i].effMinWidth;
+ int minMaxDiff = layoutStruct[i].calcWidth-layoutStruct[i].effMinWidth;
int reduce = available * minMaxDiff / mw;
- tqlayoutStruct[i].calcWidth += reduce;
+ layoutStruct[i].calcWidth += reduce;
available -= reduce;
mw -= minMaxDiff;
if ( available >= 0 )
@@ -1170,10 +1170,10 @@ void AutoTableLayout::tqlayout()
int pos = 0;
for ( int i = 0; i < nEffCols; i++ ) {
#ifdef DEBUG_LAYOUT
- qDebug("col %d: %d (width %d)", i, pos, tqlayoutStruct[i].calcWidth );
+ qDebug("col %d: %d (width %d)", i, pos, layoutStruct[i].calcWidth );
#endif
table->columnPos[i] = pos;
- pos += tqlayoutStruct[i].calcWidth + table->borderHSpacing();
+ pos += layoutStruct[i].calcWidth + table->borderHSpacing();
}
table->columnPos[table->columnPos.size()-1] = pos;
@@ -1183,9 +1183,9 @@ void AutoTableLayout::tqlayout()
void AutoTableLayout::calcPercentages() const
{
total_percent = 0;
- for ( unsigned int i = 0; i < tqlayoutStruct.size(); i++ ) {
- if ( tqlayoutStruct[i].width.isPercent() )
- total_percent += tqlayoutStruct[i].width.value();
+ for ( unsigned int i = 0; i < layoutStruct.size(); i++ ) {
+ if ( layoutStruct[i].width.isPercent() )
+ total_percent += layoutStruct[i].width.value();
}
percentagesDirty = false;
}