Skip to content

Commit

Permalink
Add -ryzom-modulate-text-color to separate text from background, #644
Browse files Browse the repository at this point in the history
  • Loading branch information
nimetu committed Sep 18, 2021
1 parent 3f39918 commit 028f6cd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions nel/include/nel/gui/css_style.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ namespace NLGUI
Underlined=false;
StrikeThrough=false;
GlobalColor=false;
GlobalColorText=false;
DisplayBlock=false;
Width=-1;
Height=-1;
Expand Down Expand Up @@ -93,6 +94,7 @@ namespace NLGUI
NLMISC::CRGBA TextColor;
STextShadow TextShadow;
bool GlobalColor;
bool GlobalColorText;
bool Underlined;
bool StrikeThrough;
bool DisplayBlock;
Expand Down Expand Up @@ -215,6 +217,7 @@ namespace NLGUI
_StyleStack.push_back(Current);

Current.GlobalColor = false;
// inherit GlobalColorText
Current.DisplayBlock = false;
Current.Width=-1;
Current.Height=-1;
Expand Down
10 changes: 10 additions & 0 deletions nel/src/gui/css_style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,16 @@ namespace NLGUI
style.GlobalColor = b;
}
else
if (it->first == "-ryzom-modulate-text-color")
{
bool b;
if (it->second == "inherit")
style.GlobalColorText = current.GlobalColorText;
else
if (fromString(it->second, b))
style.GlobalColorText = b;
}
else
if (it->first == "background-color")
{
if (it->second == "inherit")
Expand Down
12 changes: 9 additions & 3 deletions nel/src/gui/group_html.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2551,7 +2551,7 @@ namespace NLGUI
(embolden == text->getEmbolden()) &&
(style.FontOblique == text->getOblique()) &&
(getLink() == text->Link) &&
(style.GlobalColor == text->getModulateGlobalColor());
(style.GlobalColorText == text->getModulateGlobalColor());
}

// ***************************************************************************
Expand Down Expand Up @@ -2588,7 +2588,10 @@ namespace NLGUI
nlinfo("Text button template '%s' is missing :button or :b text element", tpl.c_str());
return;
}
ctrlButton->setModulateGlobalColorAll(false);
ctrlButton->setModulateGlobalColorAll(_Style.Current.GlobalColor);
ctrlButton->setTextModulateGlobalColorNormal(_Style.Current.GlobalColorText);
ctrlButton->setTextModulateGlobalColorOver(_Style.Current.GlobalColorText);
ctrlButton->setTextModulateGlobalColorPushed(_Style.Current.GlobalColorText);

// Translate the tooltip
ctrlButton->setText(text);
Expand Down Expand Up @@ -2619,7 +2622,7 @@ namespace NLGUI
newLink->setText(text);
newLink->setMultiLineSpace((uint)((float)(_Style.Current.FontSize)*LineSpaceFontFactor));
newLink->setMultiLine(true);
newLink->setModulateGlobalColor(_Style.Current.GlobalColor);
newLink->setModulateGlobalColor(_Style.Current.GlobalColorText);
setTextStyle(newLink, _Style.Current);

registerAnchor(newLink);
Expand Down Expand Up @@ -5247,6 +5250,9 @@ namespace NLGUI
if (ctrlButton)
{
ctrlButton->setModulateGlobalColorAll (_Style.Current.GlobalColor);
ctrlButton->setTextModulateGlobalColorNormal(_Style.Current.GlobalColorText);
ctrlButton->setTextModulateGlobalColorOver(_Style.Current.GlobalColorText);
ctrlButton->setTextModulateGlobalColorPushed(_Style.Current.GlobalColorText);

// Translate the tooltip
if (!tooltip.empty())
Expand Down

0 comments on commit 028f6cd

Please sign in to comment.