diff options
author | Richard Nelson <none@none> | 2010-08-24 10:50:50 -0700 |
---|---|---|
committer | Richard Nelson <none@none> | 2010-08-24 10:50:50 -0700 |
commit | 77c42fc77ead297be3ea673309699edd15f70441 (patch) | |
tree | 58082e287471c84b76934dfc37503ab5ab95aee9 /indra/llui | |
parent | 4115decfa14bb3d20f464ed0e0e3b3ec6c7b6e02 (diff) | |
parent | 65c9914d23022df6a39db50ce295750f08695893 (diff) |
merge
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfloater.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 17 | ||||
-rw-r--r-- | indra/llui/llrngwriter.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llsdparam.cpp | 28 | ||||
-rw-r--r-- | indra/llui/llsdparam.h | 7 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 3 | ||||
-rw-r--r-- | indra/llui/lluicolortable.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.cpp | 3 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.h | 6 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llview.h | 12 |
13 files changed, 65 insertions, 46 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 0cd692b4a4..e7d0950846 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2780,7 +2780,8 @@ LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build"); bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node) { Params params(LLUICtrlFactory::getDefaultParams<LLFloater>()); - LLXUIParser::instance().readXUI(node, params, filename); // *TODO: Error checking + LLXUIParser parser; + parser.readXUI(node, params, filename); // *TODO: Error checking if (output_node) { @@ -2788,8 +2789,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str setupParamsForExport(output_params, parent); Params default_params(LLUICtrlFactory::getDefaultParams<LLFloater>()); output_node->setName(node->getName()->mString); - LLXUIParser::instance().writeXUI( - output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, &default_params); } // Default floater position to top-left corner of screen diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 4512091371..2e6e4912bf 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -238,7 +238,8 @@ static void get_attribute_bool_and_write(LLXMLNodePtr node, LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node) { LLLayoutStack::Params p(LLUICtrlFactory::getDefaultParams<LLLayoutStack>()); - LLXUIParser::instance().readXUI(node, p, LLUICtrlFactory::getInstance()->getCurFileName()); + LLXUIParser parser; + parser.readXUI(node, p, LLUICtrlFactory::getInstance()->getCurFileName()); // Export must happen before setupParams() mungles rectangles and before // this item gets added to parent (otherwise screws up last_child_rect @@ -249,8 +250,7 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o setupParamsForExport(output_params, parent); LLLayoutStack::Params default_params(LLUICtrlFactory::getDefaultParams<LLLayoutStack>()); output_node->setName(node->getName()->mString); - LLXUIParser::instance().writeXUI( - output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, &default_params); } p.from_xui = true; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 51c8f6c743..4471f315c0 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -389,8 +389,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ LLPanel* panelp = NULL; - { - LLFastTimer timer(FTM_PANEL_CONSTRUCTION); + { LLFastTimer _(FTM_PANEL_CONSTRUCTION); if(!class_attr.empty()) { @@ -512,6 +511,8 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu setXMLFilename(xml_filename); } + LLXUIParser parser; + if (!xml_filename.empty()) { LLUICtrlFactory::instance().pushFileName(xml_filename); @@ -521,12 +522,11 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu { //if we are exporting, we want to export the current xml //not the referenced xml - LLXUIParser::instance().readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName()); + parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName()); Params output_params(params); setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); - LLXUIParser::instance().writeXUI( - output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, &default_params); return TRUE; } @@ -537,7 +537,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu return FALSE; } - LLXUIParser::instance().readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName()); + parser.readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName()); // add children using dimensions from referenced xml for consistent layout setShape(params.rect); @@ -547,15 +547,14 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu } // ask LLUICtrlFactory for filename, since xml_filename might be empty - LLXUIParser::instance().readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName()); + parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName()); if (output_node) { Params output_params(params); setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); - LLXUIParser::instance().writeXUI( - output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, &default_params); } params.from_xui = true; diff --git a/indra/llui/llrngwriter.cpp b/indra/llui/llrngwriter.cpp index 7e3d4b92d3..718c10d2f8 100644 --- a/indra/llui/llrngwriter.cpp +++ b/indra/llui/llrngwriter.cpp @@ -36,10 +36,15 @@ #include "lluicolor.h" #include "lluictrlfactory.h" +static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; +static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; +static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs; + // // LLRNGWriter - writes Relax NG schema files based on a param block // LLRNGWriter::LLRNGWriter() +: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs) { // register various callbacks for inspecting the contents of a param block registerInspectFunc<bool>(boost::bind(&LLRNGWriter::writeAttribute, this, "boolean", _1, _2, _3, _4)); diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index d356f061f9..844278e41c 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -2568,7 +2568,8 @@ BOOL LLScrollListCtrl::canDeselect() const void LLScrollListCtrl::addColumn(const LLSD& column, EAddPosition pos) { LLScrollListColumn::Params p; - LLParamSDParser::instance().readSD(column, p); + LLParamSDParser parser; + parser.readSD(column, p); addColumn(p, pos); } @@ -2759,7 +2760,8 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& element, EAddPosition { LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT); LLScrollListItem::Params item_params; - LLParamSDParser::instance().readSD(element, item_params); + LLParamSDParser parser; + parser.readSD(element, item_params); item_params.userdata = userdata; return addRow(item_params, pos); } diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 7d37127584..338569fc58 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -36,23 +36,31 @@ // Project includes #include "llsdparam.h" +static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; +static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; +static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs; + // // LLParamSDParser // LLParamSDParser::LLParamSDParser() +: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs) { using boost::bind; - registerParserFuncs<S32>(readS32, bind(&LLParamSDParser::writeTypedValue<S32>, this, _1, _2)); - registerParserFuncs<U32>(readU32, bind(&LLParamSDParser::writeU32Param, this, _1, _2)); - registerParserFuncs<F32>(readF32, bind(&LLParamSDParser::writeTypedValue<F32>, this, _1, _2)); - registerParserFuncs<F64>(readF64, bind(&LLParamSDParser::writeTypedValue<F64>, this, _1, _2)); - registerParserFuncs<bool>(readBool, bind(&LLParamSDParser::writeTypedValue<F32>, this, _1, _2)); - registerParserFuncs<std::string>(readString, bind(&LLParamSDParser::writeTypedValue<std::string>, this, _1, _2)); - registerParserFuncs<LLUUID>(readUUID, bind(&LLParamSDParser::writeTypedValue<LLUUID>, this, _1, _2)); - registerParserFuncs<LLDate>(readDate, bind(&LLParamSDParser::writeTypedValue<LLDate>, this, _1, _2)); - registerParserFuncs<LLURI>(readURI, bind(&LLParamSDParser::writeTypedValue<LLURI>, this, _1, _2)); - registerParserFuncs<LLSD>(readSD, bind(&LLParamSDParser::writeTypedValue<LLSD>, this, _1, _2)); + if (sReadFuncs.empty()) + { + registerParserFuncs<S32>(readS32, bind(&LLParamSDParser::writeTypedValue<S32>, this, _1, _2)); + registerParserFuncs<U32>(readU32, bind(&LLParamSDParser::writeU32Param, this, _1, _2)); + registerParserFuncs<F32>(readF32, bind(&LLParamSDParser::writeTypedValue<F32>, this, _1, _2)); + registerParserFuncs<F64>(readF64, bind(&LLParamSDParser::writeTypedValue<F64>, this, _1, _2)); + registerParserFuncs<bool>(readBool, bind(&LLParamSDParser::writeTypedValue<F32>, this, _1, _2)); + registerParserFuncs<std::string>(readString, bind(&LLParamSDParser::writeTypedValue<std::string>, this, _1, _2)); + registerParserFuncs<LLUUID>(readUUID, bind(&LLParamSDParser::writeTypedValue<LLUUID>, this, _1, _2)); + registerParserFuncs<LLDate>(readDate, bind(&LLParamSDParser::writeTypedValue<LLDate>, this, _1, _2)); + registerParserFuncs<LLURI>(readURI, bind(&LLParamSDParser::writeTypedValue<LLURI>, this, _1, _2)); + registerParserFuncs<LLSD>(readSD, bind(&LLParamSDParser::writeTypedValue<LLSD>, this, _1, _2)); + } } // special case handling of U32 due to ambiguous LLSD::assign overload diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index d8af3c9bce..e98318fc1e 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -37,17 +37,14 @@ #include "llinitparam.h" class LLParamSDParser -: public LLInitParam::Parser, - public LLSingleton<LLParamSDParser> +: public LLInitParam::Parser { LOG_CLASS(LLParamSDParser); typedef LLInitParam::Parser parser_t; -protected: - LLParamSDParser(); - friend class LLSingleton<LLParamSDParser>; public: + LLParamSDParser(); void readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent = false); void writeSD(LLSD& sd, const LLInitParam::BaseBlock& block); diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 5d8b628776..85fdfbb312 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1802,7 +1802,8 @@ void LLUI::setupPaths() LLXMLNodePtr root; BOOL success = LLXMLNode::parseFile(filename, root, NULL); Paths paths; - LLXUIParser::instance().readXUI(root, paths, filename); + LLXUIParser parser; + parser.readXUI(root, paths, filename); sXUIPaths.clear(); diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index 1b64ef3abe..88140f1a49 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -243,7 +243,8 @@ void LLUIColorTable::saveUserSettings() const } LLXMLNodePtr output_node = new LLXMLNode("colors", false); - LLXUIParser::instance().writeXUI(output_node, params); + LLXUIParser parser; + parser.writeXUI(output_node, params); if(!output_node->isNull()) { @@ -309,7 +310,8 @@ bool LLUIColorTable::loadFromFilename(const std::string& filename, string_color_ } Params params; - LLXUIParser::instance().readXUI(root, params, filename); + LLXUIParser parser; + parser.readXUI(root, params, filename); if(params.validateBlock()) { diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index ee700ee6eb..2a2fa21ec0 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -103,7 +103,8 @@ void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitPa if (!full_filename.empty()) { LLUICtrlFactory::instance().pushFileName(full_filename); - LLSimpleXUIParser::instance().readXUI(full_filename, block); + LLSimpleXUIParser parser; + parser.readXUI(full_filename, block); LLUICtrlFactory::instance().popFileName(); } } diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 207f74c89a..6b5d055b78 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -273,7 +273,8 @@ private: typename T::Params params(getDefaultParams<T>()); - LLXUIParser::instance().readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName()); + LLXUIParser parser; + parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName()); if (output_node) { @@ -283,8 +284,7 @@ private: // Export only the differences between this any default params typename T::Params default_params(getDefaultParams<T>()); copyName(node, output_node); - LLXUIParser::instance().writeXUI( - output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, &default_params); } // Apply layout transformations, usually munging rect diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 3ee4a85de0..48db873b6f 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -111,8 +111,8 @@ LLView::Params::Params() user_resize("user_resize"), auto_resize("auto_resize"), needs_translate("translate"), - min_width("min_width"), - max_width("max_width"), + min_dim("min_width"), + max_dim("max_width"), xmlns("xmlns"), xmlns_xsi("xmlns:xsi"), xsi_schemaLocation("xsi:schemaLocation"), @@ -120,6 +120,8 @@ LLView::Params::Params() { addSynonym(rect, ""); + addSynonym(min_dim, "min_height"); + addSynonym(max_dim, "max_height"); } LLView::LLView(const LLView::Params& p) diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 0f796fb408..6736ad9f33 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -145,16 +145,18 @@ public: left_delta; // from last left to my left //FIXME: get parent context involved in parsing traversal - Ignored user_resize, // nested attribute for LLLayoutPanel - auto_resize, // nested attribute for LLLayoutPanel - needs_translate, // cue for translation tools - min_width, // nested attribute for LLLayoutPanel - max_width, // nested attribute for LLLayoutPanel + Ignored needs_translate; // cue for translation tools xmlns, // xml namespace xmlns_xsi, // xml namespace xsi_schemaLocation, // xml schema xsi_type; // xml schema type + // nested attributes for LLLayoutPanel + Optional<S32> min_dim, + max_dim; + Optional<bool> user_resize, + auto_resize; + Params(); }; |