Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
Nimetu 7 years ago
commit 9d0576fbcf

@ -88,7 +88,7 @@ public:
void setShadeOutline (bool b) { _ShadeOutline = b; } void setShadeOutline (bool b) { _ShadeOutline = b; }
void setShadeExtent (float shext) { _ShadeExtent = shext; } void setShadeExtent (float x, float y) { _ShadeExtentX = x; _ShadeExtentY = y; }
/// The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255) /// The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255)
void setShadeColor (NLMISC::CRGBA color) { _ShadeColor = color; } void setShadeColor (NLMISC::CRGBA color) { _ShadeColor = color; }
@ -157,19 +157,20 @@ public:
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
if (_ShadeOutline) if (_ShadeOutline)
{ {
float rext = _ShadeExtent * 0.7071f; float rextX = _ShadeExtentX * 0.7071f;
rCS.render2D(*_Driver, x+rext, z-rext, _HotSpot, _ScaleX, _ScaleZ); float rextY = _ShadeExtentY * 0.7071f;
rCS.render2D(*_Driver, x-rext, z-rext, _HotSpot, _ScaleX, _ScaleZ); rCS.render2D(*_Driver, x+rextX, z-rextY, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x-rext, z+rext, _HotSpot, _ScaleX, _ScaleZ); rCS.render2D(*_Driver, x-rextX, z-rextY, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x+rext, z+rext, _HotSpot, _ScaleX, _ScaleZ); rCS.render2D(*_Driver, x-rextX, z+rextY, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x+_ShadeExtent, z, _HotSpot, _ScaleX, _ScaleZ); rCS.render2D(*_Driver, x+rextX, z+rextY, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x-_ShadeExtent, z, _HotSpot, _ScaleX, _ScaleZ); rCS.render2D(*_Driver, x+_ShadeExtentX, z, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ); rCS.render2D(*_Driver, x-_ShadeExtentX, z, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ); rCS.render2D(*_Driver, x, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ);
} }
else else
{ {
rCS.render2D(*_Driver, x+_ShadeExtent, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ); rCS.render2D(*_Driver, x+_ShadeExtentX, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ);
} }
rCS.Color= bkup; rCS.Color= bkup;
} }
@ -190,19 +191,20 @@ public:
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
if (_ShadeOutline) if (_ShadeOutline)
{ {
float rext = _ShadeExtent * 0.7071f; float rextX = _ShadeExtentX * 0.7071f;
rCS.render2DClip(*_Driver, rdrBuffer, x+rext, z-rext, xmin, ymin, xmax, ymax); float rextY = _ShadeExtentY * 0.7071f;
rCS.render2DClip(*_Driver, rdrBuffer, x-rext, z-rext, xmin, ymin, xmax, ymax); rCS.render2DClip(*_Driver, rdrBuffer, x+rextX, z-rextY, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x-rext, z+rext, xmin, ymin, xmax, ymax); rCS.render2DClip(*_Driver, rdrBuffer, x-rextX, z-rextY, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x+rext, z+rext, xmin, ymin, xmax, ymax); rCS.render2DClip(*_Driver, rdrBuffer, x-rextX, z+rextY, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z, xmin, ymin, xmax, ymax); rCS.render2DClip(*_Driver, rdrBuffer, x+rextX, z+rextY, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x-_ShadeExtent, z, xmin, ymin, xmax, ymax); rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtentX, z, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x, z+_ShadeExtent, xmin, ymin, xmax, ymax); rCS.render2DClip(*_Driver, rdrBuffer, x-_ShadeExtentX, z, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x, z-_ShadeExtent, xmin, ymin, xmax, ymax); rCS.render2DClip(*_Driver, rdrBuffer, x, z+_ShadeExtentY, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x, z-_ShadeExtentY, xmin, ymin, xmax, ymax);
} }
else else
{ {
rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z-_ShadeExtent, xmin, ymin, xmax, ymax); rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtentX, z-_ShadeExtentY, xmin, ymin, xmax, ymax);
} }
rCS.Color= bkup; rCS.Color= bkup;
} }
@ -223,19 +225,20 @@ public:
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
if (_ShadeOutline) if (_ShadeOutline)
{ {
float rext = _ShadeExtent * 0.7071f; float rextX = _ShadeExtentX * 0.7071f;
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rext, y-rext, depth, xmin, ymin, xmax, ymax); float rextY = _ShadeExtentY * 0.7071f;
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rext, y-rext, depth, xmin, ymin, xmax, ymax); rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rextX, y-rextY, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rext, y+rext, depth, xmin, ymin, xmax, ymax); rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rextX, y-rextY, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rext, y+rext, depth, xmin, ymin, xmax, ymax); rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rextX, y+rextY, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y, depth, xmin, ymin, xmax, ymax); rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rextX, y+rextY, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-_ShadeExtent, y, depth, xmin, ymin, xmax, ymax); rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtentX, y, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y+_ShadeExtent, depth, xmin, ymin, xmax, ymax); rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-_ShadeExtentX, y, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax); rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y+_ShadeExtentY, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y-_ShadeExtentY, depth, xmin, ymin, xmax, ymax);
} }
else else
{ {
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax); rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtentX, y-_ShadeExtentY, depth, xmin, ymin, xmax, ymax);
} }
rCS.Color= bkup; rCS.Color= bkup;
} }
@ -258,19 +261,20 @@ public:
_TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); _TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
if (_ShadeOutline) if (_ShadeOutline)
{ {
float rext = _ShadeExtent * 0.7071f; float rextX = _ShadeExtentX * 0.7071f;
_TempString.render2D(*_Driver,x+rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); float rextY = _ShadeExtentY * 0.7071f;
_TempString.render2D(*_Driver,x-rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x+rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x-rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x-rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x+rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x+_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x-_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x,z+_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z-_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ);
} }
else else
{ {
_TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver, x+_ShadeExtentX, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ);
} }
_TempString.Color = bkup; _TempString.Color = bkup;
} }
@ -297,19 +301,20 @@ public:
_TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); _TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
if (_ShadeOutline) if (_ShadeOutline)
{ {
float rext = _ShadeExtent * 0.7071f; float rextX = _ShadeExtentX * 0.7071f;
_TempString.render2D(*_Driver,x+rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); float rextY = _ShadeExtentY * 0.7071f;
_TempString.render2D(*_Driver,x-rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x+rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x-rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x-rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x+rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x+_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x-_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver,x,z+_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z-_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ);
} }
else else
{ {
_TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); _TempString.render2D(*_Driver, x+_ShadeExtentX, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ);
} }
_TempString.Color = bkup; _TempString.Color = bkup;
} }
@ -412,7 +417,8 @@ private:
bool _ShadeOutline; bool _ShadeOutline;
/// shade's extent (shadow size) /// shade's extent (shadow size)
float _ShadeExtent; float _ShadeExtentX;
float _ShadeExtentY;
/// Shade color (default is black) /// Shade color (default is black)
NLMISC::CRGBA _ShadeColor; NLMISC::CRGBA _ShadeColor;

