From 15bff79e02119d077562c9c4fdfaba89ac024b18 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 4 Aug 2012 02:18:20 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property setting for CViewText. --- code/nel/include/nel/gui/view_text.h | 1 + code/nel/src/gui/view_text.cpp | 175 +++++++++++++++++++++++++++ 2 files changed, 176 insertions(+) diff --git a/code/nel/include/nel/gui/view_text.h b/code/nel/include/nel/gui/view_text.h index 68f5c6072..436f502d4 100644 --- a/code/nel/include/nel/gui/view_text.h +++ b/code/nel/include/nel/gui/view_text.h @@ -55,6 +55,7 @@ namespace NLGUI CViewText &operator=(const CViewText &vt); std::string getProperty( const std::string &name ) const; + void setProperty( const std::string &name, const std::string &value ); void parseTextOptions (xmlNodePtr cur); bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index 4cb3c96a4..2da80a712 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -303,6 +303,181 @@ namespace NLGUI return CViewBase::getProperty( name ); } + void CViewText::setProperty( const std::string &name, const std::string &value ) + { + if( name == "color" ) + { + CRGBA c; + if( fromString( value, c ) ) + _Color = c; + return; + } + else + if( name == "global_color" ) + { + bool b; + if( fromString( value, b ) ) + _ModulateGlobalColor = b; + return; + } + else + if( name == "fontsize" ) + { + sint i; + if( fromString( value, i ) ) + _FontSize = i + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32(); + return; + } + else + if( name == "shadow" ) + { + bool b; + if( fromString( value, b ) ) + _Shadow = b; + return; + } + else + if( name == "shadow_color" ) + { + CRGBA c; + if( fromString( value, c ) ) + _ShadowColor = c; + return; + } + else + if( name == "multi_line" ) + { + bool b; + if( fromString( value, b ) ) + _MultiLine = b; + return; + } + else + if( name == "justification" ) + { + if( value == "clip_word" ) + _TextMode = ClipWord; + else + if( value == "dont_clip_word" ) + _TextMode = DontClipWord; + else + if( value == "justified" ) + _TextMode = Justified; + + return; + } + else + if( name == "line_maxw" ) + { + sint32 i; + if( fromString( value, i ) ) + _LineMaxW = i; + return; + } + else + if( name == "multi_line_space" ) + { + sint i; + if( fromString( value, i ) ) + _MultiLineSpace = i; + return; + } + else + if( name == "multi_line_maxw_only" ) + { + bool b; + if( fromString( value, b ) ) + _MultiLineMaxWOnly = b; + return; + } + else + if( name == "multi_max_line" ) + { + uint32 i; + if( fromString( value, i ) ) + _MultiMaxLine = i; + return; + } + else + if( name == "underlined" ) + { + bool b; + if( fromString( value, b ) ) + _Underlined = b; + return; + } + else + if( name == "case_mode" ) + { + uint32 i; + if( fromString( value, i ) ) + _CaseMode = (TCaseMode)i; + return; + } + else + if( name == "over_extend_view_text" ) + { + bool b; + if( fromString( value, b ) ) + _OverExtendViewText = b; + return; + } + else + if( name == "over_extend_parent_rect" ) + { + bool b; + if( fromString( value, b ) ) + _OverExtendViewTextUseParentRect = b; + return; + } + else + if( name == "auto_clamp" ) + { + bool b; + if( fromString( value, b ) ) + _AutoClamp = b; + return; + } + else + if( name == "clamp_right" ) + { + bool b; + if( fromString( value, b ) ) + _ClampRight = b; + return; + } + else + if( name == "auto_clamp_offset" ) + { + uint8 i; + if( fromString( value, i ) ) + _AutoClampOffset = i; + return; + } + else + if( name == "continuous_update" ) + { + bool b; + if( fromString( value, b ) ) + _ContinuousUpdate = b; + return; + } + else + if( name == "hardtext" ) + { + _Text = value; + return; + } + else + if( name == "hardtext_format" ) + { + _HardtextFormat = value; + return; + } + else + CViewBase::setProperty( name, value ); + } + // *************************************************************************** void CViewText::parseTextOptions (xmlNodePtr cur) {