From 48b5f159b7c3e4921d5363a0417778961ecb8a04 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 16 Sep 2019 23:04:26 +0300 Subject: [PATCH] Fixed: Table cell padding applied twice --HG-- branch : html-improvements --- code/nel/src/gui/group_table.cpp | 34 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/code/nel/src/gui/group_table.cpp b/code/nel/src/gui/group_table.cpp index fa6279ad7..7a4cca66a 100644 --- a/code/nel/src/gui/group_table.cpp +++ b/code/nel/src/gui/group_table.cpp @@ -573,13 +573,19 @@ namespace NLGUI // ---------------------------------------------------------------------------- sint32 CGroupCell::getMaxUsedW() const { - return Group->getMaxUsedW(); + sint32 result = getPaddingLeftRight() + Group->getMaxUsedW(); + if (Border) + result += Border->getLeftRightWidth(); + return result; } // ------------------------------------------------------------------------------------------------ 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; } - sint32 cellBorderPadding = cell->getPaddingLeftRight(); - if (cell->Border) - cellBorderPadding += cell->Border->getLeftRightWidth(); - // Get width min and max if( !cell->IgnoreMaxWidth) - cell->WidthMax = cell->getMaxUsedW() + cell->LeftMargin + cellBorderPadding; + cell->WidthMax = cell->getMaxUsedW() + cell->LeftMargin; else cell->WidthMax = cell->WidthWanted + additionnalWidth + cell->LeftMargin; sint32 cellWidth; if(!cell->IgnoreMinWidth) - cellWidth = cell->NoWrap ? cell->WidthMax : cell->getMinUsedW() + cell->LeftMargin + cellBorderPadding; + cellWidth = cell->NoWrap ? cell->WidthMax : cell->getMinUsedW() + cell->LeftMargin; else 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 ? if (cell->NewLine) @@ -1122,7 +1129,6 @@ namespace NLGUI // *** Now we know each column width, resize cells and get the height for each row column = 0; - // FIXME: real cell padding sint32 row = 0; sint32 currentX = 0; @@ -1413,8 +1419,7 @@ namespace NLGUI for (i=0; igetLeftRightWidth(); @@ -1461,8 +1466,7 @@ namespace NLGUI for (i=0; igetLeftRightWidth();