diff options
author | Richard Nelson <none@none> | 2010-08-16 15:00:51 -0700 |
---|---|---|
committer | Richard Nelson <none@none> | 2010-08-16 15:00:51 -0700 |
commit | c20bd2dfee1068d5a23eef9a10d21c2035c0b324 (patch) | |
tree | f6ff89910ea6ee51ff654e1f604476100c9ceedd /indra | |
parent | 94e406157d0b133d51b5dbb95aab296b46eae10e (diff) |
cleaned up LLUICtrlFactory...
removed redundant functionality
moved buildPanel to LLPanel
Diffstat (limited to 'indra')
62 files changed, 351 insertions, 415 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index c3ef734823..9337626c8e 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -89,7 +89,7 @@ LLAccordionCtrl::LLAccordionCtrl() : LLPanel() mSingleExpansion = false; mFitParent = false; - LLUICtrlFactory::getInstance()->buildPanel(this, "accordion_parent.xml"); + buildPanel(this, "accordion_parent.xml"); } //--------------------------------------------------------------------------------- diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 0f769bd6dc..bfca0bd45e 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -41,6 +41,7 @@ #include "llfontgl.h" #include "llrect.h" #include "llerror.h" +#include "lldir.h" #include "lltimer.h" #include "llaccordionctrltab.h" @@ -58,6 +59,8 @@ #include "lltabcontainer.h" static LLDefaultChildRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML); +LLPanel::factory_stack_t LLPanel::sFactoryStack; + // Compiler optimization, generate extern template template class LLPanel* LLView::getChild<class LLPanel>( @@ -400,7 +403,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ if (!panelp) { - panelp = LLUICtrlFactory::getInstance()->createFactoryPanel(name); + panelp = createFactoryPanel(name); llassert(panelp); if (!panelp) @@ -413,20 +416,20 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ // factory panels may have registered their own factory maps if (!panelp->getFactoryMap().empty()) { - LLUICtrlFactory::instance().pushFactoryFunctions(&panelp->getFactoryMap()); + sFactoryStack.push_back(&panelp->getFactoryMap()); } // for local registry callbacks; define in constructor, referenced in XUI or postBuild panelp->mCommitCallbackRegistrar.pushScope(); panelp->mEnableCallbackRegistrar.pushScope(); - panelp->initPanelXML(node, parent, output_node); + panelp->initPanelXML(node, parent, output_node, LLUICtrlFactory::getDefaultParams<LLPanel>()); panelp->mCommitCallbackRegistrar.popScope(); panelp->mEnableCallbackRegistrar.popScope(); if (!panelp->getFactoryMap().empty()) { - LLUICtrlFactory::instance().popFactoryFunctions(); + sFactoryStack.pop_back(); } return panelp; @@ -493,11 +496,9 @@ 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"); -BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node) +BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params) { - const LLPanel::Params& default_params(LLUICtrlFactory::getDefaultParams<LLPanel>()); Params params(default_params); - { LLFastTimer timer(FTM_PANEL_SETUP); @@ -965,3 +966,89 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t:: return mVisibleSignal->connect(cb); } + +static LLFastTimer::DeclareTimer FTM_BUILD_PANELS("Build Panels"); + +//----------------------------------------------------------------------------- +// buildPanel() +//----------------------------------------------------------------------------- +BOOL LLPanel::buildPanel(LLPanel* panelp, const std::string& filename, LLXMLNodePtr output_node, const LLPanel::Params& default_params) +{ + LLFastTimer timer(FTM_BUILD_PANELS); + BOOL didPost = FALSE; + LLXMLNodePtr root; + + //if exporting, only load the language being exported, + //instead of layering localized version on top of english + if (output_node) + { + if (!LLUICtrlFactory::getLocalizedXMLNode(filename, root)) + { + llwarns << "Couldn't parse panel from: " << LLUI::getLocalizedSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl; + return didPost; + } + } + else if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) + { + llwarns << "Couldn't parse panel from: " << LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl; + return didPost; + } + + // root must be called panel + if( !root->hasName("panel" ) ) + { + llwarns << "Root node should be named panel in : " << filename << llendl; + return didPost; + } + + lldebugs << "Building panel " << filename << llendl; + + LLUICtrlFactory::instance().pushFileName(filename); + { + if (!panelp->getFactoryMap().empty()) + { + sFactoryStack.push_back(&panelp->getFactoryMap()); + } + + // for local registry callbacks; define in constructor, referenced in XUI or postBuild + panelp->getCommitCallbackRegistrar().pushScope(); + panelp->getEnableCallbackRegistrar().pushScope(); + + didPost = panelp->initPanelXML(root, NULL, output_node, default_params); + + panelp->getCommitCallbackRegistrar().popScope(); + panelp->getEnableCallbackRegistrar().popScope(); + + panelp->setXMLFilename(filename); + + if (!panelp->getFactoryMap().empty()) + { + sFactoryStack.pop_back(); + } + } + LLUICtrlFactory::instance().popFileName(); + return didPost; +} + +//----------------------------------------------------------------------------- +// createFactoryPanel() +//----------------------------------------------------------------------------- +LLPanel* LLPanel::createFactoryPanel(const std::string& name) +{ + std::deque<const LLCallbackMap::map_t*>::iterator itor; + for (itor = sFactoryStack.begin(); itor != sFactoryStack.end(); ++itor) + { + const LLCallbackMap::map_t* factory_map = *itor; + + // Look up this panel's name in the map. + LLCallbackMap::map_const_iter_t iter = factory_map->find( name ); + if (iter != factory_map->end()) + { + // Use the factory to create the panel, instead of using a default LLPanel. + LLPanel *ret = (LLPanel*) iter->second.mCallback( iter->second.mData ); + return ret; + } + } + LLPanel::Params panel_p; + return LLUICtrlFactory::create<LLPanel>(panel_p); +}
\ No newline at end of file diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 784054cd86..6fc8ca204f 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -110,7 +110,10 @@ protected: LLPanel(const LLPanel::Params& params = getDefaultParams()); public: -// LLPanel(const std::string& name, const LLRect& rect = LLRect(), BOOL bordered = TRUE); + static BOOL buildPanel(LLPanel* panelp, const std::string &filename, LLXMLNodePtr output_node = NULL, const LLPanel::Params&default_params = getDefaultParams()); + + static LLPanel* createFactoryPanel(const std::string& name); + /*virtual*/ ~LLPanel(); // LLView interface @@ -163,7 +166,7 @@ public: EnableCallbackRegistry::ScopedRegistrar& getEnableCallbackRegistrar() { return mEnableCallbackRegistrar; } void initFromParams(const Params& p); - BOOL initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL); + BOOL initPanelXML( LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params); bool hasString(const std::string& name); std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const; @@ -283,6 +286,8 @@ private: // for setting the xml filename when building panel in context dependent cases std::string mXMLFilename; + typedef std::deque<const LLCallbackMap::map_t*> factory_stack_t; + static factory_stack_t sFactoryStack; }; // end class LLPanel // Build time optimization, generate once in .cpp file @@ -291,4 +296,57 @@ extern template class LLPanel* LLView::getChild<class LLPanel>( const std::string& name, BOOL recurse) const; #endif +typedef boost::function<LLPanel* (void)> LLPanelClassCreatorFunc; + +// local static instance for registering a particular panel class + +class LLRegisterPanelClass +: public LLSingleton< LLRegisterPanelClass > +{ +public: + // reigister with either the provided builder, or the generic templated builder + void addPanelClass(const std::string& tag,LLPanelClassCreatorFunc func) + { + mPanelClassesNames[tag] = func; + } + + LLPanel* createPanelClass(const std::string& tag) + { + param_name_map_t::iterator iT = mPanelClassesNames.find(tag); + if(iT == mPanelClassesNames.end()) + return 0; + return iT->second(); + } + template<typename T> + static T* defaultPanelClassBuilder() + { + T* pT = new T(); + return pT; + } + +private: + typedef std::map< std::string, LLPanelClassCreatorFunc> param_name_map_t; + + param_name_map_t mPanelClassesNames; +}; + + +// local static instance for registering a particular panel class +template<typename T> +class LLRegisterPanelClassWrapper +: public LLRegisterPanelClass +{ +public: + // reigister with either the provided builder, or the generic templated builder + LLRegisterPanelClassWrapper(const std::string& tag); +}; + + +template<typename T> +LLRegisterPanelClassWrapper<T>::LLRegisterPanelClassWrapper(const std::string& tag) +{ + LLRegisterPanelClass::instance().addPanelClass(tag,&LLRegisterPanelClass::defaultPanelClassBuilder<T>); +} + + #endif diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index db010d1cf6..2314ece6df 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -241,6 +241,7 @@ class LLTextBase public: friend class LLTextSegment; friend class LLNormalTextSegment; + friend class LLUICtrlFactory; struct LineSpacingParams : public LLInitParam::Choice<LineSpacingParams> { diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index c5bd6c7fce..913c8bdb7d 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -218,7 +218,7 @@ bool LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen { if (!floaterp->getFactoryMap().empty()) { - mFactoryStack.push_front(&floaterp->getFactoryMap()); + LLPanel::sFactoryStack.push_front(&floaterp->getFactoryMap()); } // for local registry callbacks; define in constructor, referenced in XUI or postBuild @@ -234,7 +234,7 @@ bool LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen if (!floaterp->getFactoryMap().empty()) { - mFactoryStack.pop_front(); + LLPanel::sFactoryStack.pop_front(); } } popFileName(); @@ -250,69 +250,6 @@ S32 LLUICtrlFactory::saveToXML(LLView* viewp, const std::string& filename) return 0; } -static LLFastTimer::DeclareTimer FTM_BUILD_PANELS("Build Panels"); - -//----------------------------------------------------------------------------- -// buildPanel() -//----------------------------------------------------------------------------- -BOOL LLUICtrlFactory::buildPanel(LLPanel* panelp, const std::string& filename, LLXMLNodePtr output_node) -{ - LLFastTimer timer(FTM_BUILD_PANELS); - BOOL didPost = FALSE; - LLXMLNodePtr root; - - //if exporting, only load the language being exported, - //instead of layering localized version on top of english - if (output_node) - { - if (!LLUICtrlFactory::getLocalizedXMLNode(filename, root)) - { - llwarns << "Couldn't parse panel from: " << LLUI::getLocalizedSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl; - return didPost; - } - } - else if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) - { - llwarns << "Couldn't parse panel from: " << LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl; - return didPost; - } - - // root must be called panel - if( !root->hasName("panel" ) ) - { - llwarns << "Root node should be named panel in : " << filename << llendl; - return didPost; - } - - lldebugs << "Building panel " << filename << llendl; - - pushFileName(filename); - { - if (!panelp->getFactoryMap().empty()) - { - mFactoryStack.push_front(&panelp->getFactoryMap()); - } - - // for local registry callbacks; define in constructor, referenced in XUI or postBuild - panelp->getCommitCallbackRegistrar().pushScope(); - panelp->getEnableCallbackRegistrar().pushScope(); - - didPost = panelp->initPanelXML(root, NULL, output_node); - - panelp->getCommitCallbackRegistrar().popScope(); - panelp->getEnableCallbackRegistrar().popScope(); - - panelp->setXMLFilename(filename); - - if (!panelp->getFactoryMap().empty()) - { - mFactoryStack.pop_front(); - } - } - popFileName(); - return didPost; -} - //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -344,29 +281,6 @@ LLView *LLUICtrlFactory::createFromXML(LLXMLNodePtr node, LLView* parent, const return view; } -//----------------------------------------------------------------------------- -// createFactoryPanel() -//----------------------------------------------------------------------------- -LLPanel* LLUICtrlFactory::createFactoryPanel(const std::string& name) -{ - std::deque<const LLCallbackMap::map_t*>::iterator itor; - for (itor = mFactoryStack.begin(); itor != mFactoryStack.end(); ++itor) - { - const LLCallbackMap::map_t* factory_map = *itor; - - // Look up this panel's name in the map. - LLCallbackMap::map_const_iter_t iter = factory_map->find( name ); - if (iter != factory_map->end()) - { - // Use the factory to create the panel, instead of using a default LLPanel. - LLPanel *ret = (LLPanel*) iter->second.mCallback( iter->second.mData ); - return ret; - } - } - LLPanel::Params panel_p; - return create<LLPanel>(panel_p); -} - std::string LLUICtrlFactory::getCurFileName() { return mFileNames.empty() ? "" : gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + mFileNames.back(); @@ -383,36 +297,6 @@ void LLUICtrlFactory::popFileName() mFileNames.pop_back(); } - -//----------------------------------------------------------------------------- - -//static -BOOL LLUICtrlFactory::getAttributeColor(LLXMLNodePtr node, const std::string& name, LLColor4& color) -{ - std::string colorstring; - BOOL res = node->getAttributeString(name.c_str(), colorstring); - if (res) - { - if (LLUIColorTable::instance().colorExists(colorstring)) - { - color.setVec(LLUIColorTable::instance().getColor(colorstring)); - } - else - { - res = FALSE; - } - } - if (!res) - { - res = LLColor4::parseColor(colorstring, &color); - } - if (!res) - { - res = node->getAttributeColor(name.c_str(), color); - } - return res; -} - //static void LLUICtrlFactory::setCtrlParent(LLView* view, LLView* parent, S32 tab_group) { @@ -428,28 +312,22 @@ std::string LLUICtrlFactory::findSkinnedFilename(const std::string& filename) return gDirUtilp->findSkinnedFilename(LLUI::getSkinPath(), filename); } -void LLUICtrlFactory::pushFactoryFunctions(const LLCallbackMap::map_t* map) -{ - mFactoryStack.push_back(map); -} - -void LLUICtrlFactory::popFactoryFunctions() -{ - if (!mFactoryStack.empty()) - { - mFactoryStack.pop_back(); - } -} - //static void LLUICtrlFactory::copyName(LLXMLNodePtr src, LLXMLNodePtr dest) { dest->setName(src->getName()->mString); } +template<typename T> +const LLInitParam::BaseBlock& get_empty_param_block() +{ + static typename T::Params params; + return params; +} + // 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) +void LLUICtrlFactory::registerWidget(const std::type_info* widget_type, const std::type_info* param_block_type, const std::string& tag) { // associate parameter block type with template .xml file std::string* existing_tag = LLWidgetNameRegistry::instance().getValue(param_block_type); @@ -469,17 +347,9 @@ void LLUICtrlFactory::registerWidget(const std::type_info* widget_type, const st } } LLWidgetNameRegistry::instance().defaultRegistrar().add(param_block_type, tag); - // associate widget type with factory function - LLDefaultWidgetRegistry::instance().defaultRegistrar().add(widget_type, creator_func); //FIXME: comment this in when working on schema generation //LLWidgetTypeRegistry::instance().defaultRegistrar().add(tag, widget_type); - //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); + //LLDefaultParamBlockRegistry::instance().defaultRegistrar().add(widget_type, &get_empty_param_block<T>); } //static diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index dc43b311a7..c4d3aa38d8 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -33,24 +33,14 @@ #ifndef LLUICTRLFACTORY_H #define LLUICTRLFACTORY_H -#include "llcallbackmap.h" +#include "llfasttimer.h" #include "llinitparam.h" #include "llregistry.h" -#include "v4color.h" -#include "llfasttimer.h" - #include "llxuiparser.h" -#include <boost/function.hpp> -#include <iosfwd> -#include <stack> -#include <set> - -class LLPanel; class LLFloater; class LLView; - // sort functor for typeid maps struct LLCompareTypeID { @@ -91,12 +81,6 @@ class LLWidgetNameRegistry : public LLRegistrySingleton<const std::type_info*, std::string, LLWidgetNameRegistry , LLCompareTypeID> {}; -// lookup factory functions for default widget instances by widget type -typedef LLView* (*dummy_widget_creator_func_t)(const std::string&); -class LLDefaultWidgetRegistry -: public LLRegistrySingleton<const std::type_info*, dummy_widget_creator_func_t, LLDefaultWidgetRegistry, LLCompareTypeID> -{}; - // lookup function for generating empty param block by widget type // this is used for schema generation //typedef const LLInitParam::BaseBlock& (*empty_param_block_func_t)(); @@ -164,23 +148,16 @@ public: } bool buildFloater(LLFloater* floaterp, const std::string &filename, LLXMLNodePtr output_node); - BOOL buildPanel(LLPanel* panelp, const std::string &filename, LLXMLNodePtr output_node = NULL); // Does what you want for LLFloaters and LLPanels // Returns 0 on success S32 saveToXML(LLView* viewp, const std::string& filename); + // filename tracking for debugging info std::string getCurFileName(); void pushFileName(const std::string& name); void popFileName(); - static BOOL getAttributeColor(LLXMLNodePtr node, const std::string& name, LLColor4& color); - - LLPanel* createFactoryPanel(const std::string& name); - - void pushFactoryFunctions(const LLCallbackMap::map_t* map); - void popFactoryFunctions(); - template<typename T> static T* createWidget(const typename T::Params& params, LLView* parent = NULL) { @@ -192,12 +169,10 @@ public: //return NULL; } - { - LLFastTimer timer(FTM_WIDGET_CONSTRUCTION); + { LLFastTimer _(FTM_WIDGET_CONSTRUCTION); widget = new T(params); } - { - LLFastTimer timer(FTM_INIT_FROM_PARAMS); + { LLFastTimer _(FTM_INIT_FROM_PARAMS); widget->initFromParams(params); } @@ -272,17 +247,9 @@ fail: template<class T> static T* getDefaultWidget(const std::string& name) { - dummy_widget_creator_func_t* dummy_func = getDefaultWidgetFunc(&typeid(T)); - return dummy_func ? dynamic_cast<T*>((*dummy_func)(name)) : NULL; - } - - template <class T> - static LLView* createDefaultWidget(const std::string& name) - { - typename T::Params params; - params.name(name); - - return create<T>(params); + T::Params widget_params; + widget_params.name = name; + return create<T>(widget_params); } static void copyName(LLXMLNodePtr src, LLXMLNodePtr dest); @@ -335,12 +302,9 @@ 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); + static void registerWidget(const std::type_info* widget_type, const std::type_info* param_block_type, 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 @@ -349,20 +313,10 @@ private: // Avoid directly using LLUI and LLDir in the template code static std::string findSkinnedFilename(const std::string& filename); - typedef std::deque<const LLCallbackMap::map_t*> factory_stack_t; - factory_stack_t mFactoryStack; - - LLPanel* mDummyPanel; + class LLPanel* mDummyPanel; std::vector<std::string> mFileNames; }; -template<typename T> -const LLInitParam::BaseBlock& getEmptyParamBlock() -{ - static typename T::Params params; - return params; -} - // this is here to make gcc happy with reference to LLUICtrlFactory template<typename DERIVED> template<typename T> @@ -370,7 +324,7 @@ LLChildRegistry<DERIVED>::Register<T>::Register(const char* tag, LLWidgetCreator : LLChildRegistry<DERIVED>::StaticRegistrar(tag, func.empty() ? (LLWidgetCreatorFunc)&LLUICtrlFactory::defaultBuilder<T> : func) { // add this widget to various registries - LLUICtrlFactory::instance().registerWidget(&typeid(T), &typeid(typename T::Params), &LLUICtrlFactory::createDefaultWidget<T>, tag); + LLUICtrlFactory::instance().registerWidget(&typeid(T), &typeid(typename T::Params), tag); // since registry_t depends on T, do this in line here // TODO: uncomment this for schema generation @@ -378,58 +332,4 @@ LLChildRegistry<DERIVED>::Register<T>::Register(const char* tag, LLWidgetCreator //LLChildRegistryRegistry::instance().defaultRegistrar().add(&typeid(T), registry_t::instance()); } - -typedef boost::function<LLPanel* (void)> LLPanelClassCreatorFunc; - -// local static instance for registering a particular panel class - -class LLRegisterPanelClass -: public LLSingleton< LLRegisterPanelClass > -{ -public: - // reigister with either the provided builder, or the generic templated builder - void addPanelClass(const std::string& tag,LLPanelClassCreatorFunc func) - { - mPanelClassesNames[tag] = func; - } - - LLPanel* createPanelClass(const std::string& tag) - { - param_name_map_t::iterator iT = mPanelClassesNames.find(tag); - if(iT == mPanelClassesNames.end()) - return 0; - return iT->second(); - } - template<typename T> - static T* defaultPanelClassBuilder() - { - T* pT = new T(); - return pT; - } - -private: - typedef std::map< std::string, LLPanelClassCreatorFunc> param_name_map_t; - - param_name_map_t mPanelClassesNames; -}; - - -// local static instance for registering a particular panel class -template<typename T> -class LLRegisterPanelClassWrapper -: public LLRegisterPanelClass -{ -public: - // reigister with either the provided builder, or the generic templated builder - LLRegisterPanelClassWrapper(const std::string& tag); -}; - - -template<typename T> -LLRegisterPanelClassWrapper<T>::LLRegisterPanelClassWrapper(const std::string& tag) -{ - LLRegisterPanelClass::instance().addPanelClass(tag,&LLRegisterPanelClass::defaultPanelClassBuilder<T>); -} - - #endif //LLUICTRLFACTORY_H diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 4d3708302b..3ee4a85de0 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1698,7 +1698,9 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse) const child = getDefaultWidget<LLView>(name); if (!child) { - child = LLUICtrlFactory::createDefaultWidget<LLView>(name); + LLView::Params view_params; + view_params.name = name; + child = LLUICtrlFactory::create<LLView>(view_params); } } return child; diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 70bda3893e..54ab928522 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -200,8 +200,6 @@ LLAgent::LLAgent() : mbFlagsDirty(FALSE), mbFlagsNeedReset(FALSE), - mbJump(FALSE), - mAutoPilot(FALSE), mAutoPilotFlyOnStop(FALSE), mAutoPilotTargetGlobal(), @@ -561,6 +559,9 @@ void LLAgent::toggleFlying() { BOOL fly = !gAgent.getFlying(); + gAgent.mMoveTimer.reset(); + LLFirstUse::notMoving(false); + gAgent.setFlying( fly ); gAgentCamera.resetView(); } @@ -2987,12 +2988,6 @@ void LLAgent::processScriptControlChange(LLMessageSystem *msg, void **) total_count++; } } - - // Any control taken? If so, might be first time. - //if (total_count > 0) - //{ - //LLFirstUse::useOverrideKeys(); - //} } else { diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 0185f874f9..6485cd8fd8 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -364,14 +364,6 @@ private: BOOL mIsBusy; //-------------------------------------------------------------------- - // Jump - //-------------------------------------------------------------------- -public: - BOOL getJump() const { return mbJump; } -private: - BOOL mbJump; - - //-------------------------------------------------------------------- // Grab //-------------------------------------------------------------------- public: diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 768be116f6..8e448d53ee 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -367,19 +367,19 @@ bool create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base) if(gAgent.isInGroup(match_id, TRUE)) { - LLGroupIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLGroupIconCtrl>(); + LLGroupIconCtrl::Params icon_params; icon_params.group_id = match_id; icon_params.rect = LLRect(0, 16, 16, 0); icon_params.visible = true; - icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params); + icon = LLUICtrlFactory::instance().create<LLGroupIconCtrl>(icon_params); } else { - LLAvatarIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLAvatarIconCtrl>(); + LLAvatarIconCtrl::Params icon_params; icon_params.avatar_id = match_id; icon_params.rect = LLRect(0, 16, 16, 0); icon_params.visible = true; - icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params); + icon = LLUICtrlFactory::instance().create<LLAvatarIconCtrl>(icon_params); } LLInlineViewSegment::Params params; diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 57e186b6a8..f448816f76 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -498,7 +498,7 @@ LLAvalineListItem::LLAvalineListItem(bool hide_number/* = true*/) : LLAvatarList , mIsHideNumber(hide_number) { // should not use buildPanel from the base class to ensure LLAvalineListItem::postBuild is called. - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml"); + buildPanel(this, "panel_avatar_list_item.xml"); } BOOL LLAvalineListItem::postBuild() diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index eead0c9b3e..18a5d74527 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -75,7 +75,7 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) { if (not_from_ui_factory) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml"); + buildPanel(this, "panel_avatar_list_item.xml"); } // *NOTE: mantipov: do not use any member here. They can be uninitialized here in case instance // is created from the UICtrlFactory diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index e0b605a724..310b406bfd 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -112,14 +112,14 @@ public: mGesturePanel(NULL) { mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_bottomtray_lite.xml"); + buildPanel(this, "panel_bottomtray_lite.xml"); // Necessary for focus movement among child controls setFocusRoot(TRUE); } BOOL postBuild() { - mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar"); + mNearbyChatBar = findChild<LLNearbyChatBar>("chat_bar"); mGesturePanel = getChild<LLPanel>("gesture_panel"); // Hide "show_nearby_chat" button @@ -163,7 +163,7 @@ LLBottomTray::LLBottomTray(const LLSD&) mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); - LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml"); + buildPanel(this,"panel_bottomtray.xml"); LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2)); @@ -471,8 +471,7 @@ BOOL LLBottomTray::postBuild() mBottomTrayContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_bottomtray.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); gMenuHolder->addChild(mBottomTrayContextMenu); - mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar"); - LLHints::registerHintTarget("nearby_chat_bar", mNearbyChatBar->LLView::getHandle()); + mNearbyChatBar = findChild<LLNearbyChatBar>("chat_bar"); mToolbarStack = getChild<LLLayoutStack>("toolbar_stack"); mMovementButton = getChild<LLButton>("movement_btn"); diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index a03fe79512..00a343c99c 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -147,7 +147,7 @@ BOOL LLCallFloater::postBuild() childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this)); - mNonAvatarCaller = getChild<LLNonAvatarCaller>("non_avatar_caller"); + mNonAvatarCaller = findChild<LLNonAvatarCaller>("non_avatar_caller"); mNonAvatarCaller->setVisible(FALSE); LLView *anchor_panel = LLBottomTray::getInstance()->getChild<LLView>("speak_flyout_btn"); diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 7204e6c39c..b6788b7739 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -107,7 +107,7 @@ public: static LLChatHistoryHeader* createInstance(const std::string& file_name) { LLChatHistoryHeader* pInstance = new LLChatHistoryHeader; - LLUICtrlFactory::getInstance()->buildPanel(pInstance, file_name); + buildPanel(pInstance, file_name); return pInstance; } @@ -402,7 +402,7 @@ protected: return; } - LLTextBase* name = getChild<LLTextBase>("user_name"); + LLTextBox* name = getChild<LLTextBox>("user_name"); LLRect sticky_rect = name->getRect(); S32 icon_x = llmin(sticky_rect.mLeft + name->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3); sInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - sInfoCtrl->getRect().getHeight() / 2 ) ; diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 35a244c461..ed4803f87a 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -57,7 +57,7 @@ static const S32 msg_height_pad = 5; LLNearbyChatToastPanel* LLNearbyChatToastPanel::createInstance() { LLNearbyChatToastPanel* item = new LLNearbyChatToastPanel(); - LLUICtrlFactory::getInstance()->buildPanel(item, "panel_chat_item.xml"); + buildPanel(item, "panel_chat_item.xml"); item->setFollows(FOLLOWS_NONE); return item; } diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index f181872faa..73715e4726 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -351,7 +351,7 @@ BOOL LLFloaterCamera::postBuild() setTitleVisible(TRUE); // restore title visibility after chrome applying mRotate = getChild<LLJoystickCameraRotate>(ORBIT); - mZoom = getChild<LLPanelCameraZoom>(ZOOM); + mZoom = findChild<LLPanelCameraZoom>(ZOOM); mTrack = getChild<LLJoystickCameraTrack>(PAN); assignButton2Mode(CAMERA_CTRL_MODE_MODES, "avatarview_btn"); diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp index 4bffd41d29..1e15b86762 100644 --- a/indra/newview/llfloaterinventory.cpp +++ b/indra/newview/llfloaterinventory.cpp @@ -60,7 +60,7 @@ LLFloaterInventory::~LLFloaterInventory() BOOL LLFloaterInventory::postBuild() { - mPanelMainInventory = getChild<LLPanelMainInventory>("Inventory Panel"); + mPanelMainInventory = findChild<LLPanelMainInventory>("Inventory Panel"); return TRUE; } diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp index 105d7f9201..9e3422c2b2 100644 --- a/indra/newview/llfloaternotificationsconsole.cpp +++ b/indra/newview/llfloaternotificationsconsole.cpp @@ -65,7 +65,7 @@ LLNotificationChannelPanel::LLNotificationChannelPanel(const std::string& channe mChannelRejectsPtr = LLNotificationChannelPtr( LLNotificationChannel::buildChannel(channel_name + "rejects", mChannelPtr->getParentChannelName(), !boost::bind(mChannelPtr->getFilter(), _1))); - LLUICtrlFactory::instance().buildPanel(this, "panel_notifications_channel.xml"); + buildPanel(this, "panel_notifications_channel.xml"); } BOOL LLNotificationChannelPanel::postBuild() diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 8af4955f92..a8af80b952 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -180,32 +180,32 @@ BOOL LLFloaterRegionInfo::postBuild() mInfoPanels.push_back(panel); panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", boost::bind(&LLPanelRegionInfo::onClickManageTelehub, panel)); - LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_general.xml"); + buildPanel(panel, "panel_region_general.xml"); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true)); panel = new LLPanelRegionDebugInfo; mInfoPanels.push_back(panel); - LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_debug.xml"); + buildPanel(panel, "panel_region_debug.xml"); mTab->addTabPanel(panel); panel = new LLPanelRegionTextureInfo; mInfoPanels.push_back(panel); - LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_texture.xml"); + buildPanel(panel, "panel_region_texture.xml"); mTab->addTabPanel(panel); panel = new LLPanelRegionTerrainInfo; mInfoPanels.push_back(panel); - LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_terrain.xml"); + buildPanel(panel, "panel_region_terrain.xml"); mTab->addTabPanel(panel); panel = new LLPanelEstateInfo; mInfoPanels.push_back(panel); - LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_estate.xml"); + buildPanel(panel, "panel_region_estate.xml"); mTab->addTabPanel(panel); panel = new LLPanelEstateCovenant; mInfoPanels.push_back(panel); - LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_covenant.xml"); + buildPanel(panel, "panel_region_covenant.xml"); mTab->addTabPanel(panel); gMessageSystem->setHandlerFunc( diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index a77fc4710a..a6f3acd18d 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -121,7 +121,7 @@ BOOL LLFloaterScriptLimits::postBuild() LLPanelScriptLimitsRegionMemory* panel_memory; panel_memory = new LLPanelScriptLimitsRegionMemory; mInfoPanels.push_back(panel_memory); - LLUICtrlFactory::getInstance()->buildPanel(panel_memory, "panel_script_limits_region_memory.xml"); + buildPanel(panel_memory, "panel_script_limits_region_memory.xml"); mTab->addTabPanel(panel_memory); } @@ -130,7 +130,7 @@ BOOL LLFloaterScriptLimits::postBuild() { LLPanelScriptLimitsAttachment* panel_attachments = new LLPanelScriptLimitsAttachment; mInfoPanels.push_back(panel_attachments); - LLUICtrlFactory::getInstance()->buildPanel(panel_attachments, "panel_script_limits_my_avatar.xml"); + buildPanel(panel_attachments, "panel_script_limits_my_avatar.xml"); mTab->addTabPanel(panel_attachments); } diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index 41f4580495..d32f809457 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -891,7 +891,7 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) if (save) { LLXMLNodePtr panel_write = new LLXMLNode(); - LLUICtrlFactory::getInstance()->buildPanel(panel, path, panel_write); // build it + buildPanel(panel, path, panel_write); // build it if (!panel_write->isNull()) { @@ -905,7 +905,7 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) } else { - LLUICtrlFactory::getInstance()->buildPanel(panel, path); // build it + buildPanel(panel, path); // build it LLRect new_size = panel->getRect(); // get its rectangle panel->setOrigin(0,0); // reset its origin point so it's not offset by -left or other XUI attributes (*floaterp)->setTitle(path); // use the file name as its title, since panels have no guaranteed meaningful name attribute diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp index 125936b9c7..af931810a2 100644 --- a/indra/newview/llgrouplist.cpp +++ b/indra/newview/llgrouplist.cpp @@ -289,7 +289,7 @@ mGroupNameBox(NULL), mInfoBtn(NULL), mGroupID(LLUUID::null) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group_list_item.xml"); + buildPanel(this, "panel_group_list_item.xml"); // Remember group icon width including its padding from the name text box, // so that we can hide and show the icon again later. diff --git a/indra/newview/llhudview.cpp b/indra/newview/llhudview.cpp index 261d9f1df7..beb3b4340a 100644 --- a/indra/newview/llhudview.cpp +++ b/indra/newview/llhudview.cpp @@ -56,7 +56,7 @@ const S32 HUD_ARROW_SIZE = 32; LLHUDView::LLHUDView(const LLRect& r) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_hud.xml"); + buildPanel(this, "panel_hud.xml"); setShape(r, true); } diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 9eb11a6ac4..8a84c7a9c9 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -100,9 +100,9 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, if(gAgent.isInGroup(session_id, TRUE)) { - LLGroupIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLGroupIconCtrl>(); + LLGroupIconCtrl::Params icon_params; icon_params.group_id = session_id; - icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params); + icon = LLUICtrlFactory::instance().create<LLGroupIconCtrl>(icon_params); mSessions[session_id] = floaterp; floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); @@ -111,9 +111,9 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, { LLUUID avatar_id = LLIMModel::getInstance()->getOtherParticipantID(session_id); - LLAvatarIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLAvatarIconCtrl>(); + LLAvatarIconCtrl::Params icon_params; icon_params.avatar_id = avatar_id; - icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params); + icon = LLUICtrlFactory::instance().create<LLAvatarIconCtrl>(icon_params); mSessions[session_id] = floaterp; floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); diff --git a/indra/newview/llinventorylistitem.cpp b/indra/newview/llinventorylistitem.cpp index b1f5b3be2f..b3d658b0cf 100644 --- a/indra/newview/llinventorylistitem.cpp +++ b/indra/newview/llinventorylistitem.cpp @@ -307,7 +307,9 @@ LLPanelInventoryListItemBase::LLPanelInventoryListItemBase(LLViewerInventoryItem } else { - mIconCtrl = dynamic_cast<LLIconCtrl*>(LLUICtrlFactory::createDefaultWidget<LLIconCtrl>("item_icon")); + LLIconCtrl::Params icon_params; + icon_params.name = "item_icon"; + mIconCtrl = LLUICtrlFactory::create<LLIconCtrl>(icon_params); } LLTextBox::Params text_params(params.item_name); @@ -320,7 +322,9 @@ LLPanelInventoryListItemBase::LLPanelInventoryListItemBase(LLViewerInventoryItem } else { - mTitleCtrl = dynamic_cast<LLTextBox*>(LLUICtrlFactory::createDefaultWidget<LLTextBox>("item_title")); + LLTextBox::Params text_aprams; + text_params.name = "item_title"; + mTitleCtrl = LLUICtrlFactory::create<LLTextBox>(text_params); } } diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 148a5786cb..680f937e83 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -703,7 +703,7 @@ void LLPanelStandStopFlying::reparent(LLFloaterMove* move_view) LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel() { LLPanelStandStopFlying* panel = new LLPanelStandStopFlying(); - LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_stand_stop_flying.xml"); + buildPanel(panel, "panel_stand_stop_flying.xml"); panel->setVisible(FALSE); //LLUI::getRootView()->addChild(panel); @@ -716,6 +716,8 @@ LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel() void LLPanelStandStopFlying::onStandButtonClick() { + LLFirstUse::sit(false); + LLSelectMgr::getInstance()->deselectAllForStandingUp(); gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 18ef3e19ee..e53103237c 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -278,7 +278,7 @@ LLNavigationBar::LLNavigationBar() mPurgeTPHistoryItems(false), mSaveToLocationHistory(false) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_navigation_bar.xml"); + buildPanel(this, "panel_navigation_bar.xml"); // set a listener function for LoginComplete event LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLNavigationBar::handleLoginComplete, this)); diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 4011552112..024929430c 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -39,6 +39,7 @@ #include "llchatitemscontainerctrl.h" #include "llfirstuse.h" #include "llfloaterscriptdebug.h" +#include "llhints.h" #include "llnearbychat.h" #include "llrecentpeople.h" @@ -62,7 +63,13 @@ LLToastPanelBase* createToastPanel() class LLNearbyChatScreenChannel: public LLScreenChannelBase { public: - LLNearbyChatScreenChannel(const LLUUID& id):LLScreenChannelBase(id) { mStopProcessing = false;}; + typedef std::vector<LLHandle<LLToast> > toast_vec_t; + typedef std::list<LLHandle<LLToast> > toast_list_t; + + LLNearbyChatScreenChannel(const LLUUID& id):LLScreenChannelBase(id) + { + mStopProcessing = false; + } void addNotification (LLSD& notification); void arrangeToasts (); @@ -82,15 +89,12 @@ public: } // hide all toasts from screen, but not remove them from a channel - virtual void hideToastsFromScreen() - { - }; // removes all toasts from a channel virtual void removeToastsFromChannel() { - for(std::vector<LLToast*>::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it) + for(toast_vec_t::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it) { - addToToastPool((*it)); + addToToastPool(it->get()); } m_active_toasts.clear(); }; @@ -105,10 +109,11 @@ public: protected: void addToToastPool(LLToast* toast) { + if (!toast) return; toast->setVisible(FALSE); toast->stopTimer(); toast->setIsHidden(true); - m_toast_pool.push_back(toast); + m_toast_pool.push_back(toast->getHandle()); } void createOverflowToast(S32 bottom, F32 timer); @@ -117,8 +122,8 @@ protected: bool createPoolToast(); - std::vector<LLToast*> m_active_toasts; - std::list<LLToast*> m_toast_pool; + toast_vec_t m_active_toasts; + toast_list_t m_toast_pool; bool mStopProcessing; }; @@ -139,7 +144,7 @@ void LLNearbyChatScreenChannel::onToastFade(LLToast* toast) if(!toast) return; - std::vector<LLToast*>::iterator pos = std::find(m_active_toasts.begin(),m_active_toasts.end(),toast); + toast_vec_t::iterator pos = std::find(m_active_toasts.begin(),m_active_toasts.end(),toast->getHandle()); if(pos!=m_active_toasts.end()) m_active_toasts.erase(pos); @@ -166,7 +171,7 @@ bool LLNearbyChatScreenChannel::createPoolToast() toast->setOnFadeCallback(boost::bind(&LLNearbyChatScreenChannel::onToastFade, this, _1)); toast->setOnToastDestroyedCallback(boost::bind(&LLNearbyChatScreenChannel::onToastDestroyed, this, _1)); - m_toast_pool.push_back(toast); + m_toast_pool.push_back(toast->getHandle()); return true; } @@ -184,17 +189,20 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification) { LLUUID fromID = notification["from_id"].asUUID(); // agent id or object id std::string from = notification["from"].asString(); - LLToast* toast = m_active_toasts[0]; - LLNearbyChatToastPanel* panel = dynamic_cast<LLNearbyChatToastPanel*>(toast->getPanel()); - - if(panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText()) + LLToast* toast = m_active_toasts[0].get(); + if (toast) { - panel->addMessage(notification); - toast->reshapeToPanel(); - toast->resetTimer(); - - arrangeToasts(); - return; + LLNearbyChatToastPanel* panel = dynamic_cast<LLNearbyChatToastPanel*>(toast->getPanel()); + + if(panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText()) + { + panel->addMessage(notification); + toast->reshapeToPanel(); + toast->resetTimer(); + + arrangeToasts(); + return; + } } } @@ -222,7 +230,7 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification) //take 1st element from pool, (re)initialize it, put it in active toasts - LLToast* toast = m_toast_pool.back(); + LLToast* toast = m_toast_pool.back().get(); m_toast_pool.pop_back(); @@ -235,25 +243,36 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification) toast->reshapeToPanel(); toast->resetTimer(); - m_active_toasts.push_back(toast); + m_active_toasts.push_back(toast->getHandle()); arrangeToasts(); } void LLNearbyChatScreenChannel::arrangeToasts() { - if(m_active_toasts.size() == 0 || isHovering()) - return; - - hideToastsFromScreen(); + if(!isHovering()) + { + showToastsBottom(); + } - showToastsBottom(); + if (m_active_toasts.empty()) + { + LLHints::registerHintTarget("incoming_chat", LLHandle<LLView>()); + } + else + { + LLToast* toast = m_active_toasts.front().get(); + if (toast) + { + LLHints::registerHintTarget("incoming_chat", m_active_toasts.front().get()->LLView::getHandle()); + } + } } -int sort_toasts_predicate(LLToast* first,LLToast* second) +int sort_toasts_predicate(LLHandle<LLToast> first, LLHandle<LLToast> second) { - F32 v1 = first->getTimer()->getEventTimer().getElapsedTimeF32(); - F32 v2 = second->getTimer()->getEventTimer().getElapsedTimeF32(); + F32 v1 = first.get()->getTimer()->getEventTimer().getElapsedTimeF32(); + F32 v2 = second.get()->getTimer()->getEventTimer().getElapsedTimeF32(); return v1 < v2; } @@ -271,20 +290,22 @@ void LLNearbyChatScreenChannel::showToastsBottom() //calc max visible item and hide other toasts. - for(std::vector<LLToast*>::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it) + for(toast_vec_t::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it) { - S32 toast_top = bottom + (*it)->getRect().getHeight() + margin; + LLToast* toast = it->get(); + if (!toast) continue; + + S32 toast_top = bottom + toast->getRect().getHeight() + margin; if(toast_top > gFloaterView->getRect().getHeight()) { while(it!=m_active_toasts.end()) { - addToToastPool((*it)); + addToToastPool(it->get()); it=m_active_toasts.erase(it); } break; } - LLToast* toast = (*it); toast_rect = toast->getRect(); toast_rect.setLeftTopAndSize(getRect().mLeft , bottom + toast_rect.getHeight(), toast_rect.getWidth() ,toast_rect.getHeight()); @@ -295,13 +316,16 @@ void LLNearbyChatScreenChannel::showToastsBottom() // use reverse order to provide correct z-order and avoid toast blinking - for(std::vector<LLToast*>::reverse_iterator it = m_active_toasts.rbegin(); it != m_active_toasts.rend(); ++it) + for(toast_vec_t::reverse_iterator it = m_active_toasts.rbegin(); it != m_active_toasts.rend(); ++it) { - LLToast* toast = (*it); - toast->setIsHidden(false); - toast->setVisible(TRUE); - + LLToast* toast = it->get(); + if (toast) + { + toast->setIsHidden(false); + toast->setVisible(TRUE); + } } + } void LLNearbyChatScreenChannel::reshape (S32 width, S32 height, BOOL called_from_parent) @@ -347,14 +371,6 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) { if(chat_msg.mMuted == TRUE) return; - if(chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull()) - { - LLRecentPeople::instance().add(chat_msg.mFromID); - if (chat_msg.mFromID != gAgentID) - { - LLFirstUse::otherAvatarChatFirst(); - } - } if(chat_msg.mText.empty()) return;//don't process empty messages @@ -457,7 +473,13 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ; channel->addNotification(notification); } - + + if(chat_msg.mSourceType == CHAT_SOURCE_AGENT + && chat_msg.mFromID.notNull() + && chat_msg.mFromID != gAgentID) + { + LLFirstUse::otherAvatarChatFirst(); + } } void LLNearbyChatHandler::onDeleteToast(LLToast* toast) diff --git a/indra/newview/llpanelavatartag.cpp b/indra/newview/llpanelavatartag.cpp index 7563cc7f61..0ffb10b18b 100644 --- a/indra/newview/llpanelavatartag.cpp +++ b/indra/newview/llpanelavatartag.cpp @@ -43,7 +43,7 @@ LLPanelAvatarTag::LLPanelAvatarTag(const LLUUID& key, const std::string im_time) , mAvatarId(LLUUID::null) // , mFadeTimer() { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_tag.xml"); + buildPanel(this, "panel_avatar_tag.xml"); setLeftButtonClickCallback(boost::bind(&LLPanelAvatarTag::onClick, this)); setAvatarId(key); setTime(im_time); diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 09b718f8b8..4d3d54ed15 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -144,7 +144,7 @@ LLPanelClassifiedInfo::~LLPanelClassifiedInfo() LLPanelClassifiedInfo* LLPanelClassifiedInfo::create() { LLPanelClassifiedInfo* panel = new LLPanelClassifiedInfo(); - LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_classified_info.xml"); + buildPanel(panel, "panel_classified_info.xml"); return panel; } @@ -617,7 +617,7 @@ LLPanelClassifiedEdit::~LLPanelClassifiedEdit() LLPanelClassifiedEdit* LLPanelClassifiedEdit::create() { LLPanelClassifiedEdit* panel = new LLPanelClassifiedEdit(); - LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_edit_classified.xml"); + buildPanel(panel, "panel_edit_classified.xml"); return panel; } diff --git a/indra/newview/llpanelgenerictip.cpp b/indra/newview/llpanelgenerictip.cpp index 5a71f7f315..709ed33ed1 100644 --- a/indra/newview/llpanelgenerictip.cpp +++ b/indra/newview/llpanelgenerictip.cpp @@ -42,7 +42,7 @@ LLPanelGenericTip::LLPanelGenericTip( const LLNotificationPtr& notification) : LLPanelTipToast(notification) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_generic_tip.xml"); + buildPanel(this, "panel_generic_tip.xml"); getChild<LLUICtrl>("message")->setValue(notification->getMessage()); diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 11d3768a3d..b610fa9899 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -375,7 +375,7 @@ LLPanelGroupInvite::LLPanelGroupInvite(const LLUUID& group_id) mPendingUpdate(FALSE) { // Pass on construction of this panel to the control factory. - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group_invite.xml"); + buildPanel(this, "panel_group_invite.xml"); } LLPanelGroupInvite::~LLPanelGroupInvite() diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 6f47fc60b0..9ad39d568c 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -202,7 +202,7 @@ LLLandmarksPanel::LLLandmarksPanel() mInventoryObserver = new LLLandmarksPanelObserver(this); gInventory.addObserver(mInventoryObserver); - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_landmarks.xml"); + buildPanel(this, "panel_landmarks.xml"); } LLLandmarksPanel::~LLLandmarksPanel() diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 58ed01896a..6b71e37337 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -193,7 +193,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, // Logo mLogoImage = LLUI::getUIImage("startup_logo"); - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); + buildPanel(this, "panel_login.xml"); #if USE_VIEWER_AUTH //leave room for the login menu bar diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 017f6de63b..389fe8edbf 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -168,7 +168,7 @@ void LLPanelMe::onCancelClicked() LLPanelMyProfileEdit::LLPanelMyProfileEdit() : LLPanelMyProfile() { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_edit_profile.xml"); + buildPanel(this, "panel_edit_profile.xml"); setAvatarId(gAgent.getID()); } diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp index 7a61872bc7..54703d3cdc 100644 --- a/indra/newview/llpanelmediasettingsgeneral.cpp +++ b/indra/newview/llpanelmediasettingsgeneral.cpp @@ -80,7 +80,7 @@ LLPanelMediaSettingsGeneral::LLPanelMediaSettingsGeneral() : mMediaEditable(false) { // build dialog from XML - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_media_settings_general.xml"); + buildPanel(this, "panel_media_settings_general.xml"); } //////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelmediasettingspermissions.cpp b/indra/newview/llpanelmediasettingspermissions.cpp index 5effba515b..389003dc45 100644 --- a/indra/newview/llpanelmediasettingspermissions.cpp +++ b/indra/newview/llpanelmediasettingspermissions.cpp @@ -65,7 +65,7 @@ LLPanelMediaSettingsPermissions::LLPanelMediaSettingsPermissions() : mPermsWorldControl( 0 ) { // build dialog from XML - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_media_settings_permissions.xml"); + buildPanel(this, "panel_media_settings_permissions.xml"); } //////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelmediasettingssecurity.cpp b/indra/newview/llpanelmediasettingssecurity.cpp index 1b1346c41a..502ba179d3 100644 --- a/indra/newview/llpanelmediasettingssecurity.cpp +++ b/indra/newview/llpanelmediasettingssecurity.cpp @@ -59,7 +59,7 @@ LLPanelMediaSettingsSecurity::LLPanelMediaSettingsSecurity() : mCommitCallbackRegistrar.add("Media.whitelistDelete", boost::bind(&LLPanelMediaSettingsSecurity::onBtnDel, this)); // build dialog from XML - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_media_settings_security.xml"); + buildPanel(this, "panel_media_settings_security.xml"); } //////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index 7f4609b83e..e477d71712 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -102,7 +102,7 @@ LLPanelNearByMedia::LLPanelNearByMedia() mCommitCallbackRegistrar.add("SelectedMediaCtrl.Zoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaZoom, this)); mCommitCallbackRegistrar.add("SelectedMediaCtrl.Unzoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaUnzoom, this)); - LLUICtrlFactory::instance().buildPanel(this, "panel_nearby_media.xml"); + buildPanel(this, "panel_nearby_media.xml"); } LLPanelNearByMedia::~LLPanelNearByMedia() diff --git a/indra/newview/llpanelonlinestatus.cpp b/indra/newview/llpanelonlinestatus.cpp index 7de4e8e49d..43c3ed782d 100644 --- a/indra/newview/llpanelonlinestatus.cpp +++ b/indra/newview/llpanelonlinestatus.cpp @@ -41,7 +41,7 @@ LLPanelOnlineStatus::LLPanelOnlineStatus( LLPanelTipToast(notification) { - LLUICtrlFactory::getInstance()->buildPanel(this, + buildPanel(this, "panel_online_status_toast.xml"); diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index cfd31b6829..81bd6b5414 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -491,7 +491,7 @@ BOOL LLPanelOutfitEdit::postBuild() setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2)); - mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list"); + mCOFWearables = findChild<LLCOFWearables>("cof_wearables_list"); mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this)); mCOFWearables->getCOFCallbacks().mAddWearable = boost::bind(&LLPanelOutfitEdit::onAddWearableClicked, this); diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 16ef7998b3..3c33824cd3 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -307,10 +307,10 @@ bool LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) void LLPanelOutfitsInventory::initTabPanels() { - mCurrentOutfitPanel = getChild<LLPanelWearing>(COF_TAB_NAME); + mCurrentOutfitPanel = findChild<LLPanelWearing>(COF_TAB_NAME); mCurrentOutfitPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this)); - mMyOutfitsPanel = getChild<LLOutfitsList>(OUTFITS_TAB_NAME); + mMyOutfitsPanel = findChild<LLOutfitsList>(OUTFITS_TAB_NAME); mMyOutfitsPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this)); mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs"); diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index 54eb21422e..0417c65f7a 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -80,7 +80,7 @@ LLPanelPickInfo* LLPanelPickInfo::create() { LLPanelPickInfo* panel = new LLPanelPickInfo(); - LLUICtrlFactory::getInstance()->buildPanel(panel, XML_PANEL_PICK_INFO); + buildPanel(panel, XML_PANEL_PICK_INFO); return panel; } @@ -350,7 +350,7 @@ void LLPanelPickInfo::onClickBack() LLPanelPickEdit* LLPanelPickEdit::create() { LLPanelPickEdit* panel = new LLPanelPickEdit(); - LLUICtrlFactory::getInstance()->buildPanel(panel, XML_PANEL_EDIT_PICK); + buildPanel(panel, XML_PANEL_EDIT_PICK); return panel; } diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 65254e50b4..653f3726a9 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -1045,7 +1045,7 @@ LLPickItem::LLPickItem() , mSnapshotID(LLUUID::null) , mNeedData(true) { - LLUICtrlFactory::getInstance()->buildPanel(this,"panel_pick_list_item.xml"); + buildPanel(this,"panel_pick_list_item.xml"); } LLPickItem::~LLPickItem() @@ -1175,7 +1175,7 @@ LLClassifiedItem::LLClassifiedItem(const LLUUID& avatar_id, const LLUUID& classi , mAvatarId(avatar_id) , mClassifiedId(classified_id) { - LLUICtrlFactory::getInstance()->buildPanel(this,"panel_classifieds_list_item.xml"); + buildPanel(this,"panel_classifieds_list_item.xml"); LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index c8a9176d92..83e674ee92 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -252,7 +252,7 @@ LLPanelPlaces::LLPanelPlaces() LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback( boost::bind(&LLPanelPlaces::updateVerbs, this)); - //LLUICtrlFactory::getInstance()->buildPanel(this, "panel_places.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() + //buildPanel(this, "panel_places.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() } LLPanelPlaces::~LLPanelPlaces() @@ -327,8 +327,8 @@ BOOL LLPanelPlaces::postBuild() mFilterEditor->setCommitCallback(boost::bind(&LLPanelPlaces::onFilterEdit, this, _2, false)); } - mPlaceProfile = getChild<LLPanelPlaceProfile>("panel_place_profile"); - mLandmarkInfo = getChild<LLPanelLandmarkInfo>("panel_landmark_info"); + mPlaceProfile = findChild<LLPanelPlaceProfile>("panel_place_profile"); + mLandmarkInfo = findChild<LLPanelLandmarkInfo>("panel_landmark_info"); if (!mPlaceProfile || !mLandmarkInfo) return FALSE; diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 583b41aa57..68522ffac3 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -119,7 +119,7 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() : mCommitCallbackRegistrar.add("MediaCtrl.SkipBack", boost::bind(&LLPanelPrimMediaControls::onClickSkipBack, this)); mCommitCallbackRegistrar.add("MediaCtrl.SkipForward", boost::bind(&LLPanelPrimMediaControls::onClickSkipForward, this)); - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_prim_media_controls.xml"); + buildPanel(this, "panel_prim_media_controls.xml"); mInactivityTimer.reset(); mFadeTimer.stop(); mCurrentZoom = ZOOM_NONE; diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 18da8dd48c..272622fcf7 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -133,11 +133,11 @@ BOOL LLPanelProfile::postBuild() getTabCtrl()->setCommitCallback(boost::bind(&LLPanelProfile::onTabSelected, this, _2)); - LLPanelPicks* panel_picks = getChild<LLPanelPicks>(PANEL_PICKS); + LLPanelPicks* panel_picks = findChild<LLPanelPicks>(PANEL_PICKS); panel_picks->setProfilePanel(this); getTabContainer()[PANEL_PICKS] = panel_picks; - getTabContainer()[PANEL_PROFILE] = getChild<LLPanelAvatarProfile>(PANEL_PROFILE); + getTabContainer()[PANEL_PROFILE] = findChild<LLPanelAvatarProfile>(PANEL_PROFILE); return TRUE; } diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp index d59e694be6..56a211091c 100644 --- a/indra/newview/llpanelprofileview.cpp +++ b/indra/newview/llpanelprofileview.cpp @@ -120,7 +120,7 @@ BOOL LLPanelProfileView::postBuild() { LLPanelProfile::postBuild(); - getTabContainer()[PANEL_NOTES] = getChild<LLPanelAvatarNotes>(PANEL_NOTES); + getTabContainer()[PANEL_NOTES] = findChild<LLPanelAvatarNotes>(PANEL_NOTES); //*TODO remove this, according to style guide we don't use status combobox getTabContainer()[PANEL_PROFILE]->getChildView("online_me_status_text")->setVisible( FALSE); diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index af58912b38..b398d75feb 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -131,7 +131,7 @@ LLTeleportHistoryFlatItem::LLTeleportHistoryFlatItem(S32 index, LLTeleportHistor mRegionName(region_name), mHighlight(hl) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history_item.xml"); + buildPanel(this, "panel_teleport_history_item.xml"); } LLTeleportHistoryFlatItem::~LLTeleportHistoryFlatItem() @@ -382,7 +382,7 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel() mLastSelectedFlatlList(NULL), mLastSelectedItemIndex(-1) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history.xml"); + buildPanel(this, "panel_teleport_history.xml"); } LLTeleportHistoryPanel::~LLTeleportHistoryPanel() diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp index e73d1fb7c2..6e69e6d44c 100644 --- a/indra/newview/llpaneltopinfobar.cpp +++ b/indra/newview/llpaneltopinfobar.cpp @@ -72,7 +72,7 @@ LLPanelTopInfoBar::LLPanelTopInfoBar(): mParcelChangedObserver(0) LLUICtrl::CommitCallbackRegistry::currentRegistrar() .add("TopInfoBar.Action", boost::bind(&LLPanelTopInfoBar::onContextMenuItemClicked, this, _2)); - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_topinfo_bar.xml"); + buildPanel(this, "panel_topinfo_bar.xml"); } LLPanelTopInfoBar::~LLPanelTopInfoBar() diff --git a/indra/newview/llpanelvolumepulldown.cpp b/indra/newview/llpanelvolumepulldown.cpp index 7d70a8a891..a038badb01 100644 --- a/indra/newview/llpanelvolumepulldown.cpp +++ b/indra/newview/llpanelvolumepulldown.cpp @@ -60,7 +60,7 @@ LLPanelVolumePulldown::LLPanelVolumePulldown() mCommitCallbackRegistrar.add("Vol.setControlFalse", boost::bind(&LLPanelVolumePulldown::setControlFalse, this, _2)); mCommitCallbackRegistrar.add("Vol.GoAudioPrefs", boost::bind(&LLPanelVolumePulldown::onAdvancedButtonClick, this, _2)); - LLUICtrlFactory::instance().buildPanel(this, "panel_volume_pulldown.xml"); + buildPanel(this, "panel_volume_pulldown.xml"); } BOOL LLPanelVolumePulldown::postBuild() diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index d715c47631..4c2469909b 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -62,7 +62,7 @@ LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_param mAllowModify(allow_modify), mWearable(wearable) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_scrolling_param.xml"); + buildPanel(this, "panel_scrolling_param.xml"); // *HACK To avoid hard coding texture position, lets use border's position for texture. LLViewBorder* left_border = getChild<LLViewBorder>("left_border"); diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index f9189bfb22..aa29f6cb26 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -56,7 +56,7 @@ LLSidepanelInventory::LLSidepanelInventory() mPanelMainInventory(NULL) { - //LLUICtrlFactory::getInstance()->buildPanel(this, "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() + //buildPanel(this, "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() } LLSidepanelInventory::~LLSidepanelInventory() @@ -90,7 +90,7 @@ BOOL LLSidepanelInventory::postBuild() mOverflowBtn = mInventoryPanel->getChild<LLButton>("overflow_btn"); mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onOverflowButtonClicked, this)); - mPanelMainInventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory"); + mPanelMainInventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2)); LLTabContainer* tabs = mPanelMainInventory->getChild<LLTabContainer>("inventory filter tabs"); tabs->setCommitCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this)); @@ -108,7 +108,7 @@ BOOL LLSidepanelInventory::postBuild() // UI elements from item panel { - mItemPanel = getChild<LLSidepanelItemInfo>("sidepanel__item_panel"); + mItemPanel = findChild<LLSidepanelItemInfo>("sidepanel__item_panel"); LLButton* back_btn = mItemPanel->getChild<LLButton>("back_btn"); back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this)); @@ -116,7 +116,7 @@ BOOL LLSidepanelInventory::postBuild() // UI elements from task panel { - mTaskPanel = getChild<LLSidepanelTaskInfo>("sidepanel__task_panel"); + mTaskPanel = findChild<LLSidepanelTaskInfo>("sidepanel__task_panel"); if (mTaskPanel) { LLButton* back_btn = mTaskPanel->getChild<LLButton>("back_btn"); @@ -176,7 +176,7 @@ void LLSidepanelInventory::onShopButtonClicked() void LLSidepanelInventory::performActionOnSelection(const std::string &action) { - LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory"); + LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem(); if (!current_item) { @@ -314,7 +314,7 @@ void LLSidepanelInventory::updateVerbs() bool LLSidepanelInventory::canShare() { LLPanelMainInventory* panel_main_inventory = - mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory"); + mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); LLFolderView* root_folder = panel_main_inventory->getActivePanel()->getRootFolder(); @@ -332,7 +332,7 @@ bool LLSidepanelInventory::canShare() LLInventoryItem *LLSidepanelInventory::getSelectedItem() { - LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory"); + LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem(); if (!current_item) { @@ -345,7 +345,7 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem() U32 LLSidepanelInventory::getSelectedCount() { - LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory"); + LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); std::set<LLUUID> selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(); return selection_list.size(); } diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 6a081a573e..8d61bb94e1 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -142,7 +142,7 @@ LLStatusBar::LLStatusBar(const LLRect& rect) mBalanceTimer = new LLFrameTimer(); mHealthTimer = new LLFrameTimer(); - LLUICtrlFactory::getInstance()->buildPanel(this,"panel_status_bar.xml"); + buildPanel(this,"panel_status_bar.xml"); } LLStatusBar::~LLStatusBar() diff --git a/indra/newview/llsyswellitem.cpp b/indra/newview/llsyswellitem.cpp index 1f3d6a582d..79b053da24 100644 --- a/indra/newview/llsyswellitem.cpp +++ b/indra/newview/llsyswellitem.cpp @@ -44,7 +44,7 @@ LLSysWellItem::LLSysWellItem(const Params& p) : LLPanel(p), mTitle(NULL), mCloseBtn(NULL) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_sys_well_item.xml"); + buildPanel(this, "panel_sys_well_item.xml"); mTitle = getChild<LLTextBox>("title"); mCloseBtn = getChild<LLButton>("close_btn"); diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 1a8c2b8fc0..89fd22a2a0 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -255,7 +255,7 @@ LLIMWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID& S32 chicletCounter, const std::string& name, const LLUUID& otherParticipantId) : LLPanel(LLPanel::Params()), mChiclet(NULL), mParent(parent) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_activeim_row.xml", NULL); + buildPanel(this, "panel_activeim_row.xml", NULL); // Choose which of the pre-created chiclets (IM/group) to use. // The other one gets hidden. @@ -352,7 +352,7 @@ LLIMWellWindow::ObjectRowPanel::ObjectRowPanel(const LLUUID& notification_id, bo : LLPanel() , mChiclet(NULL) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_active_object_row.xml", NULL); + buildPanel(this, "panel_active_object_row.xml", NULL); initChiclet(notification_id); diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index c0da656685..8217aae0f2 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -194,6 +194,8 @@ public: virtual S32 notifyParent(const LLSD& info); + LLHandle<LLToast> getHandle() { mHandle.bind(this); return mHandle; } + private: void onToastMouseEnter(); @@ -206,6 +208,8 @@ private: LLUUID mSessionID; LLNotificationPtr mNotification; + LLRootHandle<LLToast> mHandle; + LLPanel* mWrapperPanel; // timer counts a lifetime of a toast diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index 57b80fc792..7c2e68f942 100644 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -60,7 +60,7 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification : LLToastPanel(notification), mInventoryOffer(NULL) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group_notify.xml"); + buildPanel(this, "panel_group_notify.xml"); const LLSD& payload = notification->getPayload(); LLGroupData groupData; if (!gAgent.getGroupData(payload["group_id"].asUUID(),groupData)) diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp index 26d3bd5192..fc01b7f0d5 100644 --- a/indra/newview/lltoastimpanel.cpp +++ b/indra/newview/lltoastimpanel.cpp @@ -51,7 +51,7 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif mAvatarIcon(NULL), mAvatarName(NULL), mTime(NULL), mMessage(NULL), mGroupIcon(NULL) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_instant_message.xml"); + buildPanel(this, "panel_instant_message.xml"); mGroupIcon = getChild<LLGroupIconCtrl>("group_icon"); mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon"); diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 38f67720b7..32e12035ee 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -67,7 +67,7 @@ mNumButtons(0), mAddedDefaultBtn(false), mCloseNotificationOnDestroy(true) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_notification.xml"); + buildPanel(this, "panel_notification.xml"); if(rect != LLRect::null) { this->setShape(rect); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d8c7eabefb..c5dee710cb 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1521,7 +1521,7 @@ void LLViewerWindow::initBase() // (But wait to add it as a child of the root view so that it will be in front of the // other views.) MainPanel* main_view = new MainPanel(); - LLUICtrlFactory::instance().buildPanel(main_view, "main_view.xml"); + LLPanel::buildPanel(main_view, "main_view.xml"); main_view->setShape(full_window); getRootView()->addChild(main_view); @@ -1529,7 +1529,7 @@ void LLViewerWindow::initBase() mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle(); mNonSideTrayView = main_view->getChildView("non_side_tray_view")->getHandle(); mFloaterViewHolder = main_view->getChildView("floater_view_holder")->getHandle(); - mPopupView = main_view->getChild<LLPopupView>("popup_holder"); + mPopupView = main_view->findChild<LLPopupView>("popup_holder"); mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle(); // Constrain floaters to inside the menu and status bar regions. @@ -1568,7 +1568,7 @@ void LLViewerWindow::initBase() LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLFloaterPreference::initBusyResponse)); // Add the progress bar view (startup view), which overrides everything - mProgressView = getRootView()->getChild<LLProgressView>("progress_view"); + mProgressView = getRootView()->findChild<LLProgressView>("progress_view"); setShowProgress(FALSE); setProgressCancelButtonVisible(FALSE); |