summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfloater.cpp8
-rw-r--r--indra/llui/llpanel.cpp38
-rw-r--r--indra/llui/llpanel.h3
-rw-r--r--indra/llui/lltexteditor.cpp3
-rw-r--r--indra/llui/lluictrl.cpp8
5 files changed, 56 insertions, 4 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 845203b420..a35d279500 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -878,9 +878,11 @@ void LLFloater::setSnappedTo(const LLView* snap_view)
else
{
//RN: assume it's a floater as it must be a sibling to our parent floater
- LLFloater* floaterp = (LLFloater*)snap_view;
-
- setSnapTarget(floaterp->getHandle());
+ const LLFloater* floaterp = dynamic_cast<const LLFloater*>(snap_view);
+ if (floaterp)
+ {
+ setSnapTarget(floaterp->getHandle());
+ }
}
}
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 143f19eea6..7f23fe2671 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -898,6 +898,44 @@ LLPanel *LLPanel::childGetVisibleTabWithHelp()
return ::childGetVisibleTabWithHelp(this);
}
+static LLPanel *childGetVisiblePanelWithHelp(LLView *parent)
+{
+ LLView *child;
+
+ // look through immediate children first for an active panel with help
+ for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
+ {
+ // do we have a panel with a help topic?
+ LLPanel *panel = dynamic_cast<LLPanel *>(child);
+ if (panel && panel->getVisible() && !panel->getHelpTopic().empty())
+ {
+ return panel;
+ }
+ }
+
+ // then try a bit harder and recurse through all children
+ for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
+ {
+ if (child->getVisible())
+ {
+ LLPanel* panel = ::childGetVisiblePanelWithHelp(child);
+ if (panel)
+ {
+ return panel;
+ }
+ }
+ }
+
+ // couldn't find any active panels with a help topic string
+ return NULL;
+}
+
+LLPanel *LLPanel::childGetVisiblePanelWithHelp()
+{
+ // find a visible tab with a help topic (to determine help context)
+ return ::childGetVisiblePanelWithHelp(this);
+}
+
void LLPanel::childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) )
{
LLLineEditor* child = findChild<LLLineEditor>(id);
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index d0986a06d3..6de83fe3a7 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -214,7 +214,10 @@ public:
// LLTabContainer
void childShowTab(const std::string& id, const std::string& tabname, bool visible = true);
LLPanel *childGetVisibleTab(const std::string& id) const;
+
+ // Find a child with a nonempty Help topic
LLPanel *childGetVisibleTabWithHelp();
+ LLPanel *childGetVisiblePanelWithHelp();
// LLTextBox/LLTextEditor/LLLineEditor
void childSetText(const std::string& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); }
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index e8fc9475a5..f2c3879a6c 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -308,7 +308,8 @@ LLTextEditor::~LLTextEditor()
// Scrollbar is deleted by LLView
std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer());
- delete mContextMenu;
+ // context menu is owned by menu holder, not us
+ //delete mContextMenu;
}
////////////////////////////////////////////////////////////
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 6044908ca7..f016c0af89 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -876,6 +876,14 @@ bool LLUICtrl::findHelpTopic(std::string& help_topic_out)
return true; // success (tab)
}
+ // does the panel have a sub-panel with a help topic?
+ LLPanel *subpanel = panel->childGetVisiblePanelWithHelp();
+ if (subpanel)
+ {
+ help_topic_out = subpanel->getHelpTopic();
+ return true; // success (subpanel)
+ }
+
// otherwise, does the panel have a help topic itself?
if (!panel->getHelpTopic().empty())
{