From 7c551870c86c12fe4aa38425c57480b9689627f9 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 7 Aug 2012 22:35:08 +0200 Subject: [PATCH] CHANGED: #1471 some simple bugfixes, like missing properties, misspelled properties, widget not updating when changed, etc. --- code/nel/include/nel/gui/view_text.h | 1 + code/nel/src/gui/ctrl_text_button.cpp | 11 ++++ code/nel/src/gui/view_text.cpp | 60 ++++++++++++------- .../gui_editor/widgets/InterfaceGroup.xml | 2 +- .../plugins/gui_editor/widgets/ViewText.xml | 2 +- 5 files changed, 52 insertions(+), 24 deletions(-) diff --git a/code/nel/include/nel/gui/view_text.h b/code/nel/include/nel/gui/view_text.h index 436f502d4..c93437dae 100644 --- a/code/nel/include/nel/gui/view_text.h +++ b/code/nel/include/nel/gui/view_text.h @@ -56,6 +56,7 @@ namespace NLGUI std::string getProperty( const std::string &name ) const; void setProperty( const std::string &name, const std::string &value ); + bool setTextProperty( 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/ctrl_text_button.cpp b/code/nel/src/gui/ctrl_text_button.cpp index b46421e3e..e298060f8 100644 --- a/code/nel/src/gui/ctrl_text_button.cpp +++ b/code/nel/src/gui/ctrl_text_button.cpp @@ -102,6 +102,11 @@ namespace NLGUI return toString( _WMin ); } else + if( name == "hardtext" ) + { + return _ViewText->getText().toString(); + } + else if( name == "text_y" ) { return toString( _TextY ); @@ -244,6 +249,12 @@ namespace NLGUI return; } else + if( name == "hardtext" ) + { + _ViewText->setText( value ); + return; + } + else if( name == "text_y" ) { sint32 i; diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index 2da80a712..7b2aeb46a 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -304,13 +304,21 @@ namespace NLGUI } void CViewText::setProperty( const std::string &name, const std::string &value ) + { + if( setTextProperty( name, value ) ) + invalidateContent(); + else + CViewBase::setProperty( name, value ); + } + + bool CViewText::setTextProperty( const std::string &name, const std::string &value ) { if( name == "color" ) { CRGBA c; if( fromString( value, c ) ) _Color = c; - return; + return true; } else if( name == "global_color" ) @@ -318,7 +326,7 @@ namespace NLGUI bool b; if( fromString( value, b ) ) _ModulateGlobalColor = b; - return; + return true; } else if( name == "fontsize" ) @@ -326,7 +334,7 @@ namespace NLGUI sint i; if( fromString( value, i ) ) _FontSize = i + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32(); - return; + return true; } else if( name == "shadow" ) @@ -334,7 +342,7 @@ namespace NLGUI bool b; if( fromString( value, b ) ) _Shadow = b; - return; + return true; } else if( name == "shadow_color" ) @@ -342,7 +350,7 @@ namespace NLGUI CRGBA c; if( fromString( value, c ) ) _ShadowColor = c; - return; + return true; } else if( name == "multi_line" ) @@ -350,7 +358,7 @@ namespace NLGUI bool b; if( fromString( value, b ) ) _MultiLine = b; - return; + return true; } else if( name == "justification" ) @@ -364,7 +372,7 @@ namespace NLGUI if( value == "justified" ) _TextMode = Justified; - return; + return true; } else if( name == "line_maxw" ) @@ -372,7 +380,7 @@ namespace NLGUI sint32 i; if( fromString( value, i ) ) _LineMaxW = i; - return; + return true; } else if( name == "multi_line_space" ) @@ -380,7 +388,7 @@ namespace NLGUI sint i; if( fromString( value, i ) ) _MultiLineSpace = i; - return; + return true; } else if( name == "multi_line_maxw_only" ) @@ -388,7 +396,7 @@ namespace NLGUI bool b; if( fromString( value, b ) ) _MultiLineMaxWOnly = b; - return; + return true; } else if( name == "multi_max_line" ) @@ -396,7 +404,7 @@ namespace NLGUI uint32 i; if( fromString( value, i ) ) _MultiMaxLine = i; - return; + return true; } else if( name == "underlined" ) @@ -404,7 +412,7 @@ namespace NLGUI bool b; if( fromString( value, b ) ) _Underlined = b; - return; + return true; } else if( name == "case_mode" ) @@ -412,7 +420,7 @@ namespace NLGUI uint32 i; if( fromString( value, i ) ) _CaseMode = (TCaseMode)i; - return; + return true; } else if( name == "over_extend_view_text" ) @@ -420,7 +428,7 @@ namespace NLGUI bool b; if( fromString( value, b ) ) _OverExtendViewText = b; - return; + return true; } else if( name == "over_extend_parent_rect" ) @@ -428,7 +436,7 @@ namespace NLGUI bool b; if( fromString( value, b ) ) _OverExtendViewTextUseParentRect = b; - return; + return true; } else if( name == "auto_clamp" ) @@ -436,7 +444,7 @@ namespace NLGUI bool b; if( fromString( value, b ) ) _AutoClamp = b; - return; + return true; } else if( name == "clamp_right" ) @@ -444,7 +452,7 @@ namespace NLGUI bool b; if( fromString( value, b ) ) _ClampRight = b; - return; + return true; } else if( name == "auto_clamp_offset" ) @@ -452,7 +460,7 @@ namespace NLGUI uint8 i; if( fromString( value, i ) ) _AutoClampOffset = i; - return; + return true; } else if( name == "continuous_update" ) @@ -460,22 +468,30 @@ namespace NLGUI bool b; if( fromString( value, b ) ) _ContinuousUpdate = b; - return; + return true; } else if( name == "hardtext" ) { _Text = value; - return; + setCase( _Text, _CaseMode ); + invalidateContent(); + return true; } else if( name == "hardtext_format" ) { _HardtextFormat = value; - return; + + if( _MultiLine ) + setTextFormatTaged( _HardtextFormat ); + else + setSingleLineTextFormatTaged( _HardtextFormat ); + + return true; } else - CViewBase::setProperty( name, value ); + return false; } // *************************************************************************** diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceGroup.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceGroup.xml index f1ca3497b..d34cf34c0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceGroup.xml +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceGroup.xml @@ -109,7 +109,7 @@ params - win_proprity + win_priority int 3 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 index 30f877221..2e9e28ff5 100644 --- 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 @@ -2,7 +2,7 @@
ViewText CViewText - CtrlBase + InterfaceElement false