@ -80,7 +80,7 @@ public:
bool getShaded() const; bool getShaded() const;
void setShadeOutline(bool b); void setShadeOutline(bool b);
bool getShadeOutline() const; bool getShadeOutline() const;
void setShadeExtent(float shext) ; void setShadeExtent(float x, float y);
void setShadeColor (NLMISC::CRGBA sc); void setShadeColor (NLMISC::CRGBA sc);
NLMISC::CRGBA getShadeColor () const; NLMISC::CRGBA getShadeColor () const;
void setKeep800x600Ratio(bool keep); void setKeep800x600Ratio(bool keep);

@ -205,7 +205,7 @@ public:
* set the shadow's size * set the shadow's size
* \param the shade extent * \param the shade extent
*/ */
virtual void setShadeExtent (float shext) = 0; virtual void setShadeExtent (float x, float y) = 0;
/** /**
* set the shadow's color * set the shadow's color
* The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255) * The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255)

@ -76,10 +76,25 @@ namespace NLGUI
static SWebOptions options; static SWebOptions options;
// text-shadow
struct STextShadow
{
public:
STextShadow(bool enabled = false, bool outline = false, sint32 x=1, sint32 y=1, NLMISC::CRGBA color=NLMISC::CRGBA::Black)
: Enabled(enabled), Outline(outline), X(x), Y(y), Color(color)
{ }
bool Enabled;
bool Outline;
sint32 X;
sint32 Y;
NLMISC::CRGBA Color;
};
class CStyleParams class CStyleParams
{ {
public: public:
CStyleParams () : FontFamily(""), TextColor(255,255,255,255) CStyleParams () : FontFamily(""), TextColor(255,255,255,255), TextShadow()
{ {
FontSize=10; FontSize=10;
FontWeight=400; FontWeight=400;
@ -97,6 +112,7 @@ namespace NLGUI
bool FontOblique; bool FontOblique;
std::string FontFamily; std::string FontFamily;
NLMISC::CRGBA TextColor; NLMISC::CRGBA TextColor;
STextShadow TextShadow;
bool GlobalColor; bool GlobalColor;
bool Underlined; bool Underlined;
bool StrikeThrough; bool StrikeThrough;
@ -512,78 +528,32 @@ namespace NLGUI
// IL mode // IL mode
bool _LI; bool _LI;
// Current text color // Current active style
std::vector<NLMISC::CRGBA> _TextColor; CStyleParams _Style;
inline const NLMISC::CRGBA &getTextColor() const // Default style
CStyleParams _StyleDefault;
// Nested style stack
std::vector<CStyleParams> _StyleParams;
inline void pushStyle()
{ {
if (_TextColor.empty()) _StyleParams.push_back(_Style);
return TextColor;
return _TextColor.back();
} }
inline void popStyle()
// Current global color flag
std::vector<bool> _GlobalColor;
inline bool getGlobalColor() const
{ {
if (_GlobalColor.empty()) if (_StyleParams.empty())
return false; _Style = _StyleDefault;
return _GlobalColor.back(); else
}
// Current font name
std::vector<std::string> _FontFamily;
inline const char* getFontFamily() const
{ {
if (_FontFamily.empty()) _Style = _StyleParams.back();
return ""; _StyleParams.pop_back();
return _FontFamily.back().c_str();
} }
// Current font size
std::vector<uint> _FontSize;
inline uint getFontSize() const
{
if (_FontSize.empty())
return TextFontSize;
return _FontSize.back();
} }
inline uint getFontSizeSmaller() const inline uint getFontSizeSmaller() const
{ {
if (getFontSize() < 5) if (_Style.FontSize < 5)
return 3; return 3;
return getFontSize()-2; return _Style.FontSize-2;
}
std::vector<uint> _FontWeight;
inline uint getFontWeight() const
{
if (_FontWeight.empty())
return 400;
return _FontWeight.back();
}
std::vector<bool> _FontOblique;
inline bool getFontOblique() const
{
if (_FontOblique.empty())
return false;
return _FontOblique.back();
}
std::vector<bool> _FontUnderlined;
inline bool getFontUnderlined() const
{
if (_FontUnderlined.empty())
return false;
return _FontUnderlined.back();
}
std::vector<bool> _FontStrikeThrough;
inline bool getFontStrikeThrough() const
{
if (_FontStrikeThrough.empty())
return false;
return _FontStrikeThrough.back();
} }
// Current link // Current link
@ -648,6 +618,14 @@ namespace NLGUI
return _TR.back(); return _TR.back();
} }
std::vector<STextShadow> _TextShadow;
inline STextShadow getTextShadow() const
{
if (_TextShadow.empty())
return STextShadow();
return _TextShadow.back();
}
// Forms // Forms
class CForm class CForm
{ {

@ -102,6 +102,7 @@ namespace NLGUI
HTML_ATTR(TR,L_MARGIN), HTML_ATTR(TR,L_MARGIN),
HTML_ATTR(TR,NOWRAP), HTML_ATTR(TR,NOWRAP),
HTML_ATTR(TR,VALIGN), HTML_ATTR(TR,VALIGN),
HTML_ATTR(TR,STYLE),
}; };
enum enum

@ -88,6 +88,7 @@ namespace NLGUI
void setShadow (bool bShadow); void setShadow (bool bShadow);
void setShadowOutline (bool bShadowOutline); void setShadowOutline (bool bShadowOutline);
void setShadowColor (const NLMISC::CRGBA &color); void setShadowColor (const NLMISC::CRGBA &color);
void setShadowOffset (sint x, sint y);
void setLineMaxW (sint nMaxW, bool invalidate=true); void setLineMaxW (sint nMaxW, bool invalidate=true);
void setMultiLine (bool bMultiLine); void setMultiLine (bool bMultiLine);
void setMultiLineSpace (sint nMultiLineSpace); void setMultiLineSpace (sint nMultiLineSpace);
@ -112,6 +113,7 @@ namespace NLGUI
bool getShadow() { return _Shadow; } bool getShadow() { return _Shadow; }
bool getShadowOutline() { return _ShadowOutline; } bool getShadowOutline() { return _ShadowOutline; }
NLMISC::CRGBA getShadowColor() { return _ShadowColor; } NLMISC::CRGBA getShadowColor() { return _ShadowColor; }
void getShadowOffset(sint &x, sint &y) { x = _ShadowX; y = _ShadowY; }
sint getLineMaxW() const { return _LineMaxW; } sint getLineMaxW() const { return _LineMaxW; }
bool getMultiLine() const { return _MultiLine; } bool getMultiLine() const { return _MultiLine; }
sint getMultiLineSpace() const { return _MultiLineSpace; } sint getMultiLineSpace() const { return _MultiLineSpace; }
@ -247,6 +249,8 @@ namespace NLGUI
/// the shadow mode /// the shadow mode
bool _Shadow; bool _Shadow;
bool _ShadowOutline; bool _ShadowOutline;
sint32 _ShadowX;
sint32 _ShadowY;
/// the case mode /// the case mode
TCaseMode _CaseMode; TCaseMode _CaseMode;
/// the text shadow color /// the text shadow color

@ -47,7 +47,8 @@ CTextContext::CTextContext()
_Shaded = false; _Shaded = false;
_ShadeOutline = false; _ShadeOutline = false;
_ShadeExtent = 0.001f; _ShadeExtentX = 0.001f;
_ShadeExtentY = 0.001f;
_ShadeColor = NLMISC::CRGBA(0,0,0); _ShadeColor = NLMISC::CRGBA(0,0,0);
_Keep800x600Ratio= true; _Keep800x600Ratio= true;

@ -187,11 +187,11 @@ bool CTextContextUser::getShadeOutline() const
return _TextContext.getShadeOutline(); return _TextContext.getShadeOutline();
} }
void CTextContextUser::setShadeExtent(float shext) void CTextContextUser::setShadeExtent(float x, float y)
{ {
H_AUTO2; H_AUTO2;
_TextContext.setShadeExtent(shext); _TextContext.setShadeExtent(x, y);
} }
void CTextContextUser::setShadeColor (NLMISC::CRGBA sc) void CTextContextUser::setShadeColor (NLMISC::CRGBA sc)
{ {

File diff suppressed because it is too large Load Diff

@ -101,6 +101,7 @@ namespace NLGUI
HTML_ATTR(TR,L_MARGIN), HTML_ATTR(TR,L_MARGIN),
HTML_ATTR(TR,NOWRAP), HTML_ATTR(TR,NOWRAP),
HTML_ATTR(TR,VALIGN), HTML_ATTR(TR,VALIGN),
HTML_ATTR(TR,STYLE),
{ 0 } { 0 }
}; };

@ -72,6 +72,8 @@ namespace NLGUI
_Shadow = false; _Shadow = false;
_ShadowOutline = false; _ShadowOutline = false;
_ShadowColor = CRGBA(0,0,0,255); _ShadowColor = CRGBA(0,0,0,255);
_ShadowX = 1;
_ShadowY = 1;
_MultiLine = false; _MultiLine = false;
_TextMode = DontClipWord; _TextMode = DontClipWord;
@ -436,6 +438,22 @@ namespace NLGUI
return true; return true;
} }
else else
if( name == "shadow_x" )
{
sint sx;
if( fromString( value, sx ) )
_ShadowX = sx;
return true;
}
else
if( name == "shadow_y" )
{
sint sy;
if( fromString( value, sy ) )
_ShadowY = sy;
return true;
}
else
if( name == "multi_line" ) if( name == "multi_line" )
{ {
bool b; bool b;
@ -616,6 +634,8 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() ); xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() );
xmlSetProp( node, BAD_CAST "shadow_outline", BAD_CAST toString( _ShadowOutline ).c_str() ); xmlSetProp( node, BAD_CAST "shadow_outline", BAD_CAST toString( _ShadowOutline ).c_str() );
xmlSetProp( node, BAD_CAST "shadow_color", BAD_CAST toString( _ShadowColor ).c_str() ); xmlSetProp( node, BAD_CAST "shadow_color", BAD_CAST toString( _ShadowColor ).c_str() );
xmlSetProp( node, BAD_CAST "shadow_x", BAD_CAST toString( _ShadowX ).c_str() );
xmlSetProp( node, BAD_CAST "shadow_y", BAD_CAST toString( _ShadowY ).c_str() );
xmlSetProp( node, BAD_CAST "multi_line", BAD_CAST toString( _MultiLine ).c_str() ); xmlSetProp( node, BAD_CAST "multi_line", BAD_CAST toString( _MultiLine ).c_str() );
std::string just; std::string just;
@ -727,6 +747,16 @@ namespace NLGUI
if (prop) if (prop)
_ShadowColor = convertColor(prop); _ShadowColor = convertColor(prop);
prop= (char*) xmlGetProp( cur, (xmlChar*)"shadow_x" );
_ShadowX = 1;
if (prop)
fromString( (const char *)prop, _ShadowX);
prop= (char*) xmlGetProp( cur, (xmlChar*)"shadow_y" );
_ShadowY = 1;
if (prop)
fromString( (const char *)prop, _ShadowY);
prop = (char*) xmlGetProp( cur, (xmlChar*)"multi_line" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"multi_line" );
_MultiLine = false; _MultiLine = false;
if (prop) if (prop)
@ -958,6 +988,19 @@ namespace NLGUI
((_YReal) > (ClipY+ClipH)) || ((_YReal+_HReal) < ClipY)) ((_YReal) > (ClipY+ClipH)) || ((_YReal+_HReal) < ClipY))
return; return;
// hack: allow shadow to overflow outside parent box.
// In CGroupHTML context, clip is set for row
if (std::abs(_ShadowX) > 0)
{
ClipX -= 3;
ClipW += 3;
}
if (std::abs(_ShadowY) > 0)
{
ClipY -= 3;
ClipH += 3;
}
// *** Screen Minimized? // *** Screen Minimized?
uint32 w, h; uint32 w, h;
float oow, ooh; float oow, ooh;
@ -995,6 +1038,7 @@ namespace NLGUI
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setShadeOutline (_ShadowOutline); TextContext->setShadeOutline (_ShadowOutline);
TextContext->setShadeColor (shcol); TextContext->setShadeColor (shcol);
TextContext->setShadeExtent (_ShadowX*oow, _ShadowY*ooh);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
TextContext->setEmbolden (_Embolden); TextContext->setEmbolden (_Embolden);
TextContext->setOblique (_Oblique); TextContext->setOblique (_Oblique);
@ -1122,6 +1166,7 @@ namespace NLGUI
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setShadeOutline (_ShadowOutline); TextContext->setShadeOutline (_ShadowOutline);
TextContext->setShadeColor (shcol); TextContext->setShadeColor (shcol);
TextContext->setShadeExtent (_ShadowX*oow, _ShadowY*ooh);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
TextContext->setEmbolden (_Embolden); TextContext->setEmbolden (_Embolden);
TextContext->setOblique (_Oblique); TextContext->setOblique (_Oblique);
@ -1342,6 +1387,13 @@ namespace NLGUI
_ShadowColor = color; _ShadowColor = color;
} }
// ***************************************************************************
void CViewText::setShadowOffset(sint32 x, sint32 y)
{
_ShadowX = x;
_ShadowY = y;
}
// *************************************************************************** // ***************************************************************************
void CViewText::setLineMaxW (sint nMaxW, bool invalidate) void CViewText::setLineMaxW (sint nMaxW, bool invalidate)
{ {

@ -75,6 +75,11 @@
keep="true" keep="true"
max_historic="0" max_historic="0"
fontsize="10" fontsize="10"
shadow="true"
shadow_x="1"
shadow_y="1"
shadow_color="0 0 0 255"
shadow_outline="false"
backup_father_container_pos="false" backup_father_container_pos="false"
want_return="false" want_return="false"
color="255 255 255 255" color="255 255 255 255"
@ -93,7 +98,7 @@
<view type="bitmap" id="r" texture="log_eb_r.tga" posref="MR MR" scale="true" sizeref="h" h="-16" w="8" /> <view type="bitmap" id="r" texture="log_eb_r.tga" posref="MR MR" scale="true" sizeref="h" h="-16" w="8" />
<group type="edit_box" sizeref="wh" w="-8" h="-8" id="eb" posref="MM MM" on_focus="#on_focus" on_focus_params="#on_focus_params" onenter="#onenter" params="#params" onchange="#onchange" onchange_params="#onchange_params" max_num_chars="#max_num_chars" prompt="#prompt" enter_loose_focus="#enter_loose_focus" enter_recover_focus="#enter_recover_focus" entry_type="#entry_type" reset_focus_on_hide="#reset_focus_on_hide" menu_r="#menu_r" max_historic="#max_historic" want_return="#want_return" backup_father_container_pos="#backup_father_container_pos"> <group type="edit_box" sizeref="wh" w="-8" h="-8" id="eb" posref="MM MM" on_focus="#on_focus" on_focus_params="#on_focus_params" onenter="#onenter" params="#params" onchange="#onchange" onchange_params="#onchange_params" max_num_chars="#max_num_chars" prompt="#prompt" enter_loose_focus="#enter_loose_focus" enter_recover_focus="#enter_recover_focus" entry_type="#entry_type" reset_focus_on_hide="#reset_focus_on_hide" menu_r="#menu_r" max_historic="#max_historic" want_return="#want_return" backup_father_container_pos="#backup_father_container_pos">
<view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" fontsize="#fontsize" color="#color" shadow="true" hardtext="" global_color="false"/> <view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" fontsize="#fontsize" color="#color" shadow="#shadow" shadow_x="#shadow_x" shadow_y="#shadow_y" shadow_color="#shadow_color" shadow_outline="#shadow_outline" hardtext="" global_color="false"/>
</group> </group>
</group> </group>
@ -114,6 +119,11 @@
fontsize="10" fontsize="10"
fontweight="" fontweight=""
fontstyle="" fontstyle=""
shadow="true"
shadow_x="1"
shadow_y="1"
shadow_color="0 0 0 255"
shadow_outline="false"
backup_father_container_pos="false" backup_father_container_pos="false"
want_return="false" want_return="false"
color="255 255 255 255" color="255 255 255 255"
@ -124,7 +134,7 @@
<group id="#id" posref="#posref" x="#x" y="#y" posparent="#posparent" child_resize_h="#child_resize_h" sizeref="#sizeref" w="#w" h="#h" render_layer="#render_layer"> <group id="#id" posref="#posref" x="#x" y="#y" posparent="#posparent" child_resize_h="#child_resize_h" sizeref="#sizeref" w="#w" h="#h" render_layer="#render_layer">
<group type="edit_box" sizeref="#sizeref_eb" w="-16" id="eb" posref="TL TL" x="8" y="-8" child_resize_h="#child_resize_h" onenter="#onenter" params="#params" onchange="#onchange" onchange_params="#onchange_params" max_num_chars="#max_num_chars" prompt="#prompt" enter_loose_focus="#enter_loose_focus" enter_recover_focus="#enter_recover_focus" entry_type="#entry_type" reset_focus_on_hide="#reset_focus_on_hide" menu_r="#menu_r" max_historic="#max_historic" want_return="#want_return" backup_father_container_pos="#backup_father_container_pos" render_layer="#render_layer"> <group type="edit_box" sizeref="#sizeref_eb" w="-16" id="eb" posref="TL TL" x="8" y="-8" child_resize_h="#child_resize_h" onenter="#onenter" params="#params" onchange="#onchange" onchange_params="#onchange_params" max_num_chars="#max_num_chars" prompt="#prompt" enter_loose_focus="#enter_loose_focus" enter_recover_focus="#enter_recover_focus" entry_type="#entry_type" reset_focus_on_hide="#reset_focus_on_hide" menu_r="#menu_r" max_historic="#max_historic" want_return="#want_return" backup_father_container_pos="#backup_father_container_pos" render_layer="#render_layer">
<view type="bitmap" id="bg" scale="true" sizeref="hw" h="0" w="0" texture="log_eb_m.tga" inherit_gc_alpha="false" render_layer="#render_layer"/> <view type="bitmap" id="bg" scale="true" sizeref="hw" h="0" w="0" texture="log_eb_m.tga" inherit_gc_alpha="false" render_layer="#render_layer"/>
<view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" multi_min_line="#multi_min_line" fontsize="#fontsize" color="#color" fontweight="#fontweight" fontstyle="#fontstyle" shadow="true" hardtext="" global_color="false" render_layer="#render_layer"/> <view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" multi_min_line="#multi_min_line" fontsize="#fontsize" color="#color" fontweight="#fontweight" fontstyle="#fontstyle" shadow="#shadow" shadow_x="#shadow_x" shadow_y="#shadow_y" shadow_color="#shadow_color" shadow_outline="#shadow_outline" hardtext="" global_color="false" render_layer="#render_layer"/>
</group> </group>
<!-- border around the list --> <!-- border around the list -->
@ -153,6 +163,11 @@
keep="true" keep="true"
max_historic="40" max_historic="40"
fontsize="10" fontsize="10"
shadow="true"
shadow_x="1"
shadow_y="1"
shadow_color="0 0 0 255"
shadow_outline="false"
backup_father_container_pos="false" backup_father_container_pos="false"
want_return="false" want_return="false"
color="255 255 255 255" color="255 255 255 255"
@ -162,7 +177,7 @@
<group id="#id" posref="#posref" x="#x" y="#y" posparent="#posparent" child_resize_h="#child_resize_h" sizeref="#sizeref" w="#w" h="#h" render_layer="#render_layer"> <group id="#id" posref="#posref" x="#x" y="#y" posparent="#posparent" child_resize_h="#child_resize_h" sizeref="#sizeref" w="#w" h="#h" render_layer="#render_layer">
<group type="edit_box" sizeref="#sizeref_eb" w="-8" id="eb" posref="TL TL" x="4" y="-4" child_resize_h="#child_resize_h" onenter="#onenter" params="#params" onchange="#onchange" onchange_params="#onchange_params" max_num_chars="#max_num_chars" prompt="#prompt" enter_loose_focus="#enter_loose_focus" enter_recover_focus="#enter_recover_focus" entry_type="#entry_type" reset_focus_on_hide="#reset_focus_on_hide" menu_r="#menu_r" max_historic="#max_historic" want_return="#want_return" backup_father_container_pos="#backup_father_container_pos" render_layer="#render_layer"> <group type="edit_box" sizeref="#sizeref_eb" w="-8" id="eb" posref="TL TL" x="4" y="-4" child_resize_h="#child_resize_h" onenter="#onenter" params="#params" onchange="#onchange" onchange_params="#onchange_params" max_num_chars="#max_num_chars" prompt="#prompt" enter_loose_focus="#enter_loose_focus" enter_recover_focus="#enter_recover_focus" entry_type="#entry_type" reset_focus_on_hide="#reset_focus_on_hide" menu_r="#menu_r" max_historic="#max_historic" want_return="#want_return" backup_father_container_pos="#backup_father_container_pos" render_layer="#render_layer">
<view type="bitmap" id="bg" scale="true" sizeref="hw" h="0" w="0" texture="W_box_blank.tga" inherit_gc_alpha="true" render_layer="#render_layer"/> <view type="bitmap" id="bg" scale="true" sizeref="hw" h="0" w="0" texture="W_box_blank.tga" inherit_gc_alpha="true" render_layer="#render_layer"/>
<view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" fontsize="#fontsize" color="#color" shadow="true" hardtext="" global_color="false" render_layer="#render_layer"/> <view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" fontsize="#fontsize" color="#color" shadow="#shadow" shadow_x="#shadow_x" shadow_y="#shadow_y" shadow_color="#shadow_color" shadow_outline="#shadow_outline" hardtext="" global_color="false" render_layer="#render_layer"/>
</group> </group>
<!-- border around the list --> <!-- border around the list -->
@ -397,6 +412,11 @@
keep="true" keep="true"
max_historic="40" max_historic="40"
fontsize="10" fontsize="10"
shadow="true"
shadow_x="1"
shadow_y="1"
shadow_color="0 0 0 255"
shadow_outline="false"
backup_father_container_pos="false" backup_father_container_pos="false"
want_return="false" want_return="false"
color="255 255 255 255" color="255 255 255 255"
@ -407,7 +427,7 @@
<group type="edit_box" sizeref="#sizeref_eb" w="-16" id="eb" posref="TL TL" x="8" y="-8" child_resize_h="#child_resize_h" onenter="#onenter" params="#params" onchange="#onchange" onchange_params="#onchange_params" max_num_chars="#max_num_chars" prompt="#prompt" enter_loose_focus="#enter_loose_focus" enter_recover_focus="#enter_recover_focus" entry_type="#entry_type" reset_focus_on_hide="#reset_focus_on_hide" menu_r="#menu_r" max_historic="#max_historic" want_return="#want_return" backup_father_container_pos="#backup_father_container_pos" render_layer="#render_layer"> <group type="edit_box" sizeref="#sizeref_eb" w="-16" id="eb" posref="TL TL" x="8" y="-8" child_resize_h="#child_resize_h" onenter="#onenter" params="#params" onchange="#onchange" onchange_params="#onchange_params" max_num_chars="#max_num_chars" prompt="#prompt" enter_loose_focus="#enter_loose_focus" enter_recover_focus="#enter_recover_focus" entry_type="#entry_type" reset_focus_on_hide="#reset_focus_on_hide" menu_r="#menu_r" max_historic="#max_historic" want_return="#want_return" backup_father_container_pos="#backup_father_container_pos" render_layer="#render_layer">
<view type="bitmap" id="bg" scale="true" sizeref="hw" h="0" w="0" texture="log_eb_m.tga" inherit_gc_alpha="false" render_layer="#render_layer"/> <view type="bitmap" id="bg" scale="true" sizeref="hw" h="0" w="0" texture="log_eb_m.tga" inherit_gc_alpha="false" render_layer="#render_layer"/>
<view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" fontsize="#fontsize" color="#color" shadow="true" hardtext="" global_color="false" render_layer="#render_layer"/> <view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" fontsize="#fontsize" color="#color" shadow="#shadow" shadow_x="#shadow_x" shadow_y="#shadow_y" shadow_color="#shadow_color" shadow_outline="#shadow_outline" hardtext="" global_color="false" render_layer="#render_layer"/>
</group> </group>
<!-- border around the list --> <!-- border around the list -->
@ -435,6 +455,11 @@
keep="true" keep="true"
max_historic="40" max_historic="40"
fontsize="10" fontsize="10"
shadow="true"
shadow_x="1"
shadow_y="1"
shadow_color="0 0 0 255"
shadow_outline="false"
backup_father_container_pos="false" backup_father_container_pos="false"
want_return="false" want_return="false"
color="255 255 255 255" color="255 255 255 255"
@ -444,7 +469,7 @@
<view type="bitmap" id="bg" scale="true" sizeref="hw" h="0" w="0" texture="blank.tga" color="255 255 255 0" /> <view type="bitmap" id="bg" scale="true" sizeref="hw" h="0" w="0" texture="blank.tga" color="255 255 255 0" />
<view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" fontsize="#fontsize" color="#color" shadow="true" hardtext="" global_color="false"/> <view id="edit_text" type="text" x="#text_x" y="#text_y" posref="#text_ref" multi_line="#multi_line" multi_line_space="0" fontsize="#fontsize" color="#color" shadow="#shadow" shadow_x="#shadow_x" shadow_y="#shadow_y" shadow_color="#shadow_color" shadow_outline="#shadow_outline" hardtext="" global_color="false"/>
</group> </group>
<!-- border around the list --> <!-- border around the list -->

Loading…
Cancel
Save