summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Linden <none@none>2010-06-24 10:47:31 -0700
committerRichard Linden <none@none>2010-06-24 10:47:31 -0700
commit483f66e082dd758ac1efafdcb5ba9c277690d760 (patch)
tree2e6f5c10c08e9bdf7caa11c31a40d6a3e9792ff4 /indra/llui
parent8f892d0f36fda170a5cecf0aea89887d6d0e45ef (diff)
parent1683c7c6e99814e101312aad38718d393a2605e3 (diff)
merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfloater.cpp4
-rw-r--r--indra/llui/llfloater.h2
-rw-r--r--indra/llui/llmenugl.cpp3
-rw-r--r--indra/llui/llmenugl.h3
-rw-r--r--indra/llui/llpanel.cpp9
-rw-r--r--indra/llui/llui.cpp48
-rw-r--r--indra/llui/lluictrlfactory.cpp29
-rw-r--r--indra/llui/lluictrlfactory.h8
-rw-r--r--indra/llui/llview.cpp2
-rw-r--r--indra/llui/llview.h4
10 files changed, 92 insertions, 20 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 9a56372e68..39a6855273 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2754,10 +2754,10 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build");
-bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node)
+bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node)
{
Params params(LLUICtrlFactory::getDefaultParams<LLFloater>());
- LLXUIParser::instance().readXUI(node, params); // *TODO: Error checking
+ LLXUIParser::instance().readXUI(node, params, filename); // *TODO: Error checking
if (output_node)
{
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 654164ddc0..3ea035777c 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -149,7 +149,7 @@ public:
static void setupParamsForExport(Params& p, LLView* parent);
void initFromParams(const LLFloater::Params& p);
- bool initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
+ bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL);
/*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
/*virtual*/ BOOL canSnapTo(const LLView* other_view);
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index b77126996e..b4a1bcb7c5 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -139,6 +139,7 @@ LLMenuItemGL::Params::Params()
: shortcut("shortcut"),
jump_key("jump_key", KEY_NONE),
use_mac_ctrl("use_mac_ctrl", false),
+ allow_key_repeat("allow_key_repeat", false),
rect("rect"),
left("left"),
top("top"),
@@ -160,7 +161,7 @@ LLMenuItemGL::Params::Params()
LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p)
: LLUICtrl(p),
mJumpKey(p.jump_key),
- mAllowKeyRepeat(FALSE),
+ mAllowKeyRepeat(p.allow_key_repeat),
mHighlight( FALSE ),
mGotHover( FALSE ),
mBriefItem( FALSE ),
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 6f0f83d4b9..7668f301ea 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -61,7 +61,8 @@ public:
{
Optional<std::string> shortcut;
Optional<KEY> jump_key;
- Optional<bool> use_mac_ctrl;
+ Optional<bool> use_mac_ctrl,
+ allow_key_repeat;
Ignored rect,
left,
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 0cd052eefa..9ebdcb87c6 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -508,16 +508,19 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
if (xml_filename.empty())
{
node->getAttributeString("filename", xml_filename);
+ setXMLFilename(xml_filename);
}
if (!xml_filename.empty())
{
+ LLUICtrlFactory::instance().pushFileName(xml_filename);
+
LLFastTimer timer(FTM_EXTERNAL_PANEL_LOAD);
if (output_node)
{
//if we are exporting, we want to export the current xml
//not the referenced xml
- LLXUIParser::instance().readXUI(node, params, xml_filename);
+ LLXUIParser::instance().readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
Params output_params(params);
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
@@ -533,13 +536,13 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
return FALSE;
}
- LLXUIParser::instance().readXUI(referenced_xml, params, xml_filename);
+ LLXUIParser::instance().readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName());
// add children using dimensions from referenced xml for consistent layout
setShape(params.rect);
LLUICtrlFactory::createChildren(this, referenced_xml, child_registry_t::instance());
- setXMLFilename(xml_filename);
+ LLUICtrlFactory::instance().popFileName();
}
// ask LLUICtrlFactory for filename, since xml_filename might be empty
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index bf12384a28..dff1cb93e7 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1752,6 +1752,33 @@ std::string LLUI::getLanguage()
return language;
}
+struct SubDir : public LLInitParam::Block<SubDir>
+{
+ Mandatory<std::string> value;
+
+ SubDir()
+ : value("value")
+ {}
+};
+
+struct Directory : public LLInitParam::Block<Directory>
+{
+ Multiple<SubDir, AtLeast<1> > subdirs;
+
+ Directory()
+ : subdirs("subdir")
+ {}
+};
+
+struct Paths : public LLInitParam::Block<Paths>
+{
+ Multiple<Directory, AtLeast<1> > directories;
+
+ Paths()
+ : directories("directory")
+ {}
+};
+
//static
void LLUI::setupPaths()
{
@@ -1759,21 +1786,36 @@ void LLUI::setupPaths()
LLXMLNodePtr root;
BOOL success = LLXMLNode::parseFile(filename, root, NULL);
+ Paths paths;
+ LLXUIParser::instance().readXUI(root, paths, filename);
+
sXUIPaths.clear();
- if (success)
+ if (success && paths.validateBlock())
{
LLStringUtil::format_map_t path_args;
path_args["[LANGUAGE]"] = LLUI::getLanguage();
- for (LLXMLNodePtr path = root->getFirstChild(); path.notNull(); path = path->getNextSibling())
+ for (LLInitParam::ParamIterator<Directory>::const_iterator it = paths.directories().begin(),
+ end_it = paths.directories().end();
+ it != end_it;
+ ++it)
{
- std::string path_val_ui(path->getValue());
+ std::string path_val_ui;
+ for (LLInitParam::ParamIterator<SubDir>::const_iterator subdir_it = it->subdirs().begin(),
+ subdir_end_it = it->subdirs().end();
+ subdir_it != subdir_end_it;)
+ {
+ path_val_ui += subdir_it->value();
+ if (++subdir_it != subdir_end_it)
+ path_val_ui += gDirUtilp->getDirDelimiter();
+ }
LLStringUtil::format(path_val_ui, path_args);
if (std::find(sXUIPaths.begin(), sXUIPaths.end(), path_val_ui) == sXUIPaths.end())
{
sXUIPaths.push_back(path_val_ui);
}
+
}
}
else // parsing failed
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 930dadc377..6b337e0d74 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -101,7 +101,9 @@ void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitPa
if (LLUICtrlFactory::getLayeredXMLNode(filename, root_node))
{
+ LLUICtrlFactory::instance().pushFileName(filename);
LLXUIParser::instance().readXUI(root_node, block, filename);
+ LLUICtrlFactory::instance().popFileName();
}
}
@@ -211,7 +213,7 @@ bool LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen
bool res = true;
lldebugs << "Building floater " << filename << llendl;
- mFileNames.push_back(gDirUtilp->findSkinnedFilename(LLUI::getSkinPath(), filename));
+ pushFileName(filename);
{
if (!floaterp->getFactoryMap().empty())
{
@@ -222,7 +224,7 @@ bool LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen
floaterp->getCommitCallbackRegistrar().pushScope();
floaterp->getEnableCallbackRegistrar().pushScope();
- res = floaterp->initFloaterXML(root, floaterp->getParent(), output_node);
+ res = floaterp->initFloaterXML(root, floaterp->getParent(), filename, output_node);
floaterp->setXMLFilename(filename);
@@ -234,7 +236,7 @@ bool LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen
mFactoryStack.pop_front();
}
}
- mFileNames.pop_back();
+ popFileName();
return res;
}
@@ -283,7 +285,7 @@ BOOL LLUICtrlFactory::buildPanel(LLPanel* panelp, const std::string& filename, L
lldebugs << "Building panel " << filename << llendl;
- mFileNames.push_back(gDirUtilp->findSkinnedFilename(LLUI::getSkinPath(), filename));
+ pushFileName(filename);
{
if (!panelp->getFactoryMap().empty())
{
@@ -306,7 +308,7 @@ BOOL LLUICtrlFactory::buildPanel(LLPanel* panelp, const std::string& filename, L
mFactoryStack.pop_front();
}
}
- mFileNames.pop_back();
+ popFileName();
return didPost;
}
@@ -364,6 +366,23 @@ LLPanel* LLUICtrlFactory::createFactoryPanel(const std::string& name)
return create<LLPanel>(panel_p);
}
+std::string LLUICtrlFactory::getCurFileName()
+{
+ return mFileNames.empty() ? "" : gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + mFileNames.back();
+}
+
+
+void LLUICtrlFactory::pushFileName(const std::string& name)
+{
+ mFileNames.push_back(gDirUtilp->findSkinnedFilename(LLUI::getSkinPath(), name));
+}
+
+void LLUICtrlFactory::popFileName()
+{
+ mFileNames.pop_back();
+}
+
+
//-----------------------------------------------------------------------------
//static
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index b1fa6add67..7da96ffce3 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -170,7 +170,9 @@ public:
// Returns 0 on success
S32 saveToXML(LLView* viewp, const std::string& filename);
- std::string getCurFileName() { return mFileNames.empty() ? "" : mFileNames.back(); }
+ std::string getCurFileName();
+ void pushFileName(const std::string& name);
+ void popFileName();
static BOOL getAttributeColor(LLXMLNodePtr node, const std::string& name, LLColor4& color);
@@ -229,7 +231,7 @@ public:
T* widget = NULL;
std::string skinned_filename = findSkinnedFilename(filename);
- getInstance()->mFileNames.push_back(skinned_filename);
+ instance().pushFileName(filename);
{
LLXMLNodePtr root_node;
@@ -263,7 +265,7 @@ public:
}
}
fail:
- getInstance()->mFileNames.pop_back();
+ instance().popFileName();
return widget;
}
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index bd56da9121..394ec957d5 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -111,6 +111,8 @@ LLView::Params::Params()
user_resize("user_resize"),
auto_resize("auto_resize"),
needs_translate("translate"),
+ min_width("min_width"),
+ max_width("max_width"),
xmlns("xmlns"),
xmlns_xsi("xmlns:xsi"),
xsi_schemaLocation("xsi:schemaLocation"),
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 3779fedf34..9ff6a4e1a0 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -148,6 +148,8 @@ public:
Ignored user_resize,
auto_resize,
needs_translate,
+ min_width,
+ max_width,
xmlns,
xmlns_xsi,
xsi_schemaLocation,
@@ -634,7 +636,7 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co
// did we find *something* with that name?
if (child)
{
- llwarns << "Found child named " << name << " but of wrong type " << typeid(*child).name() << ", expecting " << typeid(T*).name() << llendl;
+ llwarns << "Found child named \"" << name << "\" but of wrong type " << typeid(*child).name() << ", expecting " << typeid(T*).name() << llendl;
}
result = getDefaultWidget<T>(name);
if (!result)