mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-09 16:59:02 +00:00
Fixed: Multiline text inside lists
--HG-- branch : develop
This commit is contained in:
parent
c22b361dc2
commit
d6dcf7415a
7 changed files with 48 additions and 34 deletions
|
@ -714,7 +714,12 @@ namespace NLGUI
|
|||
std::vector<CCellParams> _CellParams;
|
||||
|
||||
// Indentation
|
||||
uint _Indent;
|
||||
std::vector<uint> _Indent;
|
||||
inline uint getIndent() const {
|
||||
if (_Indent.empty())
|
||||
return 0;
|
||||
return _Indent.back();
|
||||
}
|
||||
|
||||
// Current node is a title
|
||||
bool _Title;
|
||||
|
|
|
@ -94,6 +94,7 @@ namespace NLGUI
|
|||
_XReal = _YReal = _WReal = _HReal = 0;
|
||||
_X = _Y = _W = _H = 0;
|
||||
//_Snap = 1;
|
||||
_MarginLeft = 0;
|
||||
|
||||
_PosRef = Hotspot_BL;
|
||||
_ParentPosRef = Hotspot_BL;
|
||||
|
@ -178,6 +179,9 @@ namespace NLGUI
|
|||
sint32 getH() const { return (_Active?_H:0); }
|
||||
sint32 getH(bool bTestActive) const { return (bTestActive?(_Active?_H:0):_H); }
|
||||
|
||||
void setMarginLeft(sint32 m) { _MarginLeft = m; }
|
||||
sint32 getMarginLeft() const { return _MarginLeft; }
|
||||
|
||||
/**
|
||||
* Get the max width used by the window.
|
||||
*
|
||||
|
@ -568,6 +572,8 @@ namespace NLGUI
|
|||
sint32 _W;
|
||||
sint32 _H;
|
||||
|
||||
sint32 _MarginLeft;
|
||||
|
||||
//sint32 _Snap;
|
||||
|
||||
// position references e.g. : _PosRef=BL, _ParentPosref=MM : the bottom left corner of the element
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace NLGUI
|
|||
void setMultiLineSpace (sint nMultiLineSpace);
|
||||
void setMultiLineMaxWOnly (bool state);
|
||||
void setMultiLineClipEndSpace (bool state); // use it for multiline edit box for instance
|
||||
void setFirstLineX (uint firstLineX);
|
||||
void setFirstLineX (sint firstLineX);
|
||||
void setMultiMaxLine(uint l) { _MultiMaxLine = l; }
|
||||
void setMultiMinLine(uint l) { _MultiMinLine = l; }
|
||||
|
||||
|
@ -398,7 +398,7 @@ namespace NLGUI
|
|||
uint _TextSelectionEnd;
|
||||
|
||||
// First line X coordinate
|
||||
uint _FirstLineX;
|
||||
sint _FirstLineX;
|
||||
|
||||
/// Dynamic tooltips
|
||||
std::vector<CCtrlToolTip*> _Tooltips;
|
||||
|
|
|
@ -2181,8 +2181,9 @@ namespace NLGUI
|
|||
sint32 indent = LIIndent;
|
||||
// list-style-type: outside
|
||||
if (_CurrentViewLink)
|
||||
indent -= _CurrentViewLink->getMaxUsedW();
|
||||
getParagraph()->setFirstViewIndent(indent);
|
||||
{
|
||||
getParagraph()->setFirstViewIndent(-_CurrentViewLink->getMaxUsedW());
|
||||
}
|
||||
|
||||
flushString ();
|
||||
|
||||
|
@ -2238,8 +2239,7 @@ namespace NLGUI
|
|||
if (present[MY_HTML_TABLE_CELLPADDING] && value[MY_HTML_TABLE_CELLPADDING])
|
||||
fromString(value[MY_HTML_TABLE_CELLPADDING], table->CellPadding);
|
||||
|
||||
// Table must fit the container size
|
||||
|
||||
table->setMarginLeft(getIndent());
|
||||
addHtmlGroup (table, 0);
|
||||
|
||||
_Tables.push_back(table);
|
||||
|
@ -2247,6 +2247,7 @@ namespace NLGUI
|
|||
// Add a cell pointer
|
||||
_Cells.push_back(NULL);
|
||||
_TR.push_back(false);
|
||||
_Indent.push_back(0);
|
||||
}
|
||||
break;
|
||||
case HTML_TH:
|
||||
|
@ -2328,7 +2329,12 @@ namespace NLGUI
|
|||
|
||||
_Cells.back()->NewLine = getTR();
|
||||
table->addChild (_Cells.back());
|
||||
|
||||
// reusing indent pushed by table
|
||||
_Indent.back() = 0;
|
||||
|
||||
newParagraph(TDBeginSpace);
|
||||
// indent is already 0, getParagraph()->setMarginLeft(0); // maybe setIndent(0) if LI is using one
|
||||
|
||||
// Reset TR flag
|
||||
if (!_TR.empty())
|
||||
|
@ -2418,7 +2424,7 @@ namespace NLGUI
|
|||
_UL.push_back(HTMLOListElement(1, "square"));
|
||||
// if LI is already present
|
||||
_LI = _UL.size() > 1 || _DL.size() > 1;
|
||||
_Indent += ULIndent;
|
||||
_Indent.push_back(getIndent() + ULIndent);
|
||||
endParagraph();
|
||||
break;
|
||||
case HTML_OBJECT:
|
||||
|
@ -2489,6 +2495,13 @@ namespace NLGUI
|
|||
case HTML_DT:
|
||||
if (!_DL.empty())
|
||||
{
|
||||
// close DT if still open
|
||||
if (_DL.back().DD)
|
||||
{
|
||||
_DL.back().DD = false;
|
||||
popIfNotEmpty(_Indent);
|
||||
}
|
||||
|
||||
// see if this is the first <dt>, closing tag not required
|
||||
if (!_DL.back().DT)
|
||||
{
|
||||
|
@ -2519,8 +2532,8 @@ namespace NLGUI
|
|||
|
||||
if (!_DL.back().DD)
|
||||
{
|
||||
_Indent += ULIndent;
|
||||
_DL.back().DD = true;
|
||||
_Indent.push_back(getIndent() + ULIndent);
|
||||
}
|
||||
|
||||
if (!_LI)
|
||||
|
@ -2547,7 +2560,7 @@ namespace NLGUI
|
|||
_UL.push_back(HTMLOListElement(start, type));
|
||||
// if LI is already present
|
||||
_LI = _UL.size() > 1 || _DL.size() > 1;
|
||||
_Indent += ULIndent;
|
||||
_Indent.push_back(getIndent() + ULIndent);
|
||||
endParagraph();
|
||||
}
|
||||
break;
|
||||
|
@ -2659,6 +2672,7 @@ namespace NLGUI
|
|||
popIfNotEmpty (_TR);
|
||||
popIfNotEmpty (_Cells);
|
||||
popIfNotEmpty (_Tables);
|
||||
popIfNotEmpty (_Indent);
|
||||
endParagraph();
|
||||
// Add a cell
|
||||
break;
|
||||
|
@ -2801,13 +2815,9 @@ namespace NLGUI
|
|||
case HTML_UL:
|
||||
if (!_UL.empty())
|
||||
{
|
||||
if (_Indent > ULIndent)
|
||||
_Indent = _Indent - ULIndent;
|
||||
else
|
||||
_Indent = 0;
|
||||
|
||||
endParagraph();
|
||||
popIfNotEmpty(_UL);
|
||||
popIfNotEmpty(_Indent);
|
||||
}
|
||||
break;
|
||||
case HTML_DL:
|
||||
|
@ -2824,10 +2834,7 @@ namespace NLGUI
|
|||
// unclosed DD
|
||||
if (_DL.back().DD)
|
||||
{
|
||||
if (_Indent > ULIndent)
|
||||
_Indent = _Indent - ULIndent;
|
||||
else
|
||||
_Indent = 0;
|
||||
popIfNotEmpty(_Indent);
|
||||
}
|
||||
|
||||
popIfNotEmpty (_DL);
|
||||
|
@ -2846,12 +2853,8 @@ namespace NLGUI
|
|||
// parser will process two DD in a row as nested when first DD is not closed
|
||||
if (_DL.back().DD)
|
||||
{
|
||||
if (_Indent > ULIndent)
|
||||
_Indent = _Indent - ULIndent;
|
||||
else
|
||||
_Indent = 0;
|
||||
|
||||
_DL.back().DD = false;
|
||||
popIfNotEmpty(_Indent);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2964,7 +2967,7 @@ namespace NLGUI
|
|||
_Connecting = false;
|
||||
_CurrentViewLink = NULL;
|
||||
_CurrentViewImage = NULL;
|
||||
_Indent = 0;
|
||||
_Indent.clear();
|
||||
_LI = false;
|
||||
_SelectOption = false;
|
||||
_GroupListAdaptor = NULL;
|
||||
|
@ -4033,7 +4036,7 @@ namespace NLGUI
|
|||
CGroupParagraph *newParagraph = new CGroupParagraph(CViewBase::TCtorParam());
|
||||
newParagraph->setResizeFromChildH(true);
|
||||
|
||||
newParagraph->setIndent(_Indent);
|
||||
newParagraph->setMarginLeft(getIndent());
|
||||
|
||||
// Add to the group
|
||||
addHtmlGroup (newParagraph, beginSpace);
|
||||
|
@ -4767,7 +4770,7 @@ namespace NLGUI
|
|||
_FontOblique.clear();
|
||||
_FontUnderlined.clear();
|
||||
_FontStrikeThrough.clear();
|
||||
_Indent = 0;
|
||||
_Indent.clear();
|
||||
_LI = false;
|
||||
_UL.clear();
|
||||
_DL.clear();
|
||||
|
|
|
@ -509,7 +509,7 @@ namespace NLGUI
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
void CInterfaceElement::updateCoords()
|
||||
{
|
||||
_XReal = _X;
|
||||
_XReal = _X + _MarginLeft;
|
||||
_YReal = _Y;
|
||||
_WReal = getW();
|
||||
_HReal = getH();
|
||||
|
@ -526,7 +526,7 @@ namespace NLGUI
|
|||
if (el == NULL)
|
||||
return;
|
||||
|
||||
_XReal += el->_XReal;
|
||||
_XReal += el->_XReal - el->_MarginLeft;
|
||||
_YReal += el->_YReal;
|
||||
|
||||
THotSpot hsParent = _ParentPosRef;
|
||||
|
|
|
@ -1457,7 +1457,7 @@ namespace NLGUI
|
|||
}
|
||||
|
||||
CViewBase::updateCoords();
|
||||
_XReal += _OffsetX;
|
||||
_XReal += _OffsetX + _MarginLeft;
|
||||
_YReal += _OffsetY;
|
||||
|
||||
//update all children elements
|
||||
|
@ -1468,7 +1468,7 @@ namespace NLGUI
|
|||
pIE->updateCoords();
|
||||
}
|
||||
|
||||
_XReal -= _OffsetX;
|
||||
_XReal -= _OffsetX - _MarginLeft;
|
||||
_YReal -= _OffsetY;
|
||||
}
|
||||
|
||||
|
@ -1958,9 +1958,9 @@ namespace NLGUI
|
|||
newSciH = newSciH - ((newSciY+newSciH)-(oldSciY+oldSciH));
|
||||
}
|
||||
|
||||
newSciXDest = newSciX;
|
||||
newSciXDest = newSciX - _MarginLeft;
|
||||
newSciYDest = newSciY;
|
||||
newSciWDest = newSciW;
|
||||
newSciWDest = newSciW + _MarginLeft;
|
||||
newSciHDest = newSciH;
|
||||
|
||||
}
|
||||
|
|
|
@ -2494,7 +2494,7 @@ namespace NLGUI
|
|||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CViewText::setFirstLineX(uint firstLineX)
|
||||
void CViewText::setFirstLineX(sint firstLineX)
|
||||
{
|
||||
_FirstLineX = firstLineX;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue