diff --git a/code/nel/include/nel/gui/ctrl_scroll.h b/code/nel/include/nel/gui/ctrl_scroll.h index cf01ada78..a22da2cbd 100644 --- a/code/nel/include/nel/gui/ctrl_scroll.h +++ b/code/nel/include/nel/gui/ctrl_scroll.h @@ -175,6 +175,7 @@ namespace NLGUI bool _CallingAH : 1; bool _Cancelable : 1; // true if the slider may be cancelled when pressed on the mouse right button bool _Frozen : 1; + bool _Scale : 1; // For Target Scroller only: the target offset step in pixel. sint32 _TargetStepX; diff --git a/code/nel/src/gui/ctrl_scroll.cpp b/code/nel/src/gui/ctrl_scroll.cpp index acdaa15f5..e97bd8cd4 100644 --- a/code/nel/src/gui/ctrl_scroll.cpp +++ b/code/nel/src/gui/ctrl_scroll.cpp @@ -68,6 +68,7 @@ namespace NLGUI _StepValue = 0; _TileM = false; _Frozen = false; + _Scale = false; } // ------------------------------------------------------------------------------------------------ @@ -108,6 +109,11 @@ namespace NLGUI return getTextureTopOrRight(); } else + if( name == "scale" ) + { + return toString( _Scale ); + } + else if( name == "vertical" ) { return toString( _Vertical ); @@ -244,6 +250,14 @@ namespace NLGUI return; } else + if( name =="scale" ) + { + bool b; + if (fromString( value, b ) ) + _Scale = b; + return; + } + else if( name == "vertical" ) { bool b; @@ -408,6 +422,7 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "tx_bottomleft", BAD_CAST getTextureBottomOrLeft().c_str() ); xmlSetProp( node, BAD_CAST "tx_middle", BAD_CAST getTextureMiddle().c_str() ); xmlSetProp( node, BAD_CAST "tx_topright", BAD_CAST getTextureTopOrRight().c_str() ); + xmlSetProp( node, BAD_CAST "scale", BAD_CAST toString( _Scale ).c_str() ); xmlSetProp( node, BAD_CAST "vertical", BAD_CAST toString( _Vertical ).c_str() ); std::string align; @@ -480,6 +495,10 @@ namespace NLGUI if(prop) setTextureTopOrRight(string((const char*)prop)); else setTextureTopOrRight ("w_scroll_l0_t.tga"); + // Override texture size (w for vertical, h for horizontal) + prop = (char*) xmlGetProp( node, (xmlChar*)"scale" ); + if (prop) _Scale = convertBool((const char*)prop); + // Read properties prop = (char*) xmlGetProp( node, (xmlChar*)"vertical" ); if (prop) _Vertical = convertBool((const char*)prop); @@ -606,13 +625,13 @@ namespace NLGUI if (_Vertical) { - _W = w; + if (!_Scale) _W = w; _H = _Target->getMaxHReal(); } else { _W = _Target->getMaxWReal(); - _H = h; + if (!_Scale) _H = h; } CCtrlBase::updateCoords ();