summaryrefslogtreecommitdiff
path: root/indra/llui/llpanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llpanel.cpp')
-rwxr-xr-xindra/llui/llpanel.cpp249
1 files changed, 43 insertions, 206 deletions
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 67472ad166..ee90574161 100755
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -38,10 +38,8 @@
#include "lldir.h"
#include "lltimer.h"
-#include "llaccordionctrltab.h"
#include "llbutton.h"
#include "llmenugl.h"
-//#include "llstatusbar.h"
#include "llui.h"
#include "llkeyboard.h"
#include "lllineeditor.h"
@@ -50,7 +48,6 @@
#include "lluictrl.h"
#include "lluictrlfactory.h"
#include "llviewborder.h"
-#include "lltabcontainer.h"
static LLDefaultChildRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML);
LLPanel::factory_stack_t LLPanel::sFactoryStack;
@@ -166,8 +163,8 @@ void LLPanel::removeBorder()
// virtual
void LLPanel::clearCtrls()
{
- LLView::ctrl_list_t ctrls = getCtrlList();
- for (LLView::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
+ LLPanel::ctrl_list_t ctrls = getCtrlList();
+ for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
{
LLUICtrl* ctrl = *ctrl_it;
ctrl->setFocus( FALSE );
@@ -178,14 +175,29 @@ void LLPanel::clearCtrls()
void LLPanel::setCtrlsEnabled( BOOL b )
{
- LLView::ctrl_list_t ctrls = getCtrlList();
- for (LLView::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
+ LLPanel::ctrl_list_t ctrls = getCtrlList();
+ for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
{
LLUICtrl* ctrl = *ctrl_it;
ctrl->setEnabled( b );
}
}
+LLPanel::ctrl_list_t LLPanel::getCtrlList() const
+{
+ ctrl_list_t controls;
+ for(child_list_t::const_iterator it = getChildList()->begin(), end_it = getChildList()->end(); it != end_it; ++it)
+ {
+ LLView* viewp = *it;
+ if(viewp->isCtrl())
+ {
+ controls.push_back(static_cast<LLUICtrl*>(viewp));
+ }
+ }
+ return controls;
+}
+
+
void LLPanel::draw()
{
F32 alpha = getDrawContext().mAlpha;
@@ -342,9 +354,9 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
return handled;
}
-void LLPanel::handleVisibilityChange ( BOOL new_visibility )
+void LLPanel::onVisibilityChange ( BOOL new_visibility )
{
- LLUICtrl::handleVisibilityChange ( new_visibility );
+ LLUICtrl::onVisibilityChange ( new_visibility );
if (mVisibleSignal)
(*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD
}
@@ -372,7 +384,7 @@ void LLPanel::setBorderVisible(BOOL b)
}
}
-LLFastTimer::DeclareTimer FTM_PANEL_CONSTRUCTION("Panel Construction");
+LLTrace::BlockTimerStatHandle FTM_PANEL_CONSTRUCTION("Panel Construction");
LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_node)
{
@@ -384,14 +396,14 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_
LLPanel* panelp = NULL;
- { LLFastTimer _(FTM_PANEL_CONSTRUCTION);
+ { LL_RECORD_BLOCK_TIME(FTM_PANEL_CONSTRUCTION);
if(!class_attr.empty())
{
panelp = LLRegisterPanelClass::instance().createPanelClass(class_attr);
if (!panelp)
{
- llwarns << "Panel class \"" << class_attr << "\" not registered." << llendl;
+ LL_WARNS() << "Panel class \"" << class_attr << "\" not registered." << LL_ENDL;
}
}
@@ -488,15 +500,15 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
setAcceptsBadge(p.accepts_badge);
}
-static LLFastTimer::DeclareTimer FTM_PANEL_SETUP("Panel Setup");
-static LLFastTimer::DeclareTimer FTM_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference");
-static LLFastTimer::DeclareTimer FTM_PANEL_POSTBUILD("Panel PostBuild");
+static LLTrace::BlockTimerStatHandle FTM_PANEL_SETUP("Panel Setup");
+static LLTrace::BlockTimerStatHandle FTM_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference");
+static LLTrace::BlockTimerStatHandle FTM_PANEL_POSTBUILD("Panel PostBuild");
BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params)
{
Params params(default_params);
{
- LLFastTimer timer(FTM_PANEL_SETUP);
+ LL_RECORD_BLOCK_TIME(FTM_PANEL_SETUP);
LLXMLNodePtr referenced_xml;
std::string xml_filename = mXMLFilename;
@@ -520,16 +532,16 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
Params output_params(params);
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
- parser.writeXUI(output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params);
return TRUE;
}
LLUICtrlFactory::instance().pushFileName(xml_filename);
- LLFastTimer timer(FTM_EXTERNAL_PANEL_LOAD);
+ LL_RECORD_BLOCK_TIME(FTM_EXTERNAL_PANEL_LOAD);
if (!LLUICtrlFactory::getLayeredXMLNode(xml_filename, referenced_xml))
{
- llwarns << "Couldn't parse panel from: " << xml_filename << llendl;
+ LL_WARNS() << "Couldn't parse panel from: " << xml_filename << LL_ENDL;
return FALSE;
}
@@ -551,13 +563,13 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
Params output_params(params);
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
- parser.writeXUI(output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params);
}
params.from_xui = true;
applyXUILayout(params, parent);
{
- LLFastTimer timer(FTM_PANEL_CONSTRUCTION);
+ LL_RECORD_BLOCK_TIME(FTM_PANEL_CONSTRUCTION);
initFromParams(params);
}
@@ -574,7 +586,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
}
{
- LLFastTimer timer(FTM_PANEL_POSTBUILD);
+ LL_RECORD_BLOCK_TIME(FTM_PANEL_POSTBUILD);
postBuild();
}
}
@@ -599,11 +611,11 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form
std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
if(LLUI::sSettingGroups["config"]->getBOOL("QAMode"))
{
- llerrs << err_str << llendl;
+ LL_ERRS() << err_str << LL_ENDL;
}
else
{
- llwarns << err_str << llendl;
+ LL_WARNS() << err_str << LL_ENDL;
}
return LLStringUtil::null;
}
@@ -618,11 +630,11 @@ std::string LLPanel::getString(const std::string& name) const
std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
if(LLUI::sSettingGroups["config"]->getBOOL("QAMode"))
{
- llerrs << err_str << llendl;
+ LL_ERRS() << err_str << LL_ENDL;
}
else
{
- llwarns << err_str << llendl;
+ LL_WARNS() << err_str << LL_ENDL;
}
return LLStringUtil::null;
}
@@ -637,16 +649,6 @@ void LLPanel::childSetVisible(const std::string& id, bool visible)
}
}
-bool LLPanel::childIsVisible(const std::string& id) const
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- return (bool)child->getVisible();
- }
- return false;
-}
-
void LLPanel::childSetEnabled(const std::string& id, bool enabled)
{
LLView* child = findChild<LLView>(id);
@@ -656,55 +658,6 @@ void LLPanel::childSetEnabled(const std::string& id, bool enabled)
}
}
-void LLPanel::childSetTentative(const std::string& id, bool tentative)
-{
- LLUICtrl* child = findChild<LLUICtrl>(id);
- if (child)
- {
- child->setTentative(tentative);
- }
-}
-
-bool LLPanel::childIsEnabled(const std::string& id) const
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- return (bool)child->getEnabled();
- }
- return false;
-}
-
-
-void LLPanel::childSetToolTip(const std::string& id, const std::string& msg)
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- child->setToolTip(msg);
- }
-}
-
-void LLPanel::childSetRect(const std::string& id, const LLRect& rect)
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- child->setRect(rect);
- }
-}
-
-bool LLPanel::childGetRect(const std::string& id, LLRect& rect) const
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- rect = child->getRect();
- return true;
- }
- return false;
-}
-
void LLPanel::childSetFocus(const std::string& id, BOOL focus)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
@@ -740,15 +693,6 @@ void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void
}
}
-void LLPanel::childSetValidate(const std::string& id, boost::function<bool (const LLSD& data)> cb)
-{
- LLUICtrl* child = findChild<LLUICtrl>(id);
- if (child)
- {
- child->setValidateBeforeCommit(cb);
- }
-}
-
void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
@@ -828,95 +772,6 @@ BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, co
return FALSE;
}
-BOOL LLPanel::childSetToolTipArg(const std::string& id, const std::string& key, const LLStringExplicit& text)
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- return child->setToolTipArg(key, text);
- }
- return FALSE;
-}
-
-void LLPanel::childShowTab(const std::string& id, const std::string& tabname, bool visible)
-{
- LLTabContainer* child = findChild<LLTabContainer>(id);
- if (child)
- {
- child->selectTabByName(tabname);
- }
-}
-
-LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const
-{
- LLTabContainer* child = findChild<LLTabContainer>(id);
- if (child)
- {
- return child->getCurrentPanel();
- }
- return NULL;
-}
-
-LLPanel* LLPanel::childGetVisibleTabWithHelp()
-{
- LLView *child;
-
- bfs_tree_iterator_t it = beginTreeBFS();
- // skip ourselves
- ++it;
- for (; it != endTreeBFS(); ++it)
- {
- child = *it;
- LLPanel *curTabPanel = NULL;
-
- // do we have a tab container?
- LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child);
- if (tab && tab->getVisible())
- {
- curTabPanel = tab->getCurrentPanel();
- }
-
- // do we have an accordion tab?
- LLAccordionCtrlTab* accordion = dynamic_cast<LLAccordionCtrlTab *>(child);
- if (accordion && accordion->getDisplayChildren())
- {
- curTabPanel = dynamic_cast<LLPanel *>(accordion->getAccordionView());
- }
-
- // if we found a valid tab, does it have a help topic?
- if (curTabPanel && !curTabPanel->getHelpTopic().empty())
- {
- return curTabPanel;
- }
- }
-
- // couldn't find any active tabs with a help topic string
- return NULL;
-}
-
-
-LLPanel *LLPanel::childGetVisiblePanelWithHelp()
-{
- LLView *child;
-
- bfs_tree_iterator_t it = beginTreeBFS();
- // skip ourselves
- ++it;
- for (; it != endTreeBFS(); ++it)
- {
- child = *it;
- // do we have a panel with a help topic?
- LLPanel *panel = dynamic_cast<LLPanel *>(child);
- if (panel && panel->isInVisibleChain() && !panel->getHelpTopic().empty())
- {
- return panel;
- }
- }
-
- // couldn't find any active panels with a help topic string
- return NULL;
-}
-
void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function)
{
LLButton* button = findChild<LLButton>(id);
@@ -935,24 +790,6 @@ void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)>
}
}
-void LLPanel::childSetActionTextbox(const std::string& id, boost::function<void(void*)> function, void* value)
-{
- LLTextBox* textbox = findChild<LLTextBox>(id);
- if (textbox)
- {
- textbox->setClickedCallback(boost::bind(function, value));
- }
-}
-
-void LLPanel::childSetControlName(const std::string& id, const std::string& control_name)
-{
- LLUICtrl* view = findChild<LLUICtrl>(id);
- if (view)
- {
- view->setControlName(control_name, NULL);
- }
-}
-
boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::slot_type& cb )
{
if (!mVisibleSignal)
@@ -963,31 +800,31 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::
return mVisibleSignal->connect(cb);
}
-static LLFastTimer::DeclareTimer FTM_BUILD_PANELS("Build Panels");
+static LLTrace::BlockTimerStatHandle FTM_BUILD_PANELS("Build Panels");
//-----------------------------------------------------------------------------
// buildPanel()
//-----------------------------------------------------------------------------
BOOL LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params)
{
- LLFastTimer timer(FTM_BUILD_PANELS);
+ LL_RECORD_BLOCK_TIME(FTM_BUILD_PANELS);
BOOL didPost = FALSE;
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
- llwarns << "Couldn't parse panel from: " << filename << llendl;
+ LL_WARNS() << "Couldn't parse panel from: " << filename << LL_ENDL;
return didPost;
}
// root must be called panel
if( !root->hasName("panel" ) )
{
- llwarns << "Root node should be named panel in : " << filename << llendl;
+ LL_WARNS() << "Root node should be named panel in : " << filename << LL_ENDL;
return didPost;
}
- lldebugs << "Building panel " << filename << llendl;
+ LL_DEBUGS() << "Building panel " << filename << LL_ENDL;
LLUICtrlFactory::instance().pushFileName(filename);
{