diff --git a/code/nel/include/nel/gui/interface_element.h b/code/nel/include/nel/gui/interface_element.h index cd82417d6..1a360bbc6 100644 --- a/code/nel/include/nel/gui/interface_element.h +++ b/code/nel/include/nel/gui/interface_element.h @@ -182,6 +182,9 @@ namespace NLGUI void setMarginLeft(sint32 m) { _MarginLeft = m; } sint32 getMarginLeft() const { return _MarginLeft; } + // Return inner width for child elements + virtual sint32 getInnerWidth() const; + /** * Get the max width used by the window. * diff --git a/code/nel/include/nel/gui/interface_group.h b/code/nel/include/nel/gui/interface_group.h index b9efd3357..01f2b9701 100644 --- a/code/nel/include/nel/gui/interface_group.h +++ b/code/nel/include/nel/gui/interface_group.h @@ -164,6 +164,7 @@ namespace NLGUI sint32 getMaxH () const { return _MaxH; } sint32 getMaxWReal () const { return _Active ? _MaxWReal : 0; } sint32 getMaxHReal () const { return _Active ? _MaxHReal : 0; } + sint32 getInnerWidth () const; sint32 getOfsX () const { return _OffsetX; } sint32 getOfsY () const { return _OffsetY; } bool getResizeFromChildW() const { return _ResizeFromChildW; } diff --git a/code/nel/src/gui/group_paragraph.cpp b/code/nel/src/gui/group_paragraph.cpp index b2635b52e..d7d50af2e 100644 --- a/code/nel/src/gui/group_paragraph.cpp +++ b/code/nel/src/gui/group_paragraph.cpp @@ -1410,7 +1410,7 @@ namespace NLGUI // Get the child width maxWidth += _Elements[k].Element->getMaxUsedW(); } - return maxWidth; + return maxWidth + _MarginLeft; } // ---------------------------------------------------------------------------- @@ -1425,7 +1425,7 @@ namespace NLGUI if (width > minWidth) minWidth = width; } - return minWidth; + return minWidth + _MarginLeft; } diff --git a/code/nel/src/gui/group_table.cpp b/code/nel/src/gui/group_table.cpp index ef3eca57a..4408bc9c3 100644 --- a/code/nel/src/gui/group_table.cpp +++ b/code/nel/src/gui/group_table.cpp @@ -703,7 +703,7 @@ namespace NLGUI { if (ContinuousUpdate) { - sint parentWidth = std::min(_Parent->getMaxWReal(), _Parent->getWReal()); + sint parentWidth = _Parent->getInnerWidth(); if (_LastParentW != (sint) parentWidth) { _LastParentW = parentWidth; @@ -1163,7 +1163,7 @@ namespace NLGUI { if (_Parent != NULL) { - sint parentWidth = std::min(_Parent->getMaxWReal(), _Parent->getWReal()); + sint parentWidth = _Parent->getInnerWidth(); if (_LastParentW != (sint) parentWidth) { if (ContinuousUpdate) @@ -1311,6 +1311,9 @@ namespace NLGUI // ---------------------------------------------------------------------------- void CGroupTable::draw () { + // move X for clip and borders + _XReal += _MarginLeft; + // search a parent container CInterfaceGroup *gr = getParent(); while (gr) @@ -1391,6 +1394,9 @@ namespace NLGUI } CInterfaceGroup::draw (); + + // restore + _XReal -= _MarginLeft; } std::string CGroupTable::getProperties( const std::string &name ) const diff --git a/code/nel/src/gui/interface_element.cpp b/code/nel/src/gui/interface_element.cpp index 2e13d80e6..d3ed2d01c 100644 --- a/code/nel/src/gui/interface_element.cpp +++ b/code/nel/src/gui/interface_element.cpp @@ -506,10 +506,16 @@ namespace NLGUI } } + // ------------------------------------------------------------------------------------------------ + sint32 CInterfaceElement::getInnerWidth() const + { + return _WReal - _MarginLeft; + } + // ------------------------------------------------------------------------------------------------ void CInterfaceElement::updateCoords() { - _XReal = _X + _MarginLeft; + _XReal = _X; _YReal = _Y; _WReal = getW(); _HReal = getH(); @@ -526,7 +532,7 @@ namespace NLGUI if (el == NULL) return; - _XReal += el->_XReal - el->_MarginLeft; + _XReal += el->_XReal; _YReal += el->_YReal; THotSpot hsParent = _ParentPosRef; diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index d349411e1..5640da530 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -1397,6 +1397,13 @@ namespace NLGUI restoreClip (oldSciX, oldSciY, oldSciW, oldSciH); } + // ------------------------------------------------------------------------------------------------ + sint32 CInterfaceGroup::getInnerWidth() const + { + sint width = CInterfaceElement::getInnerWidth(); + return std::min(width, _MaxWReal - _MarginLeft); + } + // ------------------------------------------------------------------------------------------------ void CInterfaceGroup::checkCoords() { @@ -1468,7 +1475,7 @@ namespace NLGUI pIE->updateCoords(); } - _XReal -= _OffsetX - _MarginLeft; + _XReal -= (_OffsetX + _MarginLeft); _YReal -= _OffsetY; } @@ -1958,9 +1965,11 @@ namespace NLGUI newSciH = newSciH - ((newSciY+newSciH)-(oldSciY+oldSciH)); } - newSciXDest = newSciX - _MarginLeft; + // Don't apply margins because HTML list marker is drawn outside group paragraph inner content. + // Should not be an issue because horizontal scolling not used. + newSciXDest = newSciX/* + _MarginLeft*/; newSciYDest = newSciY; - newSciWDest = newSciW + _MarginLeft; + newSciWDest = newSciW/* - _MarginLeft*/; newSciHDest = newSciH; } diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index 34f8fd3e1..805143f32 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -916,8 +916,7 @@ namespace NLGUI return _LineMaxW; else { - sint parentWidth = std::min(_Parent->getMaxWReal(), _Parent->getWReal() - _Parent->getMarginLeft()); - return std::min(parentWidth-(sint)(_XReal-(_Parent->getXReal()-_Parent->getMarginLeft())), (sint)_LineMaxW); + return std::min(_Parent->getInnerWidth(), (sint)_LineMaxW); } }