From 7547c5aa888340fe53aa03f96f69ee4bb0e7a214 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 14 Aug 2012 00:53:47 +0200 Subject: [PATCH] CHANGED: #1471 CGroupHeaderEntry fields can now we serialized. --HG-- branch : gsoc2012-gui-editor --- code/nel/include/nel/gui/group_header.h | 2 ++ code/nel/src/gui/group_header.cpp | 24 ++++++++++++++++++++---- code/nel/src/gui/group_tree.cpp | 1 - 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/code/nel/include/nel/gui/group_header.h b/code/nel/include/nel/gui/group_header.h index 444291b8a..124b040db 100644 --- a/code/nel/include/nel/gui/group_header.h +++ b/code/nel/include/nel/gui/group_header.h @@ -67,6 +67,7 @@ namespace NLGUI { public: CGroupHeaderEntry(const TCtorParam ¶m); + xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; // from CInterfaceGroup virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup); sint32 getMinSize() const { return _MinSize; } @@ -78,6 +79,7 @@ namespace NLGUI private: sint32 _MinSize; + sint32 _ResizerSize; std::string _TargetColumnId; std::string _AHOnResize; std::string _AHOnResizeParams; diff --git a/code/nel/src/gui/group_header.cpp b/code/nel/src/gui/group_header.cpp index 834f089ae..125d9150c 100644 --- a/code/nel/src/gui/group_header.cpp +++ b/code/nel/src/gui/group_header.cpp @@ -396,6 +396,23 @@ namespace NLGUI CGroupHeaderEntry::CGroupHeaderEntry(const TCtorParam ¶m) : CInterfaceGroup(param) { _MinSize = 4; + _ResizerSize = 4; + } + + xmlNodePtr CGroupHeaderEntry::serialize( xmlNodePtr parentNode, const char *type ) const + { + xmlNodePtr node = CInterfaceGroup::serialize( parentNode, type ); + if( node == NULL ) + return NULL; + + xmlSetProp( node, BAD_CAST "wmin", BAD_CAST toString( _MinSize ).c_str() ); + xmlSetProp( node, BAD_CAST "resizer_size", BAD_CAST toString( _ResizerSize ).c_str() ); + xmlSetProp( node, BAD_CAST "target", BAD_CAST toString( _TargetColumnId ).c_str() ); + xmlSetProp( node, BAD_CAST "on_resize", BAD_CAST _AHOnResize.c_str() ); + xmlSetProp( node, BAD_CAST "on_resize_params", BAD_CAST _AHOnResizeParams.c_str() ); + + + return node; } // ***************************************************************************************************************** @@ -405,9 +422,8 @@ namespace NLGUI // left mover CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"wmin" )); if (prop) fromString((const char*)prop, _MinSize); - sint32 resizerSize = 4; prop = (char*) xmlGetProp( cur, (xmlChar*)"resizer_size" ); - if (prop) fromString((const char*)prop, resizerSize); + if (prop) fromString((const char*)prop, _ResizerSize); prop = (char*) xmlGetProp(cur, (xmlChar*) "target"); if (prop) _TargetColumnId = (const char *) prop; @@ -418,7 +434,7 @@ namespace NLGUI CHeaderEntryResizer *hm = new CHeaderEntryResizer(false, _MinSize); addCtrl(hm); - hm->setW(resizerSize); + hm->setW(_ResizerSize); hm->setSizeRef(2); hm->setParent(this); hm->setParentPosRef(Hotspot_TL); @@ -426,7 +442,7 @@ namespace NLGUI // right mover hm = new CHeaderEntryResizer(true, _MinSize); addCtrl(hm); - hm->setW(resizerSize); + hm->setW(_ResizerSize); hm->setSizeRef(2); hm->setParent(this); hm->setParentPosRef(Hotspot_TR); diff --git a/code/nel/src/gui/group_tree.cpp b/code/nel/src/gui/group_tree.cpp index d1c8236a9..4dbd23155 100644 --- a/code/nel/src/gui/group_tree.cpp +++ b/code/nel/src/gui/group_tree.cpp @@ -650,7 +650,6 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "col_over", BAD_CAST toString( _OverColor ).c_str() ); xmlSetProp( node, BAD_CAST "col_select", BAD_CAST toString( _SelectedColor ).c_str() ); xmlSetProp( node, BAD_CAST "col_over_back", BAD_CAST toString( _OverColorBack ).c_str() ); - xmlSetProp( node, BAD_CAST "", BAD_CAST "" ); xmlSetProp( node, BAD_CAST "fontsize", BAD_CAST toString( _FontSize ).c_str() ); xmlSetProp( node, BAD_CAST "select_ancestor_on_close", BAD_CAST toString( _SelectAncestorOnClose ).c_str() ); xmlSetProp( node, BAD_CAST "navigate_one_branch", BAD_CAST toString( _NavigateOneBranch ).c_str() );