From fdc848cf72f755b3ce924e12625ec9923495f9bc Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 20 Oct 2009 22:05:00 +0000 Subject: removed unnecessary static variable instantiations to improve compile times moved a bunch of template class statics to cpp files also added filename parameter to LLXUIParser::readXUI for better debugging of XUI errors reviewed by James --- indra/llui/llhandle.h | 14 +++--- indra/llui/lllayoutstack.cpp | 2 +- indra/llui/llnotifications.cpp | 1 + indra/llui/llnotifications.h | 3 +- indra/llui/llpanel.cpp | 7 +-- indra/llui/llrngwriter.cpp | 3 +- indra/llui/lluicolortable.cpp | 2 +- indra/llui/lluictrlfactory.cpp | 40 +++++++++++++++- indra/llui/lluictrlfactory.h | 50 ++++++++++---------- indra/llui/lluistring.cpp | 2 - indra/llui/lluistring.h | 2 - indra/llxuixml/llinitparam.cpp | 2 - indra/llxuixml/llinitparam.h | 76 +++++++++++++++--------------- indra/llxuixml/lltrans.cpp | 4 +- indra/llxuixml/llxuiparser.cpp | 12 +++-- indra/llxuixml/llxuiparser.h | 7 ++- indra/newview/app_settings/settings.xml | 4 +- indra/newview/llfloateruipreview.cpp | 53 +++++++++++---------- indra/newview/llmimetypes.cpp | 1 + indra/newview/llviewerprecompiledheaders.h | 1 - indra/newview/llviewertexturelist.cpp | 2 +- 21 files changed, 164 insertions(+), 124 deletions(-) (limited to 'indra') diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h index 10a7fd4544..899f6b9326 100644 --- a/indra/llui/llhandle.h +++ b/indra/llui/llhandle.h @@ -60,7 +60,7 @@ template class LLHandle { public: - LLHandle() : mTombStone(sDefaultTombStone) {} + LLHandle() : mTombStone(getDefaultTombStone()) {} const LLHandle& operator =(const LLHandle& other) { mTombStone = other.mTombStone; @@ -74,7 +74,7 @@ public: void markDead() { - mTombStone = sDefaultTombStone; + mTombStone = getDefaultTombStone(); } T* get() const @@ -104,13 +104,13 @@ protected: LLPointer > mTombStone; private: - static LLPointer > sDefaultTombStone; + static LLPointer >& getDefaultTombStone() + { + static LLPointer > sDefaultTombStone = new LLTombStone; + return sDefaultTombStone; + } }; -// initialize static "empty" tombstone pointer -template LLPointer > LLHandle::sDefaultTombStone = new LLTombStone(); - - template class LLRootHandle : public LLHandle { diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 5eade72b61..24fd380bb1 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -229,7 +229,7 @@ static void get_attribute_bool_and_write(LLXMLNodePtr node, LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node) { LLLayoutStack::Params p(LLUICtrlFactory::getDefaultParams()); - LLXUIParser::instance().readXUI(node, p); + LLXUIParser::instance().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 diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 25e2475f59..a0e51151c9 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -34,6 +34,7 @@ #include "llnotifications.h" +#include "llxmlnode.h" #include "lluictrl.h" #include "lluictrlfactory.h" #include "lldir.h" diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 19895c3293..cd05db3c30 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -102,7 +102,6 @@ #include "llfunctorregistry.h" #include "llpointer.h" #include "llinitparam.h" -#include "llxmlnode.h" class LLNotification; typedef boost::shared_ptr LLNotificationPtr; @@ -160,7 +159,7 @@ public: LLNotificationForm(); LLNotificationForm(const LLSD& sd); LLNotificationForm(const std::string& name, - const LLPointer xml_node); + const LLPointer xml_node); LLSD asLLSD() const; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 742427525b..095200ddc3 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -474,7 +474,7 @@ 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); + LLXUIParser::instance().readXUI(node, params, xml_filename); Params output_params(params); setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); @@ -490,14 +490,15 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu return FALSE; } - LLXUIParser::instance().readXUI(referenced_xml, params); + LLXUIParser::instance().readXUI(referenced_xml, params, xml_filename); // add children using dimensions from referenced xml for consistent layout setShape(params.rect); LLUICtrlFactory::createChildren(this, referenced_xml, child_registry_t::instance()); } - LLXUIParser::instance().readXUI(node, params); + // ask LLUICtrlFactory for filename, since xml_filename might be empty + LLXUIParser::instance().readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName()); if (output_node) { diff --git a/indra/llui/llrngwriter.cpp b/indra/llui/llrngwriter.cpp index cf23e3af15..7e3d4b92d3 100644 --- a/indra/llui/llrngwriter.cpp +++ b/indra/llui/llrngwriter.cpp @@ -108,7 +108,8 @@ void LLRNGWriter::addDefinition(const std::string& type_name, const LLInitParam: LLXMLNodePtr old_element_node = mElementNode; LLXMLNodePtr old_child_node = mChildrenNode; - addDefinition(child_name, (*LLDefaultParamBlockRegistry::instance().getValue(type))()); + //FIXME: add LLDefaultParamBlockRegistry back when working on schema generation + //addDefinition(child_name, (*LLDefaultParamBlockRegistry::instance().getValue(type))()); mElementNode = old_element_node; mChildrenNode = old_child_node; diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index 087a99c2b0..5827c0d627 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -278,7 +278,7 @@ bool LLUIColorTable::loadFromFilename(const std::string& filename) } Params params; - LLXUIParser::instance().readXUI(root, params); + LLXUIParser::instance().readXUI(root, params, filename); if(params.validateBlock()) { diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 209ee76940..e2368cc05c 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -34,6 +34,8 @@ #include "lluictrlfactory.h" +#include "llxmlnode.h" + #include #include @@ -94,7 +96,7 @@ void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitPa if (LLUICtrlFactory::getLayeredXMLNode(filename, root_node)) { - LLXUIParser::instance().readXUI(root_node, block); + LLXUIParser::instance().readXUI(root_node, block, filename); } } @@ -410,3 +412,39 @@ void LLUICtrlFactory::popFactoryFunctions() mFactoryStack.pop_back(); } } + +//static +void LLUICtrlFactory::copyName(LLXMLNodePtr src, LLXMLNodePtr dest) +{ + dest->setName(src->getName()->mString); +} + +// adds a widget and its param block to various registries +//static +void LLUICtrlFactory::registerWidget(const std::type_info* widget_type, const std::type_info* param_block_type, dummy_widget_creator_func_t creator_func, const std::string& tag) +{ + // associate parameter block type with template .xml file + std::string* existing_tag = LLWidgetNameRegistry::instance().getValue(param_block_type); + if (existing_tag != NULL && *existing_tag != tag) + { + llerrs << "Duplicate entry for T::Params, try creating empty param block in derived classes that inherit T::Params" << llendl; + } + LLWidgetNameRegistry ::instance().defaultRegistrar().add(param_block_type, tag); + // associate widget type with factory function + LLDefaultWidgetRegistry::instance().defaultRegistrar().add(widget_type, creator_func); + LLWidgetTypeRegistry::instance().defaultRegistrar().add(tag, widget_type); + //FIXME: comment this in when working on schema generation + //LLDefaultParamBlockRegistry::instance().defaultRegistrar().add(widget_type, &getEmptyParamBlock); +} + +//static +dummy_widget_creator_func_t* LLUICtrlFactory::getDefaultWidgetFunc(const std::type_info* widget_type) +{ + return LLDefaultWidgetRegistry::instance().getValue(widget_type); +} + +//static +const std::string* LLUICtrlFactory::getWidgetTag(const std::type_info* widget_type) +{ + return LLWidgetNameRegistry::instance().getValue(widget_type); +} diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 5e6dad312c..17e32dc7a9 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -36,7 +36,7 @@ #include "llcallbackmap.h" #include "llinitparam.h" #include "llregistry.h" -#include "llxmlnode.h" +#include "v4color.h" #include "llfasttimer.h" #include "llxuiparser.h" @@ -98,10 +98,11 @@ class LLDefaultWidgetRegistry {}; // lookup function for generating empty param block by widget type -typedef const LLInitParam::BaseBlock& (*empty_param_block_func_t)(); -class LLDefaultParamBlockRegistry -: public LLRegistrySingleton -{}; +// this is used for schema generation +//typedef const LLInitParam::BaseBlock& (*empty_param_block_func_t)(); +//class LLDefaultParamBlockRegistry +//: public LLRegistrySingleton +//{}; extern LLFastTimer::DeclareTimer FTM_WIDGET_SETUP; extern LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION; @@ -124,7 +125,7 @@ private: // recursively initialize from base class param block ((typename PARAM_BLOCK::base_block_t&)mPrototype).fillFrom(ParamDefaults::instance().get()); // after initializing base classes, look up template file for this param block - std::string* param_block_tag = LLWidgetNameRegistry::instance().getValue(&typeid(PARAM_BLOCK)); + const std::string* param_block_tag = getWidgetTag(&typeid(PARAM_BLOCK)); if (param_block_tag) { LLUICtrlFactory::loadWidgetTemplate(*param_block_tag, mPrototype); @@ -241,7 +242,7 @@ fail: template static T* getDefaultWidget(const std::string& name) { - dummy_widget_creator_func_t* dummy_func = LLDefaultWidgetRegistry::instance().getValue(&typeid(T)); + dummy_widget_creator_func_t* dummy_func = getDefaultWidgetFunc(&typeid(T)); return dummy_func ? dynamic_cast((*dummy_func)(name)) : NULL; } @@ -254,6 +255,8 @@ fail: return create(params); } + static void copyName(LLXMLNodePtr src, LLXMLNodePtr dest); + template static T* defaultBuilder(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node) { @@ -262,7 +265,7 @@ fail: //#pragma message("Generating LLUICtrlFactory::defaultBuilder") typename T::Params params(getDefaultParams()); - LLXUIParser::instance().readXUI(node, params); + LLXUIParser::instance().readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName()); if (output_node) { @@ -271,7 +274,7 @@ fail: T::setupParamsForExport(output_params, parent); // Export only the differences between this any default params typename T::Params default_params(getDefaultParams()); - output_node->setName(node->getName()->mString); + copyName(node, output_node); LLXUIParser::instance().writeXUI( output_node, output_params, &default_params); } @@ -320,7 +323,15 @@ fail: static void loadWidgetTemplate(const std::string& widget_tag, LLInitParam::BaseBlock& block); + // helper function for adding widget type info to various registries + static void registerWidget(const std::type_info* widget_type, const std::type_info* param_block_type, dummy_widget_creator_func_t creator_func, const std::string& tag); + private: + // return default widget instance factory func for a given type + static dummy_widget_creator_func_t* getDefaultWidgetFunc(const std::type_info* widget_type); + + static const std::string* getWidgetTag(const std::type_info* widget_type); + // this exists to get around dependency on llview static void setCtrlParent(LLView* view, LLView* parent, S32 tab_group); @@ -347,23 +358,12 @@ template LLChildRegistry::Register::Register(const char* tag, LLWidgetCreatorFunc func) : LLChildRegistry::StaticRegistrar(tag, func.empty() ? (LLWidgetCreatorFunc)&LLUICtrlFactory::defaultBuilder : func) { - const std::type_info* widget_type_infop = &typeid(T); - // associate parameter block type with template .xml file - std::string* existing_tag = LLWidgetNameRegistry ::instance().getValue(&typeid(typename T::Params)); - if (existing_tag != NULL && *existing_tag != tag) - { - // duplicate entry for T::Params - // try creating empty param block in derived classes that inherit T::Params - int* crash = 0; - *crash = 0; - } - LLWidgetNameRegistry ::instance().defaultRegistrar().add(&typeid(typename T::Params), tag); - // associate widget type with factory function - LLDefaultWidgetRegistry::instance().defaultRegistrar().add(widget_type_infop, &LLUICtrlFactory::createDefaultWidget); - LLWidgetTypeRegistry::instance().defaultRegistrar().add(tag, widget_type_infop); - LLDefaultParamBlockRegistry::instance().defaultRegistrar().add(widget_type_infop, &getEmptyParamBlock); + // add this widget to various registries + LLUICtrlFactory::instance().registerWidget(&typeid(T), &typeid(typename T::Params), &LLUICtrlFactory::createDefaultWidget, tag); + + // since registry_t depends on T, do this in line here typedef typename T::child_registry_t registry_t; - LLChildRegistryRegistry::instance().defaultRegistrar().add(widget_type_infop, registry_t::instance()); + LLChildRegistryRegistry::instance().defaultRegistrar().add(&typeid(T), registry_t::instance()); } diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index 20ff71378e..3a1e656364 100644 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp @@ -35,8 +35,6 @@ #include "llsd.h" #include "lltrans.h" -const LLStringUtil::format_map_t LLUIString::sNullArgs; - LLFastTimer::DeclareTimer FTM_UI_STRING("UI String"); diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index 195f21a6a7..763de4d6a3 100644 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h @@ -95,8 +95,6 @@ public: void insert(S32 charidx, const LLWString& wchars); void replace(S32 charidx, llwchar wc); - static const LLStringUtil::format_map_t sNullArgs; - private: void format(); diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index 6dd1f93baf..318a0348a2 100644 --- a/indra/llxuixml/llinitparam.cpp +++ b/indra/llxuixml/llinitparam.cpp @@ -38,8 +38,6 @@ namespace LLInitParam { - BlockDescriptor BaseBlock::sBlockDescriptor; - // // Param // diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 4c936197c9..9fb464ca7b 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -46,6 +46,7 @@ namespace LLInitParam { + template ::value > struct ParamCompare { @@ -474,7 +475,11 @@ namespace LLInitParam BlockDescriptor* mBlockDescriptor; // most derived block descriptor - static BlockDescriptor sBlockDescriptor; + static BlockDescriptor& blockDescriptor() + { + static BlockDescriptor sBlockDescriptor; + return sBlockDescriptor; + } private: const std::string& getParamName(const BlockDescriptor& block_data, const Param* paramp) const; @@ -493,13 +498,13 @@ namespace LLInitParam // that derive from BaseBlock and those that don't // this is supposedly faster than boost::is_convertible and its ilk template - struct is_BaseBlock + struct IsBaseBlock { static const bool value = false; }; template - struct is_BaseBlock + struct IsBaseBlock { static const bool value = true; }; @@ -509,7 +514,7 @@ namespace LLInitParam template, bool HAS_MULTIPLE_VALUES = false, - bool VALUE_IS_BLOCK = is_BaseBlock::value> + bool VALUE_IS_BLOCK = IsBaseBlock::value> class TypedParam : public Param { @@ -1246,7 +1251,7 @@ namespace LLInitParam bool overwriteFrom(const self_t& other) { mCurChoice = other.mCurChoice; - return BaseBlock::overwriteFromImpl(sBlockDescriptor, other); + return BaseBlock::overwriteFromImpl(blockDescriptor(), other); } // take all provided params that are not already provided, and apply to self @@ -1277,7 +1282,7 @@ namespace LLInitParam Choice() : mCurChoice(0) { - BaseBlock::init(sBlockDescriptor, BaseBlock::sBlockDescriptor, sizeof(DERIVED_BLOCK)); + BaseBlock::init(blockDescriptor(), BaseBlock::blockDescriptor(), sizeof(DERIVED_BLOCK)); } // Alternatives are mutually exclusive wrt other Alternatives in the same block. @@ -1290,16 +1295,16 @@ namespace LLInitParam friend class Choice; typedef Alternative self_t; - typedef TypedParam::value> super_t; + typedef TypedParam::value> super_t; typedef typename super_t::value_assignment_t value_assignment_t; explicit Alternative(const char* name, value_assignment_t val = DefaultInitializer::get()) - : super_t(DERIVED_BLOCK::sBlockDescriptor, name, val, NULL, 0, 1), + : super_t(DERIVED_BLOCK::blockDescriptor(), name, val, NULL, 0, 1), mOriginalValue(val) { // assign initial choice to first declared option - DERIVED_BLOCK* blockp = ((DERIVED_BLOCK*)DERIVED_BLOCK::sBlockDescriptor.mCurrentBlockPtr); - if (DERIVED_BLOCK::sBlockDescriptor.mInitializationState == BlockDescriptor::INITIALIZING + DERIVED_BLOCK* blockp = ((DERIVED_BLOCK*)DERIVED_BLOCK::blockDescriptor().mCurrentBlockPtr); + if (DERIVED_BLOCK::blockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING && blockp->mCurChoice == 0) { blockp->mCurChoice = Param::enclosingBlock().getHandleFromParam(this); @@ -1345,7 +1350,11 @@ namespace LLInitParam }; protected: - static BlockDescriptor sBlockDescriptor; + static BlockDescriptor& blockDescriptor() + { + static BlockDescriptor sBlockDescriptor; + return sBlockDescriptor; + } private: param_handle_t mCurChoice; @@ -1356,15 +1365,6 @@ namespace LLInitParam } }; - template - BlockDescriptor - Choice::sBlockDescriptor; - - //struct CardinalityConstraint - //{ - // virtual std::pair getRange() = 0; - //}; - struct AnyAmount { static U32 minCount() { return 0; } @@ -1412,19 +1412,19 @@ namespace LLInitParam // take all provided params from other and apply to self bool overwriteFrom(const self_t& other) { - return BaseBlock::overwriteFromImpl(sBlockDescriptor, other); + return BaseBlock::overwriteFromImpl(blockDescriptor(), other); } // take all provided params that are not already provided, and apply to self bool fillFrom(const self_t& other) { - return BaseBlock::fillFromImpl(sBlockDescriptor, other); + return BaseBlock::fillFromImpl(blockDescriptor(), other); } protected: Block() { //#pragma message("Parsing LLInitParam::Block") - BaseBlock::init(sBlockDescriptor, BASE_BLOCK::sBlockDescriptor, sizeof(DERIVED_BLOCK)); + BaseBlock::init(blockDescriptor(), BASE_BLOCK::blockDescriptor(), sizeof(DERIVED_BLOCK)); } // @@ -1434,11 +1434,11 @@ namespace LLInitParam class Optional : public TypedParam { public: - typedef TypedParam::value> super_t; + typedef TypedParam::value> super_t; typedef typename super_t::value_assignment_t value_assignment_t; explicit Optional(const char* name = "", value_assignment_t val = DefaultInitializer::get()) - : super_t(DERIVED_BLOCK::sBlockDescriptor, name, val, NULL, 0, 1) + : super_t(DERIVED_BLOCK::blockDescriptor(), name, val, NULL, 0, 1) { //#pragma message("Parsing LLInitParam::Block::Optional") } @@ -1461,13 +1461,13 @@ namespace LLInitParam class Mandatory : public TypedParam { public: - typedef TypedParam::value> super_t; + typedef TypedParam::value> super_t; typedef Mandatory self_t; typedef typename super_t::value_assignment_t value_assignment_t; // mandatory parameters require a name to be parseable explicit Mandatory(const char* name = "", value_assignment_t val = DefaultInitializer::get()) - : super_t(DERIVED_BLOCK::sBlockDescriptor, name, val, &validate, 1, 1) + : super_t(DERIVED_BLOCK::blockDescriptor(), name, val, &validate, 1, 1) {} Mandatory& operator=(value_assignment_t val) @@ -1495,7 +1495,7 @@ namespace LLInitParam class Multiple : public TypedParam { public: - typedef TypedParam::value> super_t; + typedef TypedParam::value> super_t; typedef Multiple self_t; typedef typename super_t::container_t container_t; typedef typename super_t::value_assignment_t value_assignment_t; @@ -1503,7 +1503,7 @@ namespace LLInitParam typedef typename container_t::const_iterator const_iterator; explicit Multiple(const char* name = "", value_assignment_t val = DefaultInitializer::get()) - : super_t(DERIVED_BLOCK::sBlockDescriptor, name, val, &validate, RANGE::minCount(), RANGE::maxCount()) + : super_t(DERIVED_BLOCK::blockDescriptor(), name, val, &validate, RANGE::minCount(), RANGE::maxCount()) {} using super_t::operator(); @@ -1531,9 +1531,9 @@ namespace LLInitParam { public: explicit Deprecated(const char* name) - : Param(DERIVED_BLOCK::sBlockDescriptor.mCurrentBlockPtr) + : Param(DERIVED_BLOCK::blockDescriptor().mCurrentBlockPtr) { - BlockDescriptor& block_descriptor = DERIVED_BLOCK::sBlockDescriptor; + BlockDescriptor& block_descriptor = DERIVED_BLOCK::blockDescriptor(); if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING) { ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), @@ -1563,13 +1563,13 @@ namespace LLInitParam typedef Deprecated Ignored; protected: - static BlockDescriptor sBlockDescriptor; + static BlockDescriptor& blockDescriptor() + { + static BlockDescriptor sBlockDescriptor; + return sBlockDescriptor; + } }; - template - BlockDescriptor - Block::sBlockDescriptor; - template > class BlockValue : public Block, false> >, @@ -1803,11 +1803,11 @@ namespace LLInitParam // assign individual parameters if (overwrite) { - dst_typed_param.BaseBlock::overwriteFromImpl(block_t::sBlockDescriptor, src_param); + dst_typed_param.BaseBlock::overwriteFromImpl(block_t::blockDescriptor(), src_param); } else { - dst_typed_param.BaseBlock::fillFromImpl(block_t::sBlockDescriptor, src_param); + dst_typed_param.BaseBlock::fillFromImpl(block_t::blockDescriptor(), src_param); } // then copy actual value dst_typed_param.mData.mValue = src_param.get(); diff --git a/indra/llxuixml/lltrans.cpp b/indra/llxuixml/lltrans.cpp index e974dbd0ba..4c800a502d 100644 --- a/indra/llxuixml/lltrans.cpp +++ b/indra/llxuixml/lltrans.cpp @@ -72,7 +72,7 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set& defa } StringTable string_table; - LLXUIParser::instance().readXUI(root, string_table); + LLXUIParser::instance().readXUI(root, string_table, xml_filename); if (!string_table.validateBlock()) { @@ -115,7 +115,7 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root) } StringTable string_table; - LLXUIParser::instance().readXUI(root, string_table); + LLXUIParser::instance().readXUI(root, string_table, xml_filename); if (!string_table.validateBlock()) { diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index e28e52fd16..17399865e5 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -34,6 +34,7 @@ #include "llxuiparser.h" +#include "llxmlnode.h" #include #include @@ -401,10 +402,11 @@ LLXUIParser::LLXUIParser() static LLFastTimer::DeclareTimer FTM_PARSE_XUI("XUI Parsing"); -void LLXUIParser::readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, bool silent) +void LLXUIParser::readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename, bool silent) { LLFastTimer timer(FTM_PARSE_XUI); mNameStack.clear(); + mCurFileName = filename; mCurReadDepth = 0; setParseSilently(silent); @@ -946,9 +948,9 @@ bool LLXUIParser::writeSDValue(const void* val_ptr, const name_stack_t& stack) void LLXUIParser::parserWarning(const std::string& message) { -#if 0 //#ifdef LL_WINDOWS +#ifdef LL_WINDOWS // use Visual Studo friendly formatting of output message for easy access to originating xml - llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", LLUICtrlFactory::getInstance()->getCurFileName().c_str(), mCurReadNode->getLineNumber(), message.c_str()).c_str()); + llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()).c_str()); utf16str += '\n'; OutputDebugString(utf16str.c_str()); #else @@ -958,8 +960,8 @@ void LLXUIParser::parserWarning(const std::string& message) void LLXUIParser::parserError(const std::string& message) { -#if 0 //#ifdef LL_WINDOWS - llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", LLUICtrlFactory::getInstance()->getCurFileName().c_str(), mCurReadNode->getLineNumber(), message.c_str()).c_str()); +#ifdef LL_WINDOWS + llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()).c_str()); utf16str += '\n'; OutputDebugString(utf16str.c_str()); #else diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index 6f000f2422..884f4f7578 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -34,9 +34,9 @@ #define LLXUIPARSER_H #include "llinitparam.h" -#include "llxmlnode.h" #include "llfasttimer.h" #include "llregistry.h" +#include "llpointer.h" #include #include @@ -48,6 +48,8 @@ class LLView; +typedef LLPointer LLXMLNodePtr; + // lookup widget type by name class LLWidgetTypeRegistry @@ -114,7 +116,7 @@ public: /*virtual*/ void parserWarning(const std::string& message); /*virtual*/ void parserError(const std::string& message); - void readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, bool silent=false); + void readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename = LLStringUtil::null, bool silent=false); void writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const LLInitParam::BaseBlock* diff_block = NULL); private: @@ -168,6 +170,7 @@ private: S32 mLastWriteGeneration; LLXMLNodePtr mLastWrittenChild; S32 mCurReadDepth; + std::string mCurFileName; }; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3c7f9292ea..4bfb472b93 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8537,13 +8537,13 @@ ToolTipVisibleTimeNear Comment - Fade tooltip after after time passes (seconds) while mouse near tooltip + Fade tooltip after after time passes (seconds) while mouse near tooltip or original position Persist 1 Type F32 Value - 5.0 + 10.0 ToolTipVisibleTimeOver diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index de0b995f8f..ac743df4f1 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -553,32 +553,33 @@ void LLFloaterUIPreview::onLanguageComboSelect(LLUICtrl* ctrl) void LLFloaterUIPreview::onClickExportSchema() { - gViewerWindow->setCursor(UI_CURSOR_WAIT); - std::string template_path = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "xui", "schema"); - - typedef LLWidgetTypeRegistry::Registrar::registry_map_t::const_iterator registry_it; - registry_it end_it = LLWidgetTypeRegistry::defaultRegistrar().endItems(); - for(registry_it it = LLWidgetTypeRegistry::defaultRegistrar().beginItems(); - it != end_it; - ++it) - { - std::string widget_name = it->first; - const LLInitParam::BaseBlock& block = - (*LLDefaultParamBlockRegistry::instance().getValue(*LLWidgetTypeRegistry::instance().getValue(widget_name)))(); - LLXMLNodePtr root_nodep = new LLXMLNode(); - LLRNGWriter().writeRNG(widget_name, root_nodep, block, "http://www.lindenlab.com/xui"); - - std::string file_name(template_path + gDirUtilp->getDirDelimiter() + widget_name + ".rng"); - - LLFILE* rng_file = LLFile::fopen(file_name.c_str(), "w"); - { - LLXMLNode::writeHeaderToFile(rng_file); - const bool use_type_decorations = false; - root_nodep->writeToFile(rng_file, std::string(), use_type_decorations); - } - fclose(rng_file); - } - gViewerWindow->setCursor(UI_CURSOR_ARROW); + //NOTE: schema generation not complete + //gViewerWindow->setCursor(UI_CURSOR_WAIT); + //std::string template_path = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "xui", "schema"); + + //typedef LLWidgetTypeRegistry::Registrar::registry_map_t::const_iterator registry_it; + //registry_it end_it = LLWidgetTypeRegistry::defaultRegistrar().endItems(); + //for(registry_it it = LLWidgetTypeRegistry::defaultRegistrar().beginItems(); + // it != end_it; + // ++it) + //{ + // std::string widget_name = it->first; + // const LLInitParam::BaseBlock& block = + // (*LLDefaultParamBlockRegistry::instance().getValue(*LLWidgetTypeRegistry::instance().getValue(widget_name)))(); + // LLXMLNodePtr root_nodep = new LLXMLNode(); + // LLRNGWriter().writeRNG(widget_name, root_nodep, block, "http://www.lindenlab.com/xui"); + + // std::string file_name(template_path + gDirUtilp->getDirDelimiter() + widget_name + ".rng"); + + // LLFILE* rng_file = LLFile::fopen(file_name.c_str(), "w"); + // { + // LLXMLNode::writeHeaderToFile(rng_file); + // const bool use_type_decorations = false; + // root_nodep->writeToFile(rng_file, std::string(), use_type_decorations); + // } + // fclose(rng_file); + //} + //gViewerWindow->setCursor(UI_CURSOR_ARROW); } void LLFloaterUIPreview::onClickShowRectangles(const LLSD& data) diff --git a/indra/newview/llmimetypes.cpp b/indra/newview/llmimetypes.cpp index 525e89cdff..235487cf46 100644 --- a/indra/newview/llmimetypes.cpp +++ b/indra/newview/llmimetypes.cpp @@ -34,6 +34,7 @@ #include "llviewerprecompiledheaders.h" #include "llmimetypes.h" +#include "llxmlnode.h" #include "lluictrlfactory.h" diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 21d4c72428..bb317aeb5f 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -105,7 +105,6 @@ #include "llstl.h" #include "llstrider.h" #include "llstring.h" -#include "llstringtable.h" #include "llsys.h" #include "llthread.h" #include "lltimer.h" diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index dac2331ca3..4ad4c8e1ea 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1474,7 +1474,7 @@ bool LLUIImageList::initFromFile() } UIImageDeclarations images; - LLXUIParser::instance().readXUI(root, images); + LLXUIParser::instance().readXUI(root, images, base_file_path); if (!images.validateBlock()) return false; -- cgit v1.2.3