diff options
author | Richard Nelson <richard@lindenlab.com> | 2009-10-20 22:05:00 +0000 |
---|---|---|
committer | Richard Nelson <richard@lindenlab.com> | 2009-10-20 22:05:00 +0000 |
commit | fdc848cf72f755b3ce924e12625ec9923495f9bc (patch) | |
tree | 63ee4f050383b77359995f30cf96413539fe4b29 | |
parent | 2c05f237d23ce1a3b8de06fd710b575929cf247c (diff) |
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
-rw-r--r-- | indra/llui/llhandle.h | 14 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llnotifications.cpp | 1 | ||||
-rw-r--r-- | indra/llui/llnotifications.h | 3 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 7 | ||||
-rw-r--r-- | indra/llui/llrngwriter.cpp | 3 | ||||
-rw-r--r-- | indra/llui/lluicolortable.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.cpp | 40 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.h | 50 | ||||
-rw-r--r-- | indra/llui/lluistring.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lluistring.h | 2 | ||||
-rw-r--r-- | indra/llxuixml/llinitparam.cpp | 2 | ||||
-rw-r--r-- | indra/llxuixml/llinitparam.h | 76 | ||||
-rw-r--r-- | indra/llxuixml/lltrans.cpp | 4 | ||||
-rw-r--r-- | indra/llxuixml/llxuiparser.cpp | 12 | ||||
-rw-r--r-- | indra/llxuixml/llxuiparser.h | 7 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 4 | ||||
-rw-r--r-- | indra/newview/llfloateruipreview.cpp | 53 | ||||
-rw-r--r-- | indra/newview/llmimetypes.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llviewerprecompiledheaders.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 2 |
21 files changed, 164 insertions, 124 deletions
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 <typename T> class LLHandle { public: - LLHandle() : mTombStone(sDefaultTombStone) {} + LLHandle() : mTombStone(getDefaultTombStone()) {} const LLHandle<T>& operator =(const LLHandle<T>& other) { mTombStone = other.mTombStone; @@ -74,7 +74,7 @@ public: void markDead() { - mTombStone = sDefaultTombStone; + mTombStone = getDefaultTombStone(); } T* get() const @@ -104,13 +104,13 @@ protected: LLPointer<LLTombStone<T> > mTombStone; private: - static LLPointer<LLTombStone<T> > sDefaultTombStone; + static LLPointer<LLTombStone<T> >& getDefaultTombStone() + { + static LLPointer<LLTombStone<T> > sDefaultTombStone = new LLTombStone<T>; + return sDefaultTombStone; + } }; -// initialize static "empty" tombstone pointer -template <typename T> LLPointer<LLTombStone<T> > LLHandle<T>::sDefaultTombStone = new LLTombStone<T>(); - - template <typename T> class LLRootHandle : public LLHandle<T> { 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<LLLayoutStack>()); - 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<LLNotification> LLNotificationPtr; @@ -160,7 +159,7 @@ public: LLNotificationForm(); LLNotificationForm(const LLSD& sd); LLNotificationForm(const std::string& name, - const LLPointer<LLXMLNode> xml_node); + const LLPointer<class LLXMLNode> 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 <fstream> #include <boost/tokenizer.hpp> @@ -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<T>); +} + +//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<const std::type_info*, empty_param_block_func_t, LLDefaultParamBlockRegistry, LLCompareTypeID> -{}; +// this is used for schema generation +//typedef const LLInitParam::BaseBlock& (*empty_param_block_func_t)(); +//class LLDefaultParamBlockRegistry +//: public LLRegistrySingleton<const std::type_info*, empty_param_block_func_t, LLDefaultParamBlockRegistry, LLCompareTypeID> +//{}; 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<typename PARAM_BLOCK::base_block_t, DUMMY>::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<class T> 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<T*>((*dummy_func)(name)) : NULL; } @@ -254,6 +255,8 @@ fail: return create<T>(params); } + static void copyName(LLXMLNodePtr src, LLXMLNodePtr dest); + template<typename T> 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<T>()); - 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<T>()); - 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<typename T> LLChildRegistry<DERIVED>::Register<T>::Register(const char* tag, LLWidgetCreatorFunc func) : LLChildRegistry<DERIVED>::StaticRegistrar(tag, func.empty() ? (LLWidgetCreatorFunc)&LLUICtrlFactory::defaultBuilder<T> : 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<T>); - LLWidgetTypeRegistry::instance().defaultRegistrar().add(tag, widget_type_infop); - LLDefaultParamBlockRegistry::instance().defaultRegistrar().add(widget_type_infop, &getEmptyParamBlock<T>); + // add this widget to various registries + LLUICtrlFactory::instance().registerWidget(&typeid(T), &typeid(typename T::Params), &LLUICtrlFactory::createDefaultWidget<T>, 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 <typename T, bool IS_BOOST_FUNCTION = boost::is_convertible<T, boost::function_base>::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<typename T, typename Void = void> - struct is_BaseBlock + struct IsBaseBlock { static const bool value = false; }; template<typename T> - struct is_BaseBlock<T, typename T::baseblock_base_class_t> + struct IsBaseBlock<T, typename T::baseblock_base_class_t> { static const bool value = true; }; @@ -509,7 +514,7 @@ namespace LLInitParam template<typename T, typename NAME_VALUE_LOOKUP = TypeValues<T>, bool HAS_MULTIPLE_VALUES = false, - bool VALUE_IS_BLOCK = is_BaseBlock<T>::value> + bool VALUE_IS_BLOCK = IsBaseBlock<T>::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<DERIVED_BLOCK>; typedef Alternative<T, NAME_VALUE_LOOKUP> self_t; - typedef TypedParam<T, NAME_VALUE_LOOKUP, false, is_BaseBlock<T>::value> super_t; + typedef TypedParam<T, NAME_VALUE_LOOKUP, false, IsBaseBlock<T>::value> super_t; typedef typename super_t::value_assignment_t value_assignment_t; explicit Alternative(const char* name, value_assignment_t val = DefaultInitializer<T>::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<typename DERIVED_BLOCK> - BlockDescriptor - Choice<DERIVED_BLOCK>::sBlockDescriptor; - - //struct CardinalityConstraint - //{ - // virtual std::pair<S32, S32> 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<T, NAME_VALUE_LOOKUP, false> { public: - typedef TypedParam<T, NAME_VALUE_LOOKUP, false, is_BaseBlock<T>::value> super_t; + typedef TypedParam<T, NAME_VALUE_LOOKUP, false, IsBaseBlock<T>::value> super_t; typedef typename super_t::value_assignment_t value_assignment_t; explicit Optional(const char* name = "", value_assignment_t val = DefaultInitializer<T>::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<T, NAME_VALUE_LOOKUP, false> { public: - typedef TypedParam<T, NAME_VALUE_LOOKUP, false, is_BaseBlock<T>::value> super_t; + typedef TypedParam<T, NAME_VALUE_LOOKUP, false, IsBaseBlock<T>::value> super_t; typedef Mandatory<T, NAME_VALUE_LOOKUP> 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<T>::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<T, NAME_VALUE_LOOKUP, true> { public: - typedef TypedParam<T, NAME_VALUE_LOOKUP, true, is_BaseBlock<T>::value> super_t; + typedef TypedParam<T, NAME_VALUE_LOOKUP, true, IsBaseBlock<T>::value> super_t; typedef Multiple<T, RANGE, NAME_VALUE_LOOKUP> 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<container_t>::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<typename DERIVED_BLOCK, typename BASE_BLOCK> - BlockDescriptor - Block<DERIVED_BLOCK, BASE_BLOCK>::sBlockDescriptor; - template<typename T, typename DERIVED = TypedParam<T> > class BlockValue : public Block<TypedParam<T, TypeValues<T>, 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<std::string>& 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 <fstream> #include <boost/tokenizer.hpp> @@ -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 <boost/function.hpp> #include <iosfwd> @@ -48,6 +48,8 @@ class LLView; +typedef LLPointer<class LLXMLNode> 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 @@ <key>ToolTipVisibleTimeNear</key> <map> <key>Comment</key> - <string>Fade tooltip after after time passes (seconds) while mouse near tooltip</string> + <string>Fade tooltip after after time passes (seconds) while mouse near tooltip or original position</string> <key>Persist</key> <integer>1</integer> <key>Type</key> <string>F32</string> <key>Value</key> - <real>5.0</real> + <real>10.0</real> </map> <key>ToolTipVisibleTimeOver</key> <map> 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; |