From deb5d7c709bc4c124eb902f8e70df14a6847a109 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 11 Aug 2012 19:22:55 +0200 Subject: [PATCH] CHANGED: #1471 CCtrlScroll fields can now be serialized. --- code/nel/include/nel/gui/ctrl_scroll.h | 1 + code/nel/src/gui/ctrl_scroll.cpp | 61 +++++++++++++++++++ .../gui_editor/widgets/CtrlColPick.xml | 47 ++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlColPick.xml diff --git a/code/nel/include/nel/gui/ctrl_scroll.h b/code/nel/include/nel/gui/ctrl_scroll.h index 8939b480d..2952f9d4f 100644 --- a/code/nel/include/nel/gui/ctrl_scroll.h +++ b/code/nel/include/nel/gui/ctrl_scroll.h @@ -42,6 +42,7 @@ namespace NLGUI std::string getProperty( const std::string &name ) const; void setProperty( const std::string &name, const std::string &value ); + xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup); diff --git a/code/nel/src/gui/ctrl_scroll.cpp b/code/nel/src/gui/ctrl_scroll.cpp index 699466bab..ac52f4607 100644 --- a/code/nel/src/gui/ctrl_scroll.cpp +++ b/code/nel/src/gui/ctrl_scroll.cpp @@ -392,6 +392,67 @@ namespace NLGUI CCtrlBase::setProperty( name, value ); } + xmlNodePtr CCtrlScroll::serialize( xmlNodePtr parentNode, const char *type ) const + { + xmlNodePtr node = CCtrlBase::serialize( parentNode, type ); + if( node == NULL ) + return NULL; + + 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 "vertical", BAD_CAST toString( _Vertical ).c_str() ); + + std::string align; + + switch( _Aligned ) + { + case 0: + align = "T"; + break; + + case 1: + align = "B"; + break; + + case 2: + align = "L"; + break; + + case 3: + align = "R"; + break; + } + xmlSetProp( node, BAD_CAST "align", BAD_CAST align.c_str() ); + + xmlSetProp( node, BAD_CAST "min", BAD_CAST toString( _Min ).c_str() ); + xmlSetProp( node, BAD_CAST "max", BAD_CAST toString( _Max ).c_str() ); + + if( _IsDBLink ) + xmlSetProp( node, BAD_CAST "value", BAD_CAST _DBLink.getNodePtr()->getFullName().c_str() ); + + xmlSetProp( node, BAD_CAST "tracksize", BAD_CAST toString( _TrackSize ).c_str() ); + xmlSetProp( node, BAD_CAST "onscroll", BAD_CAST _AHOnScroll.c_str() ); + xmlSetProp( node, BAD_CAST "params", BAD_CAST _AHOnScrollParams.c_str() ); + xmlSetProp( node, BAD_CAST "onscrollend", BAD_CAST _AHOnScrollEnd.c_str() ); + xmlSetProp( node, BAD_CAST "end_params", BAD_CAST _AHOnScrollEndParams.c_str() ); + xmlSetProp( node, BAD_CAST "onscrollcancel", BAD_CAST _AHOnScrollCancel.c_str() ); + xmlSetProp( node, BAD_CAST "cancel_params", BAD_CAST _AHOnScrollCancelParams.c_str() ); + + if( _Target != NULL ) + xmlSetProp( node, BAD_CAST "target", BAD_CAST _Target->getId().c_str() ); + else + xmlSetProp( node, BAD_CAST "target", BAD_CAST "" ); + + xmlSetProp( node, BAD_CAST "target_stepx", BAD_CAST toString( _TargetStepX ).c_str() ); + xmlSetProp( node, BAD_CAST "target_stepy", BAD_CAST toString( _TargetStepY ).c_str() ); + xmlSetProp( node, BAD_CAST "step_value", BAD_CAST toString( _StepValue ).c_str() ); + xmlSetProp( node, BAD_CAST "cancelable", BAD_CAST toString( _Cancelable ).c_str() ); + xmlSetProp( node, BAD_CAST "frozen", BAD_CAST toString( _Frozen ).c_str() ); + + return node; + } + // ------------------------------------------------------------------------------------------------ bool CCtrlScroll::parse(xmlNodePtr node, CInterfaceGroup * parentGroup) { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlColPick.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlColPick.xml new file mode 100644 index 000000000..fa645655f --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlColPick.xml @@ -0,0 +1,47 @@ + +
+ CtrlColPick + CCtrlColPick + CtrlBase + + false + +
+ + + texture + string + + + + onchange + string + + + + onchange_params + string + + + + dbcolr + string + + + + dbcolg + string + + + + dbcolb + string + + + + dbcola + string + + + +