From 1e806b2a09081699e85c30eedddce2f2bdfe7b0b Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 4 Aug 2012 20:06:18 +0200 Subject: [PATCH] CHANGED: #1471 Implemented property setting for CDBViewBar3. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/dbview_bar3.h | 4 +- code/nel/src/gui/dbview_bar3.cpp | 108 +++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 1 deletion(-) diff --git a/code/nel/include/nel/gui/dbview_bar3.h b/code/nel/include/nel/gui/dbview_bar3.h index 22119921d..a8e3ff36f 100644 --- a/code/nel/include/nel/gui/dbview_bar3.h +++ b/code/nel/include/nel/gui/dbview_bar3.h @@ -39,6 +39,7 @@ namespace NLGUI CDBViewBar3(const TCtorParam ¶m); std::string getProperty( const std::string &name ) const; + void setProperty( const std::string &name, const std::string &value ); bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup); virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } virtual void updateCoords (); @@ -95,7 +96,8 @@ namespace NLGUI // Height of the bitmap sint32 _BarH; - void parseValProp(xmlNodePtr cur, CInterfaceProperty &dbProp, sint32 &intProp, const char *name); + void parseValProp(xmlNodePtr cur, CInterfaceProperty &dbProp, sint32 &intProp, const char *name); + void setValProp( const std::string &value, CInterfaceProperty &dbProp, sint32 &intProp ); sint32 getCurrentValProp(const CInterfaceProperty &dbProp, sint32 intProp); std::string getValProp( const CInterfaceProperty &prop, sint32 intProp ) const; }; diff --git a/code/nel/src/gui/dbview_bar3.cpp b/code/nel/src/gui/dbview_bar3.cpp index 94219efc8..f6cd55772 100644 --- a/code/nel/src/gui/dbview_bar3.cpp +++ b/code/nel/src/gui/dbview_bar3.cpp @@ -55,6 +55,16 @@ namespace NLGUI } + void CDBViewBar3::setValProp( const std::string &value, CInterfaceProperty &dbProp, sint32 &intProp ) + { + sint32 i; + if( fromString( value, i ) ) + intProp = i; + else + dbProp.link( value.c_str() ); + } + + std::string CDBViewBar3::getProperty( const std::string &name ) const { if( name == "value1" ) @@ -129,6 +139,104 @@ namespace NLGUI } + void CDBViewBar3::setProperty( const std::string &name, const std::string &value ) + { + if( name == "value1" ) + { + setValProp( value, _Value[ 0 ], _ValueInt[ 0 ] ); + return; + } + else + if( name == "value2" ) + { + setValProp( value, _Value[ 1 ], _ValueInt[ 1 ] ); + return; + } + else + if( name == "value3" ) + { + setValProp( value, _Value[ 2 ], _ValueInt[ 2 ] ); + return; + } + else + if( name == "range1" ) + { + setValProp( value, _Range[ 0 ], _RangeInt[ 0 ] ); + return; + } + else + if( name == "range2" ) + { + setValProp( value, _Range[ 1 ], _RangeInt[ 1 ] ); + return; + } + else + if( name == "range3" ) + { + setValProp( value, _Range[ 2 ], _RangeInt[ 2 ] ); + return; + } + else + if( name == "color1" ) + { + CRGBA c; + if( fromString( value, c ) ) + _Colors[ 0 ] = c; + return; + } + else + if( name == "color2" ) + { + CRGBA c; + if( fromString( value, c ) ) + _Colors[ 1 ] = c; + return; + } + else + if( name == "color3" ) + { + CRGBA c; + if( fromString( value, c ) ) + _Colors[ 2 ] = c; + return; + } + else + if( name == "color1_negative" ) + { + CRGBA c; + if( fromString( value, c ) ) + _ColorsNegative[ 0 ] = c; + return; + } + else + if( name == "color2_negative" ) + { + CRGBA c; + if( fromString( value, c ) ) + _ColorsNegative[ 1 ] = c; + return; + } + else + if( name == "color3_negative" ) + { + CRGBA c; + if( fromString( value, c ) ) + _ColorsNegative[ 2 ] = c; + return; + } + else + if( name == "mini" ) + { + bool b; + if( fromString( value, b ) ) + _Mini = b; + return; + } + else + CViewBitmap::setProperty( name, value ); + } + + // ---------------------------------------------------------------------------- bool CDBViewBar3::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) {