CHANGED: #1471 CGroupMenu and CGroupList created widgets shouldn't be serialized by CInterfaceGroup.

This commit is contained in:
dfighter1985 2012-08-15 18:02:05 +02:00
parent 696ae33eaa
commit 1a774d7fa8
2 changed files with 21 additions and 0 deletions

View file

@ -535,6 +535,7 @@ namespace NLGUI
{ {
const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter;
CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow());
view->setSerializable( false );
view->_Parent = this; view->_Parent = this;
view->setMultiLine (multiLine); view->setMultiLine (multiLine);
view->setTextMode(_Templ.getTextMode()); view->setTextMode(_Templ.getTextMode());
@ -553,6 +554,7 @@ namespace NLGUI
{ {
const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter;
CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow());
view->setSerializable( false );
view->_Parent = this; view->_Parent = this;
view->setMultiLine (multiLine); view->setMultiLine (multiLine);
if (multiLine) view->setMultiLineSpace (_Space); if (multiLine) view->setMultiLineSpace (_Space);
@ -569,6 +571,7 @@ namespace NLGUI
{ {
const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter;
CViewTextID *view= new CViewTextID (elid, nID, _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); CViewTextID *view= new CViewTextID (elid, nID, _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow());
view->setSerializable( false );
view->_Parent = this; view->_Parent = this;
view->setMultiLine (multiLine); view->setMultiLine (multiLine);
if (multiLine) view->setMultiLineSpace (_Space); if (multiLine) view->setMultiLineSpace (_Space);
@ -583,6 +586,7 @@ namespace NLGUI
{ {
const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter;
CViewTextID *view= new CViewTextID (elid, dbPath, _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); CViewTextID *view= new CViewTextID (elid, dbPath, _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow());
view->setSerializable( false );
view->_Parent = this; view->_Parent = this;
view->setMultiLine (multiLine); view->setMultiLine (multiLine);
if (multiLine) view->setMultiLineSpace (_Space); if (multiLine) view->setMultiLineSpace (_Space);
@ -1099,6 +1103,7 @@ namespace NLGUI
// Add this element for drawing // Add this element for drawing
{ {
child->setSerializable( false );
CInterfaceGroup *pIG = dynamic_cast<CInterfaceGroup*>(child); CInterfaceGroup *pIG = dynamic_cast<CInterfaceGroup*>(child);
if (pIG != NULL) if (pIG != NULL)
{ {

View file

@ -161,6 +161,7 @@ namespace NLGUI
{ {
nlassert(sub != NULL); nlassert(sub != NULL);
nlassert(index < _SubMenus.size()); nlassert(index < _SubMenus.size());
sub->setSerializable( false );
if (_SubMenus[index] != NULL) if (_SubMenus[index] != NULL)
{ {
@ -220,6 +221,7 @@ namespace NLGUI
_SelectionView->setX (4); _SelectionView->setX (4);
_SelectionView->setSizeRef(1); // sizeref on W _SelectionView->setSizeRef(1); // sizeref on W
_SelectionView->setW (-8); _SelectionView->setW (-8);
_SelectionView->setSerializable( false );
addView (_SelectionView, 0); addView (_SelectionView, 0);
} }
// the group list // the group list
@ -231,6 +233,7 @@ namespace NLGUI
_GroupList->setX (4); _GroupList->setX (4);
_GroupList->setY (4); _GroupList->setY (4);
_GroupList->setSpace (_GroupMenu->_Space); _GroupList->setSpace (_GroupMenu->_Space);
_GroupList->setSerializable( false );
addGroup (_GroupList); addGroup (_GroupList);
} }
} }
@ -291,6 +294,7 @@ namespace NLGUI
if (strFormatted) bFormatted = convertBool (strFormatted); if (strFormatted) bFormatted = convertBool (strFormatted);
pV = addLine (ucstrName, strAh, strParams, strId, strCond, strTexture, bCheckable, bChecked, bFormatted); pV = addLine (ucstrName, strAh, strParams, strId, strCond, strTexture, bCheckable, bChecked, bFormatted);
pV->setSerializable( false );
CXMLAutoPtr strSelectable((const char*) xmlGetProp (cur, (xmlChar*)"selectable")); CXMLAutoPtr strSelectable((const char*) xmlGetProp (cur, (xmlChar*)"selectable"));
bool bSelectable = true; bool bSelectable = true;
@ -318,6 +322,7 @@ namespace NLGUI
// and create the sub menu // and create the sub menu
CGroupSubMenu *childMenu = new CGroupSubMenu(CViewText::TCtorParam()); CGroupSubMenu *childMenu = new CGroupSubMenu(CViewText::TCtorParam());
childMenu->_GroupMenu = _GroupMenu; childMenu->_GroupMenu = _GroupMenu;
childMenu->setSerializable( false );
childMenu->parse (child, this); childMenu->parse (child, this);
CXMLAutoPtr MVL((const char*) xmlGetProp(cur, (xmlChar*)"max_visible_line")); CXMLAutoPtr MVL((const char*) xmlGetProp(cur, (xmlChar*)"max_visible_line"));
@ -379,6 +384,7 @@ namespace NLGUI
{ {
// Put the left arrow to the line // Put the left arrow to the line
CViewBitmap *pVB = new CViewBitmap(CViewBase::TCtorParam()); CViewBitmap *pVB = new CViewBitmap(CViewBase::TCtorParam());
pVB->setSerializable( false );
pVB->setParent (this); pVB->setParent (this);
pVB->setParentPos (_GroupList); pVB->setParentPos (_GroupList);
pVB->setParentPosRef (Hotspot_BR); pVB->setParentPosRef (Hotspot_BR);
@ -400,6 +406,7 @@ namespace NLGUI
{ {
// Put the left arrow to the line // Put the left arrow to the line
CViewBitmap *pVB = new CViewBitmap(CViewBase::TCtorParam()); CViewBitmap *pVB = new CViewBitmap(CViewBase::TCtorParam());
pVB->setSerializable( false );
pVB->setParent (this); pVB->setParent (this);
pVB->setParentPos (parentPos); pVB->setParentPos (parentPos);
if (!center) if (!center)
@ -567,6 +574,7 @@ namespace NLGUI
_ScrollBar->setTextureTopOrRight ("w_scroll_l123_t.tga"); _ScrollBar->setTextureTopOrRight ("w_scroll_l123_t.tga");
_ScrollBar->setTarget(_GroupList); _ScrollBar->setTarget(_GroupList);
_SelectionView->setW (-8-8-2); _SelectionView->setW (-8-8-2);
_ScrollBar->setSerializable( false );
addCtrl(_ScrollBar); addCtrl(_ScrollBar);
mustUpdate = true; mustUpdate = true;
} }
@ -1141,7 +1149,9 @@ namespace NLGUI
// create the real separator. It may be larger than the group list, this is why we create a separate group // create the real separator. It may be larger than the group list, this is why we create a separate group
CInterfaceGroup *separator = CWidgetManager::getInstance()->getParser()->createGroupInstance("menu_separator", "", NULL, 0); CInterfaceGroup *separator = CWidgetManager::getInstance()->getParser()->createGroupInstance("menu_separator", "", NULL, 0);
if (!separator) return; if (!separator) return;
separator->setSerializable( false );
separator->setId(ID_MENU_SEPARATOR); separator->setId(ID_MENU_SEPARATOR);
separator->setSerializable( false );
addGroup(separator); addGroup(separator);
separator->setParent(this); separator->setParent(this);
// create place holder group // create place holder group
@ -1249,6 +1259,7 @@ namespace NLGUI
} }
SSubMenuEntry tmp; SSubMenuEntry tmp;
CViewTextMenu *pV = new CViewTextMenu(CViewBase::TCtorParam()); CViewTextMenu *pV = new CViewTextMenu(CViewBase::TCtorParam());
pV->setSerializable( false );
pV->setCaseMode(_GroupMenu->getCaseMode()); pV->setCaseMode(_GroupMenu->getCaseMode());
@ -1520,6 +1531,7 @@ namespace NLGUI
{ {
CGroupSubMenu *copyMenu = appendToMenu ? appendToMenu : new CGroupSubMenu(CViewText::TCtorParam()); CGroupSubMenu *copyMenu = appendToMenu ? appendToMenu : new CGroupSubMenu(CViewText::TCtorParam());
uint startSize = (uint)copyMenu->_Lines.size(); uint startSize = (uint)copyMenu->_Lines.size();
copyMenu->setSerializable( false );
copyMenu->_GroupMenu = newFather; copyMenu->_GroupMenu = newFather;
copyMenu->initOptions(initGroup); copyMenu->initOptions(initGroup);
copyMenu->_Lines.reserve(_Lines.size() + startSize); copyMenu->_Lines.reserve(_Lines.size() + startSize);
@ -2261,6 +2273,7 @@ namespace NLGUI
cur = in->children; cur = in->children;
if (_RootMenu != NULL) delete _RootMenu; if (_RootMenu != NULL) delete _RootMenu;
_RootMenu = new CGroupSubMenu(CViewText::TCtorParam()); _RootMenu = new CGroupSubMenu(CViewText::TCtorParam());
_RootMenu->setSerializable( false );
_RootMenu->_GroupMenu = this; _RootMenu->_GroupMenu = this;
_RootMenu->parse (cur); _RootMenu->parse (cur);
@ -2396,6 +2409,7 @@ namespace NLGUI
{ {
_RootMenu = new CGroupSubMenu(CViewText::TCtorParam()); _RootMenu = new CGroupSubMenu(CViewText::TCtorParam());
_RootMenu->_GroupMenu = this; _RootMenu->_GroupMenu = this;
_RootMenu->setSerializable( false );
addGroup (_RootMenu); addGroup (_RootMenu);
} }
@ -2413,6 +2427,7 @@ namespace NLGUI
{ {
_RootMenu = new CGroupSubMenu(CViewText::TCtorParam()); _RootMenu = new CGroupSubMenu(CViewText::TCtorParam());
_RootMenu->_GroupMenu = this; _RootMenu->_GroupMenu = this;
_RootMenu->setSerializable( false );
addGroup (_RootMenu); addGroup (_RootMenu);
} }
_RootMenu->addLine (name, ah, params, id, cond, texture, checkable, checked, _Formatted); _RootMenu->addLine (name, ah, params, id, cond, texture, checkable, checked, _Formatted);
@ -2427,6 +2442,7 @@ namespace NLGUI
{ {
_RootMenu = new CGroupSubMenu(CViewText::TCtorParam()); _RootMenu = new CGroupSubMenu(CViewText::TCtorParam());
_RootMenu->_GroupMenu = this; _RootMenu->_GroupMenu = this;
_RootMenu->setSerializable( false );
addGroup (_RootMenu); addGroup (_RootMenu);
} }
_RootMenu->addLineAtIndex(index, name, ah, params, id, cond, texture, checkable, checked, _Formatted); _RootMenu->addLineAtIndex(index, name, ah, params, id, cond, texture, checkable, checked, _Formatted);