mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 07:06:13 +00:00
Added: -ryzom-modulate-color style to enable modulation with global color
--HG-- branch : develop
This commit is contained in:
parent
5ea48c7599
commit
9394906182
2 changed files with 48 additions and 30 deletions
|
@ -84,6 +84,7 @@ namespace NLGUI
|
||||||
FontOblique=false;
|
FontOblique=false;
|
||||||
Underlined=false;
|
Underlined=false;
|
||||||
StrikeThrough=false;
|
StrikeThrough=false;
|
||||||
|
GlobalColor=false;
|
||||||
Width=-1;
|
Width=-1;
|
||||||
Height=-1;
|
Height=-1;
|
||||||
MaxWidth=-1;
|
MaxWidth=-1;
|
||||||
|
@ -94,6 +95,7 @@ namespace NLGUI
|
||||||
bool FontOblique;
|
bool FontOblique;
|
||||||
std::string FontFamily;
|
std::string FontFamily;
|
||||||
NLMISC::CRGBA TextColor;
|
NLMISC::CRGBA TextColor;
|
||||||
|
bool GlobalColor;
|
||||||
bool Underlined;
|
bool Underlined;
|
||||||
bool StrikeThrough;
|
bool StrikeThrough;
|
||||||
sint32 Width;
|
sint32 Width;
|
||||||
|
@ -339,7 +341,7 @@ namespace NLGUI
|
||||||
void addString(const ucstring &str);
|
void addString(const ucstring &str);
|
||||||
|
|
||||||
// Add an image in the current paragraph
|
// Add an image in the current paragraph
|
||||||
void addImage(const char *image, bool globalColor, bool reloadImg=false, const CStyleParams &style = CStyleParams());
|
void addImage(const char *image, bool reloadImg=false, const CStyleParams &style = CStyleParams());
|
||||||
|
|
||||||
// Add a text area in the current paragraph
|
// Add a text area in the current paragraph
|
||||||
CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength);
|
CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength);
|
||||||
|
@ -350,7 +352,7 @@ namespace NLGUI
|
||||||
|
|
||||||
// Add a button in the current paragraph. actionHandler, actionHandlerParams and tooltip can be NULL.
|
// Add a button in the current paragraph. actionHandler, actionHandlerParams and tooltip can be NULL.
|
||||||
CCtrlButton *addButton(CCtrlButton::EType type, const std::string &name, const std::string &normalBitmap, const std::string &pushedBitmap,
|
CCtrlButton *addButton(CCtrlButton::EType type, const std::string &name, const std::string &normalBitmap, const std::string &pushedBitmap,
|
||||||
const std::string &overBitmap, bool useGlobalColor, const char *actionHandler, const char *actionHandlerParams, const char *tooltip,
|
const std::string &overBitmap, const char *actionHandler, const char *actionHandlerParams, const char *tooltip,
|
||||||
const CStyleParams &style = CStyleParams());
|
const CStyleParams &style = CStyleParams());
|
||||||
|
|
||||||
// Set the background color
|
// Set the background color
|
||||||
|
|
|
@ -1397,6 +1397,7 @@ namespace NLGUI
|
||||||
style.TextColor = LinkColor;
|
style.TextColor = LinkColor;
|
||||||
style.Underlined = true;
|
style.Underlined = true;
|
||||||
style.StrikeThrough = getFontStrikeThrough();
|
style.StrikeThrough = getFontStrikeThrough();
|
||||||
|
style.GlobalColor = LinkColorGlobalColor;
|
||||||
|
|
||||||
if (present[HTML_A_STYLE] && value[HTML_A_STYLE])
|
if (present[HTML_A_STYLE] && value[HTML_A_STYLE])
|
||||||
getStyleParams(value[HTML_A_STYLE], style);
|
getStyleParams(value[HTML_A_STYLE], style);
|
||||||
|
@ -1406,7 +1407,7 @@ namespace NLGUI
|
||||||
_TextColor.push_back(style.TextColor);
|
_TextColor.push_back(style.TextColor);
|
||||||
_FontUnderlined.push_back(style.Underlined);
|
_FontUnderlined.push_back(style.Underlined);
|
||||||
_FontStrikeThrough.push_back(style.StrikeThrough);
|
_FontStrikeThrough.push_back(style.StrikeThrough);
|
||||||
_GlobalColor.push_back(LinkColorGlobalColor);
|
_GlobalColor.push_back(style.GlobalColor);
|
||||||
_A.push_back(true);
|
_A.push_back(true);
|
||||||
_Link.push_back ("");
|
_Link.push_back ("");
|
||||||
_LinkTitle.push_back("");
|
_LinkTitle.push_back("");
|
||||||
|
@ -1676,14 +1677,14 @@ namespace NLGUI
|
||||||
getPercentage(style.Width, tmpf, value[MY_HTML_IMG_WIDTH]);
|
getPercentage(style.Width, tmpf, value[MY_HTML_IMG_WIDTH]);
|
||||||
if (present[MY_HTML_IMG_HEIGHT] && value[MY_HTML_IMG_HEIGHT])
|
if (present[MY_HTML_IMG_HEIGHT] && value[MY_HTML_IMG_HEIGHT])
|
||||||
getPercentage(style.Height, tmpf, value[MY_HTML_IMG_HEIGHT]);
|
getPercentage(style.Height, tmpf, value[MY_HTML_IMG_HEIGHT]);
|
||||||
|
|
||||||
|
// Get the global color name
|
||||||
|
if (present[MY_HTML_IMG_GLOBAL_COLOR])
|
||||||
|
style.GlobalColor = true;
|
||||||
|
|
||||||
// width, height from inline css
|
// width, height from inline css
|
||||||
if (present[MY_HTML_IMG_STYLE] && value[MY_HTML_IMG_STYLE])
|
if (present[MY_HTML_IMG_STYLE] && value[MY_HTML_IMG_STYLE])
|
||||||
getStyleParams(value[MY_HTML_IMG_STYLE], style);
|
getStyleParams(value[MY_HTML_IMG_STYLE], style);
|
||||||
|
|
||||||
// Get the global color name
|
|
||||||
bool globalColor = false;
|
|
||||||
if (present[MY_HTML_IMG_GLOBAL_COLOR])
|
|
||||||
globalColor = true;
|
|
||||||
|
|
||||||
if (getA() && getParent () && getParent ()->getParent())
|
if (getA() && getParent () && getParent ()->getParent())
|
||||||
{
|
{
|
||||||
|
@ -1694,7 +1695,7 @@ namespace NLGUI
|
||||||
|
|
||||||
string params = "name=" + getId() + "|url=" + getLink ();
|
string params = "name=" + getId() + "|url=" + getLink ();
|
||||||
addButton(CCtrlButton::PushButton, value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC],
|
addButton(CCtrlButton::PushButton, value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC],
|
||||||
"", globalColor, "browse", params.c_str(), tooltip, style);
|
"", "browse", params.c_str(), tooltip, style);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1715,7 +1716,7 @@ namespace NLGUI
|
||||||
reloadImg = true;
|
reloadImg = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
addImage (value[MY_HTML_IMG_SRC], globalColor, reloadImg, style);
|
addImage (value[MY_HTML_IMG_SRC], reloadImg, style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1741,16 +1742,6 @@ namespace NLGUI
|
||||||
// Get the type
|
// Get the type
|
||||||
if (present[MY_HTML_INPUT_TYPE] && value[MY_HTML_INPUT_TYPE])
|
if (present[MY_HTML_INPUT_TYPE] && value[MY_HTML_INPUT_TYPE])
|
||||||
{
|
{
|
||||||
// Global color flag
|
|
||||||
bool globalColor = false;
|
|
||||||
if (present[MY_HTML_INPUT_GLOBAL_COLOR])
|
|
||||||
globalColor = true;
|
|
||||||
|
|
||||||
// Tooltip
|
|
||||||
const char *tooltip = NULL;
|
|
||||||
if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT])
|
|
||||||
tooltip = value[MY_HTML_INPUT_ALT];
|
|
||||||
|
|
||||||
// by default not inherited, font family defaults to system font
|
// by default not inherited, font family defaults to system font
|
||||||
CStyleParams style;
|
CStyleParams style;
|
||||||
style.TextColor = TextColor;
|
style.TextColor = TextColor;
|
||||||
|
@ -1758,6 +1749,15 @@ namespace NLGUI
|
||||||
style.FontWeight = FONT_WEIGHT_NORMAL;
|
style.FontWeight = FONT_WEIGHT_NORMAL;
|
||||||
style.FontOblique = false;
|
style.FontOblique = false;
|
||||||
|
|
||||||
|
// Global color flag
|
||||||
|
if (present[MY_HTML_INPUT_GLOBAL_COLOR])
|
||||||
|
style.GlobalColor = true;
|
||||||
|
|
||||||
|
// Tooltip
|
||||||
|
const char *tooltip = NULL;
|
||||||
|
if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT])
|
||||||
|
tooltip = value[MY_HTML_INPUT_ALT];
|
||||||
|
|
||||||
if (present[MY_HTML_INPUT_STYLE] && value[MY_HTML_INPUT_STYLE])
|
if (present[MY_HTML_INPUT_STYLE] && value[MY_HTML_INPUT_STYLE])
|
||||||
getStyleParams(value[MY_HTML_INPUT_STYLE], style);
|
getStyleParams(value[MY_HTML_INPUT_STYLE], style);
|
||||||
|
|
||||||
|
@ -1785,7 +1785,7 @@ namespace NLGUI
|
||||||
|
|
||||||
// Add the ctrl button
|
// Add the ctrl button
|
||||||
addButton (CCtrlButton::PushButton, name, normal, pushed.empty()?normal:pushed, over,
|
addButton (CCtrlButton::PushButton, name, normal, pushed.empty()?normal:pushed, over,
|
||||||
globalColor, "html_submit_form", param.c_str(), tooltip, style);
|
"html_submit_form", param.c_str(), tooltip, style);
|
||||||
}
|
}
|
||||||
if (type == "button" || type == "submit")
|
if (type == "button" || type == "submit")
|
||||||
{
|
{
|
||||||
|
@ -1840,7 +1840,7 @@ namespace NLGUI
|
||||||
if (!ctrlButton) ctrlButton = dynamic_cast<CCtrlTextButton*>(buttonGroup->getCtrl("b"));
|
if (!ctrlButton) ctrlButton = dynamic_cast<CCtrlTextButton*>(buttonGroup->getCtrl("b"));
|
||||||
if (ctrlButton)
|
if (ctrlButton)
|
||||||
{
|
{
|
||||||
ctrlButton->setModulateGlobalColorAll (globalColor);
|
ctrlButton->setModulateGlobalColorAll (style.GlobalColor);
|
||||||
|
|
||||||
// Translate the tooltip
|
// Translate the tooltip
|
||||||
if (tooltip)
|
if (tooltip)
|
||||||
|
@ -1923,8 +1923,7 @@ namespace NLGUI
|
||||||
checked = (present[MY_HTML_INPUT_CHECKED] && value[MY_HTML_INPUT_CHECKED]);
|
checked = (present[MY_HTML_INPUT_CHECKED] && value[MY_HTML_INPUT_CHECKED]);
|
||||||
|
|
||||||
// Add the ctrl button
|
// Add the ctrl button
|
||||||
CCtrlButton *checkbox = addButton (btnType, name, normal, pushed, over,
|
CCtrlButton *checkbox = addButton (btnType, name, normal, pushed, over, "", "", tooltip, style);
|
||||||
globalColor, "", "", tooltip);
|
|
||||||
if (checkbox)
|
if (checkbox)
|
||||||
{
|
{
|
||||||
if (btnType == CCtrlButton::RadioButton)
|
if (btnType == CCtrlButton::RadioButton)
|
||||||
|
@ -2349,6 +2348,7 @@ namespace NLGUI
|
||||||
style.FontOblique = getFontOblique();
|
style.FontOblique = getFontOblique();
|
||||||
style.Underlined = getFontUnderlined();
|
style.Underlined = getFontUnderlined();
|
||||||
style.StrikeThrough = getFontStrikeThrough();
|
style.StrikeThrough = getFontStrikeThrough();
|
||||||
|
style.GlobalColor = getGlobalColor();
|
||||||
|
|
||||||
if (present[MY_HTML_SPAN_STYLE] && value[MY_HTML_SPAN_STYLE])
|
if (present[MY_HTML_SPAN_STYLE] && value[MY_HTML_SPAN_STYLE])
|
||||||
getStyleParams(value[MY_HTML_SPAN_STYLE], style);
|
getStyleParams(value[MY_HTML_SPAN_STYLE], style);
|
||||||
|
@ -2360,6 +2360,7 @@ namespace NLGUI
|
||||||
_FontOblique.push_back(style.FontOblique);
|
_FontOblique.push_back(style.FontOblique);
|
||||||
_FontUnderlined.push_back(style.Underlined);
|
_FontUnderlined.push_back(style.Underlined);
|
||||||
_FontStrikeThrough.push_back(style.StrikeThrough);
|
_FontStrikeThrough.push_back(style.StrikeThrough);
|
||||||
|
_GlobalColor.push_back(style.GlobalColor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HTML_DEL:
|
case HTML_DEL:
|
||||||
|
@ -2763,6 +2764,7 @@ namespace NLGUI
|
||||||
popIfNotEmpty (_TextColor);
|
popIfNotEmpty (_TextColor);
|
||||||
popIfNotEmpty (_FontUnderlined);
|
popIfNotEmpty (_FontUnderlined);
|
||||||
popIfNotEmpty (_FontStrikeThrough);
|
popIfNotEmpty (_FontStrikeThrough);
|
||||||
|
popIfNotEmpty (_GlobalColor);
|
||||||
break;
|
break;
|
||||||
case HTML_DEL:
|
case HTML_DEL:
|
||||||
popIfNotEmpty (_FontStrikeThrough);
|
popIfNotEmpty (_FontStrikeThrough);
|
||||||
|
@ -4321,7 +4323,7 @@ namespace NLGUI
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
void CGroupHTML::addImage(const char *img, bool globalColor, bool reloadImg, const CStyleParams &style)
|
void CGroupHTML::addImage(const char *img, bool reloadImg, const CStyleParams &style)
|
||||||
{
|
{
|
||||||
// In a paragraph ?
|
// In a paragraph ?
|
||||||
if (!_Paragraph)
|
if (!_Paragraph)
|
||||||
|
@ -4382,7 +4384,7 @@ namespace NLGUI
|
||||||
addImageDownload(img, newImage, style);
|
addImageDownload(img, newImage, style);
|
||||||
}
|
}
|
||||||
newImage->setTexture (image);
|
newImage->setTexture (image);
|
||||||
newImage->setModulateGlobalColor(globalColor);
|
newImage->setModulateGlobalColor(style.GlobalColor);
|
||||||
|
|
||||||
getParagraph()->addChild(newImage);
|
getParagraph()->addChild(newImage);
|
||||||
paragraphChange ();
|
paragraphChange ();
|
||||||
|
@ -4530,7 +4532,7 @@ namespace NLGUI
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
CCtrlButton *CGroupHTML::addButton(CCtrlButton::EType type, const std::string &/* name */, const std::string &normalBitmap, const std::string &pushedBitmap,
|
CCtrlButton *CGroupHTML::addButton(CCtrlButton::EType type, const std::string &/* name */, const std::string &normalBitmap, const std::string &pushedBitmap,
|
||||||
const std::string &overBitmap, bool useGlobalColor, const char *actionHandler, const char *actionHandlerParams,
|
const std::string &overBitmap, const char *actionHandler, const char *actionHandlerParams,
|
||||||
const char *tooltip, const CStyleParams &style)
|
const char *tooltip, const CStyleParams &style)
|
||||||
{
|
{
|
||||||
// In a paragraph ?
|
// In a paragraph ?
|
||||||
|
@ -4602,7 +4604,7 @@ namespace NLGUI
|
||||||
ctrlButton->setTexturePushed (pushed);
|
ctrlButton->setTexturePushed (pushed);
|
||||||
if (!over.empty())
|
if (!over.empty())
|
||||||
ctrlButton->setTextureOver (over);
|
ctrlButton->setTextureOver (over);
|
||||||
ctrlButton->setModulateGlobalColorAll (useGlobalColor);
|
ctrlButton->setModulateGlobalColorAll (style.GlobalColor);
|
||||||
ctrlButton->setActionOnLeftClick (actionHandler);
|
ctrlButton->setActionOnLeftClick (actionHandler);
|
||||||
ctrlButton->setParamsOnLeftClick (actionHandlerParams);
|
ctrlButton->setParamsOnLeftClick (actionHandlerParams);
|
||||||
|
|
||||||
|
@ -5767,16 +5769,20 @@ namespace NLGUI
|
||||||
newParagraph(0);
|
newParagraph(0);
|
||||||
paragraphChange();
|
paragraphChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CStyleParams style;
|
||||||
|
style.GlobalColor = ls.toBoolean(2);
|
||||||
|
|
||||||
string url = getLink();
|
string url = getLink();
|
||||||
if (!url.empty())
|
if (!url.empty())
|
||||||
{
|
{
|
||||||
string params = "name=" + getId() + "|url=" + getLink ();
|
string params = "name=" + getId() + "|url=" + getLink ();
|
||||||
addButton(CCtrlButton::PushButton, ls.toString(1), ls.toString(1), ls.toString(1),
|
addButton(CCtrlButton::PushButton, ls.toString(1), ls.toString(1), ls.toString(1),
|
||||||
"", ls.toBoolean(2), "browse", params.c_str(), "");
|
"", "browse", params.c_str(), "", style);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addImage(ls.toString(1), ls.toBoolean(2));
|
addImage(ls.toString(1), false, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6085,6 +6091,16 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
if (it->first == "max-height")
|
if (it->first == "max-height")
|
||||||
getPercentage(style.MaxHeight, tmpf, it->second.c_str());
|
getPercentage(style.MaxHeight, tmpf, it->second.c_str());
|
||||||
|
else
|
||||||
|
if (it->first == "-ryzom-modulate-color")
|
||||||
|
{
|
||||||
|
bool b;
|
||||||
|
if (it->second == "inherit")
|
||||||
|
style.GlobalColor = getGlobalColor();
|
||||||
|
else
|
||||||
|
if (fromString(it->second, b))
|
||||||
|
style.GlobalColor = b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (inherit)
|
if (inherit)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue