From 4ad9430fcf6b1458dcaa3f59817d990007b2205c Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 2 Aug 2012 19:25:00 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property querying for for CViewText. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/view_text.h | 3 +- code/nel/src/gui/view_text.cpp | 129 ++++++++++++++++++ .../plugins/gui_editor/widgets/ViewText.xml | 115 ++++++++++++++++ 3 files changed, 246 insertions(+), 1 deletion(-) create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewText.xml diff --git a/code/nel/include/nel/gui/view_text.h b/code/nel/include/nel/gui/view_text.h index 5c22f7110..68f5c6072 100644 --- a/code/nel/include/nel/gui/view_text.h +++ b/code/nel/include/nel/gui/view_text.h @@ -54,6 +54,7 @@ namespace NLGUI CViewText &operator=(const CViewText &vt); + std::string getProperty( const std::string &name ) const; void parseTextOptions (xmlNodePtr cur); bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } @@ -199,7 +200,7 @@ namespace NLGUI virtual void serial(NLMISC::IStream &f); protected: - + std::string _HardtextFormat; /// Text to display. ucstring _Text; /// index of the computed String associated to this text control diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index 4c29b5146..4cb3c96a4 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -176,6 +176,133 @@ namespace NLGUI return *this; } + std::string CViewText::getProperty( const std::string &name ) const + { + if( name == "color" ) + { + return toString( _Color ); + } + else + if( name == "global_color" ) + { + return toString( _ModulateGlobalColor ); + } + else + if( name == "fontsize" ) + { + return toString( + _FontSize - CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32() + ); + } + else + if( name == "shadow" ) + { + return toString( _Shadow ); + } + else + if( name == "shadow_color" ) + { + return toString( _ShadowColor ); + } + else + if( name == "multi_line" ) + { + return toString( _MultiLine ); + } + else + if( name == "justification" ) + { + switch( _TextMode ) + { + case ClipWord: + return "clip_word"; + break; + + case DontClipWord: + return "dont_clip_word"; + break; + + case Justified: + return "justified"; + break; + } + + return ""; + } + else + if( name == "line_maxw" ) + { + return toString( _LineMaxW ); + } + else + if( name == "multi_line_space" ) + { + return toString( _MultiLineSpace ); + } + else + if( name == "multi_line_maxw_only" ) + { + return toString( _MultiLineMaxWOnly ); + } + else + if( name == "multi_max_line" ) + { + return toString( _MultiMaxLine ); + } + else + if( name == "underlined" ) + { + return toString( _Underlined ); + } + else + if( name == "case_mode" ) + { + return toString( uint32( _CaseMode ) ); + } + else + if( name == "over_extend_view_text" ) + { + return toString( _OverExtendViewText ); + } + else + if( name == "over_extend_parent_rect" ) + { + return toString( _OverExtendViewTextUseParentRect ); + } + else + if( name == "auto_clamp" ) + { + return toString( _AutoClamp ); + } + else + if( name == "clamp_right" ) + { + return toString( _ClampRight ); + } + else + if( name == "auto_clamp_offset" ) + { + return toString( _AutoClampOffset ); + } + else + if( name == "continuous_update" ) + { + return toString( _ContinuousUpdate ); + } + else + if( name == "hardtext" ) + { + return _Text.toString(); + } + else + if( name == "hardtext_format" ) + { + return _HardtextFormat; + } + else + return CViewBase::getProperty( name ); + } + // *************************************************************************** void CViewText::parseTextOptions (xmlNodePtr cur) { @@ -333,6 +460,8 @@ namespace NLGUI if (prop) { const char *propPtr = prop; + _HardtextFormat = propPtr; + if (_MultiLine) { setTextFormatTaged(CI18N::get(propPtr)); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewText.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewText.xml new file mode 100644 index 000000000..30f877221 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewText.xml @@ -0,0 +1,115 @@ + +
+ ViewText + CViewText + CtrlBase + + false + +
+ + + color + string + 255 255 255 255 + + + global_color + bool + false + + + fontsize + int + 12 + + + shadow + bool + false + + + shadow_color + string + 0 0 0 255 + + + multi_line + bool + false + + + justification + string + dont_clip_word + + + line_maxw + int + 0 + + + multi_line_space + int + 8 + + + multi_line_maxw_only + bool + false + + + multi_max_line + int + 0 + + + underlined + bool + false + + + case_mode + int + 0 + + + over_extend_view_text + bool + false + + + over_extend_parent_rect + bool + false + + + clamp_right + bool + true + + + auto_clamp_offset + int + 0 + + + continuous_update + bool + false + + + hardtext + string + + + + hardtext_format + string + + + + + + +