Merge with html-improvements

--HG--
branch : yubo
hg/yubo
Nimetu 5 years ago
commit e4cce24f80

@ -204,11 +204,8 @@ namespace NLGUI
return Current.FontSize-2; return Current.FontSize-2;
} }
sint styleStackIndex = 0;
inline void pushStyle() inline void pushStyle()
{ {
styleStackIndex++;
_StyleStack.push_back(Current); _StyleStack.push_back(Current);
Current.GlobalColor = false; Current.GlobalColor = false;
@ -228,7 +225,6 @@ namespace NLGUI
inline void popStyle() inline void popStyle()
{ {
styleStackIndex--;
if (_StyleStack.empty()) if (_StyleStack.empty())
{ {
Current = Root; Current = Root;

@ -554,7 +554,7 @@ namespace NLGUI
rVR.flush(); rVR.flush();
} }
// Get the parent table if (Border)
{ {
// TODO: monitor these in checkCoords and update when changed // TODO: monitor these in checkCoords and update when changed
uint8 contentAlpha = CWidgetManager::getInstance()->getGlobalColorForContent().A; uint8 contentAlpha = CWidgetManager::getInstance()->getGlobalColorForContent().A;
@ -573,13 +573,19 @@ namespace NLGUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
sint32 CGroupCell::getMaxUsedW() const sint32 CGroupCell::getMaxUsedW() const
{ {
return Group->getMaxUsedW(); sint32 result = getPaddingLeftRight() + Group->getMaxUsedW();
if (Border)
result += Border->getLeftRightWidth();
return result;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
sint32 CGroupCell::getMinUsedW() const sint32 CGroupCell::getMinUsedW() const
{ {
return Group->getMinUsedW(); sint32 result = getPaddingLeftRight() + Group->getMinUsedW();
if (Border)
result += Border->getLeftRightWidth();
return result;
} }
@ -823,24 +829,25 @@ namespace NLGUI
additionnalWidth = (sint32) width; additionnalWidth = (sint32) width;
} }
sint32 cellBorderPadding = cell->getPaddingLeftRight();
if (cell->Border)
cellBorderPadding += cell->Border->getLeftRightWidth();
// Get width min and max // Get width min and max
if( !cell->IgnoreMaxWidth) if( !cell->IgnoreMaxWidth)
cell->WidthMax = cell->getMaxUsedW() + cell->LeftMargin + cellBorderPadding; cell->WidthMax = cell->getMaxUsedW() + cell->LeftMargin;
else else
cell->WidthMax = cell->WidthWanted + additionnalWidth + cell->LeftMargin; cell->WidthMax = cell->WidthWanted + additionnalWidth + cell->LeftMargin;
sint32 cellWidth; sint32 cellWidth;
if(!cell->IgnoreMinWidth) if(!cell->IgnoreMinWidth)
cellWidth = cell->NoWrap ? cell->WidthMax : cell->getMinUsedW() + cell->LeftMargin + cellBorderPadding; cellWidth = cell->NoWrap ? cell->WidthMax : cell->getMinUsedW() + cell->LeftMargin;
else else
cellWidth = cell->NoWrap ? cell->WidthMax : cell->LeftMargin; cellWidth = cell->NoWrap ? cell->WidthMax : cell->LeftMargin;
if (cellWidth < cellBorderPadding) {
cellWidth = cellBorderPadding; sint32 cellBorderPadding = cell->getPaddingLeftRight();
if (cell->Border)
cellBorderPadding += cell->Border->getLeftRightWidth();
if (cellWidth < cellBorderPadding)
cellWidth = cellBorderPadding;
}
// New cell ? // New cell ?
if (cell->NewLine) if (cell->NewLine)
@ -909,7 +916,9 @@ namespace NLGUI
} }
// Additional space contributing to table width // Additional space contributing to table width
sint32 tableBorderSpacing = Border->getLeftWidth() + Border->getRightWidth(); sint32 tableBorderSpacing = 0;
if (Border)
tableBorderSpacing += Border->getLeftRightWidth();
tableBorderSpacing += ((sint32)_Columns.size()+1) * CellSpacing;; tableBorderSpacing += ((sint32)_Columns.size()+1) * CellSpacing;;
sint32 innerForceWidthMin = ForceWidthMin; sint32 innerForceWidthMin = ForceWidthMin;
@ -1122,7 +1131,6 @@ namespace NLGUI
// *** Now we know each column width, resize cells and get the height for each row // *** Now we know each column width, resize cells and get the height for each row
column = 0; column = 0;
// FIXME: real cell padding
sint32 row = 0; sint32 row = 0;
sint32 currentX = 0; sint32 currentX = 0;
@ -1278,7 +1286,7 @@ namespace NLGUI
if (Border) if (Border)
{ {
currentY -= Border->getBottomWidth(); currentY -= Border->getBottomWidth();
finalWidth += Border->getLeftWidth() + Border->getRightWidth(); finalWidth += Border->getLeftRightWidth();
} }
// Resize the table // Resize the table
@ -1413,8 +1421,7 @@ namespace NLGUI
for (i=0; i<columns.size(); i++) for (i=0; i<columns.size(); i++)
maxWidth += columns[i]; maxWidth += columns[i];
// TODO: CellPadding is probably already in columns width maxWidth += ((sint32)columns.size()+1) * CellSpacing;
maxWidth += ((sint32)columns.size()+1) * CellSpacing + ((sint32)columns.size()*2) * CellPadding;
if (Border) if (Border)
maxWidth += Border->getLeftRightWidth(); maxWidth += Border->getLeftRightWidth();
@ -1461,8 +1468,7 @@ namespace NLGUI
for (i=0; i<columns.size(); i++) for (i=0; i<columns.size(); i++)
maxWidth += columns[i]; maxWidth += columns[i];
// TODO: CellPadding is probably already in columns width maxWidth += ((sint32)columns.size()+1) * CellSpacing;
maxWidth += ((sint32)columns.size()+1) * CellSpacing + ((sint32)columns.size()*2) * CellPadding;
if (Border) if (Border)
maxWidth += Border->getLeftRightWidth(); maxWidth += Border->getLeftRightWidth();
@ -1701,6 +1707,8 @@ namespace NLGUI
{ {
uint32 w; uint32 w;
fromString((const char*)ptr, w); fromString((const char*)ptr, w);
if (!Border)
Border = new CSSBorderRenderer();
Border->setWidth(w, w, w, w); Border->setWidth(w, w, w, w);
} }
// //
@ -1708,6 +1716,8 @@ namespace NLGUI
if (ptr) if (ptr)
{ {
CRGBA c = convertColor((const char*)ptr); CRGBA c = convertColor((const char*)ptr);
if (!Border)
Border = new CSSBorderRenderer();
Border->setColor(c, c, c, c); Border->setColor(c, c, c, c);
} }
// //

Loading…
Cancel
Save