mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-15 06:08:42 +00:00
Added: style for html elements del, u, em, strong, small, and dl list
This commit is contained in:
parent
487f92c9d0
commit
4dcbe1faad
2 changed files with 115 additions and 2 deletions
|
@ -419,6 +419,15 @@ namespace NLGUI
|
|||
return _UL.back();
|
||||
}
|
||||
|
||||
// DL list
|
||||
std::vector<bool> _DL;
|
||||
inline bool getDL() const
|
||||
{
|
||||
if (_DL.empty())
|
||||
return false;
|
||||
return _DL.back();
|
||||
}
|
||||
|
||||
// A mode
|
||||
std::vector<bool> _A;
|
||||
inline bool getA() const
|
||||
|
@ -430,6 +439,7 @@ namespace NLGUI
|
|||
|
||||
// IL mode
|
||||
bool _LI;
|
||||
bool _DT;
|
||||
|
||||
// Current text color
|
||||
std::vector<NLMISC::CRGBA> _TextColor;
|
||||
|
@ -457,6 +467,12 @@ namespace NLGUI
|
|||
return TextFontSize;
|
||||
return _FontSize.back();
|
||||
}
|
||||
inline uint getFontSizeSmaller() const
|
||||
{
|
||||
if (getFontSize() < 5)
|
||||
return 3;
|
||||
return getFontSize()-2;
|
||||
}
|
||||
|
||||
std::vector<uint> _FontWeight;
|
||||
inline uint getFontWeight() const
|
||||
|
|
|
@ -53,6 +53,8 @@ using namespace NLMISC;
|
|||
#define DEFAULT_RYZOM_CONNECTION_TIMEOUT (30.0)
|
||||
// Allow up to 10 redirects, then give up
|
||||
#define DEFAULT_RYZOM_REDIRECT_LIMIT (10)
|
||||
//
|
||||
#define FONT_WEIGHT_BOLD 700
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
@ -1832,11 +1834,64 @@ namespace NLGUI
|
|||
_FontStrikeThrough.push_back(style.StrikeThrough);
|
||||
}
|
||||
break;
|
||||
|
||||
case HTML_DEL:
|
||||
_FontStrikeThrough.push_back(true);
|
||||
break;
|
||||
case HTML_U:
|
||||
_FontUnderlined.push_back(true);
|
||||
break;
|
||||
case HTML_EM:
|
||||
_FontOblique.push_back(true);
|
||||
break;
|
||||
case HTML_STRONG:
|
||||
_FontWeight.push_back(FONT_WEIGHT_BOLD);
|
||||
break;
|
||||
case HTML_SMALL:
|
||||
_FontSize.push_back(getFontSizeSmaller());
|
||||
break;
|
||||
case HTML_STYLE:
|
||||
case HTML_SCRIPT:
|
||||
_IgnoreText = true;
|
||||
break;
|
||||
case HTML_DL:
|
||||
_DL.push_back(true);
|
||||
endParagraph();
|
||||
break;
|
||||
case HTML_DT:
|
||||
if (getDL())
|
||||
{
|
||||
newParagraph(0);
|
||||
|
||||
// see if this is the first <dt>, closing tag not required
|
||||
if (!_DT)
|
||||
{
|
||||
_DT = true;
|
||||
_FontWeight.push_back(FONT_WEIGHT_BOLD);
|
||||
}
|
||||
|
||||
if (_DL.size() > 1)
|
||||
{
|
||||
uint indent = (_DL.size()-1) * ULIndent;
|
||||
getParagraph()->setFirstViewIndent(indent);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HTML_DD:
|
||||
if (getDL())
|
||||
{
|
||||
newParagraph(0);
|
||||
|
||||
// if there was no closing tag for <dt>, then remove <dt> style
|
||||
if (_DT)
|
||||
{
|
||||
_DT = false;
|
||||
popIfNotEmpty (_FontWeight);
|
||||
}
|
||||
|
||||
uint indent = _DL.size()*ULIndent;
|
||||
getParagraph()->setFirstViewIndent(indent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1966,6 +2021,30 @@ namespace NLGUI
|
|||
popIfNotEmpty (_UL);
|
||||
}
|
||||
break;
|
||||
case HTML_DL:
|
||||
if (getDL())
|
||||
{
|
||||
endParagraph();
|
||||
popIfNotEmpty (_DL);
|
||||
if (_DT) {
|
||||
_DT = false;
|
||||
popIfNotEmpty (_FontWeight);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HTML_DT:
|
||||
if (getDL())
|
||||
{
|
||||
if (_DT)
|
||||
{
|
||||
_DT = false;
|
||||
popIfNotEmpty (_FontWeight);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HTML_DD:
|
||||
// style not changed
|
||||
break;
|
||||
case HTML_SPAN:
|
||||
popIfNotEmpty (_FontSize);
|
||||
popIfNotEmpty (_FontWeight);
|
||||
|
@ -1974,6 +2053,21 @@ namespace NLGUI
|
|||
popIfNotEmpty (_FontUnderlined);
|
||||
popIfNotEmpty (_FontStrikeThrough);
|
||||
break;
|
||||
case HTML_DEL:
|
||||
popIfNotEmpty (_FontStrikeThrough);
|
||||
break;
|
||||
case HTML_U:
|
||||
popIfNotEmpty (_FontUnderlined);
|
||||
break;
|
||||
case HTML_EM:
|
||||
popIfNotEmpty (_FontOblique);
|
||||
break;
|
||||
case HTML_STRONG:
|
||||
popIfNotEmpty (_FontWeight);
|
||||
break;
|
||||
case HTML_SMALL:
|
||||
popIfNotEmpty (_FontSize);
|
||||
break;
|
||||
case HTML_STYLE:
|
||||
case HTML_SCRIPT:
|
||||
_IgnoreText = false;
|
||||
|
@ -2060,6 +2154,7 @@ namespace NLGUI
|
|||
_CurrentViewImage = NULL;
|
||||
_Indent = 0;
|
||||
_LI = false;
|
||||
_DT = false;
|
||||
_SelectOption = false;
|
||||
_GroupListAdaptor = NULL;
|
||||
_UrlFragment.clear();
|
||||
|
@ -3373,7 +3468,7 @@ namespace NLGUI
|
|||
|
||||
// Text added ?
|
||||
bool added = false;
|
||||
bool embolden = getFontWeight() >= 700;
|
||||
bool embolden = getFontWeight() >= FONT_WEIGHT_BOLD;
|
||||
|
||||
// Number of child in this paragraph
|
||||
if (_CurrentViewLink)
|
||||
|
@ -3734,7 +3829,9 @@ namespace NLGUI
|
|||
_FontStrikeThrough.clear();
|
||||
_Indent = 0;
|
||||
_LI = false;
|
||||
_DT = false;
|
||||
_UL.clear();
|
||||
_DL.clear();
|
||||
_A.clear();
|
||||
_Link.clear();
|
||||
_LinkTitle.clear();
|
||||
|
|
Loading…
Reference in a new issue