summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2007-06-04 18:46:59 +0000
committerJosh Bell <josh@lindenlab.com>2007-06-04 18:46:59 +0000
commite61a10ec5b6b84fcb5c27e8e308022d0094f8736 (patch)
treebcf6152629edb1b2548af039bd89b6b573e1e514 /indra/llui
parent3e9872a297c3cf3f929e688e0e89a78f6bc050f5 (diff)
svn merge -r 62602:62831 svn+ssh://svn.lindenlab.com/svn/linden/branches/maintenance --> release
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llpanel.cpp17
-rw-r--r--indra/llui/llpanel.h2
-rw-r--r--indra/llui/lluictrlfactory.cpp11
-rw-r--r--indra/llui/lluictrlfactory.h4
-rw-r--r--indra/llui/llview.cpp17
-rw-r--r--indra/llui/llview.h4
6 files changed, 35 insertions, 20 deletions
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 316764474b..37feffd4b0 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -569,7 +569,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parentp, LLUICtrlFactory *fa
return panelp;
}
-void LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
+BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
LLString name("panel");
node->getAttributeString("name", name);
@@ -585,12 +585,23 @@ void LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
LLString xml_filename;
node->getAttributeString("filename", xml_filename);
+
+ BOOL didPost;
+
if (!xml_filename.empty())
{
- factory->buildPanel(this, xml_filename, NULL);
+ didPost = factory->buildPanel(this, xml_filename, NULL);
+ } else {
+ didPost = FALSE;
}
- postBuild();
+ if (!didPost)
+ {
+ postBuild();
+ didPost = TRUE;
+ }
+
+ return didPost;
}
void LLPanel::setPanelParameters(LLXMLNodePtr node, LLView* parentp)
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index fdf4a117d4..f06797a7f8 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -115,7 +115,7 @@ public:
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
- void initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
+ BOOL initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
void setPanelParameters(LLXMLNodePtr node, LLView *parentp);
// ** Wrappers for setting child properties by name ** -TomY
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 6410208189..1d149b63e2 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -350,21 +350,22 @@ S32 LLUICtrlFactory::saveToXML(LLView* viewp, const LLString& filename)
//-----------------------------------------------------------------------------
// buildPanel()
//-----------------------------------------------------------------------------
-void LLUICtrlFactory::buildPanel(LLPanel* panelp, const LLString &filename,
+BOOL LLUICtrlFactory::buildPanel(LLPanel* panelp, const LLString &filename,
const LLCallbackMap::map_t* factory_map)
{
+ BOOL didPost = FALSE;
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
- return;
+ return didPost;
}
// root must be called panel
if( !root->hasName("panel" ) )
{
llwarns << "Root node should be named panel in : " << filename << llendl;
- return;
+ return didPost;
}
if (factory_map)
@@ -372,7 +373,7 @@ void LLUICtrlFactory::buildPanel(LLPanel* panelp, const LLString &filename,
mFactoryStack.push_front(factory_map);
}
- panelp->initPanelXML(root, NULL, this);
+ didPost = panelp->initPanelXML(root, NULL, this);
if (LLUI::sShowXUINames)
{
@@ -386,6 +387,8 @@ void LLUICtrlFactory::buildPanel(LLPanel* panelp, const LLString &filename,
{
mFactoryStack.pop_front();
}
+
+ return didPost;
}
//-----------------------------------------------------------------------------
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index cb6864bafd..c7280aa4a2 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -60,8 +60,8 @@ public:
void buildFloater(LLFloater* floaterp, const LLString &filename,
const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE);
- void buildPanel(LLPanel* panelp, const LLString &filename,
- const LLCallbackMap::map_t* factory_map = NULL);
+ BOOL buildPanel(LLPanel* panelp, const LLString &filename,
+ const LLCallbackMap::map_t* factory_map = NULL);
LLMenuGL *buildMenu(const LLString &filename, LLView* parentp);
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 05c2247a35..1fab00b524 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -174,7 +174,6 @@ LLView::~LLView()
for (itor = mDispatchList.begin(); itor != mDispatchList.end(); ++itor)
{
(*itor).second->clearDispatchers();
- delete (*itor).second;
}
std::for_each(mFloaterControls.begin(), mFloaterControls.end(),
@@ -350,22 +349,25 @@ void LLView::addChildAtEnd(LLView* child, S32 tab_group)
}
// remove the specified child from the view, and set it's parent to NULL.
-void LLView::removeChild( LLView* child )
+void LLView::removeChild(LLView* child, BOOL deleteIt)
{
if (child->mParentView == this)
{
mChildList.remove( child );
child->mParentView = NULL;
+ if (child->isCtrl())
+ {
+ removeCtrl((LLUICtrl*)child);
+ }
+ if (deleteIt)
+ {
+ delete child;
+ }
}
else
{
llerrs << "LLView::removeChild called with non-child" << llendl;
}
-
- if (child->isCtrl())
- {
- removeCtrl((LLUICtrl*)child);
- }
}
void LLView::addCtrlAtEnd(LLUICtrl* ctrl, S32 tab_group)
@@ -2490,7 +2492,6 @@ void LLView::deregisterEventListener(LLString name)
dispatch_list_t::iterator itor = mDispatchList.find(name);
if (itor != mDispatchList.end())
{
- delete itor->second;
mDispatchList.erase(itor);
}
}
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 504558a132..f9875e8cca 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -221,7 +221,7 @@ public:
void addChild(LLView* view, S32 tab_group = 0);
void addChildAtEnd(LLView* view, S32 tab_group = 0);
// remove the specified child from the view, and set it's parent to NULL.
- void removeChild( LLView* view );
+ void removeChild(LLView* view, BOOL deleteIt = FALSE);
virtual void addCtrl( LLUICtrl* ctrl, S32 tab_group);
virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
@@ -464,7 +464,7 @@ protected:
LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask);
LLView* childrenHandleRightMouseUp(S32 x, S32 y, MASK mask);
- typedef std::map<LLString, LLSimpleListener*> dispatch_list_t;
+ typedef std::map<LLString, LLPointer<LLSimpleListener> > dispatch_list_t;
dispatch_list_t mDispatchList;
protected: