summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorMartin Reddy <lynx@lindenlab.com>2009-10-15 13:08:12 +0000
committerMartin Reddy <lynx@lindenlab.com>2009-10-15 13:08:12 +0000
commit925f01f6a066113049e8c829c6fc3875c69ef566 (patch)
tree4b28ca62ce3de11e3e9727ab09cdfe63466233cf /indra/llui
parent0051f6bc6d421b8f973d801189b9495c311a647b (diff)
DEV-41253: Updated the help context calculation code so that it will
now search through a panel's children to see if there are any visible tabs that have a help topic string defined. If so, we use this string. Updated all of the XUI files that include a tab_container to define help topic strings for their child panels. I named all of these strings with the floater name as the prefix and "tab" at the end. For example, "preferences_display_tab" or "people_nearby_tab".
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfloater.cpp13
-rw-r--r--indra/llui/llpanel.cpp41
-rw-r--r--indra/llui/llpanel.h1
-rw-r--r--indra/llui/lluictrl.cpp23
4 files changed, 72 insertions, 6 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 8d2783db20..47ca4899df 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1443,7 +1443,18 @@ void LLFloater::onClickHelp( LLFloater* self )
{
if (self && LLUI::sHelpImpl)
{
- LLUI::sHelpImpl->showTopic(self->getHelpTopic());
+ // get the help topic for this floater
+ std::string help_topic = self->getHelpTopic();
+
+ // but use a more specific help topic for the currently
+ // displayed tab inside of this floater, if present
+ LLPanel *curtab = self->childGetVisibleTabWithHelp();
+ if (curtab)
+ {
+ help_topic = curtab->getHelpTopic();
+ }
+
+ LLUI::sHelpImpl->showTopic(help_topic);
}
}
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 69ff3dddc3..742427525b 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -810,6 +810,47 @@ LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const
return NULL;
}
+static LLPanel *childGetVisibleTabWithHelp(LLView *parent)
+{
+ LLView *child;
+
+ // look through immediate children first for an active tab with help
+ for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
+ {
+ LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child);
+ if (tab && tab->getVisible())
+ {
+ LLPanel *curTabPanel = tab->getCurrentPanel();
+ if (curTabPanel && !curTabPanel->getHelpTopic().empty())
+ {
+ return curTabPanel;
+ }
+ }
+ }
+
+ // then try a bit harder and recurse through all children
+ for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
+ {
+ if (child->getVisible())
+ {
+ LLPanel* tab = ::childGetVisibleTabWithHelp(child);
+ if (tab)
+ {
+ return tab;
+ }
+ }
+ }
+
+ // couldn't find any active tabs with a help topic string
+ return NULL;
+}
+
+LLPanel *LLPanel::childGetVisibleTabWithHelp()
+{
+ // find a visible tab with a help topic (to determine help context)
+ return ::childGetVisibleTabWithHelp(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 0594762333..e8db68ffbb 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -208,6 +208,7 @@ public:
// LLTabContainer
void childShowTab(const std::string& id, const std::string& tabname, bool visible = true);
LLPanel *childGetVisibleTab(const std::string& id) const;
+ LLPanel *childGetVisibleTabWithHelp();
// LLTextBox/LLTextEditor/LLLineEditor
void childSetText(const std::string& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); }
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 5b72f87a78..84b1c92097 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -795,16 +795,29 @@ bool LLUICtrl::findHelpTopic(std::string& help_topic_out)
LLUICtrl* ctrl = this;
// search back through the control's parents for a panel
- // with a help_topic string defined
+ // or tab with a help_topic string defined
while (ctrl)
{
LLPanel *panel = dynamic_cast<LLPanel *>(ctrl);
- if (panel && !panel->getHelpTopic().empty())
+
+ if (panel)
{
- help_topic_out = panel->getHelpTopic();
- return true; // success
+ // does the panel have an active tab with a help topic?
+ LLPanel *tab = panel->childGetVisibleTabWithHelp();
+ if (tab)
+ {
+ help_topic_out = tab->getHelpTopic();
+ return true; // success (tab)
+ }
+
+ // otherwise, does the panel have a help topic itself?
+ if (!panel->getHelpTopic().empty())
+ {
+ help_topic_out = panel->getHelpTopic();
+ return true; // success (panel)
+ }
}
-
+
ctrl = ctrl->getParentUICtrl();
}