aboutsummaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-11-17 12:18:06 +0100
committerSebastian Geerken <devnull@localhost>2013-11-17 12:18:06 +0100
commit4045b3d64203bc758a14926cd6c6ac48c200c10c (patch)
tree42e5a720fd04c595092309bbb04d0f2984f1d23f /dw
parent9b068e74be8c7935e12b63181b8726b9595cf152 (diff)
Small cleanup.
Diffstat (limited to 'dw')
-rw-r--r--dw/table.cc58
1 files changed, 29 insertions, 29 deletions
diff --git a/dw/table.cc b/dw/table.cc
index defc4259..b1a66b77 100644
--- a/dw/table.cc
+++ b/dw/table.cc
@@ -23,8 +23,6 @@
#include "../lout/msg.h"
#include "../lout/misc.hh"
-#define MAX misc::max
-
using namespace lout;
namespace dw {
@@ -137,11 +135,11 @@ void Table::getExtremesImpl (core::Extremes *extremes)
}
if (core::style::isAbsLength (getStyle()->width)) {
extremes->minWidth =
- MAX (extremes->minWidth,
- core::style::absLengthVal(getStyle()->width));
+ misc::max (extremes->minWidth,
+ core::style::absLengthVal(getStyle()->width));
extremes->maxWidth =
- MAX (extremes->maxWidth,
- core::style::absLengthVal(getStyle()->width));
+ misc::max (extremes->maxWidth,
+ core::style::absLengthVal(getStyle()->width));
}
_MSG(" Table::getExtremesImpl, {%d, %d} numCols=%d\n",
@@ -297,7 +295,7 @@ void Table::addCell (Widget *widget, int colspan, int rowspan)
}
if (colspan == 0) {
- colspanEff = MAX (numCols - curCol, 1);
+ colspanEff = misc::max (numCols - curCol, 1);
rowClosed = true;
} else
colspanEff = colspan;
@@ -557,7 +555,7 @@ void Table::forceCalcCellSizes ()
children->get(n)->cell.widget->sizeRequest (&childRequisition);
childHeight = childRequisition.ascent + childRequisition.descent;
if (children->get(n)->cell.rowspan == 1) {
- rowHeight = MAX (rowHeight, childHeight);
+ rowHeight = misc::max (rowHeight, childHeight);
} else {
rowSpanCells->increase();
rowSpanCells->set(rowSpanCells->size()-1, n);
@@ -677,8 +675,8 @@ void Table::forceCalcColumnExtremes ()
if (core::style::isAbsLength (width)) {
// Fixed lengths include table padding, border and margin.
cellMinW = cellExtremes.minWidth;
- cellMaxW = MAX (cellMinW,
- core::style::absLengthVal(width) - pbm);
+ cellMaxW = misc::max (cellMinW,
+ core::style::absLengthVal(width) - pbm);
} else {
cellMinW = cellExtremes.minWidth;
cellMaxW = cellExtremes.maxWidth;
@@ -691,11 +689,11 @@ void Table::forceCalcColumnExtremes ()
cellMinW, cellMaxW);
colExtremes->getRef(col)->minWidth =
- MAX (colExtremes->getRef(col)->minWidth, cellMinW);
+ misc::max (colExtremes->getRef(col)->minWidth, cellMinW);
colExtremes->getRef(col)->maxWidth =
- MAX (colExtremes->getRef(col)->minWidth, MAX (
- colExtremes->getRef(col)->maxWidth,
- cellMaxW));
+ misc::max (colExtremes->getRef(col)->minWidth, misc::max (
+ colExtremes->getRef(col)->maxWidth,
+ cellMaxW));
// Also fill the colPercents array in this pass
if (core::style::isPerLength (width)) {
@@ -732,7 +730,8 @@ void Table::forceCalcColumnExtremes ()
if (core::style::isAbsLength (width)) {
// Fixed lengths include table padding, border and margin.
cellMinW = cellExtremes.minWidth;
- cellMaxW = MAX (cellMinW, core::style::absLengthVal(width) - pbm);
+ cellMaxW =
+ misc::max (cellMinW, core::style::absLengthVal(width) - pbm);
} else {
cellMinW = cellExtremes.minWidth;
cellMaxW = cellExtremes.maxWidth;
@@ -750,10 +749,10 @@ void Table::forceCalcColumnExtremes ()
continue;
// Cell size is too small; apportion {min,max} for this colspan.
- int spanMinW = MAX (MAX(cs, minSumCols),
- cellMinW - (cs-1) * getStyle()->hBorderSpacing),
- spanMaxW = MAX (MAX(cs, maxSumCols),
- cellMaxW - (cs-1) * getStyle()->hBorderSpacing);
+ int spanMinW = misc::max (misc::max (cs, minSumCols),
+ cellMinW - (cs-1) * getStyle()->hBorderSpacing),
+ spanMaxW = misc::max (misc::max (cs, maxSumCols),
+ cellMaxW - (cs-1) * getStyle()->hBorderSpacing);
if (minSumCols == 0) {
// No single cells defined for this span => pre-apportion equally
@@ -799,9 +798,9 @@ void Table::forceCalcColumnExtremes ()
curAppW -= d_a;
} else {
if (colPercents->get(i) > 0.0f) {
- wMin = MAX (colExtremes->getRef(i)->minWidth,
- (int)(availSpanMinW
- * colPercents->get(i)/cumSpanPercent));
+ wMin = misc::max (colExtremes->getRef(i)->minWidth,
+ (int)(availSpanMinW
+ * colPercents->get(i)/cumSpanPercent));
colExtremes->getRef(i)->minWidth = wMin;
}
}
@@ -810,7 +809,7 @@ void Table::forceCalcColumnExtremes ()
(int)((float)(goalMaxW-cumMaxWnew)
* colExtremes->getRef(i)->maxWidth
/ (maxSumCols-cumMaxWold));
- wMax = MAX (wMin, wMax);
+ wMax = misc::max (wMin, wMax);
cumMaxWnew += wMax;
cumMaxWold += colExtremes->getRef(i)->maxWidth;
colExtremes->getRef(i)->maxWidth = wMax;
@@ -871,7 +870,7 @@ void Table::apportion2 (int totalWidth, int forceTotalWidth)
}
// General case.
- int curTargetWidth = MAX (availAutoWidth, minAutoWidth);
+ int curTargetWidth = misc::max (availAutoWidth, minAutoWidth);
int curExtraWidth = curTargetWidth - minAutoWidth;
int curMaxWidth = maxAutoWidth;
int curNewWidth = minAutoWidth;
@@ -949,7 +948,8 @@ void Table::apportion_percentages2(int totalWidth, int forceTotalWidth)
for (int col = 0; col < numCols; col++) {
int max_wi = colExtremes->getRef(col)->maxWidth, new_wi;
if (colPercents->get(col) != LEN_ABS) {
- new_wi = MAX (colExtremes->getRef(col)->minWidth,
+ new_wi =
+ misc::max (colExtremes->getRef(col)->minWidth,
(int)((float)max_wi * perAvailWidth/sumMaxWidth));
setColWidth (col, new_wi);
perAvailWidth -= new_wi;
@@ -992,15 +992,15 @@ void Table::apportion_percentages2(int totalWidth, int forceTotalWidth)
// only percentage columns, or cumPercent < 100% => restrict width
int totW = (int)(sumMaxNonPer/(1.0f-cumPercent));
for (int col = 0; col < numCols; col++) {
- totW = MAX (totW, (int)(colExtremes->getRef(col)->maxWidth
- / colPercents->get(col)));
+ totW = misc::max (totW, (int)(colExtremes->getRef(col)->maxWidth
+ / colPercents->get(col)));
}
totalWidth = misc::min (totW, totalWidth);
}
}
// make sure there's enough space
- totalWidth = MAX (totalWidth, sumMinWidth);
+ totalWidth = misc::max (totalWidth, sumMinWidth);
// extraWidth is always >= 0
int extraWidth = totalWidth - sumMinWidth;
int sumMinWidthPer = sumMinWidth - sumMinNonPer;
@@ -1044,7 +1044,7 @@ void Table::apportion_percentages2(int totalWidth, int forceTotalWidth)
#endif
curPerWidth -= sumMinNonPer;
int perWidth = (int)(curPerWidth/cumPercent);
- totalWidth = MAX (totalWidth, perWidth);
+ totalWidth = misc::max (totalWidth, perWidth);
totalWidth = misc::min (totalWidth, oldTotalWidth);
_MSG("APP_P, curPerWidth=%d perWidth=%d, totalWidth=%d\n